Author: markt
Date: Mon Sep 10 13:43:41 2012
New Revision: 1382837
URL: http://svn.apache.org/viewvc?rev=1382837&view=rev
Log:
Make sessions in the session Store visible via the Manager web application if
showProxySessions is enabled
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/DistributedManager.java
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/LocalStrings.properties
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1382832
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/DistributedManager.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/DistributedManager.java?rev=1382837&r1=1382836&r2=1382837&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/DistributedManager.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/DistributedManager.java Mon
Sep 10 13:43:41 2012
@@ -21,11 +21,17 @@ import java.util.Set;
/**
* Interface implemented by session managers that do not keep a complete copy
- * of all sessions on the local node but do know where every session is. The
- * BackupManager is an example of such a Manager. Sessions can be primary
- * (master copy on this node), backup (backup copy on this node) or proxy (only
- * the session ID on this node). The identity of the primary and backup nodes
- * are known for all sessions, including proxy sessions.
+ * of all sessions in memory but do know where every session is. The
+ * BackupManager is an example of such a Manager as are implementations of the
+ * StoreManager interface.
+ * <p>
+ * With the BackupManager, sessions can be primary (master copy on this node),
+ * backup (backup copy on this node) or proxy (only the session ID on this
+ * node). The identity of the primary and backup nodes are known for all
+ * sessions, including proxy sessions.
+ * <p>
+ * With StoreManager implementations, sessions can be primary (session is in
+ * memory) or proxy (session is in the Store).
*/
public interface DistributedManager {
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/LocalStrings.properties?rev=1382837&r1=1382836&r2=1382837&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/LocalStrings.properties
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/LocalStrings.properties
Mon Sep 10 13:43:41 2012
@@ -80,4 +80,6 @@ persistentManager.processSwaps=Checking
persistentManager.activeSession=Session {0} has been idle for {1} seconds
persistentManager.swapIn=Swapping session {0} in from Store
persistentManager.swapInException=Exception in the Store during swapIn: {0}
-persistentManager.swapInInvalid=Swapped session {0} is invalid
\ No newline at end of file
+persistentManager.swapInInvalid=Swapped session {0} is invalid
+persistentManager.storeKeysException=Unable to determine the list of session
IDs for sessions in the session store, assuming that the store is empty
+persistentManager.storeSizeException=Unable to determine the number of
sessions in the session store, assuming that the store is empty
\ No newline at end of file
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=1382837&r1=1382836&r2=1382837&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
Mon Sep 10 13:43:41 2012
@@ -23,8 +23,11 @@ import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
+import org.apache.catalina.DistributedManager;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
@@ -47,7 +50,8 @@ import org.apache.juli.logging.LogFactor
* @version $Id$
*/
-public abstract class PersistentManagerBase extends ManagerBase {
+public abstract class PersistentManagerBase extends ManagerBase
+ implements DistributedManager {
private static final Log log =
LogFactory.getLog(PersistentManagerBase.class);
@@ -646,8 +650,40 @@ public abstract class PersistentManagerB
}
- // ------------------------------------------------------ Protected Methods
+ @Override
+ public int getActiveSessionsFull() {
+ // In memory session count
+ int result = getActiveSessions();
+ try {
+ // Store session count
+ result += getStore().getSize();
+ } catch (IOException ioe) {
+ log.warn(sm.getString("persistentManager.storeSizeException"));
+ }
+ return result;
+ }
+
+ @Override
+ public Set<String> getSessionIdsFull() {
+ Set<String> sessionIds = new HashSet<String>();
+ // In memory session ID list
+ sessionIds.addAll(sessions.keySet());
+ // Store session ID list
+ String[] storeKeys;
+ try {
+ storeKeys = getStore().keys();
+ for (String storeKey : storeKeys) {
+ sessionIds.add(storeKey);
+ }
+ } catch (IOException e) {
+ log.warn(sm.getString("persistentManager.storeKeysException"));
+ }
+ return sessionIds;
+ }
+
+
+ // ------------------------------------------------------ Protected Methods
/**
* Look for a session in the Store and, if found, restore
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1382837&r1=1382836&r2=1382837&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Sep 10 13:43:41 2012
@@ -105,6 +105,12 @@
between the tag and version parameters when using text interface of the
Manager web application. (markt)
</add>
+ <add>
+ Make sessions saved in the <code>Store</code> associated with a
+ <code>Manager</code> that extends <code>PersistentManager</code>
+ optionally visible (via the showProxySessions Servlet initialisation
+ parameter in web.xml) to the Manager web application. (markt)
+ </add>
</changelog>
</subsection>
</section>
Modified: tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml?rev=1382837&r1=1382836&r2=1382837&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml Mon Sep 10 13:43:41
2012
@@ -44,8 +44,8 @@
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
- <!-- Uncomment this to show proxy sessions from the Backup manager in the
- sessions list for an application
+ <!-- Uncomment this to show proxy sessions from the Backup manager or a
+ StoreManager in the sessions list for an application
<init-param>
<param-name>showProxySessions</param-name>
<param-value>true</param-value>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]