org.jfox.ejb
Class StatelessSessionBeanObjectPool

java.lang.Object
  extended byorg.huihoo.jfox.system.ComponentSupport
      extended byorg.jfox.ejb.StatelessSessionBeanObjectPool
All Implemented Interfaces:
Component, Loggable, ObjectPool, Persistentable, java.io.Serializable

public class StatelessSessionBeanObjectPool
extends ComponentSupport
implements ObjectPool

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.huihoo.jfox.system.ComponentSupport
logger, name, proxyInstance, sequence, state
 
Constructor Summary
StatelessSessionBeanObjectPool(StatelessSessionBucket bucket, ObjectFactory factory)
           
 
Method Summary
 void clear()
          Clears any objects sitting idle in the pool, releasing any associated resources
 PoolableObject createObject(org.jfox.ejb.StatelessSessionBeanFreshFlag fresh)
           
protected  void doDestroy()
          do actually destory action
protected  void doInit()
          do actually create action
 java.lang.String getObjectClass()
          get the pooled object's class type, it return by object pool's factory
 ObjectFactory getObjectFactory()
          get the factory use to create new instances
 int getRest()
          get the count of rest object
 int getWorking()
          get the count of working object
static void main(java.lang.String[] args)
           
 boolean removeObject(PoolableObject obj)
          如果池中对象小于 max, 存到池中,池满,则调用 ejbRemove,并返回上级池
 boolean restoreObject(PoolableObject obj)
          如果数目过多,则返回给 pool,但是先得调用 ejbRemove,释放资源
 PoolableObject retrieveObject()
          retrieve Object from object pool
 
Methods inherited from class org.huihoo.jfox.system.ComponentSupport
destroy, getLogger, getName, getState, init, parseName, setLogger, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatelessSessionBeanObjectPool

public StatelessSessionBeanObjectPool(StatelessSessionBucket bucket,
                                      ObjectFactory factory)
Method Detail

createObject

public PoolableObject createObject(org.jfox.ejb.StatelessSessionBeanFreshFlag fresh)
                            throws java.lang.Exception
Parameters:
fresh - out 参数,false 为从池中直接返回的对象,true 为新生的对象,新生的对象需要调用 setContext,ejbCreate
Returns:
Throws:
java.lang.Exception

retrieveObject

public PoolableObject retrieveObject()
                              throws java.lang.Exception
Description copied from interface: ObjectPool
retrieve Object from object pool

Specified by:
retrieveObject in interface ObjectPool
Returns:
Throws:
java.lang.Exception

restoreObject

public boolean restoreObject(PoolableObject obj)
如果数目过多,则返回给 pool,但是先得调用 ejbRemove,释放资源

Specified by:
restoreObject in interface ObjectPool
Parameters:
obj -
Returns:

removeObject

public boolean removeObject(PoolableObject obj)
如果池中对象小于 max, 存到池中,池满,则调用 ejbRemove,并返回上级池

Specified by:
removeObject in interface ObjectPool
Parameters:
obj -
Returns:

clear

public void clear()
Description copied from interface: ObjectPool
Clears any objects sitting idle in the pool, releasing any associated resources

Specified by:
clear in interface ObjectPool

getObjectFactory

public ObjectFactory getObjectFactory()
Description copied from interface: ObjectPool
get the factory use to create new instances

Specified by:
getObjectFactory in interface ObjectPool

getObjectClass

public java.lang.String getObjectClass()
Description copied from interface: ObjectPool
get the pooled object's class type, it return by object pool's factory

Specified by:
getObjectClass in interface ObjectPool
Returns:

getWorking

public int getWorking()
Description copied from interface: ObjectPool
get the count of working object

Specified by:
getWorking in interface ObjectPool
Returns:

getRest

public int getRest()
Description copied from interface: ObjectPool
get the count of rest object

Specified by:
getRest in interface ObjectPool
Returns:

doInit

protected void doInit()
               throws java.lang.Exception
Description copied from class: ComponentSupport
do actually create action

Specified by:
doInit in class ComponentSupport
Throws:
java.lang.Exception

doDestroy

protected void doDestroy()
                  throws java.lang.Exception
Description copied from class: ComponentSupport
do actually destory action

Specified by:
doDestroy in class ComponentSupport
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)