public class MessageQueueImpl extends Object implements MessageQueue
LinkedBlockingQueue
to store the messages, and a ServerMessageBus to send the
messages.Constructor and Description |
---|
MessageQueueImpl(TransmissionBuffer buffer,
QueueSession session,
int timeoutSecs) |
Modifier and Type | Method and Description |
---|---|
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() |
public MessageQueueImpl(TransmissionBuffer buffer, QueueSession session, int timeoutSecs)
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 queueIOException
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
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.