Package org.apache.activemq
Class SimplePriorityMessageDispatchChannel
- java.lang.Object
-
- org.apache.activemq.SimplePriorityMessageDispatchChannel
-
- All Implemented Interfaces:
MessageDispatchChannel
public class SimplePriorityMessageDispatchChannel extends Object implements MessageDispatchChannel
-
-
Constructor Summary
Constructors Constructor Description SimplePriorityMessageDispatchChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclose()MessageDispatchdequeue(long timeout)Used to get an enqueued message.MessageDispatchdequeueNoWait()voidenqueue(MessageDispatch message)voidenqueueFirst(MessageDispatch message)protected LinkedList<MessageDispatch>getList(MessageDispatch md)ObjectgetMutex()protected intgetPriority(MessageDispatch message)booleanisClosed()booleanisEmpty()booleanisRunning()MessageDispatchpeek()List<MessageDispatch>removeAll()intsize()voidstart()voidstop()StringtoString()
-
-
-
Method Detail
-
enqueue
public void enqueue(MessageDispatch message)
- Specified by:
enqueuein interfaceMessageDispatchChannel
-
enqueueFirst
public void enqueueFirst(MessageDispatch message)
- Specified by:
enqueueFirstin interfaceMessageDispatchChannel
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceMessageDispatchChannel
-
dequeue
public MessageDispatch dequeue(long timeout) throws InterruptedException
Description copied from interface:MessageDispatchChannelUsed to get an enqueued message. The amount of time this method blocks is based on the timeout value. - if timeout==-1 then it blocks until a message is received. - if timeout==0 then it it tries to not block at all, it returns a message if it is available - if timeout>0 then it blocks up to timeout amount of time. Expired messages will consumed by this method.- Specified by:
dequeuein interfaceMessageDispatchChannel- Returns:
- null if we timeout or if the consumer is closed.
- Throws:
InterruptedException
-
dequeueNoWait
public MessageDispatch dequeueNoWait()
- Specified by:
dequeueNoWaitin interfaceMessageDispatchChannel
-
peek
public MessageDispatch peek()
- Specified by:
peekin interfaceMessageDispatchChannel
-
start
public void start()
- Specified by:
startin interfaceMessageDispatchChannel
-
stop
public void stop()
- Specified by:
stopin interfaceMessageDispatchChannel
-
close
public void close()
- Specified by:
closein interfaceMessageDispatchChannel
-
clear
public void clear()
- Specified by:
clearin interfaceMessageDispatchChannel
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceMessageDispatchChannel
-
size
public int size()
- Specified by:
sizein interfaceMessageDispatchChannel
-
getMutex
public Object getMutex()
- Specified by:
getMutexin interfaceMessageDispatchChannel
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceMessageDispatchChannel
-
removeAll
public List<MessageDispatch> removeAll()
- Specified by:
removeAllin interfaceMessageDispatchChannel
-
getPriority
protected int getPriority(MessageDispatch message)
-
getList
protected LinkedList<MessageDispatch> getList(MessageDispatch md)
-
-