|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.messaging.core.impl.ChannelSupport
public abstract class ChannelSupport
This class provides much of the functionality needed to implement a channel. This partial implementation supports atomicity, isolation and recoverability for reliable messages.
Field Summary | |
---|---|
protected boolean |
active
|
protected long |
channelID
|
protected SynchronizedInt |
deliveringCount
|
protected Distributor |
distributor
|
protected java.lang.Object |
lock
|
protected int |
maxSize
|
protected PriorityLinkedList |
messageRefs
|
protected SynchronizedInt |
messagesAdded
|
protected PersistenceManager |
pm
|
protected boolean |
receiversReady
|
protected boolean |
recoverable
|
protected java.util.Set |
scheduledDeliveries
|
Constructor Summary | |
---|---|
protected |
ChannelSupport(long channelID,
PersistenceManager pm,
boolean recoverable,
int maxSize)
|
Method Summary | |
---|---|
void |
acknowledge(Delivery d,
Transaction tx)
|
protected void |
acknowledgeInternal(Delivery d,
Transaction tx,
boolean persist)
|
void |
activate()
Activate the channel. |
protected void |
addReferenceInMemory(MessageReference ref)
|
java.util.List |
browse(Filter filter)
|
void |
cancel(Delivery del)
|
protected void |
cancelInternal(MessageReference ref)
|
protected boolean |
checkAndSchedule(MessageReference ref)
|
protected void |
checkClosed()
|
protected void |
clearAllScheduledDeliveries()
|
void |
close()
Close the channel |
void |
deactivate()
Deactivate the channel |
void |
deliver()
Delivers as many references as possible to its router until receivers will accept no more |
protected void |
deliverInternal()
This methods delivers as many messages as possible to the distributor until no more deliveries are returned. |
protected boolean |
deliverScheduled(MessageReference ref)
|
protected org.jboss.messaging.core.impl.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()
Get the total number of messages added since this channel was started |
protected boolean |
getReceiversReady()
|
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()
|
int |
memoryRefCount()
|
protected void |
processMessageBeforeStorage(MessageReference reference)
Give subclass a chance to process the message before storing it internally. |
void |
removeAllReferences()
Remove all the references in the channel |
protected MessageReference |
removeFirstInMemory()
|
void |
setMaxSize(int newSize)
Set the maximum number of references this channel can store |
protected void |
setReceiversReady(boolean receiversReady)
|
java.util.List |
undelivered(Filter filter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.messaging.core.contract.Channel |
---|
load, unload |
Field Detail |
---|
protected long channelID
protected Distributor distributor
protected boolean receiversReady
protected PriorityLinkedList messageRefs
protected boolean recoverable
protected PersistenceManager pm
protected java.lang.Object lock
protected volatile boolean active
protected SynchronizedInt deliveringCount
protected java.util.Set scheduledDeliveries
protected int maxSize
protected SynchronizedInt messagesAdded
Constructor Detail |
---|
protected ChannelSupport(long channelID, PersistenceManager pm, 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 long getChannelID()
getChannelID
in interface Channel
public boolean isRecoverable()
isRecoverable
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()
Channel
activate
in interface Channel
public void deactivate()
Channel
deactivate
in interface Channel
public boolean isActive()
isActive
in interface Channel
public int getMaxSize()
getMaxSize
in interface Channel
public void setMaxSize(int newSize)
Channel
setMaxSize
in interface Channel
public int getMessagesAdded()
Channel
getMessagesAdded
in interface Channel
public int memoryRefCount()
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.impl.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 boolean getReceiversReady()
protected void setReceiversReady(boolean receiversReady)
protected void processMessageBeforeStorage(MessageReference reference)
protected void checkClosed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |