org.exolab.jmscts.core
Class CompletionListener

java.lang.Object
  |
  +--org.exolab.jmscts.core.CompletionListener

public class CompletionListener
extends java.lang.Object

Helper class to synchronize on the completion of tasks

Version:
$Revision: 1.4 $
Author:
Tim Anderson
See Also:
DelayedAction

Constructor Summary
CompletionListener(int expected)
          Construct a new CompletionListener
 
Method Summary
 void completed()
          Notify completion of a task
 int getCompleted()
          Returns the number of completed tasks
 void waitForCompletion()
          Wait indefinitely for the tasks to complete processing
 boolean waitForCompletion(long timeout)
          Wait for the listener to complete processing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompletionListener

public CompletionListener(int expected)
Construct a new CompletionListener
Parameters:
expected - the number of tasks expected to complete
Method Detail

completed

public void completed()
Notify completion of a task

waitForCompletion

public boolean waitForCompletion(long timeout)
                          throws java.lang.InterruptedException
Wait for the listener to complete processing
Parameters:
timeout - the number of milleseconds to wait. An argument less than or equal to zero means not to wait at all
Returns:
true if the listener completed in the given time frame
Throws:
java.lang.InterruptedException - if interrupted while waiting

waitForCompletion

public void waitForCompletion()
                       throws java.lang.InterruptedException
Wait indefinitely for the tasks to complete processing
Throws:
java.lang.InterruptedException - if interrupted while waiting

getCompleted

public int getCompleted()
Returns the number of completed tasks
Returns:
the number of completed tasks


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