org.jboss.ejb.plugins
Class SingletonStatelessSessionInstancePool

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ejb.plugins.AbstractInstancePool (src) 
              extended byorg.jboss.ejb.plugins.SingletonStatelessSessionInstancePool
All Implemented Interfaces:
AllowedOperationsFlags (src) , ContainerPlugin (src) , InstancePool (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , XmlLoadable (src)

public class SingletonStatelessSessionInstancePool
extends AbstractInstancePool (src)

Singleton pool for session beans. This lets you have singletons in EJB!


Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.AbstractInstancePool (src)
container, maxSize, pool, reclaim
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
SingletonStatelessSessionInstancePool()
           
 
Method Summary
 void add()
          Add a instance in the pool
 void create()
          create the service, do expensive operations etc
protected  EnterpriseContext (src) create(java.lang.Object instance)
           
 void destroy()
          destroy the service, tear down
 void discard(EnterpriseContext (src)  ctx)
          Discard an anonymous instance after invocation.
 void free(EnterpriseContext (src)  ctx)
          Return an instance after invocation.
 EnterpriseContext (src) get()
          Get the singleton instance
 int getCurrentSize()
          Return the size of the pool.
 int getMaxSize()
          Get the maximum size of the pool.
 void importXml(org.w3c.dom.Element element)
          XmlLoadable implementation
 void start()
          start the service, create is already called
 void stop()
          stop the service
 
Methods inherited from class org.jboss.ejb.plugins.AbstractInstancePool (src)
destroyService, getAvailableCount, getContainer, setContainer
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
createService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, startService, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonStatelessSessionInstancePool

public SingletonStatelessSessionInstancePool()
Method Detail

create

public void create()
            throws java.lang.Exception
Description copied from interface: Service (src)
create the service, do expensive operations etc

Specified by:
create in interface Service (src)
Overrides:
create in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Description copied from interface: Service (src)
start the service, create is already called

Specified by:
start in interface Service (src)
Overrides:
start in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stop

public void stop()
Description copied from interface: Service (src)
stop the service

Specified by:
stop in interface Service (src)
Overrides:
stop in class ServiceMBeanSupport (src)

destroy

public void destroy()
Description copied from interface: Service (src)
destroy the service, tear down

Specified by:
destroy in interface Service (src)
Overrides:
destroy in class ServiceMBeanSupport (src)

get

public EnterpriseContext (src)  get()
                      throws java.lang.Exception
Get the singleton instance

Specified by:
get in interface InstancePool (src)
Overrides:
get in class AbstractInstancePool (src)
Returns:
Context /w instance
Throws:
java.lang.Exception

free

public void free(EnterpriseContext (src)  ctx)
Return an instance after invocation. Called in 2 cases: a) Done with finder method b) Just removed

Specified by:
free in interface InstancePool (src)
Overrides:
free in class AbstractInstancePool (src)
Parameters:
ctx -

discard

public void discard(EnterpriseContext (src)  ctx)
Description copied from interface: InstancePool (src)
Discard an anonymous instance after invocation. This is called if the instance should not be reused, perhaps due to some exception being thrown from it.

Specified by:
discard in interface InstancePool (src)
Overrides:
discard in class AbstractInstancePool (src)

add

public void add()
         throws java.lang.Exception
Add a instance in the pool

Throws:
java.lang.Exception

getCurrentSize

public int getCurrentSize()
Description copied from interface: InstancePool (src)
Return the size of the pool.

Specified by:
getCurrentSize in interface InstancePool (src)
Overrides:
getCurrentSize in class AbstractInstancePool (src)
Returns:
the current pool size

getMaxSize

public int getMaxSize()
Description copied from interface: InstancePool (src)
Get the maximum size of the pool.

Specified by:
getMaxSize in interface InstancePool (src)
Overrides:
getMaxSize in class AbstractInstancePool (src)
Returns:
the current pool size

importXml

public void importXml(org.w3c.dom.Element element)
               throws DeploymentException (src) 
Description copied from class: AbstractInstancePool (src)
XmlLoadable implementation

Specified by:
importXml in interface XmlLoadable (src)
Overrides:
importXml in class AbstractInstancePool (src)
Throws:
DeploymentException (src)

create

protected EnterpriseContext (src)  create(java.lang.Object instance)
                            throws java.lang.Exception
Specified by:
create in class AbstractInstancePool (src)
Throws:
java.lang.Exception