org.objectweb.dream.pool
Class ObjectPoolImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.pool.ObjectPoolImpl
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, ObjectPool, ObjectPoolAttributeController, AttributeController, BindingController, LifeCycleController

public class ObjectPoolImpl
extends AbstractComponent
implements ObjectPool, ObjectPoolAttributeController

This class provides a basic implementation of ObjectPool interface. Recycled instances are pooled in a fixed size array. Instances are created using a RecyclableFactory client interface.


Field Summary
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.pool.ObjectPool
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
ObjectPoolImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 int getCapacity()
          Returns the object pool capacity.
 String[] listFc()
           
 Recyclable newInstance()
          Returns a new instance of object.
 void recycleInstance(Recyclable recyclable)
          Recycles the object so that it can be reused.
 void setCapacity(int capacity)
          Sets the object pool capacity.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectPoolImpl

public ObjectPoolImpl()
Method Detail

newInstance

public Recyclable newInstance()
Description copied from interface: ObjectPool
Returns a new instance of object.

Specified by:
newInstance in interface ObjectPool
Returns:
a new instance of object.
See Also:
ObjectPool.newInstance()

recycleInstance

public void recycleInstance(Recyclable recyclable)
Description copied from interface: ObjectPool
Recycles the object so that it can be reused.

Specified by:
recycleInstance in interface ObjectPool
Parameters:
recyclable - the object to be recycled.
See Also:
ObjectPool.recycleInstance(Recyclable)

getCapacity

public int getCapacity()
Description copied from interface: ObjectPoolAttributeController
Returns the object pool capacity.

Specified by:
getCapacity in interface ObjectPoolAttributeController
Returns:
the object pool capacity.
See Also:
ObjectPoolAttributeController.getCapacity()

setCapacity

public void setCapacity(int capacity)
Description copied from interface: ObjectPoolAttributeController
Sets the object pool capacity.

Specified by:
setCapacity in interface ObjectPoolAttributeController
Parameters:
capacity - the object pool capacity.
See Also:
ObjectPoolAttributeController.setCapacity(int)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class AbstractComponent
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)


Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.