http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java index e2f7f51..cb0465d 100644 --- a/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java +++ b/extensions/geode-modules-session/src/test/java/org/apache/geode/modules/session/junit/PerTestClassLoaderRunner.java @@ -1,37 +1,33 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session.junit; /** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ import org.junit.After; @@ -57,8 +53,7 @@ import java.util.StringTokenizer; import java.util.logging.Logger; public class PerTestClassLoaderRunner extends NamedRunner { - private static final Logger LOGGER = Logger - .getLogger(PerTestClassLoaderRunner.class.getName()); + private static final Logger LOGGER = Logger.getLogger(PerTestClassLoaderRunner.class.getName()); // The classpath is needed because the custom class loader looks there to find the classes. private static String classPath; @@ -93,8 +88,7 @@ public class PerTestClassLoaderRunner extends NamedRunner { * * @throws ClassNotFoundException the class not found exception */ - private void loadClassesWithCustomClassLoader() - throws ClassNotFoundException { + private void loadClassesWithCustomClassLoader() throws ClassNotFoundException { String classPath = System.getProperty("java.class.path"); StringTokenizer st = new StringTokenizer(classPath, ":"); List<URL> urls = new ArrayList<URL>(); @@ -111,15 +105,13 @@ public class PerTestClassLoaderRunner extends NamedRunner { } } - ClassLoader classLoader = new ChildFirstClassLoader( - urls.toArray(new URL[]{}), - Thread.currentThread().getContextClassLoader() - ); + ClassLoader classLoader = new ChildFirstClassLoader(urls.toArray(new URL[] {}), + Thread.currentThread().getContextClassLoader()); Thread.currentThread().setContextClassLoader(classLoader); - testClassFromClassLoader = new TestClass(classLoader - .loadClass(getTestClass().getJavaClass().getName())); + testClassFromClassLoader = + new TestClass(classLoader.loadClass(getTestClass().getJavaClass().getName())); // See withAfters and withBefores for the reason. beforeFromClassLoader = classLoader.loadClass(Before.class.getName()); afterFromClassLoader = classLoader.loadClass(After.class.getName()); @@ -137,8 +129,8 @@ public class PerTestClassLoaderRunner extends NamedRunner { // The method as parameter is from the original class and thus not found in our // class loaded by the custom name (reflection is class loader sensitive) // So find the same method but now in the class from the class Loader. - Method methodFromNewlyLoadedClass = testClassFromClassLoader - .getJavaClass().getMethod(method.getName()); + Method methodFromNewlyLoadedClass = + testClassFromClassLoader.getJavaClass().getMethod(method.getName()); newMethod = new FrameworkMethod(methodFromNewlyLoadedClass); } catch (ClassNotFoundException e) { // Show any problem nicely as a JUnit Test failure. @@ -155,27 +147,23 @@ public class PerTestClassLoaderRunner extends NamedRunner { @SuppressWarnings("unchecked") @Override - protected Statement withAfters(FrameworkMethod method, Object target, - Statement statement) { + protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) { // We now to need to search in the class from the custom loader. // We also need to search with the annotation loaded by the custom // class loader or otherwise we don't find any method. List<FrameworkMethod> afters = testClassFromClassLoader - .getAnnotatedMethods( - (Class<? extends Annotation>) afterFromClassLoader); + .getAnnotatedMethods((Class<? extends Annotation>) afterFromClassLoader); return new RunAfters(statement, afters, target); } @SuppressWarnings("unchecked") @Override - protected Statement withBefores(FrameworkMethod method, Object target, - Statement statement) { + protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { // We now to need to search in the class from the custom loader. // We also need to search with the annotation loaded by the custom // class loader or otherwise we don't find any method. List<FrameworkMethod> befores = testClassFromClassLoader - .getAnnotatedMethods( - (Class<? extends Annotation>) beforeFromClassLoader); + .getAnnotatedMethods((Class<? extends Annotation>) beforeFromClassLoader); return new RunBefores(statement, befores, target); }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java index c0dfe23..204ff5e 100644 --- a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java +++ b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session.catalina; import java.io.DataInput; @@ -56,7 +54,8 @@ import org.apache.geode.modules.session.catalina.internal.DeltaSessionDestroyAtt import org.apache.geode.modules.session.catalina.internal.DeltaSessionUpdateAttributeEvent; @SuppressWarnings("serial") -public class DeltaSession7 extends StandardSession implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { +public class DeltaSession7 extends StandardSession + implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { private transient Region<String, HttpSession> operatingRegion; @@ -72,7 +71,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, private transient final Object changeLock = new Object(); - private final List<DeltaSessionAttributeEvent> eventQueue = new ArrayList<DeltaSessionAttributeEvent>(); + private final List<DeltaSessionAttributeEvent> eventQueue = + new ArrayList<DeltaSessionAttributeEvent>(); private transient GatewayDeltaEvent currentGatewayDeltaEvent; @@ -87,12 +87,12 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, /** * The string manager for this package. */ -// protected static StringManager STRING_MANAGER = -// StringManager.getManager("org.apache.geode.modules.session.catalina"); + // protected static StringManager STRING_MANAGER = + // StringManager.getManager("org.apache.geode.modules.session.catalina"); /** - * Construct a new <code>Session</code> associated with no <code>Manager</code>. The <code>Manager</code> will be - * assigned later using {@link #setOwner(Object)}. + * Construct a new <code>Session</code> associated with no <code>Manager</code>. The + * <code>Manager</code> will be assigned later using {@link #setOwner(Object)}. */ public DeltaSession7() { super(null); @@ -135,9 +135,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, sp = (Principal) BlobHelper.deserializeBlob(this.serializedPrincipal); } catch (Exception e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append( - ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); + builder.append(this).append( + ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); return null; } @@ -251,7 +250,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, } // Create the update attribute message - DeltaSessionAttributeEvent event = new DeltaSessionUpdateAttributeEvent(name, serializedValue); + DeltaSessionAttributeEvent event = + new DeltaSessionUpdateAttributeEvent(name, serializedValue); queueAttributeEvent(event, true); // Distribute the update @@ -289,10 +289,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, value = BlobHelper.deserializeBlob((byte[]) value); } catch (Exception e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append(": Attribute named ") - .append(name) - .append(" contains a byte[] that cannot be deserialized due to the following exception"); + builder.append(this).append(": Attribute named ").append(name).append( + " contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } if (this.preferDeserializedForm) { @@ -310,7 +308,7 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, public void invalidate() { super.invalidate(); - //getOperatingRegion().destroy(this.id, true); // already done in super (remove) + // getOperatingRegion().destroy(this.id, true); // already done in super (remove) ((DeltaSessionManager) getManager()).getStatistics().incSessionsInvalidated(); } @@ -344,7 +342,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, super.removeAttribute(name, false); // don't do notification since this is a replication } - public void applyAttributeEvents(Region<String, DeltaSessionInterface> region, List<DeltaSessionAttributeEvent> events) { + public void applyAttributeEvents(Region<String, DeltaSessionInterface> region, + List<DeltaSessionAttributeEvent> events) { for (DeltaSessionAttributeEvent event : events) { event.apply(this); queueAttributeEvent(event, false); @@ -368,7 +367,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, } } - private void queueAttributeEvent(DeltaSessionAttributeEvent event, boolean checkAddToCurrentGatewayDelta) { + private void queueAttributeEvent(DeltaSessionAttributeEvent event, + boolean checkAddToCurrentGatewayDelta) { // Add to current gateway delta if necessary if (checkAddToCurrentGatewayDelta) { // If the manager has enabled gateway delta replication and is a P2P @@ -382,7 +382,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, if (!isCommitEnabled()) { List<DeltaSessionAttributeEvent> events = new ArrayList<DeltaSessionAttributeEvent>(); events.add(event); - this.currentGatewayDeltaEvent = new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); + this.currentGatewayDeltaEvent = + new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); } } } @@ -398,8 +399,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, } public void commit() { - if (!isValidInternal()) throw new IllegalStateException("commit: Session " + getId() + - " already invalidated"); + if (!isValidInternal()) + throw new IllegalStateException("commit: Session " + getId() + " already invalidated"); synchronized (this.changeLock) { // Jens - there used to be a check to only perform this if the queue is @@ -475,7 +476,8 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, // Add the events to the gateway delta region if necessary if (this.enableGatewayDeltaReplication && this.applyRemotely) { - setCurrentGatewayDeltaEvent(new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events)); + setCurrentGatewayDeltaEvent( + new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events)); } // Access it to set the last accessed time. End access it to set not new. @@ -535,14 +537,15 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, } } - protected ConcurrentMap<String, Object> readInAttributes(final DataInput in) throws IOException, ClassNotFoundException { + protected ConcurrentMap<String, Object> readInAttributes(final DataInput in) + throws IOException, ClassNotFoundException { return DataSerializer.readObject(in); } @Override public int getSizeInBytes() { int size = 0; - for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements(); ) { + for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements();) { // Don't use this.getAttribute() because we don't want to deserialize // the value. Object value = super.getAttribute(e.nextElement()); @@ -556,9 +559,10 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, @SuppressWarnings({"unchecked", "rawtypes"}) protected ConcurrentMap<String, byte[]> getSerializedAttributes() { - // Iterate the values and serialize them if necessary before sending them to the server. This makes the application classes unnecessary on the server. + // Iterate the values and serialize them if necessary before sending them to the server. This + // makes the application classes unnecessary on the server. ConcurrentMap<String, byte[]> serializedAttributes = new ConcurrentHashMap<String, byte[]>(); - for (Iterator i = this.attributes.entrySet().iterator(); i.hasNext(); ) { + for (Iterator i = this.attributes.entrySet().iterator(); i.hasNext();) { Map.Entry<String, Object> entry = (Map.Entry<String, Object>) i.next(); Object value = entry.getValue(); byte[] serializedValue = value instanceof byte[] ? (byte[]) value : serialize(value); @@ -573,9 +577,7 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, serializedValue = BlobHelper.serializeToBlob(obj); } catch (IOException e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append(": Object ") - .append(obj) + builder.append(this).append(": Object ").append(obj) .append(" cannot be serialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } @@ -584,16 +586,10 @@ public class DeltaSession7 extends StandardSession implements DataSerializable, @Override public String toString() { - return new StringBuilder().append("DeltaSession[") - .append("id=") - .append(getId()) - .append("; context=") - .append(this.contextName) - .append("; sessionRegionName=") - .append(this.sessionRegionName) - .append("; operatingRegionName=") + return new StringBuilder().append("DeltaSession[").append("id=").append(getId()) + .append("; context=").append(this.contextName).append("; sessionRegionName=") + .append(this.sessionRegionName).append("; operatingRegionName=") .append(getOperatingRegion() == null ? "unset" : getOperatingRegion().getFullPath()) - .append("]") - .toString(); + .append("]").toString(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/Tomcat7DeltaSessionManager.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/Tomcat7DeltaSessionManager.java b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/Tomcat7DeltaSessionManager.java index 760b9bb..dd0dc41 100644 --- a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/Tomcat7DeltaSessionManager.java +++ b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/Tomcat7DeltaSessionManager.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session.catalina; import org.apache.catalina.LifecycleException; @@ -32,10 +30,12 @@ public class Tomcat7DeltaSessionManager extends DeltaSessionManager { protected LifecycleSupport lifecycle = new LifecycleSupport(this); /** - * Prepare for the beginning of active use of the public methods of this component. This method should be called - * after <code>configure()</code>, and before any of the public methods of the component are utilized. + * Prepare for the beginning of active use of the public methods of this component. This method + * should be called after <code>configure()</code>, and before any of the public methods of the + * component are utilized. * - * @throws LifecycleException if this component detects a fatal error that prevents this component from being used + * @throws LifecycleException if this component detects a fatal error that prevents this component + * from being used */ @Override public void startInternal() throws LifecycleException { @@ -75,8 +75,8 @@ public class Tomcat7DeltaSessionManager extends DeltaSessionManager { } /** - * Gracefully terminate the active use of the public methods of this component. This method should be the last one - * called on a given instance of this component. + * Gracefully terminate the active use of the public methods of this component. This method should + * be the last one called on a given instance of this component. * * @throws LifecycleException if this component detects a fatal error that needs to be reported */ @@ -128,8 +128,8 @@ public class Tomcat7DeltaSessionManager extends DeltaSessionManager { } /** - * Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a - * zero-length array is returned. + * Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners + * registered, a zero-length array is returned. */ @Override public LifecycleListener[] findLifecycleListeners() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat7/src/test/java/org/apache/geode/modules/session/Tomcat7SessionsJUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat7/src/test/java/org/apache/geode/modules/session/Tomcat7SessionsJUnitTest.java b/extensions/geode-modules-tomcat7/src/test/java/org/apache/geode/modules/session/Tomcat7SessionsJUnitTest.java index a6e6a9e..a5f25eb 100644 --- a/extensions/geode-modules-tomcat7/src/test/java/org/apache/geode/modules/session/Tomcat7SessionsJUnitTest.java +++ b/extensions/geode-modules-tomcat7/src/test/java/org/apache/geode/modules/session/Tomcat7SessionsJUnitTest.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java index b0ca21d..b5e7d0c 100644 --- a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java +++ b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session.catalina; import java.io.DataInput; @@ -57,7 +55,8 @@ import org.apache.geode.modules.session.catalina.internal.DeltaSessionUpdateAttr @SuppressWarnings("serial") -public class DeltaSession8 extends StandardSession implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { +public class DeltaSession8 extends StandardSession + implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { private transient Region<String, HttpSession> operatingRegion; @@ -73,7 +72,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, private transient final Object changeLock = new Object(); - private final List<DeltaSessionAttributeEvent> eventQueue = new ArrayList<DeltaSessionAttributeEvent>(); + private final List<DeltaSessionAttributeEvent> eventQueue = + new ArrayList<DeltaSessionAttributeEvent>(); private transient GatewayDeltaEvent currentGatewayDeltaEvent; @@ -84,9 +84,10 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, private byte[] serializedPrincipal; private final Log LOG = LogFactory.getLog(DeltaSession.class.getName()); + /** - * Construct a new <code>Session</code> associated with no <code>Manager</code>. The <code>Manager</code> will be - * assigned later using {@link #setOwner(Object)}. + * Construct a new <code>Session</code> associated with no <code>Manager</code>. The + * <code>Manager</code> will be assigned later using {@link #setOwner(Object)}. */ public DeltaSession8() { super(null); @@ -127,12 +128,11 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, Principal sp = null; try { - sp = (Principal)BlobHelper.deserializeBlob(this.serializedPrincipal); + sp = (Principal) BlobHelper.deserializeBlob(this.serializedPrincipal); } catch (Exception e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append( - ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); + builder.append(this).append( + ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); return null; } @@ -245,7 +245,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, } // Create the update attribute message - DeltaSessionAttributeEvent event = new DeltaSessionUpdateAttributeEvent(name, serializedValue); + DeltaSessionAttributeEvent event = + new DeltaSessionUpdateAttributeEvent(name, serializedValue); queueAttributeEvent(event, true); // Distribute the update @@ -283,10 +284,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, value = BlobHelper.deserializeBlob((byte[]) value); } catch (Exception e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append(": Attribute named ") - .append(name) - .append(" contains a byte[] that cannot be deserialized due to the following exception"); + builder.append(this).append(": Attribute named ").append(name).append( + " contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } if (this.preferDeserializedForm) { @@ -304,7 +303,7 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, public void invalidate() { super.invalidate(); - //getOperatingRegion().destroy(this.id, true); // already done in super (remove) + // getOperatingRegion().destroy(this.id, true); // already done in super (remove) ((DeltaSessionManager) getManager()).getStatistics().incSessionsInvalidated(); } @@ -338,7 +337,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, super.removeAttribute(name, false); // don't do notification since this is a replication } - public void applyAttributeEvents(Region<String, DeltaSessionInterface> region, List<DeltaSessionAttributeEvent> events) { + public void applyAttributeEvents(Region<String, DeltaSessionInterface> region, + List<DeltaSessionAttributeEvent> events) { for (DeltaSessionAttributeEvent event : events) { event.apply(this); queueAttributeEvent(event, false); @@ -362,7 +362,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, } } - private void queueAttributeEvent(DeltaSessionAttributeEvent event, boolean checkAddToCurrentGatewayDelta) { + private void queueAttributeEvent(DeltaSessionAttributeEvent event, + boolean checkAddToCurrentGatewayDelta) { // Add to current gateway delta if necessary if (checkAddToCurrentGatewayDelta) { // If the manager has enabled gateway delta replication and is a P2P @@ -376,7 +377,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, if (!isCommitEnabled()) { List<DeltaSessionAttributeEvent> events = new ArrayList<DeltaSessionAttributeEvent>(); events.add(event); - this.currentGatewayDeltaEvent = new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); + this.currentGatewayDeltaEvent = + new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); } } } @@ -392,9 +394,9 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, } public void commit() { - if (!isValidInternal()) throw new IllegalStateException("commit: Session " + getId() + - " already invalidated"); - // (STRING_MANAGER.getString("deltaSession.commit.ise", getId())); + if (!isValidInternal()) + throw new IllegalStateException("commit: Session " + getId() + " already invalidated"); + // (STRING_MANAGER.getString("deltaSession.commit.ise", getId())); synchronized (this.changeLock) { // Jens - there used to be a check to only perform this if the queue is @@ -403,7 +405,7 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, DeltaSessionManager mgr = (DeltaSessionManager) this.manager; if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) { setCurrentGatewayDeltaEvent( - new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, this.eventQueue)); + new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, this.eventQueue)); } this.hasDelta = true; this.applyRemotely = true; @@ -470,7 +472,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, // Add the events to the gateway delta region if necessary if (this.enableGatewayDeltaReplication && this.applyRemotely) { - setCurrentGatewayDeltaEvent(new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events)); + setCurrentGatewayDeltaEvent( + new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events)); } // Access it to set the last accessed time. End access it to set not new. @@ -534,7 +537,7 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, @Override public int getSizeInBytes() { int size = 0; - for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements(); ) { + for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements();) { // Don't use this.getAttribute() because we don't want to deserialize // the value. Object value = super.getAttribute(e.nextElement()); @@ -552,10 +555,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, serializedValue = BlobHelper.serializeToBlob(obj); } catch (IOException e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append(": Object ") - .append(obj) - .append(" cannot be serialized due to the following exception"); + builder.append(this).append(": Object ").append(obj) + .append(" cannot be serialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } return serializedValue; @@ -563,24 +564,19 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, @Override public String toString() { - return new StringBuilder().append("DeltaSession[") - .append("id=") - .append(getId()) - .append("; context=") - .append(this.contextName) - .append("; sessionRegionName=") - .append(this.sessionRegionName) - .append("; operatingRegionName=") - .append(getOperatingRegion() == null ? "unset" : getOperatingRegion().getFullPath()) - .append("]") - .toString(); + return new StringBuilder().append("DeltaSession[").append("id=").append(getId()) + .append("; context=").append(this.contextName).append("; sessionRegionName=") + .append(this.sessionRegionName).append("; operatingRegionName=") + .append(getOperatingRegion() == null ? "unset" : getOperatingRegion().getFullPath()) + .append("]").toString(); } @SuppressWarnings({"unchecked", "rawtypes"}) protected ConcurrentMap<String, byte[]> getSerializedAttributes() { - // Iterate the values and serialize them if necessary before sending them to the server. This makes the application classes unnecessary on the server. + // Iterate the values and serialize them if necessary before sending them to the server. This + // makes the application classes unnecessary on the server. ConcurrentMap<String, byte[]> serializedAttributes = new ConcurrentHashMap<String, byte[]>(); - for (Iterator i = this.attributes.entrySet().iterator(); i.hasNext(); ) { + for (Iterator i = this.attributes.entrySet().iterator(); i.hasNext();) { Map.Entry<String, Object> entry = (Map.Entry<String, Object>) i.next(); Object value = entry.getValue(); byte[] serializedValue = value instanceof byte[] ? (byte[]) value : serialize(value); @@ -589,7 +585,8 @@ public class DeltaSession8 extends StandardSession implements DataSerializable, return serializedAttributes; } - protected ConcurrentMap readInAttributes(final DataInput in) throws IOException, ClassNotFoundException { + protected ConcurrentMap readInAttributes(final DataInput in) + throws IOException, ClassNotFoundException { return DataSerializer.readObject(in); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/Tomcat8DeltaSessionManager.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/Tomcat8DeltaSessionManager.java b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/Tomcat8DeltaSessionManager.java index e5aa1ac..16ea322 100644 --- a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/Tomcat8DeltaSessionManager.java +++ b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/Tomcat8DeltaSessionManager.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session.catalina; import org.apache.catalina.Context; @@ -27,10 +25,12 @@ import java.io.IOException; public class Tomcat8DeltaSessionManager extends DeltaSessionManager { /** - * Prepare for the beginning of active use of the public methods of this component. This method should be called - * after <code>configure()</code>, and before any of the public methods of the component are utilized. + * Prepare for the beginning of active use of the public methods of this component. This method + * should be called after <code>configure()</code>, and before any of the public methods of the + * component are utilized. * - * @throws LifecycleException if this component detects a fatal error that prevents this component from being used + * @throws LifecycleException if this component detects a fatal error that prevents this component + * from being used */ @Override public void startInternal() throws LifecycleException { @@ -70,8 +70,8 @@ public class Tomcat8DeltaSessionManager extends DeltaSessionManager { } /** - * Gracefully terminate the active use of the public methods of this component. This method should be the last one - * called on a given instance of this component. + * Gracefully terminate the active use of the public methods of this component. This method should + * be the last one called on a given instance of this component. * * @throws LifecycleException if this component detects a fatal error that needs to be reported */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat8.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat8.java b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat8.java index 58b9df1..65dda1e 100644 --- a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat8.java +++ b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat8.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session; import java.io.File; @@ -71,7 +69,8 @@ public class EmbeddedTomcat8 { */ private String webappDir = ""; - public EmbeddedTomcat8(String contextPath, int port, String jvmRoute) throws MalformedURLException { + public EmbeddedTomcat8(String contextPath, int port, String jvmRoute) + throws MalformedURLException { this.contextPath = contextPath; this.port = port; @@ -79,7 +78,7 @@ public class EmbeddedTomcat8 { container = new Tomcat(); container.setBaseDir(System.getProperty("user.dir") + "/tomcat"); - Host localHost = container.getHost();//("127.0.0.1", new File("").getAbsolutePath()); + Host localHost = container.getHost();// ("127.0.0.1", new File("").getAbsolutePath()); localHost.setDeployOnStartup(true); localHost.getCreateDirs(); @@ -87,8 +86,7 @@ public class EmbeddedTomcat8 { new File(localHost.getAppBaseFile().getAbsolutePath()).mkdir(); new File(localHost.getCatalinaBase().getAbsolutePath(), "logs").mkdir(); rootContext = container.addContext("", localHost.getAppBaseFile().getAbsolutePath()); - } - catch (Exception e) { + } catch (Exception e) { throw new Error(e); } // Otherwise we get NPE when instantiating servlets @@ -106,7 +104,7 @@ public class EmbeddedTomcat8 { // create http connector container.setPort(port); - Connector httpConnector = container.getConnector();//((InetAddress) null, port, false); + Connector httpConnector = container.getConnector();// ((InetAddress) null, port, false); // Create the JVMRoute valve for session failover ValveBase valve = new JvmRouteBinderValve(); @@ -143,7 +141,8 @@ public class EmbeddedTomcat8 { } } - public StandardWrapper addServlet(String path, String name, String clazz) throws ServletException { + public StandardWrapper addServlet(String path, String name, String clazz) + throws ServletException { StandardWrapper servlet = (StandardWrapper) rootContext.createWrapper(); servlet.setName(name); servlet.setServletClass(clazz); @@ -153,7 +152,7 @@ public class EmbeddedTomcat8 { rootContext.addServletMapping(path, name); servlet.setParent(rootContext); -// servlet.load(); + // servlet.load(); return servlet; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java index 7e7eef3..15b3874 100644 --- a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java +++ b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session; import static org.apache.geode.distributed.ConfigurationProperties.*; @@ -41,7 +39,7 @@ import org.apache.geode.modules.session.catalina.DeltaSessionManager; import org.apache.geode.test.dunit.VM; import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase; -public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ +public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase { protected static EmbeddedTomcat8 server; @@ -73,8 +71,9 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ } /** - * Test callback functionality. This is here really just as an example. Callbacks are useful to implement per test - * actions which can be defined within the actual test method instead of in a separate servlet class. + * Test callback functionality. This is here really just as an example. Callbacks are useful to + * implement per test actions which can be defined within the actual test method instead of in a + * separate servlet class. */ @Test public void testCallback() throws Exception { @@ -82,7 +81,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { PrintWriter out = response.getWriter(); out.write(helloWorld); } @@ -107,7 +107,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { HttpSession session = request.getSession(); response.getWriter().write(Boolean.toString(session.isNew())); } @@ -128,7 +129,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ } /** - * Check that our session persists. The values we pass in as query params are used to set attributes on the session. + * Check that our session persists. The values we pass in as query params are used to set + * attributes on the session. */ @Test public void testSessionPersists1() throws Exception { @@ -217,13 +219,14 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ } /** - * Test setting the session expiration via a property change as would happen under normal deployment conditions. + * Test setting the session expiration via a property change as would happen under normal + * deployment conditions. */ @Test public void testSessionExpiration2() throws Exception { // TestSessions only live for a minute - sessionManager.propertyChange( - new PropertyChangeEvent(server.getRootContext(), "sessionTimeout", new Integer(30), new Integer(1))); + sessionManager.propertyChange(new PropertyChangeEvent(server.getRootContext(), "sessionTimeout", + new Integer(30), new Integer(1))); // Check that the value has been set to 60 seconds assertEquals(60, sessionManager.getMaxInactiveInterval()); @@ -309,7 +312,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ } /** - * Test that multiple attribute updates, within the same request result in only the latest one being effective. + * Test that multiple attribute updates, within the same request result in only the latest one + * being effective. */ @Test public void testMultipleAttributeUpdates() throws Exception { @@ -317,7 +321,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { HttpSession session = request.getSession(); for (int i = 0; i < 1000; i++) { session.setAttribute(key, Integer.toString(i)); @@ -346,7 +351,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ public void testCommitSessionValveInvalidSession() throws Exception { Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { HttpSession session = request.getSession(); session.invalidate(); response.getWriter().write("done"); @@ -372,7 +378,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ public void testExtraSessionsNotCreated() throws Exception { Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { // Do nothing with sessions response.getWriter().write("done"); } @@ -392,13 +399,15 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ } /** - * Test for issue #46 lastAccessedTime is not updated at the start of the request, but only at the end. + * Test for issue #46 lastAccessedTime is not updated at the start of the request, but only at the + * end. */ @Test public void testLastAccessedTime() throws Exception { Callback c = new Callback() { @Override - public void call(HttpServletRequest request, HttpServletResponse response) throws IOException { + public void call(HttpServletRequest request, HttpServletResponse response) + throws IOException { HttpSession session = request.getSession(); // Hack to expose the session to our test context session.getServletContext().setAttribute("session", session); @@ -426,7 +435,8 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase{ Long lastAccess = (Long) session.getAttribute("lastAccessTime"); assertTrue( - "Last access time not set correctly: " + lastAccess.longValue() + " not <= " + session.getLastAccessedTime(), - lastAccess.longValue() <= session.getLastAccessedTime()); + "Last access time not set correctly: " + lastAccess.longValue() + " not <= " + + session.getLastAccessedTime(), + lastAccess.longValue() <= session.getLastAccessedTime()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsClientServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsClientServerDUnitTest.java b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsClientServerDUnitTest.java index 384689e..e475f40 100644 --- a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsClientServerDUnitTest.java +++ b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsClientServerDUnitTest.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session; import static org.apache.geode.distributed.ConfigurationProperties.*; @@ -88,8 +86,8 @@ public class Tomcat8SessionsClientServerDUnitTest extends TestSessionsTomcat8Bas pf.create("Pool Connecting to Cache Server"); /* - * Can only retrieve the region once the container has started up - * (and the cache has started too). + * Can only retrieve the region once the container has started up (and the cache has started + * too). */ region = sessionManager.getSessionCache().getSessionRegion(); sessionManager.getTheContext().setSessionTimeout(30); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsDUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsDUnitTest.java b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsDUnitTest.java index d61e114..473bfe0 100644 --- a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsDUnitTest.java +++ b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/Tomcat8SessionsDUnitTest.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.session; import static org.apache.geode.distributed.ConfigurationProperties.*; @@ -60,8 +58,8 @@ public class Tomcat8SessionsDUnitTest extends TestSessionsTomcat8Base { server.startContainer(); /* - * Can only retrieve the region once the container has started up - * (and the cache has started too). + * Can only retrieve the region once the container has started up (and the cache has started + * too). */ region = sessionManager.getSessionCache().getSessionRegion(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/AbstractGatewayDeltaEvent.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/AbstractGatewayDeltaEvent.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/AbstractGatewayDeltaEvent.java index fabde8d..7d8c844 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/AbstractGatewayDeltaEvent.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/AbstractGatewayDeltaEvent.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; import org.apache.geode.DataSerializable; @@ -31,8 +29,7 @@ public abstract class AbstractGatewayDeltaEvent implements GatewayDeltaEvent, Da protected String regionName; protected String key; - public AbstractGatewayDeltaEvent() { - } + public AbstractGatewayDeltaEvent() {} public AbstractGatewayDeltaEvent(String regionName, String key) { this.regionName = regionName; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDelta.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDelta.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDelta.java index 7a3ff8e..92cde0a 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDelta.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDelta.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; public interface GatewayDelta { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaCreateEvent.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaCreateEvent.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaCreateEvent.java index 3782ef5..ba9ba3f 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaCreateEvent.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaCreateEvent.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; import org.apache.geode.DataSerializable; @@ -33,8 +31,7 @@ public class GatewayDeltaCreateEvent extends AbstractGatewayDeltaEvent { private byte[] gatewayDelta; - public GatewayDeltaCreateEvent() { - } + public GatewayDeltaCreateEvent() {} public GatewayDeltaCreateEvent(String regionName, String key, byte[] gatewayDelta) { super(regionName, key); @@ -74,15 +71,9 @@ public class GatewayDeltaCreateEvent extends AbstractGatewayDeltaEvent { } public String toString() { - return new StringBuilder().append("GatewayDeltaCreateEvent[") - .append("regionName=") - .append(this.regionName) - .append("; key=") - .append(this.key) - .append("; gatewayDelta=") - .append(this.gatewayDelta) - .append("]") - .toString(); + return new StringBuilder().append("GatewayDeltaCreateEvent[").append("regionName=") + .append(this.regionName).append("; key=").append(this.key).append("; gatewayDelta=") + .append(this.gatewayDelta).append("]").toString(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaDestroyEvent.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaDestroyEvent.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaDestroyEvent.java index 96d9b6c..5b8d823 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaDestroyEvent.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaDestroyEvent.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; import org.apache.geode.DataSerializable; @@ -30,8 +28,7 @@ import java.io.IOException; @SuppressWarnings("serial") public class GatewayDeltaDestroyEvent extends AbstractGatewayDeltaEvent { - public GatewayDeltaDestroyEvent() { - } + public GatewayDeltaDestroyEvent() {} public GatewayDeltaDestroyEvent(String regionName, String key) { super(regionName, key); @@ -70,13 +67,8 @@ public class GatewayDeltaDestroyEvent extends AbstractGatewayDeltaEvent { } public String toString() { - return new StringBuilder().append("GatewayDeltaDestroyEvent[") - .append("regionName=") - .append(this.regionName) - .append("; key=") - .append(this.key) - .append("]") - .toString(); + return new StringBuilder().append("GatewayDeltaDestroyEvent[").append("regionName=") + .append(this.regionName).append("; key=").append(this.key).append("]").toString(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEvent.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEvent.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEvent.java index 1da0a9c..d54e90b 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEvent.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEvent.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; import org.apache.geode.cache.Cache; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEventApplicationCacheListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEventApplicationCacheListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEventApplicationCacheListener.java index ca58dde..33bbf3b 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEventApplicationCacheListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaEventApplicationCacheListener.java @@ -1,19 +1,17 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package org.apache.geode.modules.gatewaydelta; import org.apache.geode.cache.Cache; @@ -26,7 +24,8 @@ import org.apache.geode.internal.cache.wan.GatewaySenderEventCallbackArgument; import java.util.Properties; -public class GatewayDeltaEventApplicationCacheListener extends CacheListenerAdapter<String, GatewayDeltaEvent> implements Declarable { +public class GatewayDeltaEventApplicationCacheListener + extends CacheListenerAdapter<String, GatewayDeltaEvent> implements Declarable { private final Cache cache; @@ -39,11 +38,8 @@ public class GatewayDeltaEventApplicationCacheListener extends CacheListenerAdap EntryEventImpl eventImpl = (EntryEventImpl) event; if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("GatewayDeltaApplierCacheListener: Received event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) - .append("."); + builder.append("GatewayDeltaApplierCacheListener: Received event for ").append(event.getKey()) + .append("->").append(event.getNewValue()).append("."); this.cache.getLogger().fine(builder.toString()); } @@ -62,6 +58,5 @@ public class GatewayDeltaEventApplicationCacheListener extends CacheListenerAdap } } - public void init(Properties p) { - } + public void init(Properties p) {} }
