org.apache.excalibur.mpool
Class BlockingFixedSizePool

java.lang.Object
  extended byorg.apache.excalibur.mpool.BlockingFixedSizePool
All Implemented Interfaces:
Disposable, Initializable, Pool

public final class BlockingFixedSizePool
extends java.lang.Object
implements Pool, Disposable, Initializable

This is an Pool that caches Poolable objects for reuse. Please note that this pool offers no resource limiting whatsoever.

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:34 $
Author:
Avalon Development Team

Field Summary
protected  java.lang.Object m_semaphore
          The semaphor we synchronize on
 
Constructor Summary
BlockingFixedSizePool(ObjectFactory factory, int size)
           
BlockingFixedSizePool(ObjectFactory factory, int size, long timeout)
           
 
Method Summary
 java.lang.Object acquire()
          Acquire an instance of the pooled object.
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 void initialize()
          Initialize the component.
 java.lang.Object newInstance()
          Create a new instance of the object being pooled.
 void release(java.lang.Object object)
          Release the instance of the pooled object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_semaphore

protected final java.lang.Object m_semaphore
The semaphor we synchronize on

Constructor Detail

BlockingFixedSizePool

public BlockingFixedSizePool(ObjectFactory factory,
                             int size)
                      throws java.lang.Exception

BlockingFixedSizePool

public BlockingFixedSizePool(ObjectFactory factory,
                             int size,
                             long timeout)
                      throws java.lang.Exception
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if an error occurs

acquire

public java.lang.Object acquire()
Description copied from interface: Pool
Acquire an instance of the pooled object.

Specified by:
acquire in interface Pool
Returns:
the pooled Object instance

release

public void release(java.lang.Object object)
Description copied from interface: Pool
Release the instance of the pooled object.

Specified by:
release in interface Pool
Parameters:
object - The pooled object to release to the pool.

newInstance

public java.lang.Object newInstance()
                             throws java.lang.Exception
Description copied from interface: Pool
Create a new instance of the object being pooled.

Specified by:
newInstance in interface Pool
Returns:
the pooled Object instance
Throws:
java.lang.Exception - if the instance cannot be created

dispose

public void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.

Specified by:
dispose in interface Disposable


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.