deegree 2.5 (2011/06/29 09:44 build-8-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:
java.lang.Runnable
Direct Known Subclasses:
DBPool, SDEPool

public abstract class ObjectPool
extends java.util.TimerTask

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

Version:
$Revision: 20107 $, $Revision: 20107 $, $Date: 2009-10-13 13:15:16 +0200 (Di, 13 Okt 2009) $
Author:
Andreas Poth, last edited by: $Author: aschmitz $

Field Summary
protected  java.util.List<java.lang.Object> available
          all available objects
protected  int existingInstances
          number of existing instances
protected  java.util.List<java.lang.Object> in_use
          all objects in use
protected  java.util.Map<java.lang.Object,java.lang.Long> startLifeTime
          the start life time for each object
protected  java.util.Map<java.lang.Object,java.lang.Long> startUsageTime
          the start usage time for each object
 
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(java.lang.Object o)
          this method will be called when the submitted object will be removed from the pool
 void releaseObject(java.lang.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)
           
 java.lang.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 java.util.List<java.lang.Object> available
all available objects


in_use

protected java.util.List<java.lang.Object> in_use
all objects in use


startLifeTime

protected java.util.Map<java.lang.Object,java.lang.Long> startLifeTime
the start life time for each object


startUsageTime

protected java.util.Map<java.lang.Object,java.lang.Long> startUsageTime
the start usage time for each object


existingInstances

protected int existingInstances
number of existing instances

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(java.lang.Object object)
                   throws java.lang.Exception
release an object back to the pool so it is available for other requests.

Parameters:
object -
Throws:
java.lang.Exception

onObjectKill

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

Parameters:
o -

getMaxLifeTime

public int getMaxLifeTime()
Returns:
the max life time

setMaxLifeTime

public void setMaxLifeTime(int maxLifeTime)
Parameters:
maxLifeTime -

getMaxUsageTime

public int getMaxUsageTime()
Returns:
the max usage time

setMaxUsageTime

public void setMaxUsageTime(int maxUsageTime)
Parameters:
maxUsageTime -

getUpdateInterval

public int getUpdateInterval()
Returns:
the update interval

setUpdateInterval

public void setUpdateInterval(int updateInterval)
Parameters:
updateInterval -

getMaxInstances

public int getMaxInstances()
Returns:
max instances

setMaxInstances

public void setMaxInstances(int maxInstances)
Parameters:
maxInstances -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

deegree 2.5 (2011/06/29 09:44 build-8-official)

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