|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 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 del) 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 int getNumberOfReceivers()
getNumberOfReceivers
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
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()
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 java.util.List undelivered(Filter filter)
public int getMessageCount()
getMessageCount
in interface Channel
public int getDeliveringCount()
getDeliveringCount
in interface Channel
public int getScheduledCount()
Channel
getScheduledCount
in interface Channel
public void activate()
activate
in interface Channel
public void deactivate()
deactivate
in interface Channel
public boolean isActive()
isActive
in interface Channel
public java.util.List recoverDeliveries(java.util.List messageIds)
recoverDeliveries
in interface Channel
public int getMaxSize()
getMaxSize
in interface Channel
public void setMaxSize(int newSize)
setMaxSize
in interface Channel
public int getMessagesAdded()
getMessagesAdded
in interface Channel
public int memoryRefCount()
public java.lang.String toString()
protected void clearAllScheduledDeliveries()
protected void cancelInternal(MessageReference ref) throws java.lang.Exception
java.lang.Exception
protected 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.Exception
protected 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.Exception
protected void processMessageBeforeStorage(MessageReference reference)
protected void checkClosed()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |