|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.errai.bus.server.MessageQueueImpl
public class MessageQueueImpl
A message queue is keeps track of which messages need to be sent outbound. It keeps track of the amount of messages
that can be stored, transmitted and those which timeout. The MessageQueue is implemented using a
LinkedBlockingQueue
to store the messages, and a ServerMessageBus to send the
messages.
Constructor Summary | |
---|---|
MessageQueueImpl(TransmissionBuffer buffer,
QueueSession session,
int timeoutSecs)
|
Method Summary | |
---|---|
void |
discard()
|
void |
finishInit()
|
void |
fireActivationCallback()
|
QueueActivationCallback |
getActivationCallback()
Returns the current activation callback function |
Object |
getActivationLock()
|
Buffer |
getBuffer()
|
BufferColor |
getBufferColor()
|
long |
getCurrentBufferSequenceNumber()
|
MessageDeliveryHandler |
getDeliveryHandler()
|
long |
getLastTransmissionTime()
|
Object |
getPageLock()
|
QueueSession |
getSession()
|
void |
heartBeat()
Fakes a transmission, shows life with a heartbeat |
int |
incrementMessageCount()
|
boolean |
isInitialized()
|
boolean |
isPaged()
|
boolean |
isStale()
Returns true if the queue is not running, or it has timed out |
boolean |
messagesWaiting()
|
boolean |
offer(Message message)
Inserts the specified message into the queue, and returns true if it was successful |
boolean |
poll(ByteWriteAdapter stream)
|
boolean |
poll(TimeUnit timeUnit,
int time,
ByteWriteAdapter stream)
|
void |
resetMessageCount()
|
void |
setActivationCallback(QueueActivationCallback activationCallback)
Sets the activation callback function which is called when the queue is scheduled for activation |
void |
setDeliveryHandler(MessageDeliveryHandler handler)
|
void |
setDeliveryHandlerToDefault()
|
void |
setPaged(boolean pagedOut)
|
void |
setTimeout(long timeout)
|
void |
stopQueue()
Stops the queue, closes it on the bus and clears it completely |
String |
toString()
|
void |
wake()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MessageQueueImpl(TransmissionBuffer buffer, QueueSession session, int timeoutSecs)
Method Detail |
---|
public boolean poll(ByteWriteAdapter stream) throws IOException
poll
in interface MessageQueue
IOException
public boolean poll(TimeUnit timeUnit, int time, ByteWriteAdapter stream) throws IOException
poll
in interface MessageQueue
IOException
public boolean offer(Message message) throws IOException
offer
in interface MessageQueue
message
- - the message to insert into the queue
IOException
public long getCurrentBufferSequenceNumber()
getCurrentBufferSequenceNumber
in interface MessageQueue
public void wake()
wake
in interface MessageQueue
public void setActivationCallback(QueueActivationCallback activationCallback)
setActivationCallback
in interface MessageQueue
activationCallback
- - new activation callback functionpublic void fireActivationCallback()
fireActivationCallback
in interface MessageQueue
public QueueActivationCallback getActivationCallback()
getActivationCallback
in interface MessageQueue
public QueueSession getSession()
getSession
in interface MessageQueue
public boolean isStale()
isStale
in interface MessageQueue
public boolean isInitialized()
isInitialized
in interface MessageQueue
public boolean messagesWaiting()
messagesWaiting
in interface MessageQueue
public void heartBeat()
heartBeat
in interface MessageQueue
public void finishInit()
finishInit
in interface MessageQueue
public boolean isPaged()
isPaged
in interface MessageQueue
public void setPaged(boolean pagedOut)
setPaged
in interface MessageQueue
public void discard()
discard
in interface MessageQueue
public void stopQueue()
stopQueue
in interface MessageQueue
public Object getActivationLock()
getActivationLock
in interface MessageQueue
public Object getPageLock()
getPageLock
in interface MessageQueue
public MessageDeliveryHandler getDeliveryHandler()
getDeliveryHandler
in interface MessageQueue
public void setDeliveryHandler(MessageDeliveryHandler handler)
setDeliveryHandler
in interface MessageQueue
public void setDeliveryHandlerToDefault()
setDeliveryHandlerToDefault
in interface MessageQueue
public BufferColor getBufferColor()
getBufferColor
in interface MessageQueue
public Buffer getBuffer()
getBuffer
in interface MessageQueue
public int incrementMessageCount()
incrementMessageCount
in interface MessageQueue
public void resetMessageCount()
resetMessageCount
in interface MessageQueue
public long getLastTransmissionTime()
getLastTransmissionTime
in interface MessageQueue
public void setTimeout(long timeout)
setTimeout
in interface MessageQueue
public String toString()
toString
in class Object
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |