org.jboss.messaging.core.server.impl
Class QueueImpl

java.lang.Object
  extended by org.jboss.messaging.core.server.impl.QueueImpl
All Implemented Interfaces:
Bindable, Queue
Direct Known Subclasses:
LastValueQueue

public class QueueImpl
extends java.lang.Object
implements Queue

Implementation of a Queue

Author:
Tim Fox, Andy Taylor, Jeff Mesnil, Clebert Suconic

Field Summary
protected  java.util.concurrent.atomic.AtomicInteger deliveringCount
           
static int NUM_PRIORITIES
           
static int REDISTRIBUTOR_BATCH_SIZE
           
 
Constructor Summary
QueueImpl(long persistenceID, SimpleString address, SimpleString name, Filter filter, boolean durable, boolean temporary, java.util.concurrent.ScheduledExecutorService scheduledExecutor, PostOffice postOffice, StorageManager storageManager, HierarchicalRepository<AddressSettings> addressSettingsRepository)
           
 
Method Summary
 void acknowledge(MessageReference ref)
           
 void acknowledge(Transaction tx, MessageReference ref)
           
 boolean activate()
           
 void activateNow(java.util.concurrent.Executor executor)
           
 void addConsumer(Consumer consumer)
           
 void addFirst(MessageReference ref)
           
 void addLast(MessageReference ref)
           
 void addRedistributor(long delay, java.util.concurrent.Executor executor, Channel replicatingChannel)
           
 void cancel(MessageReference reference)
           
 void cancel(Transaction tx, MessageReference reference)
           
 void cancelRedistributor()
           
 boolean changeReferencePriority(long messageID, byte newPriority)
           
 boolean checkDLQ(MessageReference reference)
           
 boolean consumerFailedOver()
           
 int deleteAllReferences()
           
 int deleteMatchingReferences(Filter filter)
           
 boolean deleteReference(long messageID)
           
 void deliverAsync(java.util.concurrent.Executor executor)
           
 void deliverNow()
           
 boolean equals(java.lang.Object other)
           
 void expire(MessageReference ref)
           
 boolean expireReference(long messageID)
           
 void expireReferences()
           
 int expireReferences(Filter filter)
          Expire all the references in the queue which matches the filter
 int getConsumerCount()
           
 java.util.Set<Consumer> getConsumers()
           
 int getDeliveringCount()
           
 Distributor getDistributionPolicy()
           
 Filter getFilter()
           
 int getMessageCount()
           
 int getMessagesAdded()
           
 SimpleString getName()
           
 long getPersistenceID()
           
 MessageReference getReference(long id)
           
 SimpleString getRoutingName()
           
 int getScheduledCount()
           
 java.util.List<MessageReference> getScheduledMessages()
           
 SimpleString getUniqueName()
           
 int hashCode()
           
 boolean isBackup()
           
 boolean isDurable()
           
 boolean isExclusive()
           
 boolean isTemporary()
           
 java.util.Iterator<MessageReference> iterator()
           
 java.util.List<MessageReference> list(Filter filter)
           
 void lockDelivery()
           
 boolean moveReference(long messageID, SimpleString toAddress)
           
 int moveReferences(Filter filter, SimpleString toAddress)
           
 void preroute(ServerMessage message, Transaction tx)
           
 void reacknowledge(Transaction tx, MessageReference ref)
           
 void referenceHandled()
           
 boolean removeConsumer(Consumer consumer)
           
 MessageReference removeFirstReference(long id)
           
 MessageReference removeReferenceWithID(long id)
           
 MessageReference reroute(ServerMessage message, Transaction tx)
           
 void route(ServerMessage message, Transaction tx)
           
 boolean sendMessageToDeadLetterAddress(long messageID)
           
 void setBackup()
           
 void setDistributionPolicy(Distributor distributionPolicy)
           
 void setPersistenceID(long id)
           
 java.lang.String toString()
           
 void unlockDelivery()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REDISTRIBUTOR_BATCH_SIZE

public static final int REDISTRIBUTOR_BATCH_SIZE
See Also:
Constant Field Values

NUM_PRIORITIES

public static final int NUM_PRIORITIES
See Also:
Constant Field Values

deliveringCount

protected final java.util.concurrent.atomic.AtomicInteger deliveringCount
Constructor Detail

QueueImpl

public QueueImpl(long persistenceID,
                 SimpleString address,
                 SimpleString name,
                 Filter filter,
                 boolean durable,
                 boolean temporary,
                 java.util.concurrent.ScheduledExecutorService scheduledExecutor,
                 PostOffice postOffice,
                 StorageManager storageManager,
                 HierarchicalRepository<AddressSettings> addressSettingsRepository)
Method Detail

getRoutingName

public SimpleString getRoutingName()

getUniqueName

public SimpleString getUniqueName()

isExclusive

public boolean isExclusive()

preroute

public void preroute(ServerMessage message,
                     Transaction tx)
              throws java.lang.Exception
Specified by:
preroute in interface Bindable
Throws:
java.lang.Exception

route

public void route(ServerMessage message,
                  Transaction tx)
           throws java.lang.Exception
Specified by:
route in interface Bindable
Throws:
java.lang.Exception

reroute

public MessageReference reroute(ServerMessage message,
                                Transaction tx)
                         throws java.lang.Exception
Specified by:
reroute in interface Queue
Throws:
java.lang.Exception

lockDelivery

public void lockDelivery()
Specified by:
lockDelivery in interface Queue

unlockDelivery

public void unlockDelivery()
Specified by:
unlockDelivery in interface Queue

isDurable

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

isTemporary

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

getName

public SimpleString getName()
Specified by:
getName in interface Queue

getPersistenceID

public long getPersistenceID()
Specified by:
getPersistenceID in interface Queue

setPersistenceID

public void setPersistenceID(long id)
Specified by:
setPersistenceID in interface Queue

getFilter

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

addLast

public void addLast(MessageReference ref)
Specified by:
addLast in interface Queue

addFirst

public void addFirst(MessageReference ref)
Specified by:
addFirst in interface Queue

deliverAsync

public void deliverAsync(java.util.concurrent.Executor executor)
Specified by:
deliverAsync in interface Queue

deliverNow

public void deliverNow()
Specified by:
deliverNow in interface Queue

addConsumer

public void addConsumer(Consumer consumer)
                 throws java.lang.Exception
Specified by:
addConsumer in interface Queue
Throws:
java.lang.Exception

removeConsumer

public boolean removeConsumer(Consumer consumer)
                       throws java.lang.Exception
Specified by:
removeConsumer in interface Queue
Throws:
java.lang.Exception

addRedistributor

public void addRedistributor(long delay,
                             java.util.concurrent.Executor executor,
                             Channel replicatingChannel)
Specified by:
addRedistributor in interface Queue

cancelRedistributor

public void cancelRedistributor()
                         throws java.lang.Exception
Specified by:
cancelRedistributor in interface Queue
Throws:
java.lang.Exception

getConsumerCount

public int getConsumerCount()
Specified by:
getConsumerCount in interface Queue

getConsumers

public java.util.Set<Consumer> getConsumers()
Specified by:
getConsumers in interface Queue

iterator

public java.util.Iterator<MessageReference> iterator()
Specified by:
iterator in interface Queue
Returns:
an immutable iterator which does not allow to remove references

list

public java.util.List<MessageReference> list(Filter filter)
Specified by:
list in interface Queue

removeReferenceWithID

public MessageReference removeReferenceWithID(long id)
                                       throws java.lang.Exception
Specified by:
removeReferenceWithID in interface Queue
Throws:
java.lang.Exception

removeFirstReference

public MessageReference removeFirstReference(long id)
                                      throws java.lang.Exception
Specified by:
removeFirstReference in interface Queue
Throws:
java.lang.Exception

getReference

public MessageReference getReference(long id)
Specified by:
getReference in interface Queue

getMessageCount

public int getMessageCount()
Specified by:
getMessageCount in interface Queue

getScheduledCount

public int getScheduledCount()
Specified by:
getScheduledCount in interface Queue

getScheduledMessages

public java.util.List<MessageReference> getScheduledMessages()
Specified by:
getScheduledMessages in interface Queue

getDeliveringCount

public int getDeliveringCount()
Specified by:
getDeliveringCount in interface Queue

acknowledge

public void acknowledge(MessageReference ref)
                 throws java.lang.Exception
Specified by:
acknowledge in interface Queue
Throws:
java.lang.Exception

acknowledge

public void acknowledge(Transaction tx,
                        MessageReference ref)
                 throws java.lang.Exception
Specified by:
acknowledge in interface Queue
Throws:
java.lang.Exception

reacknowledge

public void reacknowledge(Transaction tx,
                          MessageReference ref)
                   throws java.lang.Exception
Specified by:
reacknowledge in interface Queue
Throws:
java.lang.Exception

cancel

public void cancel(Transaction tx,
                   MessageReference reference)
            throws java.lang.Exception
Specified by:
cancel in interface Queue
Throws:
java.lang.Exception

cancel

public void cancel(MessageReference reference)
            throws java.lang.Exception
Specified by:
cancel in interface Queue
Throws:
java.lang.Exception

expire

public void expire(MessageReference ref)
            throws java.lang.Exception
Specified by:
expire in interface Queue
Throws:
java.lang.Exception

referenceHandled

public void referenceHandled()
Specified by:
referenceHandled in interface Queue

getDistributionPolicy

public Distributor getDistributionPolicy()
Specified by:
getDistributionPolicy in interface Queue

setDistributionPolicy

public void setDistributionPolicy(Distributor distributionPolicy)
Specified by:
setDistributionPolicy in interface Queue

getMessagesAdded

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

deleteAllReferences

public int deleteAllReferences()
                        throws java.lang.Exception
Specified by:
deleteAllReferences in interface Queue
Throws:
java.lang.Exception

deleteMatchingReferences

public int deleteMatchingReferences(Filter filter)
                             throws java.lang.Exception
Specified by:
deleteMatchingReferences in interface Queue
Throws:
java.lang.Exception

deleteReference

public boolean deleteReference(long messageID)
                        throws java.lang.Exception
Specified by:
deleteReference in interface Queue
Throws:
java.lang.Exception

expireReference

public boolean expireReference(long messageID)
                        throws java.lang.Exception
Specified by:
expireReference in interface Queue
Throws:
java.lang.Exception

expireReferences

public int expireReferences(Filter filter)
                     throws java.lang.Exception
Description copied from interface: Queue
Expire all the references in the queue which matches the filter

Specified by:
expireReferences in interface Queue
Throws:
java.lang.Exception

expireReferences

public void expireReferences()
                      throws java.lang.Exception
Specified by:
expireReferences in interface Queue
Throws:
java.lang.Exception

sendMessageToDeadLetterAddress

public boolean sendMessageToDeadLetterAddress(long messageID)
                                       throws java.lang.Exception
Specified by:
sendMessageToDeadLetterAddress in interface Queue
Throws:
java.lang.Exception

moveReference

public boolean moveReference(long messageID,
                             SimpleString toAddress)
                      throws java.lang.Exception
Specified by:
moveReference in interface Queue
Throws:
java.lang.Exception

moveReferences

public int moveReferences(Filter filter,
                          SimpleString toAddress)
                   throws java.lang.Exception
Specified by:
moveReferences in interface Queue
Throws:
java.lang.Exception

changeReferencePriority

public boolean changeReferencePriority(long messageID,
                                       byte newPriority)
                                throws java.lang.Exception
Specified by:
changeReferencePriority in interface Queue
Throws:
java.lang.Exception

isBackup

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

setBackup

public void setBackup()
Specified by:
setBackup in interface Queue

activate

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

activateNow

public void activateNow(java.util.concurrent.Executor executor)
Specified by:
activateNow in interface Queue

consumerFailedOver

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

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

checkDLQ

public boolean checkDLQ(MessageReference reference)
                 throws java.lang.Exception
Specified by:
checkDLQ in interface Queue
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.