Inheritance diagram for org.openmobileis.common.util.ObjectPool:
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.
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 |
org.openmobileis.common.util.ObjectPool.ObjectPool | ( | String | objectClass, | |
int | minSize, | |||
int | incSize | |||
) | throws ClassNotFoundException, IllegalAccessException, InstantiationException [protected] |
objectClass |
minSize | ||
incSize |
@author |
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.
final synchronized Object org.openmobileis.common.util.ObjectPool.getObject | ( | ) | [protected] |
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 | ) |
object |
@author |
Reimplemented in org.openmobileis.embedded.webserver.ServerThreadPool.
Definition at line 136 of file ObjectPool.java.
Referenced by org.openmobileis.synchro.openmsp.server.OpenMSPService.run().