protected Object getKey(EnterpriseContext ctx) { return ctx.getId(); }
protected void unableToPassivateDueToCtxLock(EnterpriseContext ctx, boolean passivateAfterCommit) { log.warn("Unable to passivate due to ctx lock, id="+ctx.getId()); }
protected boolean doActivate(EnterpriseContext ctx) throws RemoteException { Object id = ctx.getId(); synchronized (activating) { // This is a recursive invocation if (activating.contains(id)) return false; activating.add(id); } try { return super.doActivate(ctx); } finally { synchronized (activating) { activating.remove(id); } } }
protected void passivate(EnterpriseContext ctx) throws RemoteException { m_container.getPersistenceManager().passivateSession((StatefulSessionEnterpriseContext) ctx); passivatedIDs.put(ctx.getId(), new Long(System.currentTimeMillis())); }
protected void activate(EnterpriseContext ctx) throws RemoteException { m_container.getPersistenceManager().activateSession((StatefulSessionEnterpriseContext) ctx); passivatedIDs.remove(ctx.getId()); }
protected void removeTimerServiceIfAllCancelledOrExpired(EnterpriseContext ctx) { boolean trace = log.isTraceEnabled(); if (trace) { log.trace("Check whether all timers are cancelled or expired for this entity: " + ctx); } EJBTimerService service = m_container.getTimerService(); ObjectName containerId = m_container.getJmxName(); Object pKey = ctx.getId(); TimerService timerService = service.getTimerService(containerId, pKey); if (timerService != null && timerService.getTimers().isEmpty()) { // Assuming that active timers do not include cancelled or expired ones. if (trace) { log.trace("No active timers available for " + containerId + " and primary key " + pKey); } service.removeTimerService(containerId, pKey); } }
+"#"+ctx.getId() +"#"+ctx.getTransaction() +"#"+reclaim
public Object invokeHome (Invocation mi) throws Exception { EnterpriseContext ctx = (EnterpriseContext)mi.getEnterpriseContext (); try { // Invoke through interceptors return getNext ().invokeHome (mi); } finally { if ( (ctx != null) && (ctx.getId () != null) ) // Still a valid instance and instance not removed // { // Everything went ok (at least no J2EE problem) and the instance will most probably be called // many more times. Consequently, we need to synchronize the state of our bean instance with // our persistant store (which will forward this to its HASessionState implementation) for clustering // behaviour. This is only necessary for "create" calls (which is the case because ctx.getId() != null) // synchronizeState (ctx); } } }
if ( (ctx != null) && (ctx.getId () != null) )
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 void tryToPassivate(EnterpriseContext instance) Object id = instance.getId(); if(id != null)
if (ctx.getId() == null)
Object id = ctx.getId(); if (id == null) return; BeanLock lock = getContainer().getLockManager().getLock(id);
if (ctx.getId() == null)