org.jboss.ejb3.pool
Class ThreadlocalPool

java.lang.Object
  extended by org.jboss.ejb3.pool.ThreadlocalPool
All Implemented Interfaces:
Pool

public class ThreadlocalPool
extends Object
implements Pool

Pools EJBs within a ThreadLocal.

Version:
$Revision: 67042 $
Author:
Bill Burke

Field Summary
protected  WeakThreadLocal<BeanContext> currentBeanContext
           
protected  Pool pool
           
 
Constructor Summary
ThreadlocalPool()
           
 
Method Summary
protected  BeanContext create()
           
protected  BeanContext create(Class[] initTypes, Object[] initValues)
           
 void destroy()
          Destroy the pool.
 void discard(BeanContext obj)
          Discard the bean.
 BeanContext get()
          Creates if no object is available in pool.
 BeanContext get(Class[] initTypes, Object[] initValues)
           
 int getAvailableCount()
           
 int getCreateCount()
           
 int getCurrentSize()
           
 int getMaxSize()
           
 int getRemoveCount()
           
 void initialize(Container container, int maxSize, long timeout)
           
 void release(BeanContext ctx)
          Put bean back in pool
 void remove(BeanContext ctx)
          Destroy bean.
 void setInjectors(Injector[] injectors)
           
 void setMaxSize(int maxSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pool

protected Pool pool

currentBeanContext

protected WeakThreadLocal<BeanContext> currentBeanContext
Constructor Detail

ThreadlocalPool

public ThreadlocalPool()
Method Detail

create

protected BeanContext create()

create

protected BeanContext create(Class[] initTypes,
                             Object[] initValues)

discard

public void discard(BeanContext obj)
Description copied from interface: Pool
Discard the bean. Called in different context as remove. If there is a system exception this is called.

Specified by:
discard in interface Pool

destroy

public void destroy()
Description copied from interface: Pool
Destroy the pool.

Specified by:
destroy in interface Pool

get

public BeanContext get()
Description copied from interface: Pool
Creates if no object is available in pool. ejbCreate will be called if created

Specified by:
get in interface Pool

get

public BeanContext get(Class[] initTypes,
                       Object[] initValues)
Specified by:
get in interface Pool

initialize

public void initialize(Container container,
                       int maxSize,
                       long timeout)
Specified by:
initialize in interface Pool

release

public void release(BeanContext ctx)
Description copied from interface: Pool
Put bean back in pool

Specified by:
release in interface Pool

remove

public void remove(BeanContext ctx)
Description copied from interface: Pool
Destroy bean. ejbRemove callback is executed

Specified by:
remove in interface Pool

getCurrentSize

public int getCurrentSize()
Specified by:
getCurrentSize in interface Pool

getAvailableCount

public int getAvailableCount()
Specified by:
getAvailableCount in interface Pool

getCreateCount

public int getCreateCount()
Specified by:
getCreateCount in interface Pool

getMaxSize

public int getMaxSize()
Specified by:
getMaxSize in interface Pool

getRemoveCount

public int getRemoveCount()
Specified by:
getRemoveCount in interface Pool

setInjectors

public void setInjectors(Injector[] injectors)
Specified by:
setInjectors in interface Pool

setMaxSize

public void setMaxSize(int maxSize)
Specified by:
setMaxSize in interface Pool


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.