org.jboss.ejb.plugins
Class SingletonStatelessSessionInstancePool

java.lang.Object
  extended byorg.jboss.ejb.plugins.SingletonStatelessSessionInstancePool
All Implemented Interfaces:
ContainerPlugin, InstancePool, org.jboss.system.Service, XmlLoadable

public class SingletonStatelessSessionInstancePool
extends Object
implements InstancePool, XmlLoadable

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

Version:
$Revision: 1.20.2.3 $
Author:
Rickard Öberg
See Also:

Constructor Summary
SingletonStatelessSessionInstancePool()
           
 
Method Summary
 void add()
          Add a instance in the pool
 void create()
           
protected  EnterpriseContext create(Object instance, Container con)
           
 void destroy()
           
 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
 int getCurrentSize()
          Return the size of the pool.
 int getMaxSize()
          Get the maximum size of the pool.
 void importXml(Element element)
           
 void setContainer(Container c)
          Set the callback to the container.
 void start()
           
 void stop()
           
 
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

setContainer

public void setContainer(Container c)
Set the callback to the container. This is for initialization. The pool may extract the configuration from the container.

Specified by:
setContainer in interface ContainerPlugin
Parameters:
c -

create

public void create()
            throws Exception
Specified by:
create in interface org.jboss.system.Service
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface org.jboss.system.Service
Throws:
Exception

stop

public void stop()
Specified by:
stop in interface org.jboss.system.Service

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service

get

public EnterpriseContext get()
                      throws Exception
Get the singleton instance

Specified by:
get in interface InstancePool
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
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
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
Returns:
the size of the pool.

getMaxSize

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

Specified by:
getMaxSize in interface InstancePool
Returns:
the size of the pool.

importXml

public void importXml(Element element)
               throws org.jboss.deployment.DeploymentException
Specified by:
importXml in interface XmlLoadable
Throws:
org.jboss.deployment.DeploymentException

create

protected EnterpriseContext create(Object instance,
                                   Container con)
                            throws Exception
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.