Author: kkolinko Date: Wed Apr 18 18:46:41 2012 New Revision: 1327623 URL: http://svn.apache.org/viewvc?rev=1327623&view=rev Log: Reduce indent 8->4. No functional change. Backport of r1327617
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1327617 Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1327623&r1=1327622&r2=1327623&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Wed Apr 18 18:46:41 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org