TorqueBox 3.1.2

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

java.lang.Object
  extended by org.torquebox.core.pool.ManagedPool<T>
All Implemented Interfaces:
Pool<T>
Direct Known Subclasses:
DefaultRubyRuntimePool

public class ManagedPool<T>
extends Object
implements Pool<T>


Constructor Summary
ManagedPool()
           
ManagedPool(InstanceFactory<T> factory)
           
ManagedPool(InstanceFactory<T> factory, int minInstances, int maxInstances)
           
 
Method Summary
 T borrowInstance(String requester)
          Borrow an instance from the pool.
 T borrowInstance(String requester, long timeout)
          Borrow an instance from the pool.
protected  Set<T> getAllInstances()
           
 int getAvailable()
           
protected  Set<T> getAvailableInstances()
           
 int getBorrowed()
           
protected  Set<T> getBorrowedInstances()
           
 InstanceFactory<T> getInstanceFactory()
           
 int getMaximumInstances()
           
 int getMinimumInstances()
           
 String getName()
           
 org.jboss.as.naming.context.NamespaceContextSelector getNamespaceContextSelector()
           
 int getSize()
           
 boolean isDeferredUntilRequested()
           
 boolean isDrained()
           
 boolean isLazy()
           
 boolean isStarted()
           
 void releaseInstance(T instance)
          Release an instance back into the pool.
 void setDeferUntilRequested(boolean deferUntilRequested)
           
 void setInstanceFactory(InstanceFactory<T> instanceFactory)
           
 void setMaximumInstances(int maxInstances)
           
 void setMinimumInstances(int minInstances)
           
 void setName(String name)
           
 void setNamespaceContextSelector(org.jboss.as.naming.context.NamespaceContextSelector nsContextSelector)
           
 void start()
           
 void startPool()
           
 void startPool(boolean waitForFill)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedPool

public ManagedPool()

ManagedPool

public ManagedPool(InstanceFactory<T> factory)

ManagedPool

public ManagedPool(InstanceFactory<T> factory,
                   int minInstances,
                   int maxInstances)
Method Detail

setName

public void setName(String name)

getName

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

setMinimumInstances

public void setMinimumInstances(int minInstances)

getMinimumInstances

public int getMinimumInstances()

setMaximumInstances

public void setMaximumInstances(int maxInstances)

getMaximumInstances

public int getMaximumInstances()

setInstanceFactory

public void setInstanceFactory(InstanceFactory<T> instanceFactory)

getInstanceFactory

public InstanceFactory<T> getInstanceFactory()

startPool

public void startPool()
               throws InterruptedException
Throws:
InterruptedException

startPool

public void startPool(boolean waitForFill)
               throws InterruptedException
Throws:
InterruptedException

start

public void start()
           throws InterruptedException
Throws:
InterruptedException

stop

public void stop()
          throws Exception
Throws:
Exception

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 Exception
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:
Exception - if an error occurs.

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.

isStarted

public boolean isStarted()

isLazy

public boolean isLazy()

isDeferredUntilRequested

public boolean isDeferredUntilRequested()

setDeferUntilRequested

public void setDeferUntilRequested(boolean deferUntilRequested)

getSize

public int getSize()

getBorrowed

public int getBorrowed()

getAvailable

public int getAvailable()

isDrained

public boolean isDrained()

getAllInstances

protected Set<T> getAllInstances()

getBorrowedInstances

protected Set<T> getBorrowedInstances()

getAvailableInstances

protected Set<T> getAvailableInstances()

setNamespaceContextSelector

public void setNamespaceContextSelector(org.jboss.as.naming.context.NamespaceContextSelector nsContextSelector)

getNamespaceContextSelector

public org.jboss.as.naming.context.NamespaceContextSelector getNamespaceContextSelector()

TorqueBox 3.1.2

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