Methods Summary |
---|
protected BeanContext | create()
Object bean;
BeanContext ctx;
try
{
bean = container.construct();
ctx = (BeanContext) contextClass.newInstance();
ctx.setContainer(container);
ctx.setInstance(bean);
}
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
if (ctx instanceof StatefulBeanContext)
{
StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
sfctx.setId(new GUID());
// Tell context how to handle replication
Advisor advisor = (Advisor) container;
CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
if (config != null)
{
boolean replIsPass = true;
try
{
// TODO determine why this fails on 4.2 branch if no
// CacheConfig annotation is present
replIsPass = config.replicationIsPassivation();
}
catch (Exception e)
{
log.debug("create(): Cannot determine replicationIsPassivation setting; defaulting to true " +
e.getLocalizedMessage());
}
sfctx.setReplicationIsPassivation(replIsPass);
}
// this is for propagated extended PC's
ctx = sfctx = sfctx.pushContainedIn();
}
try
{
if (injectors != null)
{
for (int i = 0; i < injectors.length; i++)
{
injectors[i].inject(ctx);
}
}
ctx.initialiseInterceptorInstances();
}
finally
{
if (ctx instanceof StatefulBeanContext)
{
// this is for propagated extended PC's
StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
sfctx.popContainedIn();
}
}
//TODO This needs to be reimplemented as replacement for create() on home interface
container.invokeInit(bean);
container.invokePostConstruct(ctx);
++createCount;
return ctx;
|
protected BeanContext | create(java.lang.Class[] initTypes, java.lang.Object[] initValues)
Object bean;
BeanContext ctx;
try
{
bean = container.construct();
ctx = (BeanContext) contextClass.newInstance();
ctx.setContainer(container);
ctx.setInstance(bean);
}
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
if (ctx instanceof StatefulBeanContext)
{
StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
sfctx.setId(new GUID());
// Tell context how to handle replication
Advisor advisor = (Advisor) container;
CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
if (config != null)
{
sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
}
// this is for propagated extended PC's
ctx = sfctx = sfctx.pushContainedIn();
}
try
{
if (injectors != null)
{
for (int i = 0; i < injectors.length; i++)
{
injectors[i].inject(ctx);
}
}
ctx.initialiseInterceptorInstances();
}
finally
{
if (ctx instanceof StatefulBeanContext)
{
// this is for propagated extended PC's
StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
sfctx.popContainedIn();
}
}
//TODO This needs to be reimplemented as replacement for create() on home interface
container.invokeInit(bean, initTypes, initValues);
container.invokePostConstruct(ctx);
++createCount;
return ctx;
|
public void | discard(BeanContext ctx)
remove(ctx);
|
public int | getCreateCount()
return createCount;
|
public int | getRemoveCount()
return removeCount;
|
public void | initialize(Container container, java.lang.Class contextClass, java.lang.Class beanClass, int maxSize, long timeout)
this.beanClass = beanClass;
this.contextClass = contextClass;
this.container = container;
|
public void | remove(BeanContext ctx)
try
{
container.invokePreDestroy(ctx);
}
finally
{
ctx.remove();
++removeCount;
}
|
public void | setInjectors(org.jboss.injection.Injector[] injectors)
this.injectors = injectors;
|