ObjectPool for Ruby

objectpool

ObjectPool provides a mechanism for pooling objects and resources.

API

Class Method

ObjectPool.instance
Return instance of ObjectPool(Singleton)

Instance Method

ObjectPool#create
Create an object. This method is used for itself. YOU HAVE TO OVERRIDE THIS METHOD.
ObjectPool#get
Get an object. If All objects in ObjectPool is used, it waits until timeout. If it occurs over timeout time, it raise TimeoutError.
ObjectPool#release(object)
Release an object.
ObjectPool#max=(size)
ObjectPool#max
Set/Get max size of the objectpool. Default value is 10.
ObjectPool#timeout=(sec)
ObjectPool#timeout
Set/Get timeout time if the objectpool can't return an instance. Default value is nil(Infinite).
ObjectPool#wait=(sec)
ObjectPool#wait
Set/Get interval of waiting time in the loop.Default value is 1 second.
ObjectPool#out=(out)
ObjectPool#out
Set/Get print stream($stdout, $stderr ...).
Last modified:2004/04/28 01:40:31
Keyword(s):
References:[YotaLab Storage]