|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jboss.messaging.core.ChannelSupport
This class provides much of the functionality needed to implement a channel. This partial implementation supports atomicity, isolation and recoverability of reliable messages.
| Field Summary | |
protected boolean |
acceptReliableMessages
|
protected boolean |
active
|
protected long |
channelID
|
protected SynchronizedInt |
deliveringCount
|
protected int |
maxSize
|
protected PriorityLinkedList |
messageRefs
|
protected SynchronizedInt |
messagesAdded
|
protected MessageStore |
ms
|
protected PersistenceManager |
pm
|
protected boolean |
receiversReady
|
protected boolean |
recoverable
|
protected java.lang.Object |
refLock
|
protected Router |
router
|
protected java.util.Set |
scheduledDeliveries
|
| Constructor Summary | |
protected |
ChannelSupport(long channelID,
MessageStore ms,
PersistenceManager pm,
boolean acceptReliableMessages,
boolean recoverable,
int maxSize)
|
| 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 void |
acknowledgeInternal(Delivery d,
Transaction tx,
boolean persist)
|
void |
activate()
|
boolean |
add(Receiver r)
Add a local receiver to this distributor. |
protected void |
addReferenceInMemory(MessageReference ref)
|
java.util.List |
browse()
|
java.util.List |
browse(Filter filter)
|
void |
cancel(Delivery del)
|
protected void |
cancelInternal(MessageReference ref)
|
protected boolean |
checkAndSchedule(MessageReference ref)
|
protected void |
checkClosed()
|
void |
clear()
Clears non-recoverable state but not persisted state, so a recovery of the channel is possible TODO really? |
protected void |
clearAllScheduledDeliveries()
|
void |
close()
Close the channel |
boolean |
contains(Receiver r)
|
void |
deactivate()
|
void |
deliver()
Delivers as many references as possible to its router until no more deliveries are returned. |
protected void |
deliverInternal()
This methods delivers as many messages as possible to the router until no more deliveries are returned. |
protected boolean |
deliverScheduled(MessageReference ref)
|
protected org.jboss.messaging.core.ChannelSupport.InMemoryCallback |
getCallback(Transaction tx)
|
long |
getChannelID()
|
int |
getDeliveringCount()
|
int |
getMaxSize()
|
int |
getMessageCount()
Returns the count of messages stored AND being delivered AND scheduled |
int |
getMessagesAdded()
|
int |
getNumberOfReceivers()
|
int |
getScheduledCount()
Count scheduled for delivery |
Delivery |
handle(DeliveryObserver sender,
MessageReference ref,
Transaction tx)
A receiver can return an active, "done" or null delivery. |
protected Delivery |
handleInternal(DeliveryObserver sender,
MessageReference ref,
Transaction tx,
boolean persist)
|
boolean |
isActive()
|
boolean |
isRecoverable()
|
java.util.Iterator |
iterator()
|
int |
memoryRefCount()
|
protected void |
processMessageBeforeStorage(MessageReference reference)
Give subclass a chance to process the message before storing it internally. |
java.util.List |
recoverDeliveries(java.util.List messageIds)
|
boolean |
remove(Receiver r)
Remove a local receiver from this distributor. |
void |
removeAllReferences()
Remove all the references in the channel |
protected MessageReference |
removeFirstInMemory()
|
void |
setMaxSize(int newSize)
|
java.lang.String |
toString()
|
java.util.List |
undelivered(Filter filter)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jboss.messaging.core.Channel |
load, unload |
| Field Detail |
protected long channelID
protected Router router
protected MessageStore ms
protected boolean receiversReady
protected PriorityLinkedList messageRefs
protected boolean acceptReliableMessages
protected boolean recoverable
protected PersistenceManager pm
protected java.lang.Object refLock
protected boolean active
protected SynchronizedInt deliveringCount
protected java.util.Set scheduledDeliveries
protected int maxSize
protected SynchronizedInt messagesAdded
| Constructor Detail |
protected ChannelSupport(long channelID,
MessageStore ms,
PersistenceManager pm,
boolean acceptReliableMessages,
boolean recoverable,
int maxSize)
| Method Detail |
public Delivery handle(DeliveryObserver sender,
MessageReference ref,
Transaction tx)
Receiver
handle in interface Receiversender - - the component the delivery should be acknowledged to.Delivery,
DeliveryObserver
public void acknowledge(Delivery d,
Transaction tx)
throws java.lang.Throwable
acknowledge in interface DeliveryObserverjava.lang.Throwable
public void cancel(Delivery del)
throws java.lang.Throwable
cancel in interface DeliveryObserverjava.lang.Throwablepublic boolean add(Receiver r)
Distributor
add in interface Distributorpublic boolean remove(Receiver r)
Distributor
remove in interface Distributorpublic void clear()
Channel
clear in interface Channelpublic boolean contains(Receiver r)
contains in interface Distributorpublic java.util.Iterator iterator()
iterator in interface Distributorpublic int getNumberOfReceivers()
getNumberOfReceivers in interface Distributorpublic long getChannelID()
getChannelID in interface Channelpublic boolean isRecoverable()
isRecoverable in interface Channelpublic boolean acceptReliableMessages()
Channel
acceptReliableMessages in interface Channelpublic java.util.List browse()
browse in interface Channelpublic java.util.List browse(Filter filter)
browse in interface Channelfilter - - may be null, in which case no filter is applied.
public void deliver()
Channel
deliver in interface Channelpublic void close()
Channel
close in interface Channel
public void removeAllReferences()
throws java.lang.Throwable
Channel
removeAllReferences in interface Channeljava.lang.Throwablepublic java.util.List undelivered(Filter filter)
public int getMessageCount()
getMessageCount in interface Channelpublic int getDeliveringCount()
getDeliveringCount in interface Channelpublic int getScheduledCount()
Channel
getScheduledCount in interface Channelpublic void activate()
activate in interface Channelpublic void deactivate()
deactivate in interface Channelpublic boolean isActive()
isActive in interface Channelpublic java.util.List recoverDeliveries(java.util.List messageIds)
recoverDeliveries in interface Channelpublic int getMaxSize()
getMaxSize in interface Channelpublic void setMaxSize(int newSize)
setMaxSize in interface Channelpublic int getMessagesAdded()
getMessagesAdded in interface Channelpublic int memoryRefCount()
public java.lang.String toString()
protected void clearAllScheduledDeliveries()
protected void cancelInternal(MessageReference ref)
throws java.lang.Exception
java.lang.Exceptionprotected void deliverInternal()
Channel.deliver()protected boolean deliverScheduled(MessageReference ref)
protected Delivery handleInternal(DeliveryObserver sender,
MessageReference ref,
Transaction tx,
boolean persist)
protected boolean checkAndSchedule(MessageReference ref)
protected void acknowledgeInternal(Delivery d,
Transaction tx,
boolean persist)
throws java.lang.Exception
java.lang.Exceptionprotected org.jboss.messaging.core.ChannelSupport.InMemoryCallback getCallback(Transaction tx)
protected MessageReference removeFirstInMemory()
throws java.lang.Exception
java.lang.Exception
protected void addReferenceInMemory(MessageReference ref)
throws java.lang.Exception
java.lang.Exceptionprotected void processMessageBeforeStorage(MessageReference reference)
protected void checkClosed()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||