org.apache.activemq.broker.region.cursors
Class AbstractPendingMessageCursor

java.lang.Object
  extended by org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
All Implemented Interfaces:
PendingMessageCursor, Service
Direct Known Subclasses:
FilePendingMessageCursor, StoreDurableSubscriberCursor, VMPendingMessageCursor

public class AbstractPendingMessageCursor
extends java.lang.Object
implements PendingMessageCursor

Abstract method holder for pending message (messages awaiting disptach to a consumer) cursor

Version:
$Revision: 474986 $

Field Summary
protected  int maxBatchSize
           
 
Constructor Summary
AbstractPendingMessageCursor()
           
 
Method Summary
 void add(ConnectionContext context, Destination destination)
          Add a destination
 void addMessageFirst(MessageReference node)
          add message to await dispatch
 void addMessageLast(MessageReference node)
          add message to await dispatch
 void clear()
          clear all pending messages
protected  void fillBatch()
           
 int getMaxBatchSize()
           
 boolean hasNext()
           
 boolean isEmpty()
           
 boolean isRecoveryRequired()
          Informs the Broker if the subscription needs to intervention to recover it's state e.g.
 MessageReference next()
           
 void remove()
          remove the message at the cursor position
 void remove(ConnectionContext context, Destination destination)
          remove a destination
 void reset()
          reset the cursor
 void resetForGC()
          Give the cursor a hint that we are about to remove messages from memory only
 void setMaxBatchSize(int maxBatchSize)
          Set the max batch size
 int size()
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxBatchSize

protected int maxBatchSize
Constructor Detail

AbstractPendingMessageCursor

public AbstractPendingMessageCursor()
Method Detail

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

add

public void add(ConnectionContext context,
                Destination destination)
         throws java.lang.Exception
Description copied from interface: PendingMessageCursor
Add a destination

Specified by:
add in interface PendingMessageCursor
Throws:
java.lang.Exception

remove

public void remove(ConnectionContext context,
                   Destination destination)
            throws java.lang.Exception
Description copied from interface: PendingMessageCursor
remove a destination

Specified by:
remove in interface PendingMessageCursor
Throws:
java.lang.Exception

isRecoveryRequired

public boolean isRecoveryRequired()
Description copied from interface: PendingMessageCursor
Informs the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do

Specified by:
isRecoveryRequired in interface PendingMessageCursor
Returns:
true if recovery required

addMessageFirst

public void addMessageFirst(MessageReference node)
                     throws java.lang.Exception
Description copied from interface: PendingMessageCursor
add message to await dispatch

Specified by:
addMessageFirst in interface PendingMessageCursor
Throws:
java.lang.Exception

addMessageLast

public void addMessageLast(MessageReference node)
                    throws java.lang.Exception
Description copied from interface: PendingMessageCursor
add message to await dispatch

Specified by:
addMessageLast in interface PendingMessageCursor
Throws:
java.io.IOException
java.lang.Exception

clear

public void clear()
Description copied from interface: PendingMessageCursor
clear all pending messages

Specified by:
clear in interface PendingMessageCursor

hasNext

public boolean hasNext()
Specified by:
hasNext in interface PendingMessageCursor
Returns:
true if there pending messages to dispatch

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface PendingMessageCursor
Returns:
true if there are no pending messages

next

public MessageReference next()
Specified by:
next in interface PendingMessageCursor
Returns:
the next pending message

remove

public void remove()
Description copied from interface: PendingMessageCursor
remove the message at the cursor position

Specified by:
remove in interface PendingMessageCursor

reset

public void reset()
Description copied from interface: PendingMessageCursor
reset the cursor

Specified by:
reset in interface PendingMessageCursor

size

public int size()
Specified by:
size in interface PendingMessageCursor
Returns:
the number of pending messages

getMaxBatchSize

public int getMaxBatchSize()
Specified by:
getMaxBatchSize in interface PendingMessageCursor
Returns:
the maximum batch size

setMaxBatchSize

public void setMaxBatchSize(int maxBatchSize)
Description copied from interface: PendingMessageCursor
Set the max batch size

Specified by:
setMaxBatchSize in interface PendingMessageCursor

fillBatch

protected void fillBatch()
                  throws java.lang.Exception
Throws:
java.lang.Exception

resetForGC

public void resetForGC()
Give the cursor a hint that we are about to remove messages from memory only

Specified by:
resetForGC in interface PendingMessageCursor


Copyright © 2010 Apache Software Foundation. All Rights Reserved.