org.apache.lucene.gdata.utils
Interface Pool<Type>

Type Parameters:
Type - - the type of the pooled objects
All Known Implementing Classes:
SimpleObjectPool

public interface Pool<Type>

Basic interface to be implemented by ObjectPool implementations. Pools should provide a constructor with a PoolObjectFactory as a mandatory parameter to create and destory the pooled objects.

Author:
Simon Willnauer
See Also:
PoolObjectFactory

Method Summary
 Type aquire()
          Return an object from the pool or create one if the pool is empty.
 void destroy()
          releases all pooled objects using PoolObjectFactory.destroyInstance(Object) method.
 boolean expires()
           
 long getExpireTime()
           
 int getSize()
           
 void release(Type type)
          Adds a previously aquired object to the pool.
 

Method Detail

aquire

Type aquire()
Return an object from the pool or create one if the pool is empty.

Returns:
- a pooled object

release

void release(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 PoolObjectFactory.destroyInstance(Object) method.

Parameters:
type - - the previously aquired object

getSize

int getSize()
Returns:
- the defined size of the pool

getExpireTime

long getExpireTime()
Returns:
- the expire time of the objects in the pool if defined

expires

boolean expires()
Returns:
true if and only if the pool uses an expire mechanismn, otherwith false

destroy

void destroy()
releases all pooled objects using PoolObjectFactory.destroyInstance(Object) method. The pool can not be reused after this method has been called



Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.