org.logicalcobwebs.proxool.admin
Class StatisticsResultMonitor

java.lang.Object
  extended by org.logicalcobwebs.proxool.ResultMonitor
      extended by org.logicalcobwebs.proxool.admin.StatisticsResultMonitor

public class StatisticsResultMonitor
extends ResultMonitor

A ResultMonitor specifically for Snapshots

Since:
Proxool 0.8
Version:
$Revision: 1.9 $, $Date: 2003/03/06 22:39:05 $
Author:
bill, $Author: billhorsman $ (current maintainer)

Field Summary
private  java.lang.String alias
           
private static Log LOG
           
private  StatisticsIF oldStatistics
           
private  StatisticsIF statistics
           
private  java.lang.String token
           
 
Fields inherited from class org.logicalcobwebs.proxool.ResultMonitor
SUCCESS, TIMEOUT, WAITING
 
Constructor Summary
StatisticsResultMonitor(java.lang.String alias, java.lang.String token)
           
 
Method Summary
 boolean check()
          waits for statistics
protected  boolean check(StatisticsIF statistics)
          This gets called when we get new statistics.
 int getResult()
          Wait for the result to happen, or for a timeout
 StatisticsIF getStatistics()
          Get the statistics used in the most recent check
 
Methods inherited from class org.logicalcobwebs.proxool.ResultMonitor
setDelay, setTimeout
 
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

statistics

private StatisticsIF statistics

oldStatistics

private StatisticsIF oldStatistics

alias

private java.lang.String alias

token

private java.lang.String token
Constructor Detail

StatisticsResultMonitor

public StatisticsResultMonitor(java.lang.String alias,
                               java.lang.String token)
Parameters:
alias - so we can lookup the latest statistics
token - so we can lookup the latest statistics
Method Detail

check

public boolean check()
              throws java.lang.Exception
waits for statistics

Specified by:
check in class ResultMonitor
Returns:
ResultMonitor.SUCCESS or ResultMonitor.TIMEOUT
Throws:
java.lang.Exception - if anything goes wrong

check

protected boolean check(StatisticsIF statistics)
This gets called when we get new statistics. By overriding this method you get the option of rejecting these new statistics and waiting for the next set

Parameters:
statistics - the newly created statistics
Returns:
true if we accept them, false if we want to wait for the next set (if you don't override this it will return true)

getResult

public int getResult()
              throws ProxoolException
Description copied from class: ResultMonitor
Wait for the result to happen, or for a timeout

Overrides:
getResult in class ResultMonitor
Returns:
ResultMonitor.SUCCESS or ResultMonitor.TIMEOUT
Throws:
ProxoolException - if the ResultMonitor.check() threw an exception
See Also:
ResultMonitor.setTimeout(long)

getStatistics

public StatisticsIF getStatistics()
Get the statistics used in the most recent check

Returns:
snapshot