http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/CreateRegionFunction.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/CreateRegionFunction.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/CreateRegionFunction.java index 21d11d9..4e9e9fd 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/CreateRegionFunction.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/CreateRegionFunction.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.util; import java.io.File; @@ -54,9 +52,11 @@ public class CreateRegionFunction implements Function, Declarable { public static final String ID = "create-region-function"; - private static final boolean DUMP_SESSION_CACHE_XML = Boolean.getBoolean("gemfiremodules.dumpSessionCacheXml"); + private static final boolean DUMP_SESSION_CACHE_XML = + Boolean.getBoolean("gemfiremodules.dumpSessionCacheXml"); - private static final String REGION_CONFIGURATION_METADATA_REGION = "__regionConfigurationMetadata"; + private static final String REGION_CONFIGURATION_METADATA_REGION = + "__regionConfigurationMetadata"; public CreateRegionFunction() { this(CacheFactory.getAnyInstance()); @@ -106,7 +106,8 @@ public class CreateRegionFunction implements Function, Declarable { RegionHelper.validateRegion(this.cache, configuration, region); } catch (Exception e) { if (!e.getMessage() - .equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME.toLocalizedString())) { + .equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME + .toLocalizedString())) { this.cache.getLogger().warning(e); } status = RegionStatus.INVALID; @@ -131,8 +132,7 @@ public class CreateRegionFunction implements Function, Declarable { return true; } - public void init(Properties properties) { - } + public void init(Properties properties) {} private RegionStatus createRegion(RegionConfiguration configuration) { // Get a distributed lock @@ -150,7 +150,8 @@ public class CreateRegionFunction implements Function, Declarable { dml.lockInterruptibly(); if (this.cache.getLogger().fineEnabled()) { end = System.currentTimeMillis(); - this.cache.getLogger().fine(this + ": Obtained lock on " + dml + " in " + (end - start) + " ms"); + this.cache.getLogger() + .fine(this + ": Obtained lock on " + dml + " in " + (end - start) + " ms"); } // Attempt to get the region again after the lock has been obtained @@ -183,7 +184,8 @@ public class CreateRegionFunction implements Function, Declarable { RegionHelper.validateRegion(this.cache, configuration, region); } catch (Exception e) { if (!e.getMessage() - .equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME.toLocalizedString())) { + .equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME + .toLocalizedString())) { this.cache.getLogger().warning(e); } status = RegionStatus.INVALID; @@ -191,10 +193,8 @@ public class CreateRegionFunction implements Function, Declarable { } } catch (Exception e) { StringBuilder builder = new StringBuilder(); - builder.append(this) - .append(": Caught Exception attempting to create region named ") - .append(configuration.getRegionName()) - .append(":"); + builder.append(this).append(": Caught Exception attempting to create region named ") + .append(configuration.getRegionName()).append(":"); this.cache.getLogger().warning(builder.toString(), e); status = RegionStatus.INVALID; } finally { @@ -214,7 +214,8 @@ public class CreateRegionFunction implements Function, Declarable { private Region<String, RegionConfiguration> createRegionConfigurationMetadataRegion() { // a sessionFactory in hibernate could have been re-started // so, it is possible that this region exists already - Region<String, RegionConfiguration> r = this.cache.getRegion(REGION_CONFIGURATION_METADATA_REGION); + Region<String, RegionConfiguration> r = + this.cache.getRegion(REGION_CONFIGURATION_METADATA_REGION); if (r != null) { return r; } @@ -227,7 +228,8 @@ public class CreateRegionFunction implements Function, Declarable { try { return gemFireCache.createVMRegion(REGION_CONFIGURATION_METADATA_REGION, ra, ira); } catch (IOException | ClassNotFoundException e) { - InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString()); + InternalGemFireError assErr = new InternalGemFireError( + LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString()); assErr.initCause(e); throw assErr; }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/DebugCacheListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/DebugCacheListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/DebugCacheListener.java index 2882f58..0f2d6ef 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/DebugCacheListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/DebugCacheListener.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.util; import org.apache.geode.cache.Declarable; @@ -43,9 +41,7 @@ public class DebugCacheListener extends CacheListenerAdapter implements Declarab private void log(EntryEvent event) { StringBuilder builder = new StringBuilder(); - builder.append("DebugCacheListener: Received ") - .append(event.getOperation()) - .append(" for key=") + builder.append("DebugCacheListener: Received ").append(event.getOperation()).append(" for key=") .append(event.getKey()); if (event.getNewValue() != null) { builder.append("; value=").append(event.getNewValue()); @@ -53,8 +49,7 @@ public class DebugCacheListener extends CacheListenerAdapter implements Declarab event.getRegion().getCache().getLogger().info(builder.toString()); } - public void init(Properties p) { - } + public void init(Properties p) {} public boolean equals(Object obj) { // This method is only implemented so that RegionCreator.validateRegion works properly. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ModuleStatistics.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ModuleStatistics.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ModuleStatistics.java index 1c41ec9..6f276c4 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ModuleStatistics.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ModuleStatistics.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.util; import org.apache.geode.StatisticDescriptor; @@ -41,10 +39,14 @@ public class ModuleStatistics { static { StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton(); type = f.createType("pluginStats", "statistics for hibernate plugin and hibernate L2 cache", - new StatisticDescriptor[]{f.createLongCounter("cacheHits", "number of times an entity was found in L2 cache", - "count"), f.createLongCounter("cacheMisses", "number of times an entity was NOT found in l2 cache", - "count"), f.createLongCounter("hibernateEntityDestroyJobsScheduled", - "number of entities scheduled for destroy because of version conflict with a remote member", "jobs")}); + new StatisticDescriptor[] { + f.createLongCounter("cacheHits", "number of times an entity was found in L2 cache", + "count"), + f.createLongCounter("cacheMisses", + "number of times an entity was NOT found in l2 cache", "count"), + f.createLongCounter("hibernateEntityDestroyJobsScheduled", + "number of entities scheduled for destroy because of version conflict with a remote member", + "jobs")}); cacheHitsId = type.nameToId("cacheHits"); cacheMissesId = type.nameToId("cacheMisses"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfiguration.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfiguration.java index f8825d2..e20421a 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfiguration.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfiguration.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.util; import org.apache.geode.DataSerializable; @@ -28,8 +26,8 @@ import java.io.IOException; import java.io.InputStream; /** - * Class <code>RegionConfiguration</code> encapsulates the configuration attributes for a <code>Region</code> to be - * created on the server. + * Class <code>RegionConfiguration</code> encapsulates the configuration attributes for a + * <code>Region</code> to be created on the server. * * @since GemFire 6.5 */ @@ -82,16 +80,15 @@ public class RegionConfiguration implements DataSerializable { private boolean enableSessionExpirationCacheListener = false; /** - * name for the CacheWriter to be associated with this region. This cache writer must have a zero arg constructor and - * must be present on the classpath on the server. + * name for the CacheWriter to be associated with this region. This cache writer must have a zero + * arg constructor and must be present on the classpath on the server. */ private String cacheWriterName; /** * Default constructor used by the <code>DataSerialiable</code> interface */ - public RegionConfiguration() { - } + public RegionConfiguration() {} /** * Sets the name of the <code>Region</code> to be created @@ -168,7 +165,8 @@ public class RegionConfiguration implements DataSerializable { /** * Enables/disables delta replication across a <code>Gateway</code>. * - * @param enableGatewayDeltaReplication true to enable, false to disable gateway delta replication. + * @param enableGatewayDeltaReplication true to enable, false to disable gateway delta + * replication. */ public void setEnableGatewayDeltaReplication(boolean enableGatewayDeltaReplication) { this.enableGatewayDeltaReplication = enableGatewayDeltaReplication; @@ -269,30 +267,21 @@ public class RegionConfiguration implements DataSerializable { } public String toString() { - return new StringBuilder().append("RegionConfiguration[") - .append("regionName=") - .append(this.regionName) - .append("; regionAttributesId=") - .append(this.regionAttributesId) - .append("; maxInactiveInterval=") - .append(this.maxInactiveInterval) - .append("; enableGatewayDeltaReplication=") - .append(this.enableGatewayDeltaReplication) - .append("; enableGatewayReplication=") - .append(this.enableGatewayReplication) - .append("; enableDebugListener=") - .append(this.enableDebugListener) + return new StringBuilder().append("RegionConfiguration[").append("regionName=") + .append(this.regionName).append("; regionAttributesId=").append(this.regionAttributesId) + .append("; maxInactiveInterval=").append(this.maxInactiveInterval) + .append("; enableGatewayDeltaReplication=").append(this.enableGatewayDeltaReplication) + .append("; enableGatewayReplication=").append(this.enableGatewayReplication) + .append("; enableDebugListener=").append(this.enableDebugListener) .append("; enableSessionExpirationCacheListener=") - .append(this.enableSessionExpirationCacheListener) - .append("; cacheWriter=") - .append(this.cacheWriterName) - .append("]") - .toString(); + .append(this.enableSessionExpirationCacheListener).append("; cacheWriter=") + .append(this.cacheWriterName).append("]").toString(); } /** - * set the fully qualified name of the {@link CacheWriter} to be created on the server. The cacheWriter must have a - * zero arg constructor, and must be present on the classpath on the server. + * set the fully qualified name of the {@link CacheWriter} to be created on the server. The + * cacheWriter must have a zero arg constructor, and must be present on the classpath on the + * server. * * @param cacheWriterName fully qualified class name of the cacheWriter */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfigurationCacheListener.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfigurationCacheListener.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfigurationCacheListener.java index c05d9d6..e756533 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfigurationCacheListener.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionConfigurationCacheListener.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.util; import org.apache.geode.cache.Cache; @@ -27,7 +25,8 @@ import org.apache.geode.cache.util.CacheListenerAdapter; import java.util.Properties; -public class RegionConfigurationCacheListener extends CacheListenerAdapter<String, RegionConfiguration> implements Declarable { +public class RegionConfigurationCacheListener + extends CacheListenerAdapter<String, RegionConfiguration> implements Declarable { private Cache cache; @@ -38,7 +37,8 @@ public class RegionConfigurationCacheListener extends CacheListenerAdapter<Strin public void afterCreate(EntryEvent<String, RegionConfiguration> event) { RegionConfiguration configuration = event.getNewValue(); if (this.cache.getLogger().fineEnabled()) { - this.cache.getLogger().fine("RegionConfigurationCacheListener received afterCreate for region " + event.getKey()); + this.cache.getLogger().fine( + "RegionConfigurationCacheListener received afterCreate for region " + event.getKey()); } // Create region // this is a replicate region, and many VMs can be doing create region @@ -69,18 +69,14 @@ public class RegionConfigurationCacheListener extends CacheListenerAdapter<Strin builder1 = new StringBuilder(); int regionSize = region.size(); if (regionSize > 0) { - builder1.append("RegionConfigurationCacheListener region ") - .append(region.getName()) - .append(" has been initialized with the following ") - .append(regionSize) + builder1.append("RegionConfigurationCacheListener region ").append(region.getName()) + .append(" has been initialized with the following ").append(regionSize) .append(" region configurations:\n"); builder2 = new StringBuilder(); builder2.append("RegionConfigurationCacheListener created the following ") - .append(regionSize) - .append(" regions:\n"); + .append(regionSize).append(" regions:\n"); } else { - builder1.append("RegionConfigurationCacheListener region ") - .append(region.getName()) + builder1.append("RegionConfigurationCacheListener region ").append(region.getName()) .append(" has been initialized with no region configurations"); } } @@ -109,6 +105,5 @@ public class RegionConfigurationCacheListener extends CacheListenerAdapter<Strin } } - public void init(Properties p) { - } + public void init(Properties p) {} } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java index dc338a1..0743bea 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionHelper.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.util; import org.apache.geode.cache.AttributesFactory; @@ -67,24 +65,24 @@ public class RegionHelper { // Create region attributes creation on existing region attributes. // The RAC is created to execute the sameAs method. - RegionAttributesCreation existingRACreation = new RegionAttributesCreation(existingAttributes, false); + RegionAttributesCreation existingRACreation = + new RegionAttributesCreation(existingAttributes, false); // Create requested region attributes RegionAttributes requestedRegionAttributes = getRegionAttributes(cache, configuration); - // Compare the two region attributes. This method either returns true or throws a RuntimeException. + // Compare the two region attributes. This method either returns true or throws a + // RuntimeException. existingRACreation.sameAs(requestedRegionAttributes); } - public static RebalanceResults rebalanceRegion(Region region) throws CancellationException, InterruptedException { + public static RebalanceResults rebalanceRegion(Region region) + throws CancellationException, InterruptedException { String regionName = region.getName(); // FilterByName only looks at name and not full path if (!PartitionRegionHelper.isPartitionedRegion(region)) { StringBuilder builder = new StringBuilder(); - builder.append("Region ") - .append(regionName) - .append(" is not partitioned. Instead, it is ") - .append(region.getAttributes().getDataPolicy()) - .append(". It can't be rebalanced."); + builder.append("Region ").append(regionName).append(" is not partitioned. Instead, it is ") + .append(region.getAttributes().getDataPolicy()).append(". It can't be rebalanced."); throw new IllegalArgumentException(builder.toString()); } @@ -100,7 +98,8 @@ public class RegionHelper { return rebalanceOperation.getResults(); } - public static RebalanceResults rebalanceCache(GemFireCache cache) throws CancellationException, InterruptedException { + public static RebalanceResults rebalanceCache(GemFireCache cache) + throws CancellationException, InterruptedException { ResourceManager resourceManager = cache.getResourceManager(); RebalanceFactory rebalanceFactory = resourceManager.createRebalanceFactory(); RebalanceOperation rebalanceOperation = rebalanceFactory.start(); @@ -119,9 +118,11 @@ public class RegionHelper { } } - private static RegionAttributes getRegionAttributes(Cache cache, RegionConfiguration configuration) { + private static RegionAttributes getRegionAttributes(Cache cache, + RegionConfiguration configuration) { // Create the requested attributes - RegionAttributes baseRequestedAttributes = cache.getRegionAttributes(configuration.getRegionAttributesId()); + RegionAttributes baseRequestedAttributes = + cache.getRegionAttributes(configuration.getRegionAttributesId()); if (baseRequestedAttributes == null) { throw new IllegalArgumentException( "No region attributes named " + configuration.getRegionAttributesId() + " are defined."); @@ -133,7 +134,8 @@ public class RegionHelper { if (maxInactiveInterval != RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL) { requestedFactory.setStatisticsEnabled(true); if (configuration.getCustomExpiry() == null) { - requestedFactory.setEntryIdleTimeout(new ExpirationAttributes(maxInactiveInterval, ExpirationAction.DESTROY)); + requestedFactory.setEntryIdleTimeout( + new ExpirationAttributes(maxInactiveInterval, ExpirationAction.DESTROY)); } else { requestedFactory.setCustomEntryIdleTimeout(configuration.getCustomExpiry()); } @@ -147,7 +149,7 @@ public class RegionHelper { // Enable gateway replication if necessary // TODO: Disabled for WAN -// requestedFactory.setEnableGateway(configuration.getEnableGatewayReplication()); + // requestedFactory.setEnableGateway(configuration.getEnableGatewayReplication()); // Add the debug cache listener if necessary if (configuration.getEnableDebugListener()) { @@ -161,7 +163,8 @@ public class RegionHelper { // Add the cacheWriter if necessary if (configuration.getCacheWriterName() != null) { try { - CacheWriter writer = (CacheWriter) Class.forName(configuration.getCacheWriterName()).newInstance(); + CacheWriter writer = + (CacheWriter) Class.forName(configuration.getCacheWriterName()).newInstance(); requestedFactory.setCacheWriter(writer); } catch (InstantiationException e) { throw new RuntimeException("Could not set a cacheWriter for the region", e); @@ -174,8 +177,7 @@ public class RegionHelper { return requestedFactory.create(); } - private RegionHelper() { - } + private RegionHelper() {} public static String getRebalanceResultsMessage(RebalanceResults results) { StringBuilder builder = new StringBuilder(); @@ -184,58 +186,42 @@ public class RegionHelper { fillInRebalanceResultsSummary(builder, rebalanceInfo); // Log the 'Before' results - fillInRebalanceResultsMemberDetails(builder, rebalanceInfo.getPartitionMemberDetailsBefore(), "Before"); + fillInRebalanceResultsMemberDetails(builder, rebalanceInfo.getPartitionMemberDetailsBefore(), + "Before"); // Log the 'After' results - fillInRebalanceResultsMemberDetails(builder, rebalanceInfo.getPartitionMemberDetailsAfter(), "After"); + fillInRebalanceResultsMemberDetails(builder, rebalanceInfo.getPartitionMemberDetailsAfter(), + "After"); } return builder.toString(); } - private static void fillInRebalanceResultsSummary(StringBuilder builder, PartitionRebalanceInfo rebalanceInfo) { - builder.append("\nRebalanced region ") - .append(rebalanceInfo.getRegionPath()) - .append(" in ") - .append(rebalanceInfo.getTime()) - .append(" ms") - - .append("\nCreated ") - .append(rebalanceInfo.getBucketCreatesCompleted()) - .append(" buckets containing ") - .append(rebalanceInfo.getBucketCreateBytes()) - .append(" bytes in ") - .append(rebalanceInfo.getBucketCreateTime()) - .append(" ms") - - .append("\nTransferred ") - .append(rebalanceInfo.getBucketTransfersCompleted()) - .append(" buckets containing ") - .append(rebalanceInfo.getBucketTransferBytes()) - .append(" bytes in ") - .append(rebalanceInfo.getBucketTransferTime()) - .append(" ms") - - .append("\nTransferred ") - .append(rebalanceInfo.getPrimaryTransfersCompleted()) - .append(" primary buckets in ") - .append(rebalanceInfo.getPrimaryTransferTime()) + private static void fillInRebalanceResultsSummary(StringBuilder builder, + PartitionRebalanceInfo rebalanceInfo) { + builder.append("\nRebalanced region ").append(rebalanceInfo.getRegionPath()).append(" in ") + .append(rebalanceInfo.getTime()).append(" ms") + + .append("\nCreated ").append(rebalanceInfo.getBucketCreatesCompleted()) + .append(" buckets containing ").append(rebalanceInfo.getBucketCreateBytes()) + .append(" bytes in ").append(rebalanceInfo.getBucketCreateTime()).append(" ms") + + .append("\nTransferred ").append(rebalanceInfo.getBucketTransfersCompleted()) + .append(" buckets containing ").append(rebalanceInfo.getBucketTransferBytes()) + .append(" bytes in ").append(rebalanceInfo.getBucketTransferTime()).append(" ms") + + .append("\nTransferred ").append(rebalanceInfo.getPrimaryTransfersCompleted()) + .append(" primary buckets in ").append(rebalanceInfo.getPrimaryTransferTime()) .append(" ms"); } - private static void fillInRebalanceResultsMemberDetails(StringBuilder builder, Set<PartitionMemberInfo> memberInfoSet, - String when) { + private static void fillInRebalanceResultsMemberDetails(StringBuilder builder, + Set<PartitionMemberInfo> memberInfoSet, String when) { builder.append("\nMember Info ").append(when).append(" Rebalance:\n"); for (PartitionMemberInfo info : memberInfoSet) { - builder.append("\tdistributedMember=") - .append(info.getDistributedMember()) - .append(", configuredMaxMemory=") - .append(info.getConfiguredMaxMemory()) - .append(", size=") - .append(info.getSize()) - .append(", bucketCount=") - .append(info.getBucketCount()) - .append(", primaryCount=") - .append(info.getPrimaryCount()); + builder.append("\tdistributedMember=").append(info.getDistributedMember()) + .append(", configuredMaxMemory=").append(info.getConfiguredMaxMemory()).append(", size=") + .append(info.getSize()).append(", bucketCount=").append(info.getBucketCount()) + .append(", primaryCount=").append(info.getPrimaryCount()); } } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionSizeFunction.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionSizeFunction.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionSizeFunction.java index 5cad86c..bedfcba 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionSizeFunction.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionSizeFunction.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.util; import org.apache.geode.cache.Declarable; @@ -51,6 +49,5 @@ public class RegionSizeFunction implements Function, Declarable { } @Override - public void init(Properties arg0) { - } + public void init(Properties arg0) {} } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionStatus.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionStatus.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionStatus.java index d539a5c..f7e33bc 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionStatus.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/RegionStatus.java @@ -1,18 +1,16 @@ /* - * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. + * 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.util; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java index bf39bb2..d3e5f18 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.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.util; import org.apache.geode.cache.GemFireCache; @@ -53,7 +51,8 @@ public class ResourceManagerValidator { } } - private static void validateSunArguments(GemFireCache cache, ResourceManager rm, List<String> inputArguments) { + private static void validateSunArguments(GemFireCache cache, ResourceManager rm, + List<String> inputArguments) { // Retrieve the -Xms, -Xmx, UseConcMarkSweepGC and CMSInitiatingOccupancyFraction arguments String dashXms = null, dashXmx = null, useCMS = null, cmsIOF = null; for (String argument : inputArguments) { @@ -69,15 +68,9 @@ public class ResourceManagerValidator { } if (cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("Relevant input java arguments: ") - .append("dashXms=") - .append(dashXms) - .append("; dashXmx=") - .append(dashXmx) - .append("; useCMS=") - .append(useCMS) - .append("; cmsIOF=") - .append(cmsIOF); + builder.append("Relevant input java arguments: ").append("dashXms=").append(dashXms) + .append("; dashXmx=").append(dashXmx).append("; useCMS=").append(useCMS) + .append("; cmsIOF=").append(cmsIOF); cache.getLogger().fine(builder.toString()); } @@ -91,15 +84,14 @@ public class ResourceManagerValidator { verifyCMSInitiatingOccupancyFraction(cache, rm, cmsIOF); } - private static void validateJavaHeapParameters(GemFireCache cache, String dashXms, String dashXmx) { + private static void validateJavaHeapParameters(GemFireCache cache, String dashXms, + String dashXmx) { if (dashXms == null) { - cache.getLogger() - .warning( - "Setting the initial size of the heap (configured using -Xms) is recommended so that GemFire cache eviction is optimal"); + cache.getLogger().warning( + "Setting the initial size of the heap (configured using -Xms) is recommended so that GemFire cache eviction is optimal"); } else if (dashXmx == null) { - cache.getLogger() - .warning( - "Setting the maximum size of the heap (configured using -Xmx) is recommended so that GemFire cache eviction is optimal"); + cache.getLogger().warning( + "Setting the maximum size of the heap (configured using -Xmx) is recommended so that GemFire cache eviction is optimal"); } else { // Neither heap parameter is null. Parse them and verify they are the same. List<String> dashXmsList = splitAtDigits(dashXms); @@ -108,13 +100,9 @@ public class ResourceManagerValidator { String dashXmxStr = dashXmxList.get(1); if (!dashXmsStr.equals(dashXmxStr)) { StringBuilder builder = new StringBuilder(); - builder.append("Setting the initial (") - .append(dashXmsStr) - .append(dashXmsList.get(2)) - .append(") and maximum (") - .append(dashXmxStr) - .append(dashXmxList.get(2)) - .append(") sizes of the heap the same is recommended so that GemFire cache eviction is optimal"); + builder.append("Setting the initial (").append(dashXmsStr).append(dashXmsList.get(2)) + .append(") and maximum (").append(dashXmxStr).append(dashXmxList.get(2)).append( + ") sizes of the heap the same is recommended so that GemFire cache eviction is optimal"); cache.getLogger().warning(builder.toString()); } } @@ -122,31 +110,33 @@ public class ResourceManagerValidator { private static void verifyCMSGC(GemFireCache cache, String useCMS) { if (useCMS == null) { - cache.getLogger() - .warning( - "Using the concurrent garbage collector (configured using -XX:+UseConcMarkSweepGC) is recommended so that GemFire cache eviction is optimal"); + cache.getLogger().warning( + "Using the concurrent garbage collector (configured using -XX:+UseConcMarkSweepGC) is recommended so that GemFire cache eviction is optimal"); } } - private static void verifyCMSInitiatingOccupancyFraction(GemFireCache cache, ResourceManager rm, String cmsIOF) { + private static void verifyCMSInitiatingOccupancyFraction(GemFireCache cache, ResourceManager rm, + String cmsIOF) { if (cmsIOF == null) { - cache.getLogger() - .warning( - "Setting the CMS initiating occupancy fraction (configured using -XX:CMSInitiatingOccupancyFraction=N) is recommended so that GemFire cache eviction is optimal"); + cache.getLogger().warning( + "Setting the CMS initiating occupancy fraction (configured using -XX:CMSInitiatingOccupancyFraction=N) is recommended so that GemFire cache eviction is optimal"); } else { - // Parse the CMSInitiatingOccupancyFraction. Verify it is less than both eviction and critical thresholds. + // Parse the CMSInitiatingOccupancyFraction. Verify it is less than both eviction and critical + // thresholds. int cmsIOFVal = Integer.parseInt(cmsIOF.split("=")[1]); float currentEvictionHeapPercentage = rm.getEvictionHeapPercentage(); if (currentEvictionHeapPercentage != 0 && currentEvictionHeapPercentage < cmsIOFVal) { cache.getLogger() - .warning( - "Setting the CMS initiating occupancy fraction (" + cmsIOFVal + ") less than the eviction heap percentage (" + currentEvictionHeapPercentage + ") is recommended so that GemFire cache eviction is optimal"); + .warning("Setting the CMS initiating occupancy fraction (" + cmsIOFVal + + ") less than the eviction heap percentage (" + currentEvictionHeapPercentage + + ") is recommended so that GemFire cache eviction is optimal"); } float currentCriticalHeapPercentage = rm.getCriticalHeapPercentage(); if (currentCriticalHeapPercentage != 0 && currentCriticalHeapPercentage < cmsIOFVal) { cache.getLogger() - .warning( - "Setting the CMS initiating occupancy fraction (" + cmsIOFVal + ") less than the critical heap percentage (" + currentCriticalHeapPercentage + ") is recommended so that GemFire cache eviction is optimal"); + .warning("Setting the CMS initiating occupancy fraction (" + cmsIOFVal + + ") less than the critical heap percentage (" + currentCriticalHeapPercentage + + ") is recommended so that GemFire cache eviction is optimal"); } } } @@ -160,7 +150,6 @@ public class ResourceManagerValidator { return result; } - private ResourceManagerValidator() { - } + private ResourceManagerValidator() {} } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/SessionCustomExpiry.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/SessionCustomExpiry.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/SessionCustomExpiry.java index 2e6b3cf..fd1e5b2 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/SessionCustomExpiry.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/SessionCustomExpiry.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.util; import org.apache.geode.cache.CustomExpiry; @@ -27,26 +25,27 @@ import java.io.Serializable; import java.util.Properties; @SuppressWarnings("serial") -public class SessionCustomExpiry implements CustomExpiry<String, HttpSession>, Serializable, Declarable { +public class SessionCustomExpiry + implements CustomExpiry<String, HttpSession>, Serializable, Declarable { private static final long serialVersionUID = 182735509690640051L; - private static final ExpirationAttributes EXPIRE_NOW = new ExpirationAttributes(1, ExpirationAction.DESTROY); + private static final ExpirationAttributes EXPIRE_NOW = + new ExpirationAttributes(1, ExpirationAction.DESTROY); public ExpirationAttributes getExpiry(Region.Entry<String, HttpSession> entry) { HttpSession session = entry.getValue(); if (session != null) { - return new ExpirationAttributes(entry.getValue().getMaxInactiveInterval(), ExpirationAction.DESTROY); + return new ExpirationAttributes(entry.getValue().getMaxInactiveInterval(), + ExpirationAction.DESTROY); } else { return EXPIRE_NOW; } } - public void close() { - } + public void close() {} - public void init(Properties props) { - } + public void init(Properties props) {} public boolean equals(Object obj) { // This method is only implemented so that RegionCreator.validateRegion works properly. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchPartitionedRegionEntriesFunction.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchPartitionedRegionEntriesFunction.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchPartitionedRegionEntriesFunction.java index ab630a2..9a3f5aa 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchPartitionedRegionEntriesFunction.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchPartitionedRegionEntriesFunction.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.util; import org.apache.geode.cache.Cache; @@ -58,12 +56,8 @@ public class TouchPartitionedRegionEntriesFunction implements Function, Declarab if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("Function ") - .append(ID) - .append(" received request to touch ") - .append(primaryDataSet.getFullPath()) - .append("->") - .append(keys); + builder.append("Function ").append(ID).append(" received request to touch ") + .append(primaryDataSet.getFullPath()).append("->").append(keys); this.cache.getLogger().fine(builder.toString()); } @@ -93,7 +87,6 @@ public class TouchPartitionedRegionEntriesFunction implements Function, Declarab return true; } - public void init(Properties properties) { - } + public void init(Properties properties) {} } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchReplicatedRegionEntriesFunction.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchReplicatedRegionEntriesFunction.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchReplicatedRegionEntriesFunction.java index f3bb294..3d2a037 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchReplicatedRegionEntriesFunction.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/TouchReplicatedRegionEntriesFunction.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.util; import org.apache.geode.cache.Cache; @@ -27,8 +25,8 @@ import java.util.Properties; import java.util.Set; /** - * Touches the keys contained in the set of keys by performing a get on the replicated region. This is a non-data-aware - * function invoked using onMembers or onServers. + * Touches the keys contained in the set of keys by performing a get on the replicated region. This + * is a non-data-aware function invoked using onMembers or onServers. * */ public class TouchReplicatedRegionEntriesFunction implements Function, Declarable { @@ -53,12 +51,8 @@ public class TouchReplicatedRegionEntriesFunction implements Function, Declarabl Set<String> keys = (Set<String>) arguments[1]; if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); - builder.append("Function ") - .append(ID) - .append(" received request to touch ") - .append(regionName) - .append("->") - .append(keys); + builder.append("Function ").append(ID).append(" received request to touch ") + .append(regionName).append("->").append(keys); this.cache.getLogger().fine(builder.toString()); } @@ -90,7 +84,6 @@ public class TouchReplicatedRegionEntriesFunction implements Function, Declarabl return true; } - public void init(Properties properties) { - } + public void init(Properties properties) {} } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Callback.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Callback.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Callback.java index 4b04b56..46b4a25 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Callback.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Callback.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 javax.servlet.ServletException; @@ -26,5 +24,6 @@ import java.io.IOException; */ public interface Callback { - public void call(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; + public void call(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java index 89e8d8d..3fede62 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.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; @@ -42,7 +40,8 @@ public class CommandServlet extends HttpServlet { * @throws IOException */ @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { QueryCommand cmd = QueryCommand.UNKNOWN; String param = request.getParameter("param"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat.java index 9ba4d8f..7f04e8b 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/EmbeddedTomcat.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 org.apache.geode.modules.session.catalina.JvmRouteBinderValve; @@ -71,7 +69,8 @@ public class EmbeddedTomcat { */ private String webappDir = ""; - public EmbeddedTomcat(String contextPath, int port, String jvmRoute) throws MalformedURLException { + public EmbeddedTomcat(String contextPath, int port, String jvmRoute) + throws MalformedURLException { this.contextPath = contextPath; this.port = port; @@ -148,7 +147,8 @@ public class EmbeddedTomcat { } } - 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); @@ -158,7 +158,7 @@ public class EmbeddedTomcat { 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/src/test/java/org/apache/geode/modules/session/QueryCommand.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java index 81d5301..2b89e68 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java @@ -1,18 +1,16 @@ /* - * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. + * 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; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java index d0c4b19..d7674dd 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.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.*; @@ -72,8 +70,8 @@ public abstract class TestSessionsBase { 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(); } @@ -107,8 +105,9 @@ public abstract class TestSessionsBase { } /** - * 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 { @@ -116,7 +115,8 @@ public abstract class TestSessionsBase { 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); } @@ -141,7 +141,8 @@ public abstract class TestSessionsBase { 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())); } @@ -162,7 +163,8 @@ public abstract class TestSessionsBase { } /** - * 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 { @@ -251,13 +253,14 @@ public abstract class TestSessionsBase { } /** - * 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()); @@ -343,7 +346,8 @@ public abstract class TestSessionsBase { } /** - * 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 { @@ -351,7 +355,8 @@ public abstract class TestSessionsBase { 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)); @@ -380,7 +385,8 @@ public abstract class TestSessionsBase { 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"); @@ -406,7 +412,8 @@ public abstract class TestSessionsBase { 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"); } @@ -426,13 +433,15 @@ public abstract class TestSessionsBase { } /** - * 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); @@ -460,7 +469,8 @@ public abstract class TestSessionsBase { Long lastAccess = (Long) session.getAttribute("lastAccessTime"); assertTrue( - "Last access time not set correctly: " + lastAccess.longValue() + " not <= " + 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/src/test/java/org/apache/geode/modules/session/Tomcat6SessionsJUnitTest.java ---------------------------------------------------------------------- diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Tomcat6SessionsJUnitTest.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Tomcat6SessionsJUnitTest.java index 1a9c715..cdcd2a3 100644 --- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Tomcat6SessionsJUnitTest.java +++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/Tomcat6SessionsJUnitTest.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 org.apache.geode.modules.session.catalina.Tomcat6DeltaSessionManager;