Author: markt
Date: Sat Jan 16 15:45:12 2016
New Revision: 1724997
URL: http://svn.apache.org/viewvc?rev=1724997&view=rev
Log:
Review Javadoc for Manager hierarchy. Remove unnecessary duplication.
Modified:
tomcat/trunk/java/org/apache/catalina/ha/ClusterManager.java
tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
tomcat/trunk/java/org/apache/catalina/session/PersistentManager.java
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
Modified: tomcat/trunk/java/org/apache/catalina/ha/ClusterManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/ClusterManager.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/ClusterManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/ClusterManager.java Sat Jan 16
15:45:12 2016
@@ -79,6 +79,14 @@ public interface ClusterManager extends
public void setCluster(CatalinaCluster cluster);
+ /**
+ * Open stream and use correct ClassLoader (Container), switching thread
+ * context class loader.
+ *
+ * @param data The data
+ * @return The object input stream
+ * @throws IOException An error occurred
+ */
public ReplicationStream getReplicationStream(byte[] data) throws
IOException;
public ReplicationStream getReplicationStream(byte[] data, int offset, int
length) throws IOException;
Modified:
tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
Sat Jan 16 15:45:12 2016
@@ -72,9 +72,6 @@ public abstract class ClusterManagerBase
*/
private boolean recordAllActions = false;
- /*
- * @see org.apache.catalina.ha.ClusterManager#getCluster()
- */
@Override
public CatalinaCluster getCluster() {
return cluster;
@@ -179,14 +176,6 @@ public abstract class ClusterManagerBase
return getClassLoaders(getContext());
}
- /**
- * Open Stream and use correct ClassLoader (Container) Switch
- * ThreadClassLoader
- *
- * @param data The data
- * @return The object input stream
- * @throws IOException An error occurred
- */
@Override
public ReplicationStream getReplicationStream(byte[] data) throws
IOException {
return getReplicationStream(data,0,data.length);
@@ -210,6 +199,10 @@ public abstract class ClusterManagerBase
// NOOP
}
+ /**
+ * {@link org.apache.catalina.Manager} implementations that also implement
+ * {@link ClusterManager} do not support local session persistence.
+ */
@Override
public void unload() {
// NOOP
Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Sat Jan
16 15:45:12 2016
@@ -128,9 +128,6 @@ public class DeltaManager extends Cluste
this.name = name;
}
- /**
- * Return the descriptive short name of this Manager implementation.
- */
@Override
public String getName() {
return name;
@@ -409,35 +406,16 @@ public class DeltaManager extends Cluste
this.notifyContainerListenersOnReplication =
notifyContainerListenersOnReplication;
}
+
// --------------------------------------------------------- Public Methods
- /**
- * Construct and return a new session object, based on the default settings
- * specified by this Manager's properties. The session id will be assigned
- * by this method, and available via the getId() method of the returned
- * session. If a new session cannot be created for any reason, return
- * <code>null</code>.
- *
- * @param sessionId The session id that should be used for the session
- * @exception IllegalStateException
- * if a new session cannot be instantiated for any reason
- *
- * Construct and return a new session object, based on the default settings
- * specified by this Manager's properties. The session id will be assigned
- * by this method, and available via the getId() method of the returned
- * session. If a new session cannot be created for any reason, return
- * <code>null</code>.
- *
- * @exception IllegalStateException
- * if a new session cannot be instantiated for any reason
- */
@Override
public Session createSession(String sessionId) {
return createSession(sessionId, true);
}
/**
- * create new session with check maxActiveSessions and send session
creation
+ * Create new session with check maxActiveSessions and send session
creation
* to other cluster nodes.
*
* @param sessionId The session id that should be used for the session
@@ -488,8 +466,9 @@ public class DeltaManager extends Cluste
}
/**
- * Create DeltaSession
- * @see org.apache.catalina.Manager#createEmptySession()
+ * {@inheritDoc}
+ * <p>
+ * Creates new DeltaSession instance.
*/
@Override
public Session createEmptySession() {
@@ -504,23 +483,11 @@ public class DeltaManager extends Cluste
return new DeltaSession(this);
}
- /**
- * Change the session ID of the current session to a new randomly generated
- * session ID.
- *
- * @param session The session to change the session ID for
- */
@Override
public void changeSessionId(Session session) {
changeSessionId(session, true);
}
- /**
- * Change the session ID of the current session to a specified session ID.
- *
- * @param session The session to change the session ID for
- * @param newId new session ID
- */
@Override
public void changeSessionId(Session session, String newId) {
changeSessionId(session, newId, true);
@@ -1168,13 +1135,6 @@ public class DeltaManager extends Cluste
}
- /**
- * When the manager expires session not tied to a request. The cluster will
- * periodically ask for a list of sessions that should expire and that
- * should be sent across the wire.
- *
- * @return The invalidated sessions array
- */
@Override
public String[] getInvalidatedSessions() {
return new String[0];
Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Sat Jan 16
15:45:12 2016
@@ -235,25 +235,12 @@ public abstract class ManagerBase extend
}
- /**
- * Return the distributable flag for the sessions supported by
- * this Manager.
- */
@Override
public boolean getDistributable() {
-
- return (this.distributable);
-
+ return this.distributable;
}
- /**
- * Set the distributable flag for the sessions supported by this
- * Manager. If this flag is set, all user data objects added to
- * sessions associated with this manager must implement Serializable.
- *
- * @param distributable The new distributable flag
- */
@Override
public void setDistributable(boolean distributable) {
@@ -265,41 +252,22 @@ public abstract class ManagerBase extend
}
- /**
- * Return the default maximum inactive interval (in seconds)
- * for Sessions created by this Manager.
- */
@Override
public int getMaxInactiveInterval() {
-
- return (this.maxInactiveInterval);
-
+ return this.maxInactiveInterval;
}
- /**
- * Set the default maximum inactive interval (in seconds)
- * for Sessions created by this Manager.
- *
- * @param interval The new default value
- */
@Override
public void setMaxInactiveInterval(int interval) {
-
int oldMaxInactiveInterval = this.maxInactiveInterval;
this.maxInactiveInterval = interval;
support.firePropertyChange("maxInactiveInterval",
Integer.valueOf(oldMaxInactiveInterval),
Integer.valueOf(this.maxInactiveInterval));
-
}
- /**
- * Gets the session id generator.
- *
- * @return The session id generator
- */
@Override
public SessionIdGenerator getSessionIdGenerator() {
if (sessionIdGenerator != null) {
@@ -318,11 +286,6 @@ public abstract class ManagerBase extend
}
- /**
- * Sets the session id generator
- *
- * @param sessionIdGenerator The session id generator
- */
@Override
public void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator) {
this.sessionIdGenerator = sessionIdGenerator;
@@ -403,32 +366,18 @@ public abstract class ManagerBase extend
}
- /**
- * Number of session creations that failed due to maxActiveSessions
- *
- * @return The count
- */
@Override
public int getRejectedSessions() {
return rejectedSessions;
}
- /**
- * Gets the number of sessions that have expired.
- *
- * @return Number of sessions that have expired
- */
+
@Override
public long getExpiredSessions() {
return expiredSessions.get();
}
- /**
- * Sets the number of sessions that have expired.
- *
- * @param expiredSessions Number of sessions that have expired
- */
@Override
public void setExpiredSessions(long expiredSessions) {
this.expiredSessions.set(expiredSessions);
@@ -474,7 +423,9 @@ public abstract class ManagerBase extend
/**
- * Implements the Manager interface, direct call to processExpires
+ * {@inheritDoc}
+ * <p>
+ * Direct call to {@link #processExpires()}
*/
@Override
public void backgroundProcess() {
@@ -561,14 +512,8 @@ public abstract class ManagerBase extend
}
- /**
- * Add this Session to the set of active Sessions for this Manager.
- *
- * @param session Session to be added
- */
@Override
public void add(Session session) {
-
sessions.put(session.getIdInternal(), session);
int size = getActiveSessions();
if( size > maxActive ) {
@@ -581,32 +526,12 @@ public abstract class ManagerBase extend
}
- /**
- * Add a property change listener to this component.
- *
- * @param listener The listener to add
- */
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
-
support.addPropertyChangeListener(listener);
-
}
- /**
- * Construct and return a new session object, based on the default
- * settings specified by this Manager's properties. The session
- * id specified will be used as the session id.
- * If a new session cannot be created for any reason, return
- * <code>null</code>.
- *
- * @param sessionId The session id which should be used to create the
- * new session; if <code>null</code>, a new session id will be
- * generated
- * @exception IllegalStateException if a new session cannot be
- * instantiated for any reason
- */
@Override
public Session createSession(String sessionId) {
@@ -643,69 +568,35 @@ public abstract class ManagerBase extend
}
- /**
- * Get a session from the recycled ones or create a new empty one.
- * The PersistentManager manager does not need to create session data
- * because it reads it from the Store.
- */
@Override
public Session createEmptySession() {
return (getNewSession());
}
- /**
- * Return the active Session, associated with this Manager, with the
- * specified session id (if any); otherwise return <code>null</code>.
- *
- * @param id The session id for the session to be returned
- *
- * @exception IllegalStateException if a new session cannot be
- * instantiated for any reason
- * @exception IOException if an input/output error occurs while
- * processing this request
- */
@Override
public Session findSession(String id) throws IOException {
-
- if (id == null)
- return (null);
+ if (id == null) {
+ return null;
+ }
return sessions.get(id);
-
}
- /**
- * Return the set of active Sessions associated with this Manager.
- * If this Manager has no active Sessions, a zero-length array is returned.
- */
@Override
public Session[] findSessions() {
-
return sessions.values().toArray(new Session[0]);
-
}
- /**
- * Remove this Session from the active Sessions for this Manager.
- *
- * @param session Session to be removed
- */
@Override
public void remove(Session session) {
remove(session, false);
}
- /**
- * Remove this Session from the active Sessions for this Manager.
- *
- * @param session Session to be removed
- * @param update Should the expiration statistics be updated
- */
+
@Override
public void remove(Session session, boolean update) {
-
// If the session has expired - as opposed to just being removed from
// the manager because it is being persisted - update the expired stats
if (update) {
@@ -727,42 +618,25 @@ public abstract class ManagerBase extend
}
- /**
- * Remove a property change listener from this component.
- *
- * @param listener The listener to remove
- */
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
-
support.removePropertyChangeListener(listener);
-
}
- /**
- * Change the session ID of the current session to a new randomly generated
- * session ID.
- *
- * @param session The session to change the session ID for
- */
@Override
public void changeSessionId(Session session) {
String newId = generateSessionId();
changeSessionId(session, newId, true, true);
}
- /**
- * Change the session ID of the current session to a specified session ID.
- *
- * @param session The session to change the session ID for
- * @param newId new session ID
- */
+
@Override
public void changeSessionId(Session session, String newId) {
changeSessionId(session, newId, true, true);
}
+
protected void changeSessionId(Session session, String newId,
boolean notifySessionListeners, boolean notifyContainerListeners) {
String oldId = session.getIdInternal();
@@ -857,11 +731,6 @@ public abstract class ManagerBase extend
}
- /**
- * Total sessions created by this manager.
- *
- * @return sessions created
- */
@Override
public long getSessionCounter() {
return sessionCounter;
@@ -884,22 +753,12 @@ public abstract class ManagerBase extend
}
- /**
- * Returns the number of active sessions
- *
- * @return number of sessions active
- */
@Override
public int getActiveSessions() {
return sessions.size();
}
- /**
- * Max number of concurrent active sessions
- *
- * @return The highest number of concurrent active sessions
- */
@Override
public int getMaxActive() {
return maxActive;
@@ -942,26 +801,12 @@ public abstract class ManagerBase extend
}
- /**
- * Gets the longest time (in seconds) that an expired session had been
- * alive.
- *
- * @return Longest time (in seconds) that an expired session had been
- * alive.
- */
@Override
public int getSessionMaxAliveTime() {
return sessionMaxAliveTime;
}
- /**
- * Sets the longest time (in seconds) that an expired session had been
- * alive. Typically used for resetting the current value.
- *
- * @param sessionMaxAliveTime Longest time (in seconds) that an expired
- * session had been alive.
- */
@Override
public void setSessionMaxAliveTime(int sessionMaxAliveTime) {
synchronized (sessionMaxAliveTimeUpdateLock) {
@@ -988,12 +833,10 @@ public abstract class ManagerBase extend
}
/**
- * Gets the average time (in seconds) that expired sessions had been
- * alive based on the last 100 sessions to expire. If less than
- * 100 sessions have expired then all available data is used.
- *
- * @return Average time (in seconds) that expired sessions had been
- * alive.
+ * {@inheritDoc}
+ * <p>
+ * Based on the last 100 sessions to expire. If less than 100 sessions have
+ * expired then all available data is used.
*/
@Override
public int getSessionAverageAliveTime() {
@@ -1024,11 +867,9 @@ public abstract class ManagerBase extend
/**
- * Gets the current rate of session creation (in session per minute) based
- * on the creation time of the previous 100 sessions created. If less than
- * 100 sessions have been created then all available data is used.
- *
- * @return The current rate (in sessions per minute) of session creation
+ * {@inheritDoc}<p>
+ * Based on the creation time of the previous 100 sessions created. If less
+ * than 100 sessions have been created then all available data is used.
*/
@Override
public int getSessionCreateRate() {
@@ -1067,9 +908,10 @@ public abstract class ManagerBase extend
/**
- * Gets the current rate of session expiration (in session per minute)
based
- * on the expiry time of the previous 100 sessions expired. If less than
- * 100 sessions have expired then all available data is used.
+ * {@inheritDoc}
+ * <p>
+ * Based on the expiry time of the previous 100 sessions expired. If less
+ * than 100 sessions have expired then all available data is used.
*
* @return The current rate (in sessions per minute) of session expiration
*/
@@ -1245,9 +1087,6 @@ public abstract class ManagerBase extend
}
- /**
- * Return a String rendering of this object.
- */
@Override
public String toString() {
StringBuilder sb = new StringBuilder(this.getClass().getName());
@@ -1286,14 +1125,9 @@ public abstract class ManagerBase extend
return context.getDomain();
}
+
// ----------------------------------------- PropertyChangeListener Methods
- /**
- * Process property change events from our associated Context.
- *
- * @param event
- * The property change event that has occurred
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
@@ -1313,6 +1147,7 @@ public abstract class ManagerBase extend
}
}
+
// ----------------------------------------------------------- Inner
classes
protected static final class SessionTiming {
Modified: tomcat/trunk/java/org/apache/catalina/session/PersistentManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManager.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManager.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManager.java Sat
Jan 16 15:45:12 2016
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.session;
/**
@@ -40,17 +38,14 @@ public final class PersistentManager ext
/**
* The descriptive name of this Manager implementation (for logging).
*/
- static final String name = "PersistentManager";
+ private static final String name = "PersistentManager";
// ------------------------------------------------------------- Properties
- /**
- * Return the descriptive short name of this Manager implementation.
- */
@Override
public String getName() {
- return (name);
+ return name;
}
}
Modified:
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
Sat Jan 16 15:45:12 2016
@@ -312,14 +312,9 @@ public abstract class PersistentManagerB
}
- /**
- * @return the descriptive short name of this Manager implementation.
- */
@Override
public String getName() {
-
return name;
-
}
@@ -332,7 +327,6 @@ public abstract class PersistentManagerB
public void setStore(Store store) {
this.store = store;
store.setManager(this);
-
}
@@ -342,9 +336,7 @@ public abstract class PersistentManagerB
*/
@Override
public Store getStore() {
-
return this.store;
-
}
@@ -416,8 +408,9 @@ public abstract class PersistentManagerB
/**
- * Implements the {@link org.apache.catalina.Manager Manager} interface,
- * direct call to processExpires and processPersistenceChecks
+ * {@inheritDoc}
+ * <p>
+ * Direct call to processExpires and processPersistenceChecks
*/
@Override
public void processExpires() {
@@ -460,17 +453,10 @@ public abstract class PersistentManagerB
/**
- * Return the active Session, associated with this Manager, with the
- * specified session id (if any); otherwise return <code>null</code>.
+ * {@inheritDoc}
+ * <p>
* This method checks the persistence store if persistence is enabled,
* otherwise just uses the functionality from ManagerBase.
- *
- * @param id The session id for the session to be returned
- *
- * @exception IllegalStateException if a new session cannot be
- * instantiated for any reason
- * @exception IOException if an input/output error occurs while
- * processing this request
*/
@Override
public Session findSession(String id) throws IOException {
@@ -499,7 +485,6 @@ public abstract class PersistentManagerB
// See if the Session is in the Store
session = swapIn(id);
return session;
-
}
/**
@@ -570,10 +555,9 @@ public abstract class PersistentManagerB
/**
- * Remove this Session from the active Sessions for this Manager,
- * and from the Store.
- *
- * @param session Session to be removed
+ * {@inheritDoc}
+ * <p>
+ * Remove this Session from the Store.
*/
@Override
public void remove(Session session, boolean update) {
Modified: tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardManager.java?rev=1724997&r1=1724996&r2=1724997&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardManager.java Sat Jan
16 15:45:12 2016
@@ -113,9 +113,6 @@ public class StandardManager extends Man
// ------------------------------------------------------------- Properties
- /**
- * Return the descriptive short name of this Manager implementation.
- */
@Override
public String getName() {
return name;
@@ -145,15 +142,6 @@ public class StandardManager extends Man
// --------------------------------------------------------- Public Methods
- /**
- * Load any currently active sessions that were previously unloaded
- * to the appropriate persistence mechanism, if any. If persistence is not
- * supported, this method returns without doing anything.
- *
- * @exception ClassNotFoundException if a serialized class cannot be
- * found during the reload
- * @exception IOException if an input/output error occurs
- */
@Override
public void load() throws ClassNotFoundException, IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
@@ -257,13 +245,6 @@ public class StandardManager extends Man
}
- /**
- * Save any currently active sessions in the appropriate persistence
- * mechanism, if any. If persistence is not supported, this method
- * returns without doing anything.
- *
- * @exception IOException if an input/output error occurs
- */
@Override
public void unload() throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]