[jboss-cvs] JBossAS SVN: r108971 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 28 13:16:58 EDT 2010
Author: smarlow at redhat.com
Date: 2010-10-28 13:16:57 -0400 (Thu, 28 Oct 2010)
New Revision: 108971
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
Log:
add more logging and fix for handling remote node removing the last session of a SSO
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java 2010-10-28 16:56:30 UTC (rev 108970)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java 2010-10-28 17:16:57 UTC (rev 108971)
@@ -372,6 +372,7 @@
/**
* Notify the cluster of the removal of a Session from an SSO session.
+ * May be called from ssoValue.deregister(String ssoId, String session)
*
* @param ssoId the id of the SSO session
* @param sessionId id of the Session that has been removed
@@ -381,11 +382,14 @@
{
if (ssoId == null || sessionId == null)
{
+ log.trace("removeSession is ignored as ssoID or sessionId is null " +
+ "ssoId = " + ssoId + ", sessionId = " + sessionId);
return;
}
if (!isCacheAvailable())
{
+ log.trace("removeSession is ignored as cache is not available");
return;
}
@@ -393,6 +397,7 @@
// of an SSO following receipt of a nodeRemoved() call
if (ssoId.equals(beingRemotelyRemoved.get()))
{
+ log.trace("removeSession is ignored for being remotely removed case ");
return;
}
@@ -403,7 +408,6 @@
}
boolean doTx = false;
- boolean removing = false;
try
{
// Confirm we have a transaction manager; if not get it from Cache
@@ -414,7 +418,14 @@
// Don't do anything if there is already a transaction
// context associated with this thread.
if (tm.getTransaction() == null)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("removeSession(): no active transaction, will start a new transaction");
+ }
+
doTx = true;
+ }
if (doTx)
tm.begin();
@@ -427,7 +438,14 @@
try
{
if (doTx)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("removeSession(): rollback transaction due to failure " + e.getMessage());
+ }
+
tm.setRollbackOnly();
+ }
}
catch (Exception x)
{
@@ -438,18 +456,10 @@
}
finally
{
- try
+ if (doTx)
{
- if (removing)
- {
- beingLocallyRemoved.set(null);
- }
+ endTransaction();
}
- finally
- {
- if (doTx)
- endTransaction();
- }
}
}
@@ -510,6 +520,11 @@
return;
}
+ if (log.isTraceEnabled())
+ {
+ log.trace("cacheEntryRemoved ssoId =" + ssoId);
+ }
+
// Entire SSO is being removed; i.e. an invalidation
// Ignore messages generated by our own logout activity
// TODO: can we check event.isOriginLocal instead of beingLocallyRemoved?
@@ -617,9 +632,11 @@
* notifies the valve that the SSO is empty.
*
* @param ssoId
+ * @return true if SSO has zero sessions
*/
- private void notifySSOEmpty(String ssoId)
+ private boolean notifySSOEmpty(String ssoId)
{
+ boolean isEmpty = false;
try
{
int ssoSessionCount = getSSOSessions(ssoId).size();
@@ -630,13 +647,16 @@
if (ssoSessionCount == 0)
{
+ isEmpty = true;
ssoValve.notifySSOEmpty(ssoId);
}
+
}
catch (Exception e)
{
log.error("Caught exception checking if " + ssoId + " is empty", e);
}
+ return isEmpty;
}
/**
@@ -662,10 +682,18 @@
if (key instanceof CredentialKey)
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("received a credentials modified message for SSO " + ssoId);
+ }
handleCredentialModifiedEvent(ssoId, (SSOCredentials) event.getValue());
}
else if (key instanceof SessionKey)
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("received a session modified message for SSO " + ssoId);
+ }
handleSessionModifiedEvent(ssoId);
}
}
@@ -683,11 +711,6 @@
return;
}
- if (log.isTraceEnabled())
- {
- log.trace("received a credentials modified message for SSO " + ssoId);
- }
-
try
{
if (credentials != null)
@@ -709,7 +732,12 @@
{
// Peers remove their entire node when it's empty, so any
// other modification means it's not empty
- ssoValve.notifySSONotEmpty(ssoId);
+ // notifySSOEmpty will tell the valve that SSO is empty,
+ // otherwise we tell the valve that its not empty
+ if(!notifySSOEmpty(ssoId))
+ {
+ ssoValve.notifySSONotEmpty(ssoId);
+ }
}
/**
@@ -882,10 +910,18 @@
{
if(tm.getTransaction().getStatus() != Status.STATUS_MARKED_ROLLBACK)
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("committing transaction" );
+ }
tm.commit();
}
else
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("rolling back transaction, tx status=" +tm.getTransaction().getStatus());
+ }
tm.rollback();
}
}
@@ -958,7 +994,7 @@
this.cache.remove(key);
if (log.isTraceEnabled())
{
- log.trace("removeSSOFromCache(): removed credentials for SSO id ="+ssoId);
+ log.trace("removeSSOFromCache(): removed SSO id ="+ssoId);
}
}
@@ -974,7 +1010,15 @@
Map<FullyQualifiedSessionId, Void> map = key.cast(this.cache).get(key);
if (map != null)
{
+ int beforeCount = map.size();
map.remove(fullyQualifiedSessionId);
+ if (log.isTraceEnabled())
+ {
+ log.trace("removeSessionFromCache " +
+ fullyQualifiedSessionId.toString() + " for SSO id=" + ssoId +
+ "session count for SSO was="+ beforeCount + " and is now=" + map.size());
+ }
+
if(map.size() == 0) // last session removed, send signal that credentials can be removed after maxEmptyLife
{
notifySSOEmpty(ssoId);
More information about the jboss-cvs-commits
mailing list