Repository: geode Updated Branches: refs/heads/feature/GEODE-2449 c6dbc6d4e -> 81e64a9a2
GEODE-2449: spotless Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/81e64a9a Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/81e64a9a Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/81e64a9a Branch: refs/heads/feature/GEODE-2449 Commit: 81e64a9a27c74ffcff78103b66cc9ca9ec4f7cf3 Parents: c6dbc6d Author: Udo Kohlmeyer <[email protected]> Authored: Fri Feb 10 13:43:28 2017 -0800 Committer: Udo Kohlmeyer <[email protected]> Committed: Fri Feb 10 13:43:28 2017 -0800 ---------------------------------------------------------------------- .../geode/internal/cache/GemFireCacheImpl.java | 152 +++++++++++++------ .../geode/redis/GeodeRedisServiceImpl.java | 13 +- .../org/apache/geode/redis/AuthJUnitTest.java | 2 +- .../apache/geode/redis/ConcurrentStartTest.java | 124 +++++++-------- .../org/apache/geode/redis/RedisTestBase.java | 36 +++-- .../org/apache/geode/redis/SetsJUnitTest.java | 2 +- 6 files changed, 190 insertions(+), 139 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java index fd48be1..4015ea9 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java @@ -290,6 +290,7 @@ public class GemFireCacheImpl * If true then when a delta is applied the size of the entry value will be recalculated. If false * (the default) then the size of the entry value is unchanged by a delta application. Not a final * so that tests can change this value. + * * @since GemFire hitachi 6.1.2.9 */ public static boolean DELTAS_RECALCULATE_SIZE = @@ -403,6 +404,7 @@ public class GemFireCacheImpl /** * Controls updates to the list of all gateway senders + * * @see #allGatewaySenders */ public final Object allGatewaySendersLock = new Object(); @@ -429,6 +431,7 @@ public class GemFireCacheImpl /** * Controls updates to the list of all gateway receivers + * * @see #allGatewayReceivers */ public final Object allGatewayReceiversLock = new Object(); @@ -460,6 +463,7 @@ public class GemFireCacheImpl /** * conflict resolver for WAN, if any + * * @guarded.By {@link #allGatewayHubsLock} */ private GatewayConflictResolver gatewayConflictResolver; @@ -516,6 +520,7 @@ public class GemFireCacheImpl * DistributedLockService for PartitionedRegions. Remains null until the first PartitionedRegion * is created. Destroyed by GemFireCache when closing the cache. Protected by synchronization on * this GemFireCache. + * * @guarded.By prLockServiceLock */ private DistributedLockService prLockService; @@ -528,6 +533,7 @@ public class GemFireCacheImpl /** * DistributedLockService for GatewaySenders. Remains null until the first GatewaySender is * created. Destroyed by GemFireCache when closing the cache. + * * @guarded.By gatewayLockServiceLock */ private volatile DistributedLockService gatewayLockService; @@ -553,6 +559,7 @@ public class GemFireCacheImpl /** * Enabled when CacheExistsException issues arise in debugging + * * @see #creationStack */ private static final boolean DEBUG_CREATION_STACK = false; @@ -610,6 +617,7 @@ public class GemFireCacheImpl /** * {@link ExtensionPoint} support. + * * @since GemFire 8.1 */ private SimpleExtensionPoint<Cache> extensionPoint = new SimpleExtensionPoint<Cache>(this, this); @@ -645,12 +653,13 @@ public class GemFireCacheImpl * kernel data, shared memory, and memory-mapped files. All mapped pages are guaranteed to be * resident in RAM when the call returns successfully; the pages are guaranteed to stay in RAM * until later unlocked. + * * @param flags MCL_CURRENT 1 - Lock all pages which are currently mapped into the address space - * of the process. + * of the process. * - * MCL_FUTURE 2 - Lock all pages which will become mapped into the address space of the process in - * the future. These could be for instance new pages required by a growing heap and stack as well - * as new memory mapped files or shared memory regions. + * MCL_FUTURE 2 - Lock all pages which will become mapped into the address space of the + * process in the future. These could be for instance new pages required by a growing heap + * and stack as well as new memory mapped files or shared memory regions. * @return 0 if success, non-zero if error and errno set */ private static native int mlockall(int flags); @@ -737,6 +746,7 @@ public class GemFireCacheImpl /** * Returns an existing instance. If a cache does not exist throws a cache closed exception. + * * @return the existing cache * @throws CacheClosedException if an existing cache can not be found. */ @@ -755,6 +765,7 @@ public class GemFireCacheImpl /** * Returns an existing instance. If a cache does not exist throws an exception. + * * @param reason the reason an existing cache is being requested. * @return the existing cache * @throws CacheClosedException if an existing cache can not be found. @@ -788,7 +799,7 @@ public class GemFireCacheImpl // } public static GemFireCacheImpl createClient(DistributedSystem system, PoolFactory pf, - CacheConfig cacheConfig) { + CacheConfig cacheConfig) { return basicCreate(system, true, cacheConfig, pf, true, ASYNC_EVENT_LISTENERS, null); } @@ -797,22 +808,19 @@ public class GemFireCacheImpl } public static GemFireCacheImpl createWithAsyncEventListeners(DistributedSystem system, - CacheConfig cacheConfig, - TypeRegistry typeRegistry) { + CacheConfig cacheConfig, TypeRegistry typeRegistry) { return basicCreate(system, true, cacheConfig, null, false, true, typeRegistry); } public static Cache create(DistributedSystem system, boolean existingOk, - CacheConfig cacheConfig) { + CacheConfig cacheConfig) { return basicCreate(system, existingOk, cacheConfig, null, false, ASYNC_EVENT_LISTENERS, null); } private static GemFireCacheImpl basicCreate(DistributedSystem system, boolean existingOk, - CacheConfig cacheConfig, PoolFactory pf, - boolean isClient, boolean asyncEventListeners, - TypeRegistry typeRegistry) - throws CacheExistsException, TimeoutException, + CacheConfig cacheConfig, PoolFactory pf, boolean isClient, boolean asyncEventListeners, + TypeRegistry typeRegistry) throws CacheExistsException, TimeoutException, CacheWriterException, GatewayException, RegionExistsException { try { synchronized (GemFireCacheImpl.class) { @@ -855,11 +863,11 @@ public class GemFireCacheImpl /** * Creates a new instance of GemFireCache and populates it according to the * <code>cache.xml</code>, if appropriate. + * * @param typeRegistry: currently only unit tests set this parameter to a non-null value */ private GemFireCacheImpl(boolean isClient, PoolFactory pf, DistributedSystem system, - CacheConfig cacheConfig, boolean asyncEventListeners, - TypeRegistry typeRegistry) { + CacheConfig cacheConfig, boolean asyncEventListeners, TypeRegistry typeRegistry) { this.isClient = isClient; this.clientpf = pf; this.cacheConfig = cacheConfig; // do early for bug 43213 @@ -1007,6 +1015,7 @@ public class GemFireCacheImpl /** * Used by Hydra tests to get handle of Rest Agent + * * @return RestAgent */ public RestAgent getRestAgent() { @@ -1081,7 +1090,7 @@ public class GemFireCacheImpl if (isMisConfigured(clusterSecProperties, serverSecProperties, ConfigurationProperties.SECURITY_MANAGER) || isMisConfigured(clusterSecProperties, serverSecProperties, - ConfigurationProperties.SECURITY_POST_PROCESSOR)) { + ConfigurationProperties.SECURITY_POST_PROCESSOR)) { throw new GemFireConfigException( LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION.toLocalizedString()); } @@ -1114,7 +1123,7 @@ public class GemFireCacheImpl // When called, clusterProps and serverProps and key could not be null public static boolean isMisConfigured(Properties clusterProps, Properties serverProps, - String key) { + String key) { String clusterPropValue = clusterProps.getProperty(key); String serverPropValue = serverProps.getProperty(key); @@ -1173,6 +1182,7 @@ public class GemFireCacheImpl /** * Method to check for GemFire client. In addition to checking for ClientCacheFactory, this method * checks for any defined pools. + * * @return true if the cache has pools declared */ public boolean hasPool() { @@ -1181,7 +1191,7 @@ public class GemFireCacheImpl private Collection<Pool> getAllPools() { Collection<Pool> pools = PoolManagerImpl.getPMI().getMap().values(); - for (Iterator<Pool> itr = pools.iterator(); itr.hasNext(); ) { + for (Iterator<Pool> itr = pools.iterator(); itr.hasNext();) { PoolImpl pool = (PoolImpl) itr.next(); if (pool.isUsedByGateway()) { itr.remove(); @@ -1214,7 +1224,7 @@ public class GemFireCacheImpl GemFireCacheImpl.pdxInstance = this; for (Iterator<CacheLifecycleListener> iter = cacheLifecycleListeners.iterator(); iter - .hasNext(); ) { + .hasNext();) { CacheLifecycleListener listener = (CacheLifecycleListener) iter.next(); listener.cacheCreated(this); } @@ -1341,11 +1351,11 @@ public class GemFireCacheImpl if (bindAddress.equals(DistributionConfig.DEFAULT_MEMCACHED_BIND_ADDRESS)) { logger.info(LocalizedMessage.create( LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_MEMCACHED_SERVER_ON_PORT_0_FOR_1_PROTOCOL, - new Object[]{port, protocol})); + new Object[] {port, protocol})); } else { logger.info(LocalizedMessage.create( LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_MEMCACHED_SERVER_ON_BIND_ADDRESS_0_PORT_1_FOR_2_PROTOCOL, - new Object[]{bindAddress, port, protocol})); + new Object[] {bindAddress, port, protocol})); } this.memcachedServer = new GemFireMemcachedServer(bindAddress, port, Protocol.valueOf(protocol.toUpperCase())); @@ -1354,7 +1364,8 @@ public class GemFireCacheImpl } private void startRedisServer() { - //TODO this needs to be fixed up. Maybe we don't want to leave the starting of redis to the setting of the port. + // TODO this needs to be fixed up. Maybe we don't want to leave the starting of redis to the + // setting of the port. int port = system.getConfig().getRedisPort(); if (port != 0) { GeodeRedisService geodeRedisService = getService(GeodeRedisService.class); @@ -1417,16 +1428,17 @@ public class GemFireCacheImpl * file specified by the given <code>DistributedSystem</code>. Note that this operation cannot be * performed in the constructor because creating regions in the cache, etc. uses the cache itself * (which isn't initialized until the constructor returns). + * * @throws CacheXmlException If something goes wrong while parsing the declarative caching XML - * file. + * file. * @throws TimeoutException If a {@link org.apache.geode.cache.Region#put(Object, Object)}times - * out while initializing the cache. + * out while initializing the cache. * @throws CacheWriterException If a <code>CacheWriterException</code> is thrown while - * initializing the cache. + * initializing the cache. * @throws RegionExistsException If the declarative caching XML file desribes a region that - * already exists (including the root region). + * already exists (including the root region). * @throws GatewayException If a <code>GatewayException</code> is thrown while initializing the - * cache. + * cache. * @see #loadCacheXml */ private void initializeDeclarativeCache() @@ -1464,12 +1476,12 @@ public class GemFireCacheImpl } catch (IOException ex) { throw new CacheXmlException( LocalizedStrings.GemFireCache_WHILE_OPENING_CACHE_XML_0_THE_FOLLOWING_ERROR_OCCURRED_1 - .toLocalizedString(new Object[]{url.toString(), ex})); + .toLocalizedString(new Object[] {url.toString(), ex})); } catch (CacheXmlException ex) { CacheXmlException newEx = new CacheXmlException(LocalizedStrings.GemFireCache_WHILE_READING_CACHE_XML_0_1 - .toLocalizedString(new Object[]{url, ex.getMessage()})); + .toLocalizedString(new Object[] {url, ex.getMessage()})); newEx.setStackTrace(ex.getStackTrace()); newEx.initCause(ex.getCause()); throw newEx; @@ -1494,11 +1506,11 @@ public class GemFireCacheImpl } logger.info( LocalizedMessage.create(LocalizedStrings.GemFireCache_INITIALIZING_CACHE_USING__0__1, - new Object[]{url.toString(), sb.toString()})); + new Object[] {url.toString(), sb.toString()})); } else { logger.info( LocalizedMessage.create(LocalizedStrings.GemFireCache_INITIALIZING_CACHE_USING__0__1, - new Object[]{"generated description from old cache", cacheXmlDescription})); + new Object[] {"generated description from old cache", cacheXmlDescription})); } } @@ -1530,6 +1542,7 @@ public class GemFireCacheImpl /** * create diskstore factory with default attributes + * * @since GemFire prPersistSprint2 */ public DiskStoreFactory createDiskStoreFactory() { @@ -1538,6 +1551,7 @@ public class GemFireCacheImpl /** * create diskstore factory with predefined attributes + * * @since GemFire prPersistSprint2 */ public DiskStoreFactory createDiskStoreFactory(DiskStoreAttributes attrs) { @@ -1646,12 +1660,14 @@ public class GemFireCacheImpl /** * Set to true during a cache close if user requested durable subscriptions to be kept. + * * @since GemFire 5.7 */ private boolean keepAlive; /** * Returns true if durable subscriptions (registrations and queries) should be preserved. + * * @since GemFire 5.7 */ public boolean keepDurableSubscriptionsAlive() { @@ -1665,6 +1681,7 @@ public class GemFireCacheImpl /** * Ensure that all the necessary classes for closing the cache are loaded + * * @see SystemFailure#loadEmergencyClasses() */ static public void loadEmergencyClasses() { @@ -1680,6 +1697,7 @@ public class GemFireCacheImpl /** * Close the distributed system, cache servers, and gateways. Clears the rootRegions and * partitionedRegions map. Marks the cache as closed. + * * @see SystemFailure#emergencyClose() */ static public void emergencyClose() { @@ -2011,6 +2029,7 @@ public class GemFireCacheImpl /** * Gets or lazily creates the PartitionedRegion distributed lock service. This call will * synchronize on this GemFireCache. + * * @return the PartitionedRegion distributed lock service */ protected DistributedLockService getPartitionedRegionLockService() { @@ -2036,6 +2055,7 @@ public class GemFireCacheImpl /** * Gets or lazily creates the GatewaySender distributed lock service. + * * @return the GatewaySender distributed lock service */ public DistributedLockService getGatewaySenderLockService() { @@ -2125,6 +2145,7 @@ public class GemFireCacheImpl /** * close the cache + * * @param reason the reason the cache is being closed * @param systemFailureCause whether this member was ejected from the distributed system * @param keepalive whoever added this should javadoc it @@ -2134,7 +2155,7 @@ public class GemFireCacheImpl } public void close(String reason, Throwable systemFailureCause, boolean keepalive, - boolean keepDS) { + boolean keepDS) { securityService.close(); if (isClosed()) { @@ -2276,7 +2297,7 @@ public class GemFireCacheImpl LocalRegion prRoot = null; - for (Iterator itr = rootRegionValues.iterator(); itr.hasNext(); ) { + for (Iterator itr = rootRegionValues.iterator(); itr.hasNext();) { LocalRegion lr = (LocalRegion) itr.next(); if (isDebugEnabled) { logger.debug("{}: processing region {}", this, lr.getFullPath()); @@ -2296,7 +2317,7 @@ public class GemFireCacheImpl if (isDebugEnabled || !forcedDisconnect) { logger.warn(LocalizedMessage.create( LocalizedStrings.GemFireCache_0_ERROR_CLOSING_REGION_1, - new Object[]{this, lr.getFullPath()}), e); + new Object[] {this, lr.getFullPath()}), e); } } } @@ -2476,7 +2497,7 @@ public class GemFireCacheImpl // do this late to prevent 43412 TypeRegistry.setPdxSerializer(null); - for (Iterator iter = cacheLifecycleListeners.iterator(); iter.hasNext(); ) { + for (Iterator iter = cacheLifecycleListeners.iterator(); iter.hasNext();) { CacheLifecycleListener listener = (CacheLifecycleListener) iter.next(); listener.cacheClosed(this); } @@ -2528,7 +2549,7 @@ public class GemFireCacheImpl if (this.memcachedServer != null) { logger.info(LocalizedMessage.create( LocalizedStrings.GemFireCacheImpl_MEMCACHED_SERVER_ON_PORT_0_IS_SHUTTING_DOWN, - new Object[]{this.system.getConfig().getMemcachedPort()})); + new Object[] {this.system.getConfig().getMemcachedPort()})); this.memcachedServer.shutdown(); } } @@ -2541,7 +2562,7 @@ public class GemFireCacheImpl if (this.restAgent != null) { logger.info(LocalizedMessage.create( LocalizedStrings.GemFireCacheImpl_REST_SERVER_ON_PORT_0_IS_SHUTTING_DOWN, - new Object[]{this.system.getConfig().getHttpServicePort()})); + new Object[] {this.system.getConfig().getHttpServicePort()})); this.restAgent.stop(); } } @@ -2668,6 +2689,7 @@ public class GemFireCacheImpl /** * Returns the DiskStore by name + * * @since GemFire prPersistSprint2 */ public DiskStore findDiskStore(String name) { @@ -2679,6 +2701,7 @@ public class GemFireCacheImpl /** * Returns the DiskStore list + * * @since GemFire prPersistSprint2 */ public Collection<DiskStoreImpl> listDiskStores() { @@ -2877,6 +2900,7 @@ public class GemFireCacheImpl /** * Returns the member id of my distributed system + * * @since GemFire 5.0 */ public InternalDistributedMember getMyId() { @@ -2969,6 +2993,7 @@ public class GemFireCacheImpl /** * get the threadid/sequenceid sweeper task for this cache + * * @return the sweeper task */ protected EventTracker.ExpiryTask getEventTrackerTask() { @@ -2985,6 +3010,7 @@ public class GemFireCacheImpl /** * Get the list of all instances of properties for Declarables with the given class name. + * * @param className Class name of the declarable * @return List of all instances of properties found for the given declarable */ @@ -3002,6 +3028,7 @@ public class GemFireCacheImpl /** * Get the properties for the given declarable. + * * @param declarable The declarable * @return Properties found for the given declarable */ @@ -3011,6 +3038,7 @@ public class GemFireCacheImpl /** * Returns the date and time that this cache was created. + * * @since GemFire 3.5 */ public Date getCreationDate() { @@ -3019,6 +3047,7 @@ public class GemFireCacheImpl /** * Returns the number of seconds that have elapsed since the Cache was created. + * * @since GemFire 3.5 */ public int getUpTime() { @@ -3029,6 +3058,7 @@ public class GemFireCacheImpl * All entry and region operations should be using this time rather than * System.currentTimeMillis(). Specially all version stamps/tags must be populated with this * timestamp. + * * @return distributed cache time. */ @Override @@ -3127,6 +3157,7 @@ public class GemFireCacheImpl /** * Used to see if a existing cache's pool is compatible with us. + * * @return the default pool that is right for us */ public Pool determineDefaultPool(PoolFactory pf) { @@ -3210,7 +3241,7 @@ public class GemFireCacheImpl } public <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> p_attrs, - InternalRegionArguments internalRegionArgs) + InternalRegionArguments internalRegionArgs) throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException { if (getMyId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE) { if (!internalRegionArgs.isUsedForMetaRegion() @@ -3239,7 +3270,7 @@ public class GemFireCacheImpl final String regionPath = LocalRegion.calcFullPath(name, null); try { - for (; ; ) { + for (;;) { getCancelCriterion().checkCancelInProgress(null); Future future = null; @@ -3369,8 +3400,7 @@ public class GemFireCacheImpl } public RegionAttributes invokeRegionBefore(LocalRegion parent, String name, - RegionAttributes attrs, - InternalRegionArguments internalRegionArgs) { + RegionAttributes attrs, InternalRegionArguments internalRegionArgs) { for (RegionListener listener : regionListeners) { attrs = listener.beforeCreate(parent, name, attrs, internalRegionArgs); } @@ -3389,6 +3419,7 @@ public class GemFireCacheImpl /** * returns a set of all current regions in the cache, including buckets + * * @since GemFire 6.0 */ public Set<LocalRegion> getAllRegions() { @@ -3626,19 +3657,19 @@ public class GemFireCacheImpl stopper.checkCancelInProgress(null); Set regions = new HashSet(); synchronized (this.rootRegions) { - for (Iterator itr = this.rootRegions.values().iterator(); itr.hasNext(); ) { + for (Iterator itr = this.rootRegions.values().iterator(); itr.hasNext();) { LocalRegion r = (LocalRegion) itr.next(); // If this is an internal meta-region, don't return it to end user if (r.isSecret() || r.isUsedForMetaRegion() || r instanceof HARegion || !includePRAdminRegions - && (r.isUsedForPartitionedRegionAdmin() || r.isUsedForPartitionedRegionBucket())) { + && (r.isUsedForPartitionedRegionAdmin() || r.isUsedForPartitionedRegionBucket())) { continue; // Skip administrative PartitionedRegions } regions.add(r); } } if (waitForInit) { - for (Iterator r = regions.iterator(); r.hasNext(); ) { + for (Iterator r = regions.iterator(); r.hasNext();) { LocalRegion lr = (LocalRegion) r.next(); // lr.waitOnInitialization(); if (!lr.checkForInitialization()) { @@ -3651,6 +3682,7 @@ public class GemFireCacheImpl /** * Called by ccn when a client goes away + * * @since GemFire 5.7 */ public void cleanupForClient(CacheClientNotifier ccn, ClientProxyMembershipID client) { @@ -3760,6 +3792,7 @@ public class GemFireCacheImpl /** * Register the specified region name as reinitializing, creating and adding a Future for it to * the map. + * * @throws IllegalStateException if there is already a region by that name registered. */ void regionReinitializing(String fullPath) { @@ -3773,6 +3806,7 @@ public class GemFireCacheImpl /** * Set the reinitialized region and unregister it as reinitializing. + * * @throws IllegalStateException if there is no region by that name registered as reinitializing. */ void regionReinitialized(Region region) { @@ -3789,6 +3823,7 @@ public class GemFireCacheImpl /** * Clear a reinitializing region, e.g. reinitialization failed. + * * @throws IllegalStateException if cannot find reinitializing region registered by that name. */ void unregisterReinitializingRegion(String fullPath) { @@ -3805,6 +3840,7 @@ public class GemFireCacheImpl /** * Returns true if get should give a copy; false if a reference. + * * @since GemFire 4.0 */ final boolean isCopyOnRead() { @@ -3813,6 +3849,7 @@ public class GemFireCacheImpl /** * Implementation of {@link org.apache.geode.cache.Cache#setCopyOnRead} + * * @since GemFire 4.0 */ public void setCopyOnRead(boolean copyOnRead) { @@ -3821,6 +3858,7 @@ public class GemFireCacheImpl /** * Implementation of {@link org.apache.geode.cache.Cache#getCopyOnRead} + * * @since GemFire 4.0 */ final public boolean getCopyOnRead() { @@ -3829,6 +3867,7 @@ public class GemFireCacheImpl /** * Remove the specified root region + * * @param rootRgn the region to be removed * @return true if root region was removed, false if not found */ @@ -3848,7 +3887,7 @@ public class GemFireCacheImpl /** * @return array of two Strings, the root name and the relative path from root If there is no - * relative path from root, then String[1] will be an empty string + * relative path from root, then String[1] will be an empty string */ static String[] parsePath(String p_path) { String path = p_path; @@ -3880,6 +3919,7 @@ public class GemFireCacheImpl /** * Removes a <code>CacheLifecycleListener</code> + * * @return Whether or not the listener was removed */ public static boolean removeCacheLifecycleListener(CacheLifecycleListener l) { @@ -3904,6 +3944,7 @@ public class GemFireCacheImpl /** * Creates the single instance of the Transation Manager for this cache. Returns the existing one * upon request. + * * @return the CacheTransactionManager instance. * @since GemFire 4.0 */ @@ -3924,6 +3965,7 @@ public class GemFireCacheImpl /** * Get cache-wide CacheClientProxy SystemTimer + * * @return the timer, lazily created */ public SystemTimer getCCPTimer() { @@ -3946,6 +3988,7 @@ public class GemFireCacheImpl /** * Get cache-wide ExpirationScheduler + * * @return the scheduler, lazily created */ public ExpirationScheduler getExpirationScheduler() { @@ -3959,6 +4002,7 @@ public class GemFireCacheImpl /** * Returns the <code>Executor</code> (thread pool) that is used to execute cache event listeners. * Returns <code>null</code> if no pool exists. + * * @since GemFire 3.5 */ Executor getEventThreadPool() { @@ -4075,6 +4119,7 @@ public class GemFireCacheImpl /** * Returns List of GatewaySender (excluding the senders for internal use) + * * @return List List of GatewaySender objects */ public Set<GatewaySender> getGatewaySenders() { @@ -4089,6 +4134,7 @@ public class GemFireCacheImpl /** * Returns List of all GatewaySenders (including the senders for internal use) + * * @return List List of GatewaySender objects */ public Set<GatewaySender> getAllGatewaySenders() { @@ -4180,7 +4226,7 @@ public class GemFireCacheImpl */ public void requiresPREvents() { synchronized (this.partitionedRegions) { - for (Iterator it = this.partitionedRegions.iterator(); it.hasNext(); ) { + for (Iterator it = this.partitionedRegions.iterator(); it.hasNext();) { ((PartitionedRegion) it.next()).cacheRequiresNotification(); } } @@ -4281,7 +4327,7 @@ public class GemFireCacheImpl } private void addColocatedChildRecursively(LinkedHashMap<String, PartitionedRegion> prMap, - PartitionedRegion pr) { + PartitionedRegion pr) { for (PartitionedRegion colocatedRegion : ColocationHelper.getColocatedChildRegions(pr)) { addColocatedChildRecursively(prMap, colocatedRegion); } @@ -4292,6 +4338,7 @@ public class GemFireCacheImpl * check to see if any cache components require notification from a partitioned region. * Notification adds to the messaging a PR must do on each put/destroy/invalidate operation and * should be kept to a minimum + * * @param r the partitioned region * @return true if the region should deliver all of its events to this cache */ @@ -4327,6 +4374,7 @@ public class GemFireCacheImpl /** * remove a partitioned region from the set of tracked instances. + * * @see #addPartitionedRegion(PartitionedRegion) */ public void removePartitionedRegion(PartitionedRegion r) { @@ -4494,6 +4542,7 @@ public class GemFireCacheImpl /** * Returns this cache's ReliableMessageQueueFactory. + * * @since GemFire 5.0 */ public ReliableMessageQueueFactory getReliableMessageQueueFactory() { @@ -4622,11 +4671,12 @@ public class GemFireCacheImpl /** * Wait for given sender queue to flush for given timeout. + * * @param id ID of GatewaySender or AsyncEventQueue * @param isAsyncListener true if this is for an AsyncEventQueue and false if for a GatewaySender * @param maxWaitTime maximum time to wait in seconds; zero or -ve means infinite wait * @return zero if maxWaitTime was not breached, -1 if queue could not be found or is closed, and - * elapsed time if timeout was breached + * elapsed time if timeout was breached */ public int waitForSenderQueueFlush(String id, boolean isAsyncListener, int maxWaitTime) { getCancelCriterion().checkCancelInProgress(null); @@ -4681,6 +4731,7 @@ public class GemFireCacheImpl /** * Returns the QueryMonitor instance based on system property MAX_QUERY_EXECUTION_TIME. + * * @since GemFire 6.0 */ public QueryMonitor getQueryMonitor() { @@ -4731,13 +4782,13 @@ public class GemFireCacheImpl /** * Simple class to allow waiters for register interest. Has at most one thread that ever calls * wait. + * * @since GemFire 5.7 */ private class SimpleWaiter { private boolean notified = false; - SimpleWaiter() { - } + SimpleWaiter() {} public void doWait() { synchronized (this) { @@ -5309,6 +5360,7 @@ public class GemFireCacheImpl /** * Add to the map of declarable properties. Any properties that exactly match existing properties * for a class in the list will be discarded (no duplicate Properties allowed). + * * @param mapOfNewDeclarableProps Map of the declarable properties to add */ public void addDeclarableProperties(final Map<Declarable, Properties> mapOfNewDeclarableProps) { @@ -5322,7 +5374,7 @@ public class GemFireCacheImpl if (clazz.getName().equals(oldEntry.getKey().getClass().getName()) && (newEntry.getValue() .equals(oldEntry.getValue()) || ((newEntry.getKey() instanceof Identifiable) && (((Identifiable) oldEntry.getKey()) - .getId().equals(((Identifiable) newEntry.getKey()).getId()))))) { + .getId().equals(((Identifiable) newEntry.getKey()).getId()))))) { matchingDeclarable = oldEntry.getKey(); break; } http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java ---------------------------------------------------------------------- diff --git a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java index 6503766..8d81456 100644 --- a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java +++ b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java @@ -576,21 +576,22 @@ public class GeodeRedisServiceImpl implements GeodeRedisService { logger.info("GeodeRedisServiceImpl shutting down"); } - Future<?> workerGroupFuture = workerGroup.shutdownGracefully(0,1, TimeUnit.SECONDS); - Future<?> bossGroupFuture = bossGroup.shutdownGracefully(0,1,TimeUnit.SECONDS); + Future<?> workerGroupFuture = workerGroup.shutdownGracefully(0, 1, TimeUnit.SECONDS); + Future<?> bossGroupFuture = bossGroup.shutdownGracefully(0, 1, TimeUnit.SECONDS); ChannelFuture closeFuture = this.serverChannel.close(); - // We are likely brought here by a channel read reading a shutdown message, in which case calling + // We are likely brought here by a channel read reading a shutdown message, in which case + // calling // await or sync can cause a deadlock. -// workerGroupFuture.syncUninterruptibly(); -// bossGroupFuture.syncUninterruptibly(); + // workerGroupFuture.syncUninterruptibly(); + // bossGroupFuture.syncUninterruptibly(); this.regionProvider.close(); for (ScheduledFuture<?> f : this.expirationFutures.values()) { f.cancel(true); } this.expirationFutures.clear(); this.expirationExecutor.shutdownNow(); -// closeFuture.syncUninterruptibly(); + // closeFuture.syncUninterruptibly(); shutdown = true; } } http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java index 753bc9e..2b03bd8 100644 --- a/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java +++ b/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java @@ -102,7 +102,7 @@ public class AuthJUnitTest extends RedisTestBase { public void testSeparateClientRequests() { setupCacheWithPassword(); try (Jedis authorizedJedis = new Jedis(hostName, Integer.parseInt(redisPort), 100000); - Jedis nonAuthorizedJedis = new Jedis(hostName, Integer.parseInt(redisPort), 100000)) { + Jedis nonAuthorizedJedis = new Jedis(hostName, Integer.parseInt(redisPort), 100000)) { String res = authorizedJedis.auth(PASSWORD); assertEquals(res, "OK"); authorizedJedis.set("foo", "bar"); // No exception for authorized client http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java ---------------------------------------------------------------------- diff --git a/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java b/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java index 7ada70c..4a5e717 100644 --- a/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java +++ b/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java @@ -17,69 +17,69 @@ package org.apache.geode.redis; import org.apache.geode.test.junit.categories.IntegrationTest; import org.junit.experimental.categories.Category; -//TODO I think this test can now be removed +// TODO I think this test can now be removed @Category(IntegrationTest.class) public class ConcurrentStartTest extends RedisTestBase { -// private Cache cache; -// private int numServers = 10; -// -// @Rule -// public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties(); -// -// @Before -// public void setUp() { -// System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, -// getClass().getSimpleName() + ".properties"); -// } -// -// @After -// public void tearDown() { -// if (this.cache != null) { -// this.cache.close(); -// this.cache = null; -// } -// } -// -// @Test -// public void testCachelessStart() throws InterruptedException { -// runNServers(numServers); -// GemFireCacheImpl.getInstance().close(); -// } -// -// @Test -// public void testCachefulStart() throws InterruptedException { -// CacheFactory cf = new CacheFactory(); -// cf.set(MCAST_PORT, "0"); -// cf.set(LOCATORS, ""); -// this.cache = cf.create(); -// -// runNServers(numServers); -// } -// -// private void runNServers(int n) throws InterruptedException { -// final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(numServers); -// final Thread[] threads = new Thread[n]; -// for (int i = 0; i < n; i++) { -// final int j = i; -// Runnable r = new Runnable() { -// -// @Override -// public void run() { -// GeodeRedisServiceImpl s = new GeodeRedisServiceImpl(ports[j]); -// s.start(); -// s.stop(); -// } -// }; -// -// Thread t = new Thread(r); -// t.setDaemon(true); -// t.start(); -// threads[i] = t; -// } -// for (Thread t : threads) -// t.join(); -// this.cache = GemFireCacheImpl.getInstance(); -// assertFalse(this.cache.isClosed()); -// } + // private Cache cache; + // private int numServers = 10; + // + // @Rule + // public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties(); + // + // @Before + // public void setUp() { + // System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, + // getClass().getSimpleName() + ".properties"); + // } + // + // @After + // public void tearDown() { + // if (this.cache != null) { + // this.cache.close(); + // this.cache = null; + // } + // } + // + // @Test + // public void testCachelessStart() throws InterruptedException { + // runNServers(numServers); + // GemFireCacheImpl.getInstance().close(); + // } + // + // @Test + // public void testCachefulStart() throws InterruptedException { + // CacheFactory cf = new CacheFactory(); + // cf.set(MCAST_PORT, "0"); + // cf.set(LOCATORS, ""); + // this.cache = cf.create(); + // + // runNServers(numServers); + // } + // + // private void runNServers(int n) throws InterruptedException { + // final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(numServers); + // final Thread[] threads = new Thread[n]; + // for (int i = 0; i < n; i++) { + // final int j = i; + // Runnable r = new Runnable() { + // + // @Override + // public void run() { + // GeodeRedisServiceImpl s = new GeodeRedisServiceImpl(ports[j]); + // s.start(); + // s.stop(); + // } + // }; + // + // Thread t = new Thread(r); + // t.setDaemon(true); + // t.start(); + // threads[i] = t; + // } + // for (Thread t : threads) + // t.join(); + // this.cache = GemFireCacheImpl.getInstance(); + // assertFalse(this.cache.isClosed()); + // } } http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java ---------------------------------------------------------------------- diff --git a/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java b/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java index b111fbc..e6b04b2 100644 --- a/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java +++ b/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.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.redis; @@ -36,7 +34,7 @@ import java.util.Random; import redis.clients.jedis.Jedis; public class RedisTestBase { - // protected Jedis jedis; + // protected Jedis jedis; protected GemFireCacheImpl cache; protected static String redisPort; protected Random rand; @@ -74,12 +72,12 @@ public class RedisTestBase { @After public void tearDown() throws InterruptedException { -// if (jedis != null) { -// jedis.flushAll(); -// jedis.shutdown(); -// } -// GeodeRedisService service = cache.getService(GeodeRedisService.class); -// service.stop(); + // if (jedis != null) { + // jedis.flushAll(); + // jedis.shutdown(); + // } + // GeodeRedisService service = cache.getService(GeodeRedisService.class); + // service.stop(); if (cache != null) { cache.close(); } http://git-wip-us.apache.org/repos/asf/geode/blob/81e64a9a/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java index d979947..d4b1364 100644 --- a/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java +++ b/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java @@ -181,7 +181,7 @@ public class SetsJUnitTest extends RedisTestBase { } private void populateListRandomData(int numSets, int elements, String[] keys, - ArrayList<Set<String>> sets) { + ArrayList<Set<String>> sets) { for (int j = 0; j < numSets; j++) { keys[j] = randString(); Set<String> newSet = new HashSet<>();
