org.exolab.jmscts.core
Class ThreadedReceiver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.exolab.jmscts.core.ThreadedAction
              |
              +--org.exolab.jmscts.core.ThreadedReceiver
All Implemented Interfaces:
java.lang.Runnable

public class ThreadedReceiver
extends ThreadedAction

Helper class which performs message receipt in a separate thread

Version:
$Revision: 1.4 $ $Date: 2004/02/03 21:52:06 $
Author:
Tim Anderson

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadedReceiver(MessageReceiver receiver, int count, long timeout)
          Construct a new ThreadedReceiver, for synchronous receipt
ThreadedReceiver(MessageReceiver receiver, int count, long timeout, CompletionListener completion)
          Construct a new ThreadedReceiver, for synchronous receipt
ThreadedReceiver(MessageReceiver receiver, int count, long timeout, CountingListener listener, CompletionListener completion)
          Construct a new ThreadedReceiver, for asynchronous receipt
ThreadedReceiver(MessageReceiver receiver, long timeout, CountingListener listener)
          Construct a new ThreadedReceiver, for asynchronous receipt
 
Method Summary
 java.util.List getMessages()
          The received messages, when synchronous receipt is used
 void runProtected()
          Run the action
 
Methods inherited from class org.exolab.jmscts.core.ThreadedAction
getElapsedTime, getException, run, setException, waitForCompletion, waitForCompletion
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadedReceiver

public ThreadedReceiver(MessageReceiver receiver,
                        int count,
                        long timeout)
Construct a new ThreadedReceiver, for synchronous receipt
Parameters:
receiver - the message receiver
count - the expected no. of messages to receive
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.

ThreadedReceiver

public ThreadedReceiver(MessageReceiver receiver,
                        int count,
                        long timeout,
                        CompletionListener completion)
Construct a new ThreadedReceiver, for synchronous receipt
Parameters:
receiver - the message receiver
count - the expected no. of messages to receive
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.
completion - the listener to notify on completion

ThreadedReceiver

public ThreadedReceiver(MessageReceiver receiver,
                        long timeout,
                        CountingListener listener)
Construct a new ThreadedReceiver, for asynchronous receipt
Parameters:
receiver - the message receiver
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.
listener - the listener to handle received messages

ThreadedReceiver

public ThreadedReceiver(MessageReceiver receiver,
                        int count,
                        long timeout,
                        CountingListener listener,
                        CompletionListener completion)
Construct a new ThreadedReceiver, for asynchronous receipt
Parameters:
receiver - the message receiver
count - the expected no. of messages to receive
timeout - the maximum time to wait for each message. If set to 0, then it waits until a message becomes available.
listener - the listener to handle received messages
completion - the listener to notify on completion
Method Detail

getMessages

public java.util.List getMessages()
The received messages, when synchronous receipt is used
Returns:
the received messages, when synchronous receipt is used, or null if no message has been received or this hasn't completed

runProtected

public void runProtected()
                  throws java.lang.Exception
Run the action
Overrides:
runProtected in class ThreadedAction
Throws:
java.lang.Exception - for any error


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.