org.jboss.ejb.plugins
Class SingletonStatelessSessionInstancePool

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.ejb.plugins.AbstractInstancePool
              extended by org.jboss.ejb.plugins.SingletonStatelessSessionInstancePool
All Implemented Interfaces:
MBeanRegistration, NotificationBroadcaster, NotificationEmitter, AllowedOperationsFlags, ContainerPlugin, InstancePool, AbstractInstancePoolMBean, org.jboss.kernel.spi.dependency.KernelControllerContextAware, XmlLoadable, Service, ServiceMBean

public class SingletonStatelessSessionInstancePool
extends AbstractInstancePool

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

Version:
$Revision: 81030 $
Author:
Rickard Oberg

Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.AbstractInstancePool
container, isStrict, maxSize, pool, reclaim
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
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
 
Constructor Summary
SingletonStatelessSessionInstancePool()
           
 
Method Summary
 void add()
          Add a instance in the pool
protected  EnterpriseContext create(Object instance)
           
 void discard(EnterpriseContext ctx)
          Discard an anonymous instance after invocation.
 void free(EnterpriseContext ctx)
          Return an instance after invocation.
 EnterpriseContext get()
          Get the singleton instance
 long getAvailableCount()
          Get the current avaiable count from the strict max view.
 int getCurrentSize()
          Return the size of the pool.
 int getMaxSize()
          Get the maximum size of the pool.
 void importXml(Element element)
          XmlLoadable implementation
 
Methods inherited from class org.jboss.ejb.plugins.AbstractInstancePool
clear, createService, destroyService, getContainer, setContainer
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, pojoChange, pojoCreate, pojoDestroy, pojoStart, pojoStop, postDeregister, postRegister, preDeregister, preRegister, setKernelControllerContext, start, startService, stop, stopService, unsetKernelControllerContext
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

SingletonStatelessSessionInstancePool

public SingletonStatelessSessionInstancePool()
Method Detail

get

public EnterpriseContext get()
                      throws Exception
Get the singleton instance

Specified by:
get in interface InstancePool
Overrides:
get in class AbstractInstancePool
Returns:
Context /w instance
Throws:
Exception

free

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

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

discard

public void discard(EnterpriseContext ctx)
Description copied from interface: InstancePool
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
Overrides:
discard in class AbstractInstancePool
Parameters:
ctx - The context to discard.

add

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

Throws:
Exception

getCurrentSize

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

Specified by:
getCurrentSize in interface InstancePool
Specified by:
getCurrentSize in interface AbstractInstancePoolMBean
Overrides:
getCurrentSize in class AbstractInstancePool
Returns:
the current pool size

getMaxSize

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

Specified by:
getMaxSize in interface InstancePool
Specified by:
getMaxSize in interface AbstractInstancePoolMBean
Overrides:
getMaxSize in class AbstractInstancePool
Returns:
the current pool size

getAvailableCount

public long getAvailableCount()
Description copied from class: AbstractInstancePool
Get the current avaiable count from the strict max view. If there is no strict max then this will be Long.MAX_VALUE to indicate there is no restriction.

Overrides:
getAvailableCount in class AbstractInstancePool
Returns:
the current avaiable count from the strict max view

importXml

public void importXml(Element element)
               throws DeploymentException
Description copied from class: AbstractInstancePool
XmlLoadable implementation

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

create

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


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