try
{
if ( invalidatedSessions.get(sessionId) != null ) {
synchronized ( invalidatedSessions ) {
invalidatedSessions.remove(sessionId);
SessionMessage msg = new SessionMessageImpl(name,
SessionMessage.EVT_SESSION_EXPIRED,
null,
sessionId,
sessionId);
return msg;
}
} else {
ReplicatedSession session = (ReplicatedSession) findSession(
sessionId);
if (session != null) {
//return immediately if the session is not dirty
if (useDirtyFlag && (!session.isDirty())) {
//but before we return doing nothing,
//see if we should send
//an updated last access message so that
//sessions across cluster dont expire
long interval = session.getMaxInactiveInterval();
long lastaccdist = System.currentTimeMillis() -
session.getLastAccessWasDistributed();
if ( ((interval*1000) / lastaccdist)< 3 ) {
SessionMessage accmsg = new SessionMessageImpl(name,
SessionMessage.EVT_SESSION_ACCESSED,
null,
sessionId,
sessionId);
session.setLastAccessWasDistributed(System.currentTimeMillis());
return accmsg;
}
return null;
}
session.setIsDirty(false);
if (log.isDebugEnabled()) {
try {
log.debug("Sending session to cluster=" + session);
}
catch (Exception ignore) {}
}
SessionMessage msg = new SessionMessageImpl(name,
SessionMessage.EVT_SESSION_CREATED,
writeSession(session),
session.getId(),
session.getId());
return msg;