deegree 2.2 (2008/12/22 11:33 build-3038-official)

org.deegree.framework.util
Class ObjectPool

java.lang.Object
  extended by java.util.TimerTask
      extended by org.deegree.framework.util.ObjectPool
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
DBPool, SDEPool

public abstract class ObjectPool
extends TimerTask

class to manage the object pool. this is part of the combination of the object pool pattern an the singelton pattern.

Since:
2.0
Version:
$Revision: 9339 $, 1.0. $Revision: 9339 $, $Date: 2007-12-27 13:31:52 +0100 (Do, 27 Dez 2007) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Field Summary
protected  List<Object> available
           
protected  int existingInstances
           
protected  List<Object> in_use
           
protected  Map<Object,Long> startLifeTime
           
protected  Map<Object,Long> startUsageTime
           
 
Constructor Summary
protected ObjectPool()
          Creates a new ObjectPool object.
 
Method Summary
 void clear()
          clears the complete pool. objects in used while the clear() method has been called won't be put back to the pool if released back through the releaseObject method.
static ObjectPool getInstance()
          dummy
 int getMaxInstances()
           
 int getMaxLifeTime()
           
 int getMaxUsageTime()
           
 int getUpdateInterval()
           
abstract  void onObjectKill(Object o)
          this method will be called when the submitted object will be removed from the pool
 void releaseObject(Object object)
          release an object back to the pool so it is available for other requests.
 void run()
           
 void setMaxInstances(int maxInstances)
           
 void setMaxLifeTime(int maxLifeTime)
           
 void setMaxUsageTime(int maxUsageTime)
           
 void setUpdateInterval(int updateInterval)
           
 String toString()
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

available

protected List<Object> available

in_use

protected List<Object> in_use

startLifeTime

protected Map<Object,Long> startLifeTime

startUsageTime

protected Map<Object,Long> startUsageTime

existingInstances

protected int existingInstances
Constructor Detail

ObjectPool

protected ObjectPool()
Creates a new ObjectPool object.

Method Detail

getInstance

public static ObjectPool getInstance()
dummy

Returns:
null

clear

public void clear()
clears the complete pool. objects in used while the clear() method has been called won't be put back to the pool if released back through the releaseObject method.


releaseObject

public void releaseObject(Object object)
                   throws Exception
release an object back to the pool so it is available for other requests.

Throws:
Exception

onObjectKill

public abstract void onObjectKill(Object o)
this method will be called when the submitted object will be removed from the pool


getMaxLifeTime

public int getMaxLifeTime()
Returns:

setMaxLifeTime

public void setMaxLifeTime(int maxLifeTime)
Parameters:
maxLifeTime -

getMaxUsageTime

public int getMaxUsageTime()
Returns:

setMaxUsageTime

public void setMaxUsageTime(int maxUsageTime)
Parameters:
maxUsageTime -

getUpdateInterval

public int getUpdateInterval()
Returns:

setUpdateInterval

public void setUpdateInterval(int updateInterval)
Parameters:
updateInterval -

getMaxInstances

public int getMaxInstances()
Returns:

setMaxInstances

public void setMaxInstances(int maxInstances)
Parameters:
maxInstances -

toString

public String toString()
Overrides:
toString in class Object
Returns:

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

deegree 2.2 (2008/12/22 11:33 build-3038-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net