TorqueBox 3.1.2

org.torquebox.core.pool
Class SimplePool<T>

java.lang.Object
  extended by org.torquebox.core.pool.SimplePool<T>
All Implemented Interfaces:
ManageablePool<T>, Pool<T>

public class SimplePool<T>
extends Object
implements ManageablePool<T>


Constructor Summary
SimplePool()
           
 
Method Summary
 void addListener(PoolListener<T> listener)
           
protected  T borrowedInstance()
           
 T borrowInstance(String requester)
          Borrow an instance from the pool.
 T borrowInstance(String requester, long timeout)
          Borrow an instance from the pool.
 T drainInstance()
           
 T drainInstance(long timeout)
           
 void fillInstance(T instance)
           
 String getName()
           
 void releaseInstance(T instance)
          Release an instance back into the pool.
 boolean removeListener(PoolListener<T> listener)
           
protected  void requestInstance()
           
 void setName(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePool

public SimplePool()
Method Detail

setName

public void setName(String name)

getName

public String getName()
Specified by:
getName in interface Pool<T>

addListener

public void addListener(PoolListener<T> listener)

removeListener

public boolean removeListener(PoolListener<T> listener)

borrowInstance

public T borrowInstance(String requester)
                 throws Exception
Description copied from interface: Pool
Borrow an instance from the pool.

Specified by:
borrowInstance in interface Pool<T>
Returns:
The borrowed instance.
Throws:
Exception - if an error occurs.

borrowInstance

public T borrowInstance(String requester,
                        long timeout)
                 throws InterruptedException
Description copied from interface: Pool
Borrow an instance from the pool.

Specified by:
borrowInstance in interface Pool<T>
timeout - Wait time to acquire instance.
Returns:
The borrowed instance.
Throws:
InterruptedException

requestInstance

protected void requestInstance()

borrowedInstance

protected T borrowedInstance()

releaseInstance

public void releaseInstance(T instance)
Description copied from interface: Pool
Release an instance back into the pool.

Specified by:
releaseInstance in interface Pool<T>
Parameters:
instance - The instance to release.

fillInstance

public void fillInstance(T instance)
Specified by:
fillInstance in interface ManageablePool<T>

drainInstance

public T drainInstance()
                throws Exception
Specified by:
drainInstance in interface ManageablePool<T>
Throws:
Exception

drainInstance

public T drainInstance(long timeout)
                throws Exception
Specified by:
drainInstance in interface ManageablePool<T>
Throws:
Exception

TorqueBox 3.1.2

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.