| Method from org.jboss.ejb.plugins.SingletonStatelessSessionInstancePool Detail: |
public void add() throws Exception {
// Empty
}
Add a instance in the pool |
protected EnterpriseContext create(Object instance) throws Exception {
// The instance is created by the caller and is a newInstance();
return new StatelessSessionEnterpriseContext(instance, getContainer());
}
|
public synchronized void discard(EnterpriseContext ctx) {
// Throw away
try
{
ctx.discard();
} catch (RemoteException e)
{
// DEBUG Logger.exception(e);
}
// Notify waiters
inUse = false;
this.notifyAll();
}
|
public synchronized void free(EnterpriseContext ctx) {
// Notify waiters
inUse = false;
this.notifyAll();
}
Return an instance after invocation.
Called in 2 cases:
a) Done with finder method
b) Just removed |
public synchronized EnterpriseContext get() throws Exception {
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
// Wait while someone else is using it
while(inUse && isSynchronized)
{
try { this.wait(); } catch (InterruptedException e) {}
}
// Create if not already created (or it has been discarded)
if (ctx == null)
{
try
{
ctx = create(getContainer().createBeanClassInstance());
} catch (InstantiationException e)
{
throw new EJBException("Could not instantiate bean", e);
} catch (IllegalAccessException e)
{
throw new EJBException("Could not instantiate bean", e);
}
}
else
{
}
// Lock and return instance
inUse = true;
return ctx;
}
Get the singleton instance |
public long getAvailableCount() {
return 1;
}
|
public int getCurrentSize() {
return 1;
}
|
public int getMaxSize() {
return 1;
}
|
public void importXml(Element element) throws DeploymentException {
Element synch = MetaData.getUniqueChild(element, "Synchronized");
isSynchronized = Boolean.valueOf(MetaData.getElementContent(synch)).booleanValue();
}
|