|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.messaging.core.ChannelSupport
Channel implementation. It supports atomicity, isolation and recoverability of reliable messages. The channel implementation here uses a "SEDA-type" approach, where requests to handle messages, deliver to receivers or acknowledge messages are not executed concurrently but placed on an event queue and executed serially by a single thread. This prevents lock contention since requests are executed serially, resulting in better scalability and higher throughput at the expense of some latency.
Field Summary | |
protected boolean |
acceptReliableMessages
|
protected long |
channelID
|
protected java.util.Set |
deliveries
|
protected java.util.List |
downCache
|
protected int |
downCacheSize
|
protected QueuedExecutor |
executor
|
protected int |
fullSize
|
protected SynchronizedLong |
messageOrdering
|
protected PrioritizedDeque |
messageRefs
|
protected MemoryManager |
mm
|
protected MessageStore |
ms
|
protected int |
pageSize
|
protected boolean |
paging
|
protected PersistenceManager |
pm
|
protected boolean |
receiversReady
|
protected boolean |
recoverable
|
protected int |
refsInStorage
|
protected Router |
router
|
Constructor Summary | |
protected |
ChannelSupport(long channelID,
MessageStore ms,
PersistenceManager pm,
MemoryManager mm,
boolean acceptReliableMessages,
boolean recoverable,
int fullSize,
int pageSize,
int downCacheSize,
QueuedExecutor executor)
|
Method Summary | |
boolean |
acceptReliableMessages()
A non-recoverable channel cannot guarantee recoverability for reliable messages so by default it won't accept reliable messages. |
void |
acknowledge(Delivery d,
Transaction tx)
|
protected boolean |
acknowledgeInMemory(Delivery d)
|
protected void |
acknowledgeInternal(Delivery d)
|
boolean |
add(Receiver r)
Add a local receiver to this distributor. |
protected void |
addReferenceInMemory(MessageReference ref)
|
protected void |
addToDownCache(MessageReference ref)
|
java.util.List |
browse()
|
java.util.List |
browse(Filter filter)
|
void |
cancel(Delivery d)
|
protected void |
cancelInternal(Delivery del)
|
protected void |
checkMemory()
|
void |
clear()
Clears non-recoverable state but not persisted state, so a recovery of the channel is possible TODO really? |
void |
close()
Close the channel |
boolean |
contains(Receiver r)
|
void |
deliver(boolean synchronous)
Delivers as many references as possible to it's router until no more deliveries are returned |
java.util.List |
delivering(Filter filter)
Get a list of message references of messages in the process of being delivered, subject to the filter |
protected void |
deliverInternal()
|
int |
downCacheCount()
|
protected void |
flushDownCache()
|
protected org.jboss.messaging.core.ChannelSupport.InMemoryCallback |
getCallback(Transaction tx)
|
long |
getChannelID()
|
Delivery |
handle(DeliveryObserver sender,
Routable r,
Transaction tx)
A receiver can return an active, "done" or null delivery. |
protected Delivery |
handleInternal(DeliveryObserver sender,
Routable r,
Transaction tx)
|
boolean |
isPaging()
|
boolean |
isRecoverable()
|
java.util.Iterator |
iterator()
|
void |
load()
Load the channel state from storage |
protected void |
load(int number)
|
int |
memoryDeliveryCount()
|
int |
memoryRefCount()
|
int |
messageCount()
Returns the count of messages stored AND being delivered. |
protected MessageReference |
obtainReference(Routable r)
|
protected void |
processMessageBeforeStorage(MessageReference reference)
Give subclass a chance to process the message before storing it internally. |
boolean |
remove(Receiver r)
Remove a local receiver from this distributor. |
void |
removeAllReferences()
Remove all the references in the channel |
protected MessageReference |
removeFirstInMemory()
|
java.lang.String |
toString()
|
java.util.List |
undelivered(Filter filter)
Get a list of message references of messages not in the process of being delivered, subject to the filter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected long channelID
protected Router router
protected MessageStore ms
protected QueuedExecutor executor
protected boolean receiversReady
protected PrioritizedDeque messageRefs
protected java.util.Set deliveries
protected java.util.List downCache
protected boolean acceptReliableMessages
protected boolean recoverable
protected SynchronizedLong messageOrdering
protected PersistenceManager pm
protected MemoryManager mm
protected int fullSize
protected int pageSize
protected int downCacheSize
protected boolean paging
protected int refsInStorage
Constructor Detail |
protected ChannelSupport(long channelID, MessageStore ms, PersistenceManager pm, MemoryManager mm, boolean acceptReliableMessages, boolean recoverable, int fullSize, int pageSize, int downCacheSize, QueuedExecutor executor)
acceptReliableMessages
- -
it only makes sense if tl is null. Otherwise ignored (a
recoverable channel always accepts reliable messages)Method Detail |
public Delivery handle(DeliveryObserver sender, Routable r, Transaction tx)
Receiver
handle
in interface Receiver
sender
- - the component the delivery should be acknowledged to.Delivery
,
DeliveryObserver
public void acknowledge(Delivery d, Transaction tx) throws java.lang.Throwable
acknowledge
in interface DeliveryObserver
java.lang.Throwable
public void cancel(Delivery d) throws java.lang.Throwable
cancel
in interface DeliveryObserver
java.lang.Throwable
public boolean add(Receiver r)
Distributor
add
in interface Distributor
public boolean remove(Receiver r)
Distributor
remove
in interface Distributor
public void clear()
Channel
clear
in interface Channel
public boolean contains(Receiver r)
contains
in interface Distributor
public java.util.Iterator iterator()
iterator
in interface Distributor
public long getChannelID()
getChannelID
in interface Channel
public boolean isRecoverable()
isRecoverable
in interface Channel
public boolean acceptReliableMessages()
Channel
acceptReliableMessages
in interface Channel
State#acceptReliableMessages()
public java.util.List browse()
browse
in interface Channel
public java.util.List browse(Filter filter)
browse
in interface Channel
filter
- - may be null, in which case no filter is applied.
public void deliver(boolean synchronous)
Channel
deliver
in interface Channel
public void close()
Channel
close
in interface Channel
public void removeAllReferences() throws java.lang.Throwable
Channel
removeAllReferences
in interface Channel
java.lang.Throwable
public void load() throws java.lang.Exception
Channel
load
in interface Channel
java.lang.Exception
public java.util.List delivering(Filter filter)
Channel
delivering
in interface Channel
filter
-
public java.util.List undelivered(Filter filter)
Channel
undelivered
in interface Channel
filter
-
public int messageCount()
messageCount
in interface Channel
public int memoryRefCount()
public int memoryDeliveryCount()
public int downCacheCount()
public boolean isPaging()
public java.lang.String toString()
protected void deliverInternal()
protected Delivery handleInternal(DeliveryObserver sender, Routable r, Transaction tx)
protected void acknowledgeInternal(Delivery d) throws java.lang.Exception
java.lang.Exception
protected void cancelInternal(Delivery del) throws java.lang.Exception
java.lang.Exception
protected MessageReference removeFirstInMemory() throws java.lang.Exception
java.lang.Exception
protected MessageReference obtainReference(Routable r)
protected void checkMemory()
protected void addReferenceInMemory(MessageReference ref) throws java.lang.Exception
java.lang.Exception
protected void addToDownCache(MessageReference ref) throws java.lang.Exception
java.lang.Exception
protected void flushDownCache() throws java.lang.Exception
java.lang.Exception
protected boolean acknowledgeInMemory(Delivery d)
protected void load(int number) throws java.lang.Exception
java.lang.Exception
protected org.jboss.messaging.core.ChannelSupport.InMemoryCallback getCallback(Transaction tx)
protected void processMessageBeforeStorage(MessageReference reference)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |