org.exolab.jmscts.core
Class DelayedAction

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

public abstract class DelayedAction
extends ThreadedAction

Helper class to run an action in a separate thread after a delay, and catch any exception that the action generates.

Version:
$Revision: 1.6 $ $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
DelayedAction(long sleep)
          Construct a new DelayedAction
DelayedAction(long sleep, CompletionListener listener)
          Construct a new DelayedAction, with a listener to notify on completion
 
Method Summary
 void run()
          Run the action.
 
Methods inherited from class org.exolab.jmscts.core.ThreadedAction
getElapsedTime, getException, runProtected, 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

DelayedAction

public DelayedAction(long sleep)
Construct a new DelayedAction
Parameters:
sleep - the time to wait, in milliseconds, before invoking the action

DelayedAction

public DelayedAction(long sleep,
                     CompletionListener listener)
Construct a new DelayedAction, with a listener to notify on completion
Parameters:
sleep - the time to wait, in milliseconds, before invoking the action
listener - the listener to notify on completion
Method Detail

run

public void run()
Run the action. This sleeps for the specified time, before invoking ThreadedAction.runProtected().
If a CompletionListener was supplied, it will be notified on completion of the action.
Overrides:
run in class ThreadedAction


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