org.apache.commons.performance.pool
Class WaiterFactory

java.lang.Object
  extended by org.apache.commons.performance.pool.WaiterFactory
All Implemented Interfaces:
KeyedPoolableObjectFactory, PoolableObjectFactory

public class WaiterFactory
extends Object
implements PoolableObjectFactory, KeyedPoolableObjectFactory

Object factory with configurable latencies for object lifecycle methods.


Field Summary
protected static Logger logger
           
 
Constructor Summary
WaiterFactory(long activateLatency, long destroyLatency, long makeLatency, long passivateLatency, long validateLatency, long waiterLatency)
           
WaiterFactory(long activateLatency, long destroyLatency, long makeLatency, long passivateLatency, long validateLatency, long waiterLatency, long maxActive)
           
WaiterFactory(long activateLatency, long destroyLatency, long makeLatency, long passivateLatency, long validateLatency, long waiterLatency, long maxActive, long maxActivePerKey)
           
 
Method Summary
 void activateObject(Object arg0)
           
 void activateObject(Object key, Object obj)
           
 void destroyObject(Object arg0)
           
 void destroyObject(Object key, Object obj)
           
protected  void doWait(long latency)
           
 long getMaxActive()
           
 Object makeObject()
           
 Object makeObject(Object key)
           
 void passivateObject(Object arg0)
           
 void passivateObject(Object key, Object obj)
           
 void reset()
           
 void setMaxActive(long maxActive)
           
 boolean validateObject(Object arg0)
           
 boolean validateObject(Object key, Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
Constructor Detail

WaiterFactory

public WaiterFactory(long activateLatency,
                     long destroyLatency,
                     long makeLatency,
                     long passivateLatency,
                     long validateLatency,
                     long waiterLatency,
                     long maxActive,
                     long maxActivePerKey)

WaiterFactory

public WaiterFactory(long activateLatency,
                     long destroyLatency,
                     long makeLatency,
                     long passivateLatency,
                     long validateLatency,
                     long waiterLatency)

WaiterFactory

public WaiterFactory(long activateLatency,
                     long destroyLatency,
                     long makeLatency,
                     long passivateLatency,
                     long validateLatency,
                     long waiterLatency,
                     long maxActive)
Method Detail

activateObject

public void activateObject(Object arg0)
                    throws Exception
Specified by:
activateObject in interface PoolableObjectFactory
Throws:
Exception

destroyObject

public void destroyObject(Object arg0)
                   throws Exception
Specified by:
destroyObject in interface PoolableObjectFactory
Throws:
Exception

makeObject

public Object makeObject()
                  throws Exception
Specified by:
makeObject in interface PoolableObjectFactory
Throws:
Exception

passivateObject

public void passivateObject(Object arg0)
                     throws Exception
Specified by:
passivateObject in interface PoolableObjectFactory
Throws:
Exception

validateObject

public boolean validateObject(Object arg0)
Specified by:
validateObject in interface PoolableObjectFactory

doWait

protected void doWait(long latency)

reset

public void reset()

getMaxActive

public long getMaxActive()
Returns:
the maxActive

setMaxActive

public void setMaxActive(long maxActive)
Parameters:
maxActive - the maxActive to set

activateObject

public void activateObject(Object key,
                           Object obj)
                    throws Exception
Specified by:
activateObject in interface KeyedPoolableObjectFactory
Throws:
Exception

destroyObject

public void destroyObject(Object key,
                          Object obj)
                   throws Exception
Specified by:
destroyObject in interface KeyedPoolableObjectFactory
Throws:
Exception

makeObject

public Object makeObject(Object key)
                  throws Exception
Specified by:
makeObject in interface KeyedPoolableObjectFactory
Throws:
Exception

passivateObject

public void passivateObject(Object key,
                            Object obj)
                     throws Exception
Specified by:
passivateObject in interface KeyedPoolableObjectFactory
Throws:
Exception

validateObject

public boolean validateObject(Object key,
                              Object obj)
Specified by:
validateObject in interface KeyedPoolableObjectFactory


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.