Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

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)

Protected Member Functions

 ObjectPool (String objectClass, int minSize, int incSize) throws ClassNotFoundException, IllegalAccessException, InstantiationException
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 ()

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 
minSize 
incSize 
Returns:
Exceptions:
@author 
See also:
Since:
Version:
38C5242C0241

Definition at line 72 of file ObjectPool.java.

References org.openmobileis.common.util.ObjectPool.arrayPool, org.openmobileis.common.util.ObjectPool.incSize_, org.openmobileis.common.util.ObjectPool.minSize_, org.openmobileis.common.util.ObjectPool.objectClass_, and org.openmobileis.common.util.ObjectPool.pool_.


Member Function Documentation

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.

References org.openmobileis.common.util.ObjectPool.pool_.

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

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.minSize_, and org.openmobileis.common.util.ObjectPool.pool_.


The documentation for this class was generated from the following file:
Generated on Wed Dec 14 21:05:37 2005 for OpenMobileIS by  doxygen 1.4.4