http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaForwarderCacheListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaForwarderCacheListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaForwarderCacheListener.java index aa8ad99..a276728 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaForwarderCacheListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/gatewaydelta/GatewayDeltaForwarderCacheListener.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; @@ -33,7 +31,8 @@ import org.apache.geode.internal.cache.LocalRegion; import java.util.Properties; -public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<String, GatewayDelta> implements Declarable { +public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<String, GatewayDelta> + implements Declarable { private final Cache cache; @@ -55,9 +54,7 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Received create event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) + .append(event.getKey()).append("->").append(event.getNewValue()) .append(" that originated in the local site. Sending it to the remote site."); this.cache.getLogger().fine(builder.toString()); } @@ -67,12 +64,12 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str String sessionId = event.getKey(); SerializedCacheValue scv = event.getSerializedNewValue(); if (scv == null) { - getGatewayDeltaRegion().put(sessionId, - new GatewayDeltaCreateEvent(regionName, sessionId, EntryEventImpl.serialize(event.getNewValue()))); + getGatewayDeltaRegion().put(sessionId, new GatewayDeltaCreateEvent(regionName, sessionId, + EntryEventImpl.serialize(event.getNewValue()))); } else { System.out.println( - "GatewayDeltaForwarderCacheListener event.getSerializedNewValue().getSerializedValue(): " + event.getSerializedNewValue() - .getSerializedValue()); + "GatewayDeltaForwarderCacheListener event.getSerializedNewValue().getSerializedValue(): " + + event.getSerializedNewValue().getSerializedValue()); getGatewayDeltaRegion().put(sessionId, new GatewayDeltaCreateEvent(regionName, sessionId, scv.getSerializedValue())); } @@ -80,9 +77,7 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Received create event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) + .append(event.getKey()).append("->").append(event.getNewValue()) .append(" that originated in the remote site."); this.cache.getLogger().fine(builder.toString()); } @@ -90,16 +85,14 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str } public void afterUpdate(EntryEvent<String, GatewayDelta> event) { - //System.out.println("GatewayDeltaForwarderCacheListener.afterUpdate: " + event); + // System.out.println("GatewayDeltaForwarderCacheListener.afterUpdate: " + event); // If the event is from the local site, create an 'update' event and send it to the // gateway delta region if (event.getCallbackArgument() == null) { if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Received update event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) + .append(event.getKey()).append("->").append(event.getNewValue()) .append(" that originated in the local site. Sending it to the remote site."); this.cache.getLogger().fine(builder.toString()); } @@ -114,9 +107,7 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Received update event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) + .append(event.getKey()).append("->").append(event.getNewValue()) .append(" that originated in the remote site."); this.cache.getLogger().fine(builder.toString()); } @@ -130,16 +121,15 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Received destroy event for ") - .append(event.getKey()) - .append("->") - .append(event.getNewValue()) + .append(event.getKey()).append("->").append(event.getNewValue()) .append(" that originated in the local site. Sending it to the remote site."); this.cache.getLogger().fine(builder.toString()); } // Distribute the destroy event to the gateway hub(s) String sessionId = event.getKey(); - getGatewayDeltaRegion().put(sessionId, new GatewayDeltaDestroyEvent(event.getRegion().getFullPath(), sessionId)); + getGatewayDeltaRegion().put(sessionId, + new GatewayDeltaDestroyEvent(event.getRegion().getFullPath(), sessionId)); } else { if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); @@ -151,8 +141,7 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str } } - public void init(Properties p) { - } + public void init(Properties p) {} private LocalRegion getGatewayDeltaRegion() { if (this.gatewayDeltaRegion == null) { @@ -165,17 +154,17 @@ public class GatewayDeltaForwarderCacheListener extends CacheListenerAdapter<Str private LocalRegion createOrRetrieveGatewayDeltaRegion() { Region region = this.cache.getRegion(GatewayDelta.GATEWAY_DELTA_REGION_NAME); if (region == null) { - region = new RegionFactory().setScope(Scope.LOCAL) - .setDataPolicy(DataPolicy.EMPTY) + region = new RegionFactory().setScope(Scope.LOCAL).setDataPolicy(DataPolicy.EMPTY) .setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)) -// TODO: Disabled for WAN -// .setEnableGateway(true) + // TODO: Disabled for WAN + // .setEnableGateway(true) .addCacheListener(new GatewayDeltaEventApplicationCacheListener()) .create(GatewayDelta.GATEWAY_DELTA_REGION_NAME); } if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ").append(region); + builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ") + .append(region); this.cache.getLogger().fine(builder.toString()); } return (LocalRegion) region;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java index 6c18e0f..483af3d 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.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.bootstrap; import org.apache.geode.cache.GemFireCache; @@ -44,13 +42,16 @@ public abstract class AbstractCache { private static final DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd"); - protected static final String DEFAULT_LOG_FILE_NAME = RegionHelper.NAME + "." + FORMAT.format(new Date()) + ".log"; + protected static final String DEFAULT_LOG_FILE_NAME = + RegionHelper.NAME + "." + FORMAT.format(new Date()) + ".log"; protected static final String DEFAULT_STATISTIC_ARCHIVE_FILE_NAME = RegionHelper.NAME + ".gfs"; - protected static final float DEFAULT_EVICTION_HEAP_PERCENTAGE = LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE; + protected static final float DEFAULT_EVICTION_HEAP_PERCENTAGE = + LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE; - protected static final float DEFAULT_CRITICAL_HEAP_PERCENTAGE = ResourceManager.DEFAULT_CRITICAL_PERCENTAGE; + protected static final float DEFAULT_CRITICAL_HEAP_PERCENTAGE = + ResourceManager.DEFAULT_CRITICAL_PERCENTAGE; protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractCache.class); @@ -175,7 +176,7 @@ public abstract class AbstractCache { } public void setProperty(String name, String value) { - //TODO Look at fake attributes + // TODO Look at fake attributes if (name.equals("className")) { return; } @@ -194,7 +195,8 @@ public abstract class AbstractCache { if (validProperty) { this.gemfireProperties.put(name, value); } else { - getLogger().warn("The input property named " + name + " is not a valid GemFire property. It is being ignored."); + getLogger().warn("The input property named " + name + + " is not a valid GemFire property. It is being ignored."); } } @@ -258,10 +260,11 @@ public abstract class AbstractCache { } else if (System.getProperty("weblogic.Name") != null) { String weblogicName = System.getProperty("weblogic.Name"); String separator = System.getProperty("file.separator"); - logFile = new File("servers" + separator + weblogicName + separator + - "logs" + separator + logFileName); + logFile = new File( + "servers" + separator + weblogicName + separator + "logs" + separator + logFileName); } else { - logFile = new File(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "logdir"), logFileName); + logFile = + new File(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "logdir"), logFileName); } } return logFile; @@ -276,14 +279,17 @@ public abstract class AbstractCache { // If the statistics archive file is not absolute, point it at the logs directory. if (!statisticsArchiveFile.isAbsolute()) { if (System.getProperty("catalina.base") != null) { - statisticsArchiveFile = new File(System.getProperty("catalina.base") + "/logs/", statisticsArchiveFileName); + statisticsArchiveFile = + new File(System.getProperty("catalina.base") + "/logs/", statisticsArchiveFileName); } else if (System.getProperty("weblogic.Name") != null) { String weblogicName = System.getProperty("weblogic.Name"); String separator = System.getProperty("file.separator"); - statisticsArchiveFile = new File("servers" + separator + weblogicName + separator + - "logs" + separator + statisticsArchiveFileName); + statisticsArchiveFile = new File("servers" + separator + weblogicName + separator + "logs" + + separator + statisticsArchiveFileName); } else { - statisticsArchiveFile = new File(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "statisticsdir"), statisticsArchiveFileName); + statisticsArchiveFile = + new File(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "statisticsdir"), + statisticsArchiveFileName); } } } @@ -297,19 +303,16 @@ public abstract class AbstractCache { float currentCriticalHeapPercentage = rm.getCriticalHeapPercentage(); // Set new eviction and critical heap percentages if necessary - if (getEvictionHeapPercentage() != currentEvictionHeapPercentage || getCriticalHeapPercentage() != currentCriticalHeapPercentage) { + if (getEvictionHeapPercentage() != currentEvictionHeapPercentage + || getCriticalHeapPercentage() != currentCriticalHeapPercentage) { if (getLogger().isDebugEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("Previous eviction heap percentage=") - .append(currentEvictionHeapPercentage) - .append("; critical heap percentage=") - .append(currentCriticalHeapPercentage); + builder.append("Previous eviction heap percentage=").append(currentEvictionHeapPercentage) + .append("; critical heap percentage=").append(currentCriticalHeapPercentage); getLogger().debug(builder.toString()); builder.setLength(0); - builder.append("Requested eviction heap percentage=") - .append(getEvictionHeapPercentage()) - .append("; critical heap percentage=") - .append(getCriticalHeapPercentage()); + builder.append("Requested eviction heap percentage=").append(getEvictionHeapPercentage()) + .append("; critical heap percentage=").append(getCriticalHeapPercentage()); getLogger().debug(builder.toString()); } if (currentCriticalHeapPercentage == 0.0f) { @@ -320,7 +323,8 @@ public abstract class AbstractCache { rm.setEvictionHeapPercentage(getEvictionHeapPercentage()); rm.setCriticalHeapPercentage(getCriticalHeapPercentage()); } catch (IllegalArgumentException e) { - handleResourceManagerException(e, currentEvictionHeapPercentage, currentCriticalHeapPercentage); + handleResourceManagerException(e, currentEvictionHeapPercentage, + currentCriticalHeapPercentage); rm.setEvictionHeapPercentage(currentEvictionHeapPercentage); rm.setCriticalHeapPercentage(currentCriticalHeapPercentage); } @@ -332,7 +336,8 @@ public abstract class AbstractCache { rm.setCriticalHeapPercentage(getCriticalHeapPercentage()); rm.setEvictionHeapPercentage(getEvictionHeapPercentage()); } catch (IllegalArgumentException e) { - handleResourceManagerException(e, currentEvictionHeapPercentage, currentCriticalHeapPercentage); + handleResourceManagerException(e, currentEvictionHeapPercentage, + currentCriticalHeapPercentage); rm.setCriticalHeapPercentage(currentCriticalHeapPercentage); rm.setEvictionHeapPercentage(currentEvictionHeapPercentage); } @@ -344,17 +349,16 @@ public abstract class AbstractCache { rm.setEvictionHeapPercentage(getEvictionHeapPercentage()); rm.setCriticalHeapPercentage(getCriticalHeapPercentage()); } catch (IllegalArgumentException e) { - handleResourceManagerException(e, currentEvictionHeapPercentage, currentCriticalHeapPercentage); + handleResourceManagerException(e, currentEvictionHeapPercentage, + currentCriticalHeapPercentage); rm.setEvictionHeapPercentage(currentEvictionHeapPercentage); rm.setCriticalHeapPercentage(currentCriticalHeapPercentage); } } if (getLogger().isDebugEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("Actual eviction heap percentage=") - .append(rm.getEvictionHeapPercentage()) - .append("; critical heap percentage=") - .append(rm.getCriticalHeapPercentage()); + builder.append("Actual eviction heap percentage=").append(rm.getEvictionHeapPercentage()) + .append("; critical heap percentage=").append(rm.getCriticalHeapPercentage()); getLogger().debug(builder.toString()); } } @@ -365,29 +369,23 @@ public abstract class AbstractCache { ResourceManagerValidator.validateJavaStartupParameters(getCache()); } - private void handleResourceManagerException(IllegalArgumentException e, float currentEvictionHeapPercentage, - float currentCriticalHeapPercentage) { + private void handleResourceManagerException(IllegalArgumentException e, + float currentEvictionHeapPercentage, float currentCriticalHeapPercentage) { StringBuilder builder = new StringBuilder(); builder.append("Caught exception attempting to set eviction heap percentage=") - .append(getEvictionHeapPercentage()) - .append(" and critical heap percentage=") + .append(getEvictionHeapPercentage()).append(" and critical heap percentage=") .append(getCriticalHeapPercentage()) - .append(". The percentages will be set back to their previous values (eviction heap percentage=") - .append(currentEvictionHeapPercentage) - .append(" and critical heap percentage=") - .append(currentCriticalHeapPercentage) - .append(")."); + .append( + ". The percentages will be set back to their previous values (eviction heap percentage=") + .append(currentEvictionHeapPercentage).append(" and critical heap percentage=") + .append(currentCriticalHeapPercentage).append(")."); getLogger().warn(builder.toString(), e); } @Override public String toString() { - return new StringBuilder().append(getClass().getSimpleName()) - .append("[") - .append("cache=") - .append(this.cache) - .append("]") - .toString(); + return new StringBuilder().append(getClass().getSimpleName()).append("[").append("cache=") + .append(this.cache).append("]").toString(); } protected abstract void createOrRetrieveCache(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/ClientServerCache.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/ClientServerCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/ClientServerCache.java index 986ff32..7cef225 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/ClientServerCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/ClientServerCache.java @@ -1,26 +1,25 @@ /* -* 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.bootstrap; import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.client.ClientCacheFactory; /** - * This is a singleton class which maintains configuration properties as well as starting a Client-Server cache. + * This is a singleton class which maintains configuration properties as well as starting a + * Client-Server cache. */ public class ClientServerCache extends AbstractCache { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/LifecycleTypeAdapter.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/LifecycleTypeAdapter.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/LifecycleTypeAdapter.java index 3b24cda..3b9b5ed 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/LifecycleTypeAdapter.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/LifecycleTypeAdapter.java @@ -1,22 +1,19 @@ /* -* 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. + */ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * To change this template, choose Tools | Templates and open the template in the editor. */ package org.apache.geode.modules.session.bootstrap; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/PeerToPeerCache.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/PeerToPeerCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/PeerToPeerCache.java index c220804..36b19e4 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/PeerToPeerCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/PeerToPeerCache.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.bootstrap; import org.apache.geode.cache.CacheClosedException; @@ -22,7 +20,8 @@ import org.apache.geode.cache.control.RebalanceResults; import org.apache.geode.modules.util.RegionHelper; /** - * This is a singleton class which maintains configuration properties as well as starting a Peer-To-Peer cache. + * This is a singleton class which maintains configuration properties as well as starting a + * Peer-To-Peer cache. */ public class PeerToPeerCache extends AbstractCache { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractCacheLifecycleListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractCacheLifecycleListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractCacheLifecycleListener.java index edea6a9..024c27c 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractCacheLifecycleListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractCacheLifecycleListener.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; @@ -39,8 +37,7 @@ public abstract class AbstractCacheLifecycleListener implements LifecycleListene } /* - * These getters and setters are also called by Tomcat and just passed on to - * the cache. + * These getters and setters are also called by Tomcat and just passed on to the cache. */ public float getEvictionHeapPercentage() { return cache.getEvictionHeapPercentage(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractSessionCache.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractSessionCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractSessionCache.java index 461a982..ff6ab42 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractSessionCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/AbstractSessionCache.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.geode.cache.EntryNotFoundException; @@ -30,13 +28,15 @@ public abstract class AbstractSessionCache implements SessionCache { protected SessionManager sessionManager; /** - * The sessionRegion is the <code>Region</code> that actually stores and replicates the <code>Session</code>s. + * The sessionRegion is the <code>Region</code> that actually stores and replicates the + * <code>Session</code>s. */ protected Region<String, HttpSession> sessionRegion; /** - * The operatingRegion is the <code>Region</code> used to do HTTP operations. if local cache is enabled, then this - * will be the local <code>Region</code>; otherwise, it will be the session <code>Region</code>. + * The operatingRegion is the <code>Region</code> used to do HTTP operations. if local cache is + * enabled, then this will be the local <code>Region</code>; otherwise, it will be the session + * <code>Region</code>. */ protected Region<String, HttpSession> operatingRegion; @@ -101,11 +101,13 @@ public abstract class AbstractSessionCache implements SessionCache { RegionConfiguration configuration = new RegionConfiguration(); configuration.setRegionName(getSessionManager().getRegionName()); configuration.setRegionAttributesId(getSessionManager().getRegionAttributesId()); - if (getSessionManager().getMaxInactiveInterval() != RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL) { + if (getSessionManager() + .getMaxInactiveInterval() != RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL) { configuration.setMaxInactiveInterval(getSessionManager().getMaxInactiveInterval()); configuration.setCustomExpiry(new SessionCustomExpiry()); } - configuration.setEnableGatewayDeltaReplication(getSessionManager().getEnableGatewayDeltaReplication()); + configuration + .setEnableGatewayDeltaReplication(getSessionManager().getEnableGatewayDeltaReplication()); configuration.setEnableGatewayReplication(getSessionManager().getEnableGatewayReplication()); configuration.setEnableDebugListener(getSessionManager().getEnableDebugListener()); return configuration; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerCacheLifecycleListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerCacheLifecycleListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerCacheLifecycleListener.java index ffed8ca..8c3c651 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerCacheLifecycleListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerCacheLifecycleListener.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.geode.modules.session.bootstrap.ClientServerCache; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java index 333b355..2d4a8cd 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.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.geode.cache.GemFireCache; @@ -47,7 +45,8 @@ public class ClientServerSessionCache extends AbstractSessionCache { private ClientCache cache; - protected static final String DEFAULT_REGION_ATTRIBUTES_ID = RegionShortcut.PARTITION_REDUNDANT.toString(); + protected static final String DEFAULT_REGION_ATTRIBUTES_ID = + RegionShortcut.PARTITION_REDUNDANT.toString(); protected static final boolean DEFAULT_ENABLE_LOCAL_CACHE = true; @@ -100,7 +99,8 @@ public class ClientServerSessionCache extends AbstractSessionCache { // Execute the partitioned touch function on the primary server(s) Execution execution = FunctionService.onRegion(getSessionRegion()).withFilter(sessionIds); try { - ResultCollector collector = execution.execute(TouchPartitionedRegionEntriesFunction.ID, true, false, true); + ResultCollector collector = + execution.execute(TouchPartitionedRegionEntriesFunction.ID, true, false, true); collector.getResult(); } catch (Exception e) { // If an exception occurs in the function, log it. @@ -109,9 +109,10 @@ public class ClientServerSessionCache extends AbstractSessionCache { } else { // Execute the member touch function on all the server(s) Execution execution = FunctionService.onServers(getCache()) - .withArgs(new Object[]{this.sessionRegion.getFullPath(), sessionIds}); + .withArgs(new Object[] {this.sessionRegion.getFullPath(), sessionIds}); try { - ResultCollector collector = execution.execute(TouchReplicatedRegionEntriesFunction.ID, true, false, false); + ResultCollector collector = + execution.execute(TouchReplicatedRegionEntriesFunction.ID, true, false, false); collector.getResult(); } catch (Exception e) { // If an exception occurs in the function, log it. @@ -209,7 +210,9 @@ public class ClientServerSessionCache extends AbstractSessionCache { for (RegionStatus status : results) { if (status == RegionStatus.INVALID) { StringBuilder builder = new StringBuilder(); - builder.append("An exception occurred on the server while attempting to create or validate region named ") + builder + .append( + "An exception occurred on the server while attempting to create or validate region named ") .append(getSessionManager().getRegionName()) .append(". See the server log for additional details."); throw new IllegalStateException(builder.toString()); @@ -240,8 +243,8 @@ public class ClientServerSessionCache extends AbstractSessionCache { Region region = factory.create(getSessionManager().getRegionName()); /* - * If we're using an empty client region, we register interest so that - * expired sessions are destroyed correctly. + * If we're using an empty client region, we register interest so that expired sessions are + * destroyed correctly. */ if (!getSessionManager().getEnableLocalCache()) { region.registerInterest("ALL_KEYS", InterestResultPolicy.KEYS); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/CommitSessionValve.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/CommitSessionValve.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/CommitSessionValve.java index a6568e6..659181a 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/CommitSessionValve.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/CommitSessionValve.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.Manager; @@ -30,7 +28,8 @@ public class CommitSessionValve extends ValveBase { private static final Log log = LogFactory.getLog(CommitSessionValve.class); - protected static final String info = "org.apache.geode.modules.session.catalina.CommitSessionValve/1.0"; + protected static final String info = + "org.apache.geode.modules.session.catalina.CommitSessionValve/1.0"; public CommitSessionValve() { log.info("Initialized"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java index 8691829..bc421a5 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.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.geode.DataSerializable; @@ -54,7 +52,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @SuppressWarnings("serial") -public class DeltaSession extends StandardSession implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { +public class DeltaSession extends StandardSession + implements DataSerializable, Delta, GatewayDelta, Sizeable, DeltaSessionInterface { private transient Region<String, HttpSession> operatingRegion; @@ -70,7 +69,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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; @@ -85,12 +85,12 @@ public class DeltaSession extends StandardSession implements DataSerializable, D /** * 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 DeltaSession() { super(null); @@ -133,18 +133,18 @@ public class DeltaSession extends StandardSession implements DataSerializable, D sp = (SerializablePrincipal) 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; } - this.principal = sp.getPrincipal(((DeltaSessionManager)this.manager).getTheContext().getRealm()); + this.principal = + sp.getPrincipal(((DeltaSessionManager) this.manager).getTheContext().getRealm()); if (getManager() != null) { DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Deserialized principal: " + this.principal); - //mgr.logCurrentStack(); + // mgr.logCurrentStack(); } } } @@ -161,7 +161,7 @@ public class DeltaSession extends StandardSession implements DataSerializable, D DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Cached principal: " + principal); - //mgr.logCurrentStack(); + // mgr.logCurrentStack(); } } } @@ -176,7 +176,7 @@ public class DeltaSession extends StandardSession implements DataSerializable, D DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Serialized principal: " + sp); - //mgr.logCurrentStack(); + // mgr.logCurrentStack(); } } } @@ -253,7 +253,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D } // Create the update attribute message - DeltaSessionAttributeEvent event = new DeltaSessionUpdateAttributeEvent(name, serializedValue); + DeltaSessionAttributeEvent event = + new DeltaSessionUpdateAttributeEvent(name, serializedValue); queueAttributeEvent(event, true); // Distribute the update @@ -291,10 +292,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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) { @@ -312,7 +311,7 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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(); } @@ -346,7 +345,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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); @@ -370,7 +370,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D } } - 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 @@ -384,7 +385,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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); } } } @@ -400,9 +402,9 @@ public class DeltaSession extends StandardSession implements DataSerializable, D } 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 @@ -478,7 +480,8 @@ public class DeltaSession extends StandardSession implements DataSerializable, D // 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. @@ -545,7 +548,7 @@ public class DeltaSession extends StandardSession implements DataSerializable, D @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()); @@ -559,9 +562,10 @@ public class DeltaSession extends StandardSession implements DataSerializable, D @SuppressWarnings({"unchecked", "rawtypes"}) protected Map<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. Map<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); @@ -576,9 +580,7 @@ public class DeltaSession extends StandardSession implements DataSerializable, D 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); } @@ -587,16 +589,10 @@ public class DeltaSession extends StandardSession implements DataSerializable, D @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/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionFacade.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionFacade.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionFacade.java index a64e408..e6d7c65 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionFacade.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionFacade.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.session.StandardSessionFacade; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionInterface.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionInterface.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionInterface.java index cbcd569..cb8ac51 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionInterface.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionInterface.java @@ -1,25 +1,21 @@ /* -* 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.geode.cache.Region; - - import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -33,20 +29,28 @@ import org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeE public interface DeltaSessionInterface extends Session { void commit(); + void abort(); + boolean isValid(); + void localDestroyAttribute(String name); - void applyAttributeEvents(Region<String, DeltaSessionInterface> region, List<DeltaSessionAttributeEvent> events); + + void applyAttributeEvents(Region<String, DeltaSessionInterface> region, + List<DeltaSessionAttributeEvent> events); void localUpdateAttribute(String attributeName, Object attributeValue); void toData(DataOutput os) throws IOException; + void fromData(DataInput is) throws IOException, ClassNotFoundException; String getContextName(); + boolean getExpired(); void setOwner(Object manager); + void activate(); void processExpired();