org.jasig.cas.monitor
Class AbstractPoolMonitor

java.lang.Object
  extended by org.jasig.cas.monitor.AbstractNamedMonitor<PoolStatus>
      extended by org.jasig.cas.monitor.AbstractPoolMonitor
All Implemented Interfaces:
Monitor<PoolStatus>
Direct Known Subclasses:
DataSourceMonitor

public abstract class AbstractPoolMonitor
extends AbstractNamedMonitor<PoolStatus>

Describes a monitor that observes a pool of resources.

Since:
3.5.0
Author:
Marvin S. Addison

Field Summary
static int DEFAULT_MAX_WAIT
          Default maximum wait time for asynchronous pool validation.
 
Fields inherited from class org.jasig.cas.monitor.AbstractNamedMonitor
name
 
Constructor Summary
AbstractPoolMonitor()
           
 
Method Summary
protected abstract  StatusCode checkPool()
          Performs a health check on a the pool.
protected abstract  int getActiveCount()
          Gets the number of pool resources active at present.
protected abstract  int getIdleCount()
          Gets the number of pool resources idle at present.
 PoolStatus observe()
          Observes the monitored resource and reports the status.
 void setExecutor(ExecutorService executorService)
          Sets the executor service responsible for pool resource validation.
 void setMaxWait(int time)
          Set the maximum amount of time wait while validating pool resources.
 
Methods inherited from class org.jasig.cas.monitor.AbstractNamedMonitor
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_WAIT

public static final int DEFAULT_MAX_WAIT
Default maximum wait time for asynchronous pool validation.

See Also:
Constant Field Values
Constructor Detail

AbstractPoolMonitor

public AbstractPoolMonitor()
Method Detail

setExecutor

public void setExecutor(ExecutorService executorService)
Sets the executor service responsible for pool resource validation.

Parameters:
executorService - Executor of pool validation operations.

setMaxWait

public void setMaxWait(int time)
Set the maximum amount of time wait while validating pool resources. If the pool defines a minumum time to wait for a resource, this property should be set less than that value.

Parameters:
time - Wait time in milliseconds.

observe

public PoolStatus observe()
Observes the monitored resource and reports the status.

Returns:
Status of monitored resource.

checkPool

protected abstract StatusCode checkPool()
                                 throws Exception
Performs a health check on a the pool. The recommended implementation is to obtain a pool resource, validate it, and return it to the pool.

Returns:
Status code describing pool health.
Throws:
Exception - Thrown to indicate a serious problem with pool validation.

getIdleCount

protected abstract int getIdleCount()
Gets the number of pool resources idle at present.

Returns:
Number of idle pool resources.

getActiveCount

protected abstract int getActiveCount()
Gets the number of pool resources active at present.

Returns:
Number of active pool resources.


Copyright © 2004-2013 Jasig. All Rights Reserved.