/** * Return an instance to the free pool. Reset state * * <p>Called in 3 cases: * <ul> * <li>Done with finder method * <li>Removed * <li>Passivated * </ul> * * @param ctx */ public void free(EnterpriseContext ctx) { // If transaction still present don't do anything (let the instance be GC) if (ctx.getTransaction() != null) { if( log.isTraceEnabled() ) log.trace("Can Not FREE Entity Context because a Transaction exists."); return ; } super.free(ctx); }
public void discard(EnterpriseContext ctx) { if( log.isTraceEnabled() ) { String msg = "Discard instance:"+this+"#"+ctx +"#"+ctx.getTransaction() +"#"+reclaim +"#"+getContainer().getBeanClass(); log.trace(msg); } // If we block when maxSize instances are in use, invoke release on strictMaxSize if( strictMaxSize != null ) strictMaxSize.release(); // Throw away, unsetContext() try { ctx.discard(); } catch (RemoteException e) { if( log.isTraceEnabled() ) log.trace("Ctx.discard error", e); } }
protected boolean canPassivate(EnterpriseContext ctx) { if (ctx.isLocked()) { // The context is in the interceptor chain return false; } else if (m_container.getLockManager().canPassivate(ctx.getId()) == false) { return false; } else { if (ctx.getTransaction() != null) { try { return (ctx.getTransaction().getStatus() == Status.STATUS_NO_TRANSACTION); } catch (SystemException e) { // SA FIXME: not sure what to do here return false; } } } return true; }
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); }
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); }
+"#"+ctx.getTransaction() +"#"+reclaim +"#"+getContainer().getBeanClass();
if (ctx.getTransaction() == null) ctx.setTransaction(mi.getTransaction());
if (ctx.getTransaction() == null) ctx.setTransaction(mi.getTransaction()); else if(ejbObjectRemove.equals(miMethod) || ejbLocalObjectRemove.equals(miMethod)) "object while the object is in a transaction " + "(EJB2.1, 7.6.4 Restrictions for Transactions): ejb-name=" + metaData.getEjbName() + ", method=" + mi.getMethod() + ", tx=" + ctx.getTransaction());
Transaction beanTx = ctx.getTransaction();
if (ctx.getTransaction() == null)
if (ctx.getTransaction() != null && !ctx.getTransaction().equals(mi.getTransaction())) msg.append(", contextTx: " + ctx.getTransaction()); msg.append(", methodTx: " + mi.getTransaction()); throw new EJBException(msg.toString()); if (ctx.getTransaction() == null && mi.getTransaction() != null)