org.logicalcobwebs.proxool
Class ResultMonitor

java.lang.Object
  extended by org.logicalcobwebs.proxool.ResultMonitor
Direct Known Subclasses:
SnapshotResultMonitor, StateResultMonitor, StatisticsResultMonitor

public abstract class ResultMonitor
extends java.lang.Object

Waits for a set of results to become true with timeout functionality

Since:
Proxool 0.8
Version:
$Revision: 1.9 $, $Date: 2003/03/05 18:44:10 $
Author:
bill, $Author: billhorsman $ (current maintainer)

Field Summary
private  int delay
           
private static Log LOG
           
private  int result
           
static int SUCCESS
          The result has happened
private  long timeout
          Seems awfully long, but it seems to need it.
static int TIMEOUT
          There was a timeout waiting for the result to happen
static int WAITING
          This monitor is still waiting for the result to come true
 
Constructor Summary
ResultMonitor()
           
 
Method Summary
abstract  boolean check()
          Override this with your specific check
 int getResult()
          Wait for the result to happen, or for a timeout
 void setDelay(int delay)
           
 void setTimeout(long timeout)
          Set the timeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

WAITING

public static final int WAITING
This monitor is still waiting for the result to come true

See Also:
Constant Field Values

SUCCESS

public static final int SUCCESS
The result has happened

See Also:
Constant Field Values

TIMEOUT

public static final int TIMEOUT
There was a timeout waiting for the result to happen

See Also:
setTimeout(long), Constant Field Values

timeout

private long timeout
Seems awfully long, but it seems to need it. Sometimes.


result

private int result

delay

private int delay
Constructor Detail

ResultMonitor

public ResultMonitor()
Method Detail

check

public abstract boolean check()
                       throws java.lang.Exception
Override this with your specific check

Returns:
true if the result has happened, else false
Throws:
java.lang.Exception - if anything goes wrong

getResult

public int getResult()
              throws ProxoolException
Wait for the result to happen, or for a timeout

Returns:
SUCCESS or TIMEOUT
Throws:
ProxoolException - if the check() threw an exception
See Also:
setTimeout(long)

setTimeout

public void setTimeout(long timeout)
Set the timeout

Parameters:
timeout - milliseconds

setDelay

public void setDelay(int delay)