Commit 277f3f99 authored by guus's avatar guus

Capping queue size (OF-77)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11378 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4ea6ed15
......@@ -108,7 +108,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
* Queue that will store the JID of the local users that came online. This queue
* will be consumed by another thread to improve performance of the server.
*/
private static BlockingQueue<JID> availableSessions = new LinkedBlockingQueue<JID>();
private static BlockingQueue<JID> availableSessions = new LinkedBlockingQueue<JID>(10000);
/**
* A map of all known full JIDs that have sent presences from a remote server.
......
......@@ -116,12 +116,12 @@ public class PEPService implements PubSubService {
/**
* Queue that holds the items that need to be added to the database.
*/
private Queue<PublishedItem> itemsToAdd = new LinkedBlockingQueue<PublishedItem>();
private Queue<PublishedItem> itemsToAdd = new LinkedBlockingQueue<PublishedItem>(10000);
/**
* Queue that holds the items that need to be deleted from the database.
*/
private Queue<PublishedItem> itemsToDelete = new LinkedBlockingQueue<PublishedItem>();
private Queue<PublishedItem> itemsToDelete = new LinkedBlockingQueue<PublishedItem>(10000);
/**
* Manager that keeps the list of ad-hoc commands and processing command
......
......@@ -61,10 +61,11 @@ public class PrivacyListProvider {
private static final String INSERT_PRIVACY_LIST =
"INSERT INTO ofPrivacyList (username, name, isDefault, list) VALUES (?, ?, ?, ?)";
private static final int POOL_SIZE = 50;
/**
* Pool of SAX Readers. SAXReader is not thread safe so we need to have a pool of readers.
*/
private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<SAXReader>();
private BlockingQueue<SAXReader> xmlReaders = new LinkedBlockingQueue<SAXReader>(POOL_SIZE);
/**
* Stores the total number of privacy lists.
......@@ -74,7 +75,7 @@ public class PrivacyListProvider {
public PrivacyListProvider() {
super();
// Initialize the pool of sax readers
for (int i=0; i<50; i++) {
for (int i=0; i<POOL_SIZE; i++) {
SAXReader xmlReader = new SAXReader();
xmlReader.setEncoding("UTF-8");
xmlReaders.add(xmlReader);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment