org.jboss.jms.client.remoting
Class MessageCallbackHandler

java.lang.Object
  extended byorg.jboss.jms.client.remoting.MessageCallbackHandler

public class MessageCallbackHandler
extends java.lang.Object

Version:
$Revision: 1.70 $ $Id: MessageCallbackHandler.java,v 1.70 2006/06/26 18:41:21 timfox Exp $
Author:
Ovidiu Feodorov, Tim Fox/a>

Field Summary
protected  int ackMode
           
protected  PooledExecutor activateConsumerExecutor
           
protected  int activationCount
           
protected  java.util.LinkedList buffer
           
protected  boolean closed
           
protected  boolean closing
           
protected  ConsumerDelegate consumerDelegate
           
protected  int consumerID
           
protected  int deliveryAttempts
           
protected  boolean gotLastMessage
           
protected  boolean isConnectionConsumer
           
protected  long lastMessageId
           
protected  MessageListener listener
           
protected  java.lang.Object mainLock
           
protected  boolean onMessageExecuting
           
protected  QueuedExecutor onMessageExecutor
           
protected  java.lang.Object onMessageLock
           
protected  java.lang.Thread receiverThread
           
protected  SessionDelegate sessionDelegate
           
 
Constructor Summary
MessageCallbackHandler(boolean isCC, int ackMode, QueuedExecutor onMessageExecutor, PooledExecutor activateConsumerExecutor, SessionDelegate sess, ConsumerDelegate cons, int consumerID)
           
 
Method Summary
protected  void activateConsumer()
           
static void callOnMessage(ConsumerDelegate cons, SessionDelegate sess, MessageListener listener, int consumerID, boolean isConnectionConsumer, MessageProxy m, int ackMode)
           
protected  void cancelDeliveries(java.util.List ids)
           
 void close()
           
protected  long deactivateConsumer()
           
protected  MessageProxy getMessage(long timeout)
           
 MessageListener getMessageListener()
           
protected  MessageProxy getMessageNow()
           
 void handleMessage(MessageProxy md)
           
protected static void postDeliver(SessionDelegate sess, int consumerID, MessageProxy m, boolean isConnectionConsumer)
           
protected static void preDeliver(SessionDelegate sess, int consumerID, MessageProxy m, boolean isConnectionConsumer)
           
protected  MessageProxy processMessage(MessageProxy del)
           
 MessageProxy receive(long timeout)
          Method used by the client thread to get a Message, if available.
 void setMessageListener(MessageListener listener)
           
 java.lang.String toString()
           
protected  long waitOnLock(java.lang.Object lock, long waitTime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buffer

protected java.util.LinkedList buffer

sessionDelegate

protected SessionDelegate sessionDelegate

consumerDelegate

protected ConsumerDelegate consumerDelegate

consumerID

protected int consumerID

isConnectionConsumer

protected boolean isConnectionConsumer

receiverThread

protected volatile java.lang.Thread receiverThread

listener

protected MessageListener listener

deliveryAttempts

protected int deliveryAttempts

ackMode

protected int ackMode

onMessageExecutor

protected QueuedExecutor onMessageExecutor

activateConsumerExecutor

protected PooledExecutor activateConsumerExecutor

mainLock

protected java.lang.Object mainLock

onMessageLock

protected java.lang.Object onMessageLock

closed

protected boolean closed

closing

protected volatile boolean closing

gotLastMessage

protected boolean gotLastMessage

lastMessageId

protected long lastMessageId

activationCount

protected volatile int activationCount

onMessageExecuting

protected volatile boolean onMessageExecuting
Constructor Detail

MessageCallbackHandler

public MessageCallbackHandler(boolean isCC,
                              int ackMode,
                              QueuedExecutor onMessageExecutor,
                              PooledExecutor activateConsumerExecutor,
                              SessionDelegate sess,
                              ConsumerDelegate cons,
                              int consumerID)
Method Detail

callOnMessage

public static void callOnMessage(ConsumerDelegate cons,
                                 SessionDelegate sess,
                                 MessageListener listener,
                                 int consumerID,
                                 boolean isConnectionConsumer,
                                 MessageProxy m,
                                 int ackMode)
                          throws JMSException
Throws:
JMSException

preDeliver

protected static void preDeliver(SessionDelegate sess,
                                 int consumerID,
                                 MessageProxy m,
                                 boolean isConnectionConsumer)
                          throws JMSException
Throws:
JMSException

postDeliver

protected static void postDeliver(SessionDelegate sess,
                                  int consumerID,
                                  MessageProxy m,
                                  boolean isConnectionConsumer)
                           throws JMSException
Throws:
JMSException

handleMessage

public void handleMessage(MessageProxy md)
                   throws HandleCallbackException
Throws:
HandleCallbackException

setMessageListener

public void setMessageListener(MessageListener listener)
                        throws JMSException
Throws:
JMSException

close

public void close()
           throws JMSException
Throws:
JMSException

receive

public MessageProxy receive(long timeout)
                     throws JMSException
Method used by the client thread to get a Message, if available.

Parameters:
timeout - - the timeout value in milliseconds. A zero timeount never expires, and the call blocks indefinitely. A -1 timeout means receiveNoWait(): return the next message or null if one is not immediately available. Returns null if the consumer is concurrently closed.
Throws:
JMSException

getMessageListener

public MessageListener getMessageListener()

toString

public java.lang.String toString()

waitOnLock

protected long waitOnLock(java.lang.Object lock,
                          long waitTime)
                   throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

cancelDeliveries

protected void cancelDeliveries(java.util.List ids)

activateConsumer

protected void activateConsumer()
                         throws JMSException
Throws:
JMSException

deactivateConsumer

protected long deactivateConsumer()
                           throws JMSException
Throws:
JMSException

getMessageNow

protected MessageProxy getMessageNow()
                              throws JMSException
Throws:
JMSException

getMessage

protected MessageProxy getMessage(long timeout)
                           throws JMSException
Throws:
JMSException

processMessage

protected MessageProxy processMessage(MessageProxy del)


Copyright © 2006 JBoss Inc. All Rights Reserved.