org.openmobileis.common.util.ObjectPool Class Reference

Inheritance diagram for org.openmobileis.common.util.ObjectPool:

org.openmobileis.embedded.webserver.ServerThreadPool org.openmobileis.synchro.openmsp.server.util.FileSystemObjectPool List of all members.

Detailed Description

Title: OpenMobileIS project source
Description: Implement a generic object pool.

The pool contain a set of object and client get and dispose object depending on there need. When an object is retreive fro; the pool (getObject ()), it must be disposed. If not it can leads to memory link ( object not garbage collected). So to insure this behaviour put object use in a try / finally clause. example :

Object obj = ObjectPool.getObject(); try { use the object } finally [ ObjectPool.disposeObject(obj); }

A pool can only create a single type of object. The size of the pool is initialized with the minimum size at the begining and grow by the specified increment size.

Author:
Philippe Delrieu
Since:
JDK 1.1
Version:
1.0.

Definition at line 54 of file ObjectPool.java.

Public Member Functions

synchronized void disposeObject (Object object)
 
Parameters:
object 


Protected Member Functions

 ObjectPool (String objectClass, int minSize, int incSize) throws ClassNotFoundException, IllegalAccessException, InstantiationException
 
Parameters:
objectClass 

Object createNewInstance (Class objectClass) throws IllegalAccessException, InstantiationException
 A factory method that you may override to instantiate the proper object Default implementation does a newInstance().
final synchronized Object getObject ()
 
Returns:
Object
Exceptions:
 


Protected Attributes

java.util.Stack pool
Array arrayPool
Class objectClass
int minSize
int incSize


Constructor & Destructor Documentation

org.openmobileis.common.util.ObjectPool.ObjectPool ( String  objectClass,
int  minSize,
int  incSize 
) throws ClassNotFoundException, IllegalAccessException, InstantiationException [protected]

Parameters:
objectClass 

Parameters:
minSize 
incSize 
Returns:
Exceptions:
@author 
See also:
Since:
Version:
38C5242C0241

Definition at line 72 of file ObjectPool.java.

References org.openmobileis.common.util.ObjectPool.incSize, org.openmobileis.common.util.ObjectPool.minSize, and org.openmobileis.common.util.ObjectPool.objectClass.


Member Function Documentation

final synchronized Object org.openmobileis.common.util.ObjectPool.getObject (  )  [protected]

Returns:
Object
Exceptions:
 

Author:
See also:
Since:
Version:
Return an available object from the pool. If no object is available create a new one depending on the increment argument. If the pool can not grow (increment = 0) return null. 38C5224B0147

Definition at line 111 of file ObjectPool.java.

References org.openmobileis.common.util.ObjectPool.incSize, and org.openmobileis.common.util.ObjectPool.pool.

synchronized void org.openmobileis.common.util.ObjectPool.disposeObject ( Object  object  ) 

Parameters:
object 

Returns:
void
Exceptions:
@author 
See also:
Since:
Version:
dispose the object. The object return to the pool and become available. 38C5229D001E

Reimplemented in org.openmobileis.embedded.webserver.ServerThreadPool.

Definition at line 136 of file ObjectPool.java.

Referenced by org.openmobileis.synchro.openmsp.server.OpenMSPService.run().


The documentation for this class was generated from the following file:
Generated on Mon Dec 4 11:03:33 2006 for OpenMobileIS by  doxygen 1.5.1-p1