public void start() { // This is in here so that EntityMultiInstanceInterceptor can avoid doing a lock.sync(). // if (!container.getLockManager().lockClass.equals(org.jboss.ejb.plugins.lock.NoLock.class) && !container.getLockManager().lockClass.equals(org.jboss.ejb.plugins.lock.JDBCOptimisticLock.class) && !container.getLockManager().lockClass.equals(org.jboss.ejb.plugins.lock.MethodOnlyEJBLock.class) ) { throw new IllegalStateException("the <locking-policy> must be org.jboss.ejb.plugins.lock.NoLock, JDBCOptimisticLock, or MethodOnlyEJBLock for Instance Per Transaction:" + container.getLockManager().lockClass.getName()); } }
/** * Create a new instance synchronization instance. */ InstanceSynchronization(Transaction tx, EntityEnterpriseContext ctx) { this.tx = tx; this.ctx = ctx; this.lock = container.getLockManager().getLock(ctx.getCacheKey()); }
protected boolean canPassivate(EnterpriseContext ctx) { if (ctx.isLocked()) { // The context is in the interceptor chain return false; } if (ctx.getTransaction() != null) { return false; } Object key = ((EntityEnterpriseContext)ctx).getCacheKey(); return m_container.getLockManager().canPassivate(key); }
protected boolean canPassivate(EnterpriseContext ctx) { if(ctx.isLocked()) { // The context is in the interceptor chain return false; } if(ctx.getTransaction() != null) { return false; } Object key = ((EntityEnterpriseContext) ctx).getCacheKey(); return container.getLockManager().canPassivate(key); }
if(id != null) BeanLock lock = container.getLockManager().getLock(id); try container.getLockManager().removeLockRef(id);
public Object invokeHome(Invocation mi) throws Exception { EntityEnterpriseContext ctx = (EntityEnterpriseContext)mi.getEnterpriseContext(); Transaction tx = mi.getTransaction(); Object rtn = getNext().invokeHome(mi); // An anonymous context was sent in, so if it has an id it is a real instance now if(ctx.getId() != null) { // it doesn't need to be read, but it might have been changed from the db already. ctx.setValid(true); if(tx != null) { BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey()); try { lock.schedule(mi); register(ctx, tx); // Set tx lock.endInvocation(mi); } finally { container.getLockManager().removeLockRef(lock.getId()); } } } return rtn; }
container.getLockManager().removeLockRef(lock.getId()); container.popENC(); if(setCl)
BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey()); container.getLockManager().removeLockRef(ctx.getCacheKey());