org.jboss.messaging.core.plugin.postoffice.cluster
Class RemoteQueueStub

java.lang.Object
  extended byorg.jboss.messaging.core.plugin.postoffice.cluster.RemoteQueueStub
All Implemented Interfaces:
Channel, ClusteredQueue, DeliveryObserver, Distributor, Queue, Receiver

public class RemoteQueueStub
extends java.lang.Object
implements ClusteredQueue

A RemoteQueueStub TODO to avoid having to implement a lot of methods that throw UnsupportedOperationException should define an interface that only declares the required methods and implement that

Version:
$Revision: 2386 $ $Id: RemoteQueueStub.java 2386 2007-02-21 18:07:44Z timfox $
Author:
Tim Fox

Constructor Summary
RemoteQueueStub(int nodeId, java.lang.String name, long id, boolean recoverable, PersistenceManager pm, Filter filter)
           
 
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)
           
 void activate()
           
 boolean add(Receiver receiver)
          Add a local receiver to this distributor.
 java.util.List browse()
           
 java.util.List browse(Filter filter)
           
 void cancel(Delivery d)
           
 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 receiver)
           
 void deactivate()
           
 void deliver()
          Delivers as many references as possible to its router until no more deliveries are returned.
 java.util.List delivering(Filter filter)
           
 long getChannelID()
           
 int getDeliveringCount()
           
 Filter getFilter()
           
 int getMaxSize()
           
 int getMessageCount()
           
 int getMessagesAdded()
           
 java.lang.String getName()
           
 int getNodeId()
           
 int getNumberOfReceivers()
           
 int getScheduledCount()
          Count scheduled for delivery
 QueueStats getStats()
           
 Delivery handle(DeliveryObserver observer, MessageReference reference, Transaction tx)
          A receiver can return an active, "done" or null delivery.
 boolean isActive()
           
 boolean isClustered()
           
 boolean isLocal()
           
 boolean isRecoverable()
           
 java.util.Iterator iterator()
           
 void load()
           
 java.util.List recoverDeliveries(java.util.List messageIds)
           
 boolean remove(Receiver receiver)
          Remove a local receiver from this distributor.
 void removeAllReferences()
          Remove all the references in the channel
 void setMaxSize(int newSize)
           
 void setStats(QueueStats stats)
           
 java.lang.String toString()
           
 java.util.List undelivered(Filter filter)
           
 void unload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteQueueStub

public RemoteQueueStub(int nodeId,
                       java.lang.String name,
                       long id,
                       boolean recoverable,
                       PersistenceManager pm,
                       Filter filter)
Method Detail

handle

public Delivery handle(DeliveryObserver observer,
                       MessageReference reference,
                       Transaction tx)
Description copied from interface: Receiver
A receiver can return an active, "done" or null delivery. The method returns null in case the receiver doesn't accept the message. The return value is unspecified when the message is submitted in the context of a transaction (tx not null).

Specified by:
handle in interface Receiver
Parameters:
observer - - the component the delivery should be acknowledged to.
See Also:
Delivery, DeliveryObserver

contains

public boolean contains(Receiver receiver)
Specified by:
contains in interface Distributor

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface Distributor
Returns:
an iterator of local receivers

add

public boolean add(Receiver receiver)
Description copied from interface: Distributor
Add a local receiver to this distributor.

Specified by:
add in interface Distributor
Returns:
true if the distributor did not already contain the specified receiver and the receiver was added to the distributor, false otherwise.

remove

public boolean remove(Receiver receiver)
Description copied from interface: Distributor
Remove a local receiver from this distributor.

Specified by:
remove in interface Distributor
Returns:
true if this distributor contained the specified receiver.

getNumberOfReceivers

public int getNumberOfReceivers()
Specified by:
getNumberOfReceivers in interface Distributor
Returns:
The number of receivers in the distributor

acknowledge

public void acknowledge(Delivery d,
                        Transaction tx)
                 throws java.lang.Throwable
Specified by:
acknowledge in interface DeliveryObserver
Throws:
java.lang.Throwable

cancel

public void cancel(Delivery d)
            throws java.lang.Throwable
Specified by:
cancel in interface DeliveryObserver
Throws:
java.lang.Throwable

getChannelID

public long getChannelID()
Specified by:
getChannelID in interface Channel
Returns:
the unique ID of the channel

isRecoverable

public boolean isRecoverable()
Specified by:
isRecoverable in interface Channel
Returns:
true if the channel can guarantee recoverability for reliable messages. Recoverability is not guaranteed for non-reliable messages (and should not be provided by default, for performance reasons), even if the channel is recoverable.

acceptReliableMessages

public boolean acceptReliableMessages()
Description copied from interface: Channel
A non-recoverable channel cannot guarantee recoverability for reliable messages so by default it won't accept reliable messages. However, there are situations when discarding a reliable message is acceptable for a specific instance of a channel, so it should be a way to configure the channel to do so. A channel indicates unequivocally whether it accepts reliable messages or not returning true or false as result of this method. A recoverable channel must always accept reliable messages, so this method must always return true for a recoverable channel.

Specified by:
acceptReliableMessages in interface Channel
Returns:
false if the channel doesn't accept reliable messages.

browse

public java.util.List browse()
Specified by:
browse in interface Channel
Returns:
a List containing messages being held by the channel.

browse

public java.util.List browse(Filter filter)
Specified by:
browse in interface Channel
Parameters:
filter - - may be null, in which case no filter is applied.
Returns:
a List containing message references of messages whose state is maintained by this State instance.

deliver

public void deliver()
Description copied from interface: Channel
Delivers as many references as possible to its router until no more deliveries are returned.

Specified by:
deliver in interface Channel

close

public void close()
Description copied from interface: Channel
Close the channel

Specified by:
close in interface Channel

delivering

public java.util.List delivering(Filter filter)

undelivered

public java.util.List undelivered(Filter filter)

clear

public void clear()
Description copied from interface: Channel
Clears non-recoverable state but not persisted state, so a recovery of the channel is possible TODO really?

Specified by:
clear in interface Channel

getMessageCount

public int getMessageCount()
Specified by:
getMessageCount in interface Channel
Returns:
Total message count = undelivered + delivering + scheduled

removeAllReferences

public void removeAllReferences()
                         throws java.lang.Throwable
Description copied from interface: Channel
Remove all the references in the channel

Specified by:
removeAllReferences in interface Channel
Throws:
java.lang.Throwable

load

public void load()
          throws java.lang.Exception
Specified by:
load in interface Channel
Throws:
java.lang.Exception

unload

public void unload()
            throws java.lang.Exception
Specified by:
unload in interface Channel
Throws:
java.lang.Exception

activate

public void activate()
Specified by:
activate in interface Channel

deactivate

public void deactivate()
Specified by:
deactivate in interface Channel

isActive

public boolean isActive()
Specified by:
isActive in interface Channel

recoverDeliveries

public java.util.List recoverDeliveries(java.util.List messageIds)
Specified by:
recoverDeliveries in interface Channel

getDeliveringCount

public int getDeliveringCount()
Specified by:
getDeliveringCount in interface Channel
Returns:
Count being delivered

getMaxSize

public int getMaxSize()
Specified by:
getMaxSize in interface Channel

getMessagesAdded

public int getMessagesAdded()
Specified by:
getMessagesAdded in interface Channel

setMaxSize

public void setMaxSize(int newSize)
Specified by:
setMaxSize in interface Channel

getScheduledCount

public int getScheduledCount()
Description copied from interface: Channel
Count scheduled for delivery

Specified by:
getScheduledCount in interface Channel

getName

public java.lang.String getName()
Specified by:
getName in interface Queue

getFilter

public Filter getFilter()
Specified by:
getFilter in interface Queue

isClustered

public boolean isClustered()
Specified by:
isClustered in interface Queue

getStats

public QueueStats getStats()
Specified by:
getStats in interface ClusteredQueue

getNodeId

public int getNodeId()
Specified by:
getNodeId in interface ClusteredQueue

isLocal

public boolean isLocal()
Specified by:
isLocal in interface ClusteredQueue

setStats

public void setStats(QueueStats stats)

toString

public java.lang.String toString()


Copyright © 2006 JBoss Inc. All Rights Reserved.