GEODE-2632: cleanup GemFireCacheImpl * change SecurityService from static constant to final member field * fix typos and javadocs * narrow scope of constants, variables, methods * remove deadcode and useless comments/javadocs * fix misc IntelliJ warnings * add @Override annotations * improve some variable names * fix (some) generics and types * add TODOs for a couple problem areas that need further fixing
Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/e2ba3081 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/e2ba3081 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/e2ba3081 Branch: refs/heads/feature/GEM-1299 Commit: e2ba30815da615a80fca951ab7e56773b0a0d1da Parents: 6f33bbc Author: Kirk Lund <[email protected]> Authored: Mon Apr 24 10:38:37 2017 -0700 Committer: zhouxh <[email protected]> Committed: Wed Apr 26 23:28:49 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/geode/CancelCriterion.java | 23 +- .../main/java/org/apache/geode/cache/Cache.java | 132 +- .../geode/cache/client/internal/ProxyCache.java | 18 +- .../org/apache/geode/cache/query/Query.java | 1 + .../cache/query/internal/QueryMonitor.java | 6 +- .../apache/geode/distributed/internal/DM.java | 5 +- .../internal/DistributionManager.java | 2 +- .../internal/InternalDistributedSystem.java | 7 +- .../internal/LonerDistributionManager.java | 5 + .../geode/internal/cache/DiskStoreImpl.java | 2 +- .../geode/internal/cache/DistTXState.java | 6 +- .../geode/internal/cache/GemFireCacheImpl.java | 2509 ++++++++---------- .../geode/internal/cache/InternalCache.java | 4 +- .../geode/internal/cache/LocalRegion.java | 4 +- .../util/FindRestEnabledServersFunction.java | 8 +- .../persistence/PersistenceAdvisorImpl.java | 8 +- .../internal/cache/xmlcache/CacheCreation.java | 2 +- .../internal/beans/MemberMBeanBridge.java | 13 +- .../test/java/org/apache/geode/TXJUnitTest.java | 844 +++--- .../java/org/apache/geode/TXWriterTestCase.java | 67 +- .../dunit/QueryIndexUsingXMLDUnitTest.java | 1001 +++---- ...esourceManagerWithQueryMonitorDUnitTest.java | 11 +- .../NewDeclarativeIndexCreationJUnitTest.java | 185 +- .../geode/cache30/CacheXml66DUnitTest.java | 7 +- .../geode/disttx/DistTXDebugDUnitTest.java | 98 +- .../apache/geode/disttx/DistTXJUnitTest.java | 37 +- .../disttx/DistTXPersistentDebugDUnitTest.java | 15 +- .../geode/disttx/DistTXWriterJUnitTest.java | 37 +- .../geode/disttx/DistTXWriterOOMEJUnitTest.java | 39 +- .../disttx/DistributedTransactionDUnitTest.java | 9 +- .../apache/geode/disttx/PRDistTXJUnitTest.java | 25 +- .../geode/internal/cache/PRTXJUnitTest.java | 106 +- .../ParallelQueueRemovalMessageJUnitTest.java | 106 +- .../cache/internal/JUnit4CacheTestCase.java | 5 +- .../dunit/internal/DistributedTestFixture.java | 3 +- .../tests/GetDefaultDiskStoreNameDUnitTest.java | 2 +- .../JUnit4GetDefaultDiskStoreNameDUnitTest.java | 2 +- .../geode/cache/query/dunit/IndexCreation.xml | 16 +- .../cache/query/internal/cq/CqServiceImpl.java | 2 +- .../query/dunit/QueryMonitorDUnitTest.java | 20 +- .../web/controllers/CommonCrudController.java | 4 +- 41 files changed, 2451 insertions(+), 2945 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/CancelCriterion.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java index e4f9a41..fec3827 100644 --- a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java +++ b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java @@ -22,20 +22,20 @@ package org.apache.geode; * * Code inside the service can check to see if the service is cancelled by calling * {@link #checkCancelInProgress(Throwable)}. Generally the pattern is to check before performing an - * operation, check if the service is canceled before propgrating an exception futher up the stack, - * and check for cancelation inside a long loop. Eg. + * operation, check if the service is canceled before propagating an exception further up the stack, + * and check for cancellation inside a long loop. Eg. * - * <code> - * while(true) { + * <pre> + * while (true) { * c.checkCancelInProgress(null); * try { - * dispatchEvents(); - * } catch(IOException e) { + * dispatchEvents(); + * } catch (IOException e) { * c.checkCancelInProgress(e); * throw e; * } * } - * </code> + * </pre> * * @see CancelException * @since GemFire 5.1 @@ -51,10 +51,6 @@ public abstract class CancelCriterion { * exception indicating the service is shut down. */ public abstract String cancelInProgress(); - // import org.apache.geode.distributed.internal.DistributionManager; - // * <p> - // * In particular, a {@link DistributionManager} returns a non-null result if - // * message distribution has been terminated. /** * Use this utility function in your implementation of cancelInProgress() and cancelled() to @@ -95,11 +91,11 @@ public abstract class CancelCriterion { * This method should wrap the exception in a service specific CancelationException (eg * CacheClosedException). or return null if the service is not being canceled. * - * @param e an underlying exception, if any + * @param throwable an underlying exception, if any * @return RuntimeException to be thrown by checkCancelInProgress(), null if the receiver has not * been cancelled. */ - abstract public RuntimeException generateCancelledException(Throwable e); + public abstract RuntimeException generateCancelledException(Throwable throwable); /** * Checks to see if a cancellation is in progress. This is equivalent to the expression @@ -111,5 +107,4 @@ public abstract class CancelCriterion { return cancelInProgress() != null; } - } http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/cache/Cache.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/Cache.java b/geode-core/src/main/java/org/apache/geode/cache/Cache.java index bc4aa19..66a3cd8 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/Cache.java +++ b/geode-core/src/main/java/org/apache/geode/cache/Cache.java @@ -12,7 +12,6 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ - package org.apache.geode.cache; import java.util.List; @@ -34,7 +33,6 @@ import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.i18n.LogWriterI18n; - /** * Caches are obtained from the {@link CacheFactory#create()} method. See {@link CacheFactory} for * common usage patterns for creating the cache instance. @@ -43,17 +41,15 @@ import org.apache.geode.i18n.LogWriterI18n; * where to find other caches on the network and how to communicate with them. The system can also * specify a <a href="../distribution/DistributedSystem.html#cache-xml-file">"cache-xml-file"</a> * property which will cause this cache to be initialized with the contents of that file. The - * contents must comply with the <code>"doc-files/cache8_0.dtd"</code> file and the top level - * element must be a <code>cache</code> element. + * contents must comply with the {@code "doc-files/cache8_0.dtd"} file and the top level element + * must be a {@code cache} element. * <p> * When a cache will no longer be used it should be {@link #close() closed}. Once it * {@link #isClosed is closed} any attempt to use it or any {@link Region} obtained from it will * cause a {@link CacheClosedException} to be thrown. - * * <p> * A cache can have multiple root regions, each with a different name. * - * * @since GemFire 2.0 */ @SuppressWarnings("deprecation") @@ -63,13 +59,13 @@ public interface Cache extends GemFireCache { * region in the cache. After this cache is closed, any further method call on this cache or any * region object will throw {@link CacheClosedException}, unless otherwise noted. * - * @param keepalive whether the server should keep the durable client's queues alive for the + * @param keepAlive whether the server should keep the durable client's queues alive for the * timeout period * @throws CacheClosedException if the cache is already closed. * @deprecated as of 6.5 use {@link ClientCache#close(boolean)} instead. */ @Deprecated - public void close(boolean keepalive); + void close(boolean keepAlive); /** * Creates a VM region using the specified RegionAttributes. @@ -88,7 +84,7 @@ public interface Cache extends GemFireCache { * @deprecated as of GemFire 5.0, use {@link #createRegion} instead. */ @Deprecated - public <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> aRegionAttributes) + <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> aRegionAttributes) throws RegionExistsException, TimeoutException; /** @@ -109,7 +105,7 @@ public interface Cache extends GemFireCache { * @deprecated as of 6.5 use {@link #createRegionFactory(RegionAttributes)} instead */ @Deprecated - public <K, V> Region<K, V> createRegion(String name, RegionAttributes<K, V> aRegionAttributes) + <K, V> Region<K, V> createRegion(String name, RegionAttributes<K, V> aRegionAttributes) throws RegionExistsException, TimeoutException; /** @@ -119,7 +115,7 @@ public interface Cache extends GemFireCache { * @see #createRegionFactory(RegionShortcut) * @since GemFire 6.5 */ - public <K, V> RegionFactory<K, V> createRegionFactory(); + <K, V> RegionFactory<K, V> createRegionFactory(); /** * Creates a {@link RegionFactory} for the most commonly used {@link Region} types defined by @@ -127,7 +123,7 @@ public interface Cache extends GemFireCache { * * @since GemFire 6.5 */ - public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut atts); + <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut shortcut); /** * Creates a {@link RegionFactory} for creating a {@link Region} from {@link RegionAttributes} @@ -137,7 +133,7 @@ public interface Cache extends GemFireCache { * @see #setRegionAttributes(String, RegionAttributes) * @since GemFire 6.5 */ - public <K, V> RegionFactory<K, V> createRegionFactory(String regionAttributesId); + <K, V> RegionFactory<K, V> createRegionFactory(String regionAttributesId); /** * Creates a {@link RegionFactory} for creating a {@link Region} from the given regionAttributes @@ -146,43 +142,43 @@ public interface Cache extends GemFireCache { * @see #createRegionFactory(RegionShortcut) * @since GemFire 6.5 */ - public <K, V> RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes); + <K, V> RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes); /** * Internal GemStone method for accessing the internationalized logging object for GemFire, use - * {@link #getLogger()} instead. This method does not throw <code>CacheClosedException</code> if - * the cache is closed. + * {@link #getLogger()} instead. This method does not throw {@code CacheClosedException} if the + * cache is closed. * * @return the logging object * @deprecated as of 6.5 use getLogger().convertToLogWriterI18n() instead */ @Deprecated - public LogWriterI18n getLoggerI18n(); + LogWriterI18n getLoggerI18n(); /** * Internal GemStone method for accessing the internationalized logging object for GemFire, use - * {@link #getSecurityLogger()} instead. This method does not throw - * <code>CacheClosedException</code> if the cache is closed. + * {@link #getSecurityLogger()} instead. This method does not throw {@code CacheClosedException} + * if the cache is closed. * * @return the security logging object * @deprecated as of 6.5 use getSecurityLogger().convertToLogWriterI18n() instead */ @Deprecated - public LogWriterI18n getSecurityLoggerI18n(); + LogWriterI18n getSecurityLoggerI18n(); /** * Gets the number of seconds a cache operation will wait to obtain a distributed lock lease. This - * method does not throw <code>CacheClosedException</code> if the cache is closed. + * method does not throw {@code CacheClosedException} if the cache is closed. */ - public int getLockTimeout(); + int getLockTimeout(); /** * Sets the number of seconds a cache operation may wait to obtain a distributed lock lease before * timing out. * - * @throws IllegalArgumentException if <code>seconds</code> is less than zero + * @throws IllegalArgumentException if {@code seconds} is less than zero */ - public void setLockTimeout(int seconds); + void setLockTimeout(int seconds); /** * Gets the frequency (in seconds) at which a message will be sent by the primary cache-server to @@ -191,45 +187,45 @@ public interface Cache extends GemFireCache { * * @return The time interval in seconds */ - public int getMessageSyncInterval(); + int getMessageSyncInterval(); /** * Sets the frequency (in seconds) at which a message will be sent by the primary cache-server * node to all the secondary cache-server nodes to remove the events which have already been * dispatched from the queue. * - * @param seconds - the time interval in seconds - * @throws IllegalArgumentException if <code>seconds</code> is less than zero + * @param seconds the time interval in seconds + * @throws IllegalArgumentException if {@code seconds} is less than zero */ - public void setMessageSyncInterval(int seconds); + void setMessageSyncInterval(int seconds); /** * Gets the length, in seconds, of distributed lock leases obtained by this cache. This method - * does not throw <code>CacheClosedException</code> if the cache is closed. + * does not throw {@code CacheClosedException} if the cache is closed. */ - public int getLockLease(); + int getLockLease(); /** * Sets the length, in seconds, of distributed lock leases obtained by this cache. * - * @throws IllegalArgumentException if <code>seconds</code> is less than zero. + * @throws IllegalArgumentException if {@code seconds} is less than zero. */ - public void setLockLease(int seconds); + void setLockLease(int seconds); /** * Gets the number of seconds a cache {@link org.apache.geode.cache.Region#get(Object) get} * operation can spend searching for a value before it times out. The search includes any time * spent loading the object. When the search times out it causes the get to fail by throwing an - * exception. This method does not throw <code>CacheClosedException</code> if the cache is closed. + * exception. This method does not throw {@code CacheClosedException} if the cache is closed. */ - public int getSearchTimeout(); + int getSearchTimeout(); /** * Sets the number of seconds a cache get operation can spend searching for a value. * - * @throws IllegalArgumentException if <code>seconds</code> is less than zero + * @throws IllegalArgumentException if {@code seconds} is less than zero */ - public void setSearchTimeout(int seconds); + void setSearchTimeout(int seconds); /** * Creates a new cache server, with the default configuration, that will allow clients to access @@ -242,17 +238,17 @@ public interface Cache extends GemFireCache { * * @since GemFire 5.7 */ - public CacheServer addCacheServer(); + CacheServer addCacheServer(); /** - * Returns a collection of all of the <code>CacheServer</code>s that can serve the contents of - * this <code>Cache</code> to clients. + * Returns a collection of all of the {@code CacheServer}s that can serve the contents of this + * {@code Cache} to clients. * * @see #addCacheServer * * @since GemFire 5.7 */ - public List<CacheServer> getCacheServers(); + List<CacheServer> getCacheServers(); /** * Adds a gateway event conflict resolution resolver. This is invoked if an event is processed @@ -262,27 +258,27 @@ public interface Cache extends GemFireCache { * event's distributed system ID is larger than that of the last event to modify the affected * entry. * - * @param resolver + * @param resolver gateway event conflict resolution resolver * @since GemFire 7.0 */ - public void setGatewayConflictResolver(GatewayConflictResolver resolver); + void setGatewayConflictResolver(GatewayConflictResolver resolver); /** * Returns the current gateway event conflict resolver * * @since GemFire 7.0 */ - public GatewayConflictResolver getGatewayConflictResolver(); + GatewayConflictResolver getGatewayConflictResolver(); /** - * Sets whether or not this <code>Cache</code> resides in a long-running "cache server" VM. A - * cache server may be an application VM or may be a stand-along VM launched using + * Sets whether or not this {@code Cache} resides in a long-running "cache server" VM. A cache + * server may be an application VM or may be a stand-along VM launched using * {@linkplain org.apache.geode.admin.AdminDistributedSystem#addCacheServer administration API} or - * the <code>cacheserver</code> command line utility. + * the {@code cacheserver} command line utility. * * @since GemFire 4.0 */ - public void setIsServer(boolean isServer); + void setIsServer(boolean isServer); /** * Returns whether or not this cache resides in a "cache server" VM. @@ -291,7 +287,7 @@ public interface Cache extends GemFireCache { * * @since GemFire 4.0 */ - public boolean isServer(); + boolean isServer(); /** * Notifies the server that this client is ready to receive updates. This method is used by @@ -309,7 +305,7 @@ public interface Cache extends GemFireCache { * @deprecated as of 6.5 use {@link ClientCache#readyForEvents} instead. */ @Deprecated - public void readyForEvents(); + void readyForEvents(); /** * Creates {@link GatewaySenderFactory} for creating a SerialGatewaySender @@ -317,7 +313,8 @@ public interface Cache extends GemFireCache { * @return SerialGatewaySenderFactory * @since GemFire 7.0 */ - public GatewaySenderFactory createGatewaySenderFactory(); + @Override + GatewaySenderFactory createGatewaySenderFactory(); /** * Creates {@link AsyncEventQueueFactory} for creating a AsyncEventQueue @@ -325,7 +322,7 @@ public interface Cache extends GemFireCache { * @return AsyncEventQueueFactory * @since GemFire 7.0 */ - public AsyncEventQueueFactory createAsyncEventQueueFactory(); + AsyncEventQueueFactory createAsyncEventQueueFactory(); /** * Creates {@link GatewayReceiverFactory} for creating a GatewayReceiver @@ -333,7 +330,7 @@ public interface Cache extends GemFireCache { * @return GatewayReceiverFactory * @since GemFire 7.0 */ - public GatewayReceiverFactory createGatewayReceiverFactory(); + GatewayReceiverFactory createGatewayReceiverFactory(); /** * Returns all {@link GatewaySender}s for this Cache. @@ -341,7 +338,7 @@ public interface Cache extends GemFireCache { * @return Set of GatewaySenders * @since GemFire 7.0 */ - public Set<GatewaySender> getGatewaySenders(); + Set<GatewaySender> getGatewaySenders(); /** * Returns the {@link GatewaySender} with the given id added to this Cache. @@ -349,7 +346,7 @@ public interface Cache extends GemFireCache { * @return GatewaySender with id * @since GemFire 7.0 */ - public GatewaySender getGatewaySender(String id); + GatewaySender getGatewaySender(String id); /** * Returns all {@link GatewayReceiver}s for this Cache @@ -357,7 +354,7 @@ public interface Cache extends GemFireCache { * @return Set of GatewaySenders * @since GemFire 7.0 */ - public Set<GatewayReceiver> getGatewayReceivers(); + Set<GatewayReceiver> getGatewayReceivers(); /** * Returns all {@link AsyncEventQueue}s for this Cache @@ -365,7 +362,7 @@ public interface Cache extends GemFireCache { * @return Set of AsyncEventQueue * @since GemFire 7.0 */ - public Set<AsyncEventQueue> getAsyncEventQueues(); + Set<AsyncEventQueue> getAsyncEventQueues(); /** * Returns the {@link AsyncEventQueue} with the given id added to this Cache. @@ -373,37 +370,37 @@ public interface Cache extends GemFireCache { * @return AsyncEventQueue with id * @since GemFire 7.0 */ - public AsyncEventQueue getAsyncEventQueue(String id); + AsyncEventQueue getAsyncEventQueue(String id); /** * Returns a set of the other non-administrative members in the distributed system. * * @since GemFire 6.6 */ - public Set<DistributedMember> getMembers(); + Set<DistributedMember> getMembers(); /** * Returns a set of the administrative members in the distributed system. * * @since GemFire 6.6 */ - public Set<DistributedMember> getAdminMembers(); + Set<DistributedMember> getAdminMembers(); /** * Returns a set of the members in the distributed system that have the given region. For regions * with local scope an empty set is returned. * - * @param r a Region in the cache + * @param region a Region in the cache * @since GemFire 6.6 */ - public Set<DistributedMember> getMembers(Region r); + Set<DistributedMember> getMembers(Region region); /** * Obtains the snapshot service to allow the cache data to be imported or exported. * * @return the snapshot service */ - public CacheSnapshotService getSnapshotService(); + CacheSnapshotService getSnapshotService(); /** * Test to see whether the Cache is in the process of reconnecting and recreating a new cache @@ -415,30 +412,29 @@ public interface Cache extends GemFireCache { * * @return true if the Cache is attempting to reconnect or has finished reconnecting */ - public boolean isReconnecting(); + boolean isReconnecting(); /** * Wait for the Cache to finish reconnecting to the distributed system and recreate a new Cache. * * @see #getReconnectedCache * @param time amount of time to wait, or -1 to wait forever - * @param units + * @param units time unit * @return true if the cache was reconnected * @throws InterruptedException if the thread is interrupted while waiting */ - public boolean waitUntilReconnected(long time, TimeUnit units) throws InterruptedException; + boolean waitUntilReconnected(long time, TimeUnit units) throws InterruptedException; /** * Force the Cache to stop reconnecting. If the Cache is currently connected this will disconnect * and close it. * */ - public void stopReconnecting(); + void stopReconnecting(); /** * Returns the new Cache if there was an auto-reconnect and the cache was recreated. */ - public Cache getReconnectedCache(); + Cache getReconnectedCache(); } - http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/cache/client/internal/ProxyCache.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ProxyCache.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ProxyCache.java index 76306f5..f4a8d5b 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ProxyCache.java +++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ProxyCache.java @@ -221,22 +221,16 @@ public class ProxyCache implements RegionService { return this.stopper; } - /* - * (non-Javadoc) - * - * @see org.apache.geode.cache.RegionService#rootRegions() - */ + @Override public Set<Region<?, ?>> rootRegions() { preOp(); - Set<Region<?, ?>> rRegions = new HashSet<Region<?, ?>>(); - Iterator<LocalRegion> it = this.cache.rootRegions().iterator(); - while (it.hasNext()) { - LocalRegion lr = it.next(); - if (!lr.getAttributes().getDataPolicy().withStorage()) { - rRegions.add(new ProxyRegion(this, lr)); + Set<Region<?, ?>> rootRegions = new HashSet<>(); + for (Region<?, ?> region : this.cache.rootRegions()) { + if (!region.getAttributes().getDataPolicy().withStorage()) { + rootRegions.add(new ProxyRegion(this, region)); } } - return Collections.unmodifiableSet(rRegions); + return Collections.unmodifiableSet(rootRegions); } public PdxInstanceFactory createPdxInstanceFactory(String className) { http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/cache/query/Query.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/Query.java b/geode-core/src/main/java/org/apache/geode/cache/query/Query.java index ade83a9..8a7b4a5 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/query/Query.java +++ b/geode-core/src/main/java/org/apache/geode/cache/query/Query.java @@ -16,6 +16,7 @@ package org.apache.geode.cache.query; import org.apache.geode.cache.Region; +import org.apache.geode.cache.persistence.PartitionOfflineException; import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionContext; import org.apache.geode.cache.execute.FunctionService; http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryMonitor.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryMonitor.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryMonitor.java index d6acfbf..569fbb0 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryMonitor.java +++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryMonitor.java @@ -103,7 +103,7 @@ public class QueryMonitor implements Runnable { /** For dunit test purpose */ if (GemFireCacheImpl.getInstance() != null - && GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME > 0) { + && GemFireCacheImpl.getInstance().testMaxQueryExecutionTime > 0) { if (this.queryMonitorTasks == null) { this.queryMonitorTasks = new ConcurrentHashMap(); } @@ -127,8 +127,8 @@ public class QueryMonitor implements Runnable { // START - DUnit Test purpose. if (GemFireCacheImpl.getInstance() != null - && GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME > 0) { - long maxTimeSet = GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME; + && GemFireCacheImpl.getInstance().testMaxQueryExecutionTime > 0) { + long maxTimeSet = GemFireCacheImpl.getInstance().testMaxQueryExecutionTime; QueryThreadTask queryTask = (QueryThreadTask) queryThreads.peek(); long currentTime = System.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java index 328a4f8..afc8125 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java @@ -33,9 +33,6 @@ import org.apache.geode.internal.Version; /** * This interface defines the services provided by any class that is a distribution manager. - * - * - * */ public interface DM extends ReplySender { @@ -463,4 +460,6 @@ public interface DM extends ReplySender { * forceUDPMessagingForCurrentThread. */ public void releaseUDPMessagingForCurrentThread(); + + int getDMType(); } http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java index 2ae86e6..6920311 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java @@ -1756,7 +1756,7 @@ public class DistributionManager implements DM { } /** - * Add a membership listener and return other DistribtionManagerIds as an atomic operation + * Add a membership listener and return other DistributionManagerIds as an atomic operation */ public Set addMembershipListenerAndGetDistributionManagerIds(MembershipListener l) { // switched sync order to fix bug 30360 http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java index 987e491..86bc7a4 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java @@ -117,6 +117,11 @@ import org.apache.geode.security.GemFireSecurityException; public class InternalDistributedSystem extends DistributedSystem implements OsStatisticsFactory, StatisticsManager { + /** + * True if the user is allowed lock when memory resources appear to be overcommitted. + */ + private static final boolean ALLOW_MEMORY_LOCK_WHEN_OVERCOMMITTED = + Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "Cache.ALLOW_MEMORY_OVERCOMMIT"); private static final Logger logger = LogService.getLogger(); public static final String DISABLE_MANAGEMENT_PROPERTY = @@ -654,7 +659,7 @@ public class InternalDistributedSystem extends DistributedSystem long avail = LinuxProcFsStatistics.getAvailableMemory(logger); long size = offHeapMemorySize + Runtime.getRuntime().totalMemory(); if (avail < size) { - if (GemFireCacheImpl.ALLOW_MEMORY_LOCK_WHEN_OVERCOMMITTED) { + if (ALLOW_MEMORY_LOCK_WHEN_OVERCOMMITTED) { logger.warn(LocalizedMessage.create( LocalizedStrings.InternalDistributedSystem_MEMORY_OVERCOMMIT_WARN, size - avail)); } else { http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java index af4e674..e9068e6 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java @@ -1357,6 +1357,11 @@ public class LonerDistributionManager implements DM { } @Override + public int getDMType() { + return 0; + } + + @Override public boolean isSharedConfigurationServiceEnabledForDS() { // return false for loner return false; http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java index d13b4a6..bbff29c 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java @@ -2731,7 +2731,7 @@ public class DiskStoreImpl implements DiskStore { String name = getName(); if (name == null) { - name = GemFireCacheImpl.DEFAULT_DS_NAME; + name = GemFireCacheImpl.getDefaultDiskStoreName(); } return (name + "_" + getDiskStoreID().toString()); http://git-wip-us.apache.org/repos/asf/geode/blob/e2ba3081/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXState.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXState.java index 6df2623..226ffa6 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXState.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXState.java @@ -51,6 +51,8 @@ import org.apache.geode.internal.offheap.annotations.Released; */ public class DistTXState extends TXState { + public static Runnable internalBeforeApplyChanges; + public static Runnable internalBeforeNonTXBasicPut; private boolean updatingTxStateDuringPreCommit = false; public DistTXState(TXStateProxy proxy, boolean onBehalfOfRemoteStub) { @@ -263,8 +265,8 @@ public class DistTXState extends TXState { try { attachFilterProfileInformation(entries); - if (GemFireCacheImpl.internalBeforeApplyChanges != null) { - GemFireCacheImpl.internalBeforeApplyChanges.run(); + if (internalBeforeApplyChanges != null) { + internalBeforeApplyChanges.run(); } // apply changes to the cache
