You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2012/04/18 20:42:34 UTC
svn commit: r1327617 -
/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
Author: kkolinko
Date: Wed Apr 18 18:42:34 2012
New Revision: 1327617
URL: http://svn.apache.org/viewvc?rev=1327617&view=rev
Log:
Reduce indent 8->4. No functional change.
I thought I was looking at an inner class.
Modified:
tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1327617&r1=1327616&r2=1327617&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Wed Apr 18 18:42:34 2012
@@ -112,139 +112,139 @@ public class DeltaSession extends Standa
// ----------------------------------------------------- ReplicatedMapEntry
/**
- * Has the object changed since last replication
- * and is not in a locked state
- * @return boolean
- */
- @Override
- public boolean isDirty() {
- return getDeltaRequest().getSize()>0;
- }
-
- /**
- * If this returns true, the map will extract the diff using getDiff()
- * Otherwise it will serialize the entire object.
- * @return boolean
- */
- @Override
- public boolean isDiffable() {
- return true;
- }
+ * Has the object changed since last replication
+ * and is not in a locked state
+ * @return boolean
+ */
+ @Override
+ public boolean isDirty() {
+ return getDeltaRequest().getSize()>0;
+ }
- /**
- * Returns a diff and sets the dirty map to false
- * @return byte[]
- * @throws IOException
- */
- @Override
- public byte[] getDiff() throws IOException {
- try{
- lock();
- return getDeltaRequest().serialize();
- }finally{
- unlock();
- }
+ /**
+ * If this returns true, the map will extract the diff using getDiff()
+ * Otherwise it will serialize the entire object.
+ * @return boolean
+ */
+ @Override
+ public boolean isDiffable() {
+ return true;
+ }
+
+ /**
+ * Returns a diff and sets the dirty map to false
+ * @return byte[]
+ * @throws IOException
+ */
+ @Override
+ public byte[] getDiff() throws IOException {
+ try{
+ lock();
+ return getDeltaRequest().serialize();
+ }finally{
+ unlock();
}
+ }
+
+ public ClassLoader[] getClassLoaders() {
+ if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders();
+ else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders();
+ else if ( manager instanceof StandardManager ) {
+ StandardManager sm = (StandardManager)manager;
+ return ClusterManagerBase.getClassLoaders(sm.getContainer());
+ } else if ( manager instanceof ManagerBase ) {
+ ManagerBase mb = (ManagerBase)manager;
+ return ClusterManagerBase.getClassLoaders(mb.getContainer());
+ }//end if
+ return null;
+ }
- public ClassLoader[] getClassLoaders() {
- if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders();
- else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders();
- else if ( manager instanceof StandardManager ) {
- StandardManager sm = (StandardManager)manager;
- return ClusterManagerBase.getClassLoaders(sm.getContainer());
- } else if ( manager instanceof ManagerBase ) {
- ManagerBase mb = (ManagerBase)manager;
- return ClusterManagerBase.getClassLoaders(mb.getContainer());
- }//end if
- return null;
- }
-
- /**
- * Applies a diff to an existing object.
- * @param diff byte[]
- * @param offset int
- * @param length int
- * @throws IOException
- */
- @Override
- public void applyDiff(byte[] diff, int offset, int length) throws IOException, ClassNotFoundException {
+ /**
+ * Applies a diff to an existing object.
+ * @param diff byte[]
+ * @param offset int
+ * @param length int
+ * @throws IOException
+ */
+ @Override
+ public void applyDiff(byte[] diff, int offset, int length) throws IOException, ClassNotFoundException {
+ try {
+ lock();
+ ReplicationStream stream = ( (ClusterManager) getManager()).getReplicationStream(diff, offset, length);
+ ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
try {
- lock();
- ReplicationStream stream = ( (ClusterManager) getManager()).getReplicationStream(diff, offset, length);
- ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
- try {
- ClassLoader[] loaders = getClassLoaders();
- if (loaders != null && loaders.length > 0)
- Thread.currentThread().setContextClassLoader(loaders[0]);
- getDeltaRequest().readExternal(stream);
- getDeltaRequest().execute(this, ((ClusterManager)getManager()).isNotifyListenersOnReplication());
- } finally {
- Thread.currentThread().setContextClassLoader(contextLoader);
- }
- }finally {
- unlock();
+ ClassLoader[] loaders = getClassLoaders();
+ if (loaders != null && loaders.length > 0)
+ Thread.currentThread().setContextClassLoader(loaders[0]);
+ getDeltaRequest().readExternal(stream);
+ getDeltaRequest().execute(this, ((ClusterManager)getManager()).isNotifyListenersOnReplication());
+ } finally {
+ Thread.currentThread().setContextClassLoader(contextLoader);
}
+ }finally {
+ unlock();
}
+ }
- /**
- * Resets the current diff state and resets the dirty flag
- */
- @Override
- public void resetDiff() {
- resetDeltaRequest();
- }
-
- /**
- * Lock during serialization
- */
- @Override
- public void lock() {
- diffLock.lock();
- }
-
- /**
- * Unlock after serialization
- */
- @Override
- public void unlock() {
- diffLock.unlock();
- }
-
- @Override
- public void setOwner(Object owner) {
- if ( owner instanceof ClusterManager && getManager()==null) {
- ClusterManager cm = (ClusterManager)owner;
- this.setManager(cm);
- this.setValid(true);
- this.setPrimarySession(false);
- this.access();
- this.resetDeltaRequest();
- this.endAccess();
- }
- }
+ /**
+ * Resets the current diff state and resets the dirty flag
+ */
+ @Override
+ public void resetDiff() {
+ resetDeltaRequest();
+ }
- /**
- * If this returns true, to replicate that an object has been accessed
- * @return boolean
- */
- @Override
- public boolean isAccessReplicate() {
- long replDelta = System.currentTimeMillis() - getLastTimeReplicated();
- if (maxInactiveInterval >=0 && replDelta > (maxInactiveInterval * 1000)) {
- return true;
- }
- return false;
- }
+ /**
+ * Lock during serialization
+ */
+ @Override
+ public void lock() {
+ diffLock.lock();
+ }
- /**
- * Access to an existing object.
- */
- @Override
- public void accessEntry() {
- this.access();
+ /**
+ * Unlock after serialization
+ */
+ @Override
+ public void unlock() {
+ diffLock.unlock();
+ }
+
+ @Override
+ public void setOwner(Object owner) {
+ if ( owner instanceof ClusterManager && getManager()==null) {
+ ClusterManager cm = (ClusterManager)owner;
+ this.setManager(cm);
+ this.setValid(true);
this.setPrimarySession(false);
+ this.access();
+ this.resetDeltaRequest();
this.endAccess();
}
+ }
+
+ /**
+ * If this returns true, to replicate that an object has been accessed
+ * @return boolean
+ */
+ @Override
+ public boolean isAccessReplicate() {
+ long replDelta = System.currentTimeMillis() - getLastTimeReplicated();
+ if (maxInactiveInterval >=0 && replDelta > (maxInactiveInterval * 1000)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Access to an existing object.
+ */
+ @Override
+ public void accessEntry() {
+ this.access();
+ this.setPrimarySession(false);
+ this.endAccess();
+ }
// ----------------------------------------------------- Session Properties
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org