* with additional logic to ensure that the generated bean will cache locally.
* @see {@link org.jboss.ejb3.stateful.StatefulContainer#create(Class[], Object[])}
*/
private StatefulBeanContext create()
{
StatefulBeanContext bean = (StatefulBeanContext) this.container.createBeanContext();
DistributionManager manager = this.cache.getAdvancedCache().getDistributionManager();
if (manager != null)
{
// If using distribution mode, ensure that bean will cache locally
while (!manager.isLocal(bean.getId()))
{
bean = new InfinispanStatefulBeanContext(this.container, bean.getInstance());
}
}
// Tell context how to handle replication
CacheConfig config = this.container.getAnnotation(CacheConfig.class);
if (config != null)
{
bean.setReplicationIsPassivation(config.replicationIsPassivation());
}
// this is for propagated extended PC's
bean = bean.pushContainedIn();
this.container.pushContext(bean);
try
{
this.container.injectBeanContext(bean);
}
finally
{
this.container.popContext();
// this is for propagated extended PC's
bean.popContainedIn();
}
this.container.invokePostConstruct(bean);
return bean;