@Override public void complete(HttpSession session) { ClusteredSession clusteredSession = (ClusteredSession) session; clusteredSession.session.onEndAccess(); }
public void release() { session.release(); }
protected ClusteredSession(org.apache.geronimo.clustering.Session session) { super(System.currentTimeMillis(), 0L, session.getSessionId()); this.session = session; }
public void endAccess() { session.addState(SESSION_KEY_ENTRY, this); session.onEndAccess(); }
protected ClusteredSession(org.apache.geronimo.clustering.Session session) { super(ClusteredManager.this); this.session = session; attributes = session.getState(); String sessionId = router.transformGlobalSessionIdToSessionId(session.getSessionId()); super.setId(sessionId); setValid(true); setNew(false); }
protected WadiInstance getWadiInstance(Session session) { if (session == null) { throw new IllegalArgumentException("session is required"); } Instance instance = (Instance) session.getState(SESSION_KEY_ENTRY); if (instance == null) { return null; } return new WadiInstance(instance, session); }
private WadiInstance(Instance instance, Session session) { this.instance = instance; this.session = session; session.addState(SESSION_KEY_ENTRY, instance); }
try { switch (wadiInstance.getState()) { case AVAILABLE: break;
@Override public void invalidate() throws IllegalStateException { super.invalidate(); session.release(); } }
@Override public void complete(HttpSession session) { ClusteredSession clusteredSession = (ClusteredSession) session; clusteredSession.session.onEndAccess(); }
private ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session session) throws AssertionError { ClusteredSession clusteredSession; synchronized (idToSession) { clusteredSession = idToSession.remove(session.getSessionId()); } if (null == clusteredSession) { throw new AssertionError("Session [" + session + "] is undefined"); } return clusteredSession; }
public void checkIn(Object primaryKey) { // find the entry WadiInstance wadiInstance = localInstances.get(primaryKey); if (wadiInstance == null) { return; } wadiInstance.lock.lock(); try { // verfiy state switch (wadiInstance.getState()) { case AVAILABLE: throw new IllegalStateException("The entry " + primaryKey + " is not checked-out"); case PASSIVATED: // An entry in-use should not be passivated so we can only assume // that the caller never checked out the bean in the first place throw new IllegalStateException("The entry " + primaryKey + " is not checked-out"); case REMOVED: // Entry has been removed between get and lock (most likely by undeploying the EJB), simply drop the instance return; } // mark entry as available wadiInstance.setState(WadiInstanceState.AVAILABLE); } finally { wadiInstance.lock.unlock(); } // todo should this be instide of the lock? wadiInstance.endAccess(); }
@Override public void invalidate() throws IllegalStateException { super.invalidate(); session.release(); } }
@Override public void endAccess() { super.endAccess(); session.onEndAccess(); } }
private ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session session) throws AssertionError { ClusteredSession clusteredSession; synchronized (idToSession) { clusteredSession = idToSession.remove(session.getSessionId()); } if (null == clusteredSession) { throw new AssertionError("Session [" + session + "] is undefined"); } return clusteredSession; }
@Override public void setId(String id) { super.setId(id); newUnderlyingSession(id); attributes = session.getState(); }
@Override public void invalidate() throws IllegalStateException { super.invalidate(); session.release(); }
protected ClusteredSession(org.apache.geronimo.clustering.Session session) { super(System.currentTimeMillis(), System.currentTimeMillis(), session.getSessionId()); this.session = session; }
public void add(Object primaryKey, Instance instance) { if (!primaryKey.equals(instance.primaryKey)) throw new IllegalArgumentException("primaryKey does not equal instance.primaryKey"); // Check if we already have this primary key cached locally WadiInstance wadiInstance = localInstances.get(primaryKey); if (wadiInstance != null) { wadiInstance.lock.lock(); try { if (wadiInstance.getState() != WadiInstanceState.REMOVED) { throw new IllegalStateException("An entry for the key " + primaryKey + " already exists"); } // Entry has been removed between get and lock, simply remove the garbage entry localInstances.remove(primaryKey); } finally { wadiInstance.lock.unlock(); } } if (!(primaryKey instanceof VMID)) { // primaryKey.toString() must be an unique String representation for an unique identifier. Here, we // check that primaryKey is a VMID as its Object.toString implementation returns an unique String // representation. Other types may not implement Object.toString() "correctly". throw new AssertionError("primaryKey MUST be a " + VMID.class.getName()); } try { Object deploymentId = instance.beanContext.getDeploymentID(); Session session = getSessionManager(deploymentId).createSession(primaryKey.toString()); localInstances.put(primaryKey, new WadiInstance(instance, session)); } catch (SessionAlreadyExistException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } }
protected ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session session) { String sessionId = session.getSessionId(); sessionId = router.transformGlobalSessionIdToSessionId(sessionId); return (ClusteredSession) ClusteredManager.this.sessions.get(sessionId); } }