org.xmlBlaster.engine.query.plugins
Class QueueQueryPlugin
java.lang.Object
org.xmlBlaster.engine.query.plugins.QueueQueryPlugin
- All Implemented Interfaces:
- I_Query, I_StorageSizeListener
public class QueueQueryPlugin
- extends java.lang.Object
- implements I_Query, I_StorageSizeListener
Each TopicHandler/SessionInfo or SubjectInfo instance creates its own instance of this plugin.
- Author:
- Michele Laghi
- See Also:
- The engine.qos.queryspec requirement,
The engine.qos.queryspec.QueueQuery requirement
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ME
private static final java.lang.String ME
- See Also:
- Constant Field Values
global
private Global global
log
private static java.util.logging.Logger log
waitingThreads
private java.util.Set waitingThreads
QueueQueryPlugin
public QueueQueryPlugin(Global global)
getWaitingQueries
private QueueQueryPlugin.WaitingQuery[] getWaitingQueries()
checkIfNeedsWaiting
private final boolean checkIfNeedsWaiting(int entriesInQueue,
long bytesInQueue,
QueueQueryPlugin.WaitingQuery wq)
- If no restriction is given, i.e. if both maxEntries and maxBytes is negative,
then it will wait.
- Returns:
- true if it has to wait, false if there are already sufficently entries
in the queue.
query
public MsgUnit[] query(java.lang.Object source,
java.lang.String query)
throws XmlBlasterException
- The query to the queue. The parameters specifying which kind of query it is
are specified in the qos, and more precisely in the QuerySpecQos.
- Specified by:
query
in interface I_Query
- Parameters:
source
- must be an I_Queue implementation (can not be null).query
- must not be null, e.g.
"maxEntries=3&maxSize=1000&consumable=true&waitingDelay=1000"
for example from qosData.getQuerySpecArr()[0].getQuery().getQuery()
- Returns:
- a MsgUnit[] containing all entries which match the query
- Throws:
XmlBlasterException
- if something is wrong in the query (for example
if the type of the object specified as the source is wrong)
changed
public void changed(I_Storage storage,
long numEntries,
long numBytes,
boolean isShutdown)
- We register for queue size changes and our blocking thread returns if we are done.
Enforced by I_StorageSizeListener
- Specified by:
changed
in interface I_StorageSizeListener
- Parameters:
storage
- The queue which fires the change eventnumEntries
- the number of entries in the queue after the
change has taken placenumBytes
- number of bytes in the queue after the change
has taken change.isShutdown
- Is set to true if queue.shutdown() was executed
Copyright © 1999-2014 The xmlBlaster.org contributers.