|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsystemic.sif.sifcommon.subscriber.queue.SubscriberQueue<T>
public class SubscriberQueue<T extends BaseMessage>
This class encapsulates a standard BlockingQueue from the java.util.concurrent package. It only gives access to the blocking put() and take() method. This is the desired behaviour for agents that allow for multi-threaded subscribers that must follow the producer-consumer design pattern. A further advantage of encapsulating the lower level blocking queue is that further functionality can be provided to this SubscriberQueue queue such a 'persistence', notification etc. without the need of changes in the classes that use this SubscriberQueue class.
Note:
At this point in time the persistence functionality is not yet implemented. This might be a future
feature. This means if the system should go down, the messages currently held in the queue are lost.
One needs to carefully analyse what capacity of the subscriber queue shall be as this is the maximum
number of lost messages in case of a system failure.
Constructor Summary | |
---|---|
SubscriberQueue(int capacity,
java.lang.String queueID,
java.lang.String workingDir)
This initialises the Subscriber Queue for use in multi-threaded environment. |
Method Summary | |
---|---|
T |
blockingPull()
This method returns the next available message from the queue. |
void |
blockingPush(T subscriberMsg)
This method attempts to put a SubscriberMessage on to the SubscriberQueue. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubscriberQueue(int capacity, java.lang.String queueID, java.lang.String workingDir)
capacity
- The max capacity of elements that can be held by this queue. Generally that should be
a low number but theoretically can be any number.queueID
- A unique name representing this queue. This ID should not contain any white spaces. In
fact all white spaces will be removed from this value. Once persistence is implemented
this name will be used as part of the persistence store identification.workingDir
- This is a directory that might be used for temporary or permanent storage once persistence
is implemented. This should point to a valid directory that will be created if it
doesn't exist.Method Detail |
---|
public void blockingPush(T subscriberMsg)
subscriberMsg
- The element to be put on the queue.public T blockingPull()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |