FileDocCategorySizeDatePackage
Pool.javaAPI DocApache Lucene 2.1.02492Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.utils

Pool

public interface Pool
Basic interface to be implemented by ObjectPool implementations. Pools should provide a constructor with a {@link org.apache.lucene.gdata.utils.PoolObjectFactory} as a mandatory parameter to create and destory the pooled objects.
see
org.apache.lucene.gdata.utils.PoolObjectFactory
author
Simon Willnauer
param
- the type of the pooled objects

Fields Summary
Constructors Summary
Methods Summary
public abstract Typeaquire()
Return an object from the pool or create one if the pool is empty.

return
- a pooled object

public abstract voiddestroy()
releases all pooled objects using {@link PoolObjectFactory#destroyInstance(Object)} method. The pool can not be reused after this method has been called

public abstract booleanexpires()

return
true if and only if the pool uses an expire mechanismn, otherwith false

public abstract longgetExpireTime()

return
- the expire time of the objects in the pool if defined

public abstract intgetSize()

return
- the defined size of the pool

public abstract voidrelease(Type type)
Adds a previously aquired object to the pool. If the pool has already been closed or if the pool has already reached his size the released object will be destroyed using {@link PoolObjectFactory#destroyInstance(Object)} method.

param
type - the previously aquired object