org.openejb.util
Class SoftLimitedInstancePool

java.lang.Object
  extended byorg.openejb.util.SoftLimitedInstancePool
All Implemented Interfaces:
InstancePool, Serializable

public final class SoftLimitedInstancePool
extends Object
implements InstancePool, Serializable

Version:
$Revision: 1.2 $ $Date: 2004/04/03 22:20:11 $
See Also:
Serialized Form

Constructor Summary
SoftLimitedInstancePool(InstanceFactory factory, int maxSize)
           
 
Method Summary
 Object acquire()
          Get an instance from the pool.
 boolean release(Object instance)
          Releases the hold on the instance.
 void remove(Object instance)
          Drop an instance permanently from the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftLimitedInstancePool

public SoftLimitedInstancePool(InstanceFactory factory,
                               int maxSize)
Method Detail

acquire

public Object acquire()
               throws Exception
Description copied from interface: InstancePool
Get an instance from the pool. This method may block indefinately if the pool has a strict limit.

Specified by:
acquire in interface InstancePool
Returns:
an instance
Throws:
Exception - if object demand object construction was required and an error occured during construction

release

public boolean release(Object instance)
Description copied from interface: InstancePool
Releases the hold on the instance. This method may or may not reinsert the instance into the pool. This method can not block.

Specified by:
release in interface InstancePool
Parameters:
instance - the instance to return to the pool
Returns:
true is the instance was reinserted into the pool.

remove

public void remove(Object instance)
Description copied from interface: InstancePool
Drop an instance permanently from the pool. The instance will never be used again. This method can not block.

Specified by:
remove in interface InstancePool
Parameters:
instance - the instance to discard


Copyright © 1999-2005 OpenEJB. All Rights Reserved.