You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/01 21:21:43 UTC
[01/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache [Forced Update!]
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2632-10 dc820690c -> 57e93a5a1 (forced update)
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheCreationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheCreationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheCreationJUnitTest.java
index 6035c7a..c728cb0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheCreationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheCreationJUnitTest.java
@@ -21,7 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.geode.cache.GemFireCache;
+import org.apache.geode.cache.Region;
import org.apache.geode.cache.wan.GatewayReceiver;
import org.apache.geode.cache.wan.GatewayReceiverFactory;
import org.junit.Before;
@@ -34,14 +34,14 @@ import org.mockito.MockitoAnnotations;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.internal.cache.CacheServerImpl;
import org.apache.geode.internal.cache.CacheServerLauncher;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class CacheCreationJUnitTest {
@Mock
- private GemFireCacheImpl cache;
+ private InternalCache cache;
@Before
public void setUp() {
@@ -56,130 +56,126 @@ public class CacheCreationJUnitTest {
RegionCreation declarativeRegion = mock(RegionCreation.class);
when(declarativeRegion.getName()).thenReturn("testRegion");
- Map declarativeRegions = new HashMap();
+ Map<String, Region<?, ?>> declarativeRegions = new HashMap<>();
declarativeRegions.put("testRegion", declarativeRegion);
- when(cache.getRegion("testRegion")).thenReturn(null);
+ when(this.cache.getRegion("testRegion")).thenReturn(null);
- cacheCreation.initializeRegions(declarativeRegions, cache);
+ cacheCreation.initializeRegions(declarativeRegions, this.cache);
- verify(declarativeRegion, times(1)).createRoot(cache);
+ verify(declarativeRegion, times(1)).createRoot(this.cache);
}
@Test
public void defaultCacheServerIsNotCreatedWithDefaultPortWhenNoDeclarativeServerIsConfigured() {
- Boolean disableDefaultCacheServer = false;
- Integer configuredServerPort = null;
- String configuredServerBindAddress = null;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
List<CacheServer> cacheServers = new ArrayList<>();
- when(cache.getCacheServers()).thenReturn(cacheServers);
+ when(this.cache.getCacheServers()).thenReturn(cacheServers);
+
+ Boolean disableDefaultCacheServer = false;
+ Integer configuredServerPort = null;
+ String configuredServerBindAddress = null;
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
- verify(cache, never()).addCacheServer();
+ verify(this.cache, never()).addCacheServer();
}
@Test
public void defaultCacheServerIsNotCreatedWhenDisableDefaultCacheServerIsTrue() {
- Boolean disableDefaultCacheServer = true;
- Integer configuredServerPort = null;
- String configuredServerBindAddress = null;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
List<CacheServer> cacheServers = new ArrayList<>();
- when(cache.getCacheServers()).thenReturn(cacheServers);
+ when(this.cache.getCacheServers()).thenReturn(cacheServers);
+
+ Boolean disableDefaultCacheServer = true;
+ Integer configuredServerPort = null;
+ String configuredServerBindAddress = null;
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
- verify(cache, never()).addCacheServer();
+ verify(this.cache, never()).addCacheServer();
}
@Test
public void defaultCacheServerIsCreatedWithConfiguredPortWhenNoDeclarativeServerIsConfigured() {
- Boolean disableDefaultCacheServer = false;
- Integer configuredServerPort = 9999;
- String configuredServerBindAddress = null;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
List<CacheServer> cacheServers = new ArrayList<>();
- when(cache.getCacheServers()).thenReturn(cacheServers);
+ when(this.cache.getCacheServers()).thenReturn(cacheServers);
+
+ Boolean disableDefaultCacheServer = false;
+ Integer configuredServerPort = 9999;
+ String configuredServerBindAddress = null;
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
- verify(cache, times(1)).addCacheServer();
+ verify(this.cache, times(1)).addCacheServer();
verify(mockServer).setPort(9999);
}
@Test
public void declarativeCacheServerIsCreatedWithConfiguredServerPort() {
- Integer configuredServerPort = 9999;
- String configuredServerBindAddress = null;
- Boolean disableDefaultCacheServer = false;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerCreation br1 = new CacheServerCreation(cacheCreation, false);
br1.setPort(8888);
cacheCreation.getCacheServers().add(br1);
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ Integer configuredServerPort = 9999;
+ String configuredServerBindAddress = null;
+ Boolean disableDefaultCacheServer = false;
+
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
- verify(cache, times(1)).addCacheServer();
+ verify(this.cache, times(1)).addCacheServer();
verify(mockServer).setPort(configuredServerPort);
}
@Test
public void cacheServerCreationIsSkippedWhenAServerExistsForAGivenPort() {
- Integer configuredServerPort = null;
- String configuredServerBindAddress = null;
- Boolean disableDefaultCacheServer = false;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerCreation br1 = new CacheServerCreation(cacheCreation, false);
br1.setPort(40406);
cacheCreation.getCacheServers().add(br1);
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
when(mockServer.getPort()).thenReturn(40406);
List<CacheServer> cacheServers = new ArrayList<>();
cacheServers.add(mockServer);
- when(cache.getCacheServers()).thenReturn(cacheServers);
+ when(this.cache.getCacheServers()).thenReturn(cacheServers);
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ Integer configuredServerPort = null;
+ String configuredServerBindAddress = null;
+ Boolean disableDefaultCacheServer = false;
- verify(cache, never()).addCacheServer();
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
+
+ verify(this.cache, never()).addCacheServer();
}
@Test
public void userCanCreateMultipleCacheServersDeclaratively() {
- Integer configuredServerPort = null;
- String configuredServerBindAddress = null;
- Boolean disableDefaultCacheServer = false;
-
CacheCreation cacheCreation = new CacheCreation();
CacheServerCreation br1 = new CacheServerCreation(cacheCreation, false);
br1.setPort(40406);
@@ -189,28 +185,32 @@ public class CacheCreationJUnitTest {
cacheCreation.getCacheServers().add(br2);
CacheServerImpl mockServer = mock(CacheServerImpl.class);
- when(cache.addCacheServer()).thenReturn(mockServer);
+ when(this.cache.addCacheServer()).thenReturn(mockServer);
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ Integer configuredServerPort = null;
+ String configuredServerBindAddress = null;
+ Boolean disableDefaultCacheServer = false;
+
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
- verify(cache, times(2)).addCacheServer();
+ verify(this.cache, times(2)).addCacheServer();
verify(mockServer).configureFrom(br1);
verify(mockServer).configureFrom(br2);
}
@Test(expected = RuntimeException.class)
public void shouldThrowExceptionWhenUserTriesToDeclareMultipleCacheServersWithPort() {
- Integer configuredServerPort = 50505;
- String configuredServerBindAddress = "localhost[50505]";
- Boolean disableDefaultCacheServer = false;
-
CacheCreation cacheCreation = new CacheCreation();
cacheCreation.getCacheServers().add(new CacheServerCreation(cacheCreation, false));
cacheCreation.getCacheServers().add(new CacheServerCreation(cacheCreation, false));
- cacheCreation.startCacheServers(cacheCreation.getCacheServers(), cache, configuredServerPort,
- configuredServerBindAddress, disableDefaultCacheServer);
+ Integer configuredServerPort = 50505;
+ String configuredServerBindAddress = "localhost[50505]";
+ Boolean disableDefaultCacheServer = false;
+
+ cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache,
+ configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
}
@Test
@@ -219,16 +219,16 @@ public class CacheCreationJUnitTest {
GatewayReceiver receiver = mock(GatewayReceiver.class);
cacheCreation.addGatewayReceiver(receiver);
cacheCreation.addRootRegion(new RegionCreation(cacheCreation, "region"));
- GemFireCacheImpl cache = mock(GemFireCacheImpl.class);
+ InternalCache internalCache = mock(InternalCache.class);
GatewayReceiverFactory receiverFactory = mock(GatewayReceiverFactory.class);
- when(cache.createGatewayReceiverFactory()).thenReturn(receiverFactory);
+ when(internalCache.createGatewayReceiverFactory()).thenReturn(receiverFactory);
when(receiverFactory.create()).thenReturn(receiver);
- InOrder inOrder = inOrder(cache, receiverFactory);
- cacheCreation.create(cache);
+ InOrder inOrder = inOrder(internalCache, receiverFactory);
+ cacheCreation.create(internalCache);
- inOrder.verify(cache).basicCreateRegion(eq("region"), any());
- inOrder.verify(cache).createGatewayReceiverFactory();
+ // inOrder.verify(cache).basicCreateRegion(eq("region"), any());
+ inOrder.verify(internalCache).createGatewayReceiverFactory();
inOrder.verify(receiverFactory).create();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
index 5b07f28..4b7ba9c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
@@ -60,6 +60,7 @@ import org.apache.geode.internal.AvailablePort;
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.cache.DiskStoreImpl;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.SnapshotTestUtil;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
@@ -96,7 +97,7 @@ import java.util.concurrent.TimeUnit;
* The DiskStoreCommandsDUnitTest class is a distributed test suite of test cases for testing the
* disk store commands that are part of Gfsh.
* </p>
- *
+ *
* @see org.apache.geode.management.internal.cli.commands.DiskStoreCommands
* @see org.junit.Assert
* @see org.junit.Test
@@ -202,7 +203,7 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
regionFactory.setScope(Scope.DISTRIBUTED_ACK);
try {
regionFactory.create(regionName);
- } catch (DistributedSystemDisconnectedException e) {
+ } catch (DistributedSystemDisconnectedException ignore) {
// okay to ignore
}
}
@@ -215,7 +216,7 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
public boolean done() {
Cache cache = getCache();
PersistentMemberManager memberManager =
- ((GemFireCacheImpl) cache).getPersistentMemberManager();
+ ((InternalCache) cache).getPersistentMemberManager();
return !memberManager.getWaitingRegions().isEmpty();
}
@@ -840,13 +841,13 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
Cache cache = getCache();
assertNotNull(cache);
- GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
- Collection<DiskStoreImpl> diskStoreList = gfc.listDiskStores();
+ InternalCache internalCache = (InternalCache) cache;
+ Collection<DiskStore> diskStoreList = internalCache.listDiskStores();
assertNotNull(diskStoreList);
assertFalse(diskStoreList.isEmpty());
assertTrue(diskStoreList.size() == 1);
- for (DiskStoreImpl diskStore : diskStoreList) {
+ for (DiskStore diskStore : diskStoreList) {
assertTrue(diskStore.getName().equals(diskStoreName));
break;
}
@@ -892,8 +893,8 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
getSystem(localProps);
Cache cache = getCache();
assertNotNull(cache);
- GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
- Collection<DiskStoreImpl> diskStores = gfc.listDiskStores();
+ InternalCache internalCache = (InternalCache) cache;
+ Collection<DiskStore> diskStores = internalCache.listDiskStores();
assertNotNull(diskStores);
assertTrue(diskStores.isEmpty());
return null;
@@ -905,7 +906,7 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
/**
* 1) Create a disk-store in a member, get the disk-dirs. 2) Close the member. 3) Execute the
* command. 4) Restart the member. 5) Check if the disk-store is altered.
- *
+ *
* @throws IOException
* @throws ClassNotFoundException
*/
@@ -1190,9 +1191,7 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, "2023");
commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, "3110");
commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
- diskStore1Dir1.getAbsolutePath() + "#1452637463");
- commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
- diskStore1Dir2.getAbsolutePath());
+ diskStore1Dir1.getAbsolutePath() + "#1452637463," + diskStore1Dir2.getAbsolutePath());
cmdResult = executeCommand(commandStringBuilder.toString());
assertEquals(Result.Status.OK, cmdResult.getStatus());
String stringResult = commandResultToString(cmdResult);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
index 1966a08..5d74ca4 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
@@ -26,8 +26,10 @@ import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.dunit.IgnoredException;
import org.apache.geode.test.dunit.internal.JUnit3DistributedTestCase;
@@ -78,19 +80,19 @@ public abstract class JUnit3CacheTestCase extends JUnit3DistributedTestCase
/**
* Return a cache for obtaining regions, created lazily.
*/
- public final Cache getCache() {
+ public final InternalCache getCache() {
return delegate.getCache();
}
- public final Cache getCache(final CacheFactory factory) {
+ public final InternalCache getCache(final CacheFactory factory) {
return delegate.getCache(factory);
}
- public final Cache getCache(final boolean client) {
+ public final InternalCache getCache(final boolean client) {
return delegate.getCache(client);
}
- public final Cache getCache(final boolean client, final CacheFactory factory) {
+ public final InternalCache getCache(final boolean client, final CacheFactory factory) {
return delegate.getCache(client, factory);
}
@@ -99,7 +101,7 @@ public abstract class JUnit3CacheTestCase extends JUnit3DistributedTestCase
*
* @since GemFire 6.5
*/
- public final ClientCache getClientCache(final ClientCacheFactory factory) {
+ public final InternalClientCache getClientCache(final ClientCacheFactory factory) {
return delegate.getClientCache(factory);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
index 4ccf8c2..5b1629b 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -39,10 +39,12 @@ import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionMessageObserver;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.xmlcache.CacheCreation;
@@ -79,7 +81,7 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
* <p>
* Field is static so it doesn't get serialized with SerializableRunnable inner classes.
*/
- private static Cache cache;
+ private static InternalCache cache;
private final CacheTestFixture cacheTestFixture;
@@ -112,20 +114,20 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
try {
System.setProperty(
DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
- Cache newCache;
+ InternalCache newCache;
if (client) {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "locators", "");
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0");
- newCache = (Cache) new ClientCacheFactory(getSystem().getProperties()).create();
+ newCache = (InternalCache) new ClientCacheFactory(getSystem().getProperties()).create();
} else {
if (factory == null) {
- newCache = CacheFactory.create(getSystem());
+ newCache = (InternalCache) CacheFactory.create(getSystem());
} else {
Properties props = getSystem().getProperties();
for (Map.Entry entry : props.entrySet()) {
factory.set((String) entry.getKey(), (String) entry.getValue());
}
- newCache = factory.create();
+ newCache = (InternalCache) factory.create();
}
}
cache = newCache;
@@ -154,7 +156,7 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
try {
System.setProperty(
DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
- Cache newCache = CacheFactory.create(getLonerSystem());
+ InternalCache newCache = (InternalCache) CacheFactory.create(getLonerSystem());
cache = newCache;
} catch (CacheExistsException e) {
Assert.fail("the cache already exists", e); // TODO: remove error handling
@@ -238,24 +240,24 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
/**
* Return a cache for obtaining regions, created lazily.
*/
- public final Cache getCache() {
+ public final InternalCache getCache() {
return getCache(false);
}
- public final Cache getCache(final CacheFactory factory) {
+ public final InternalCache getCache(final CacheFactory factory) {
return getCache(false, factory);
}
- public final Cache getCache(final Properties properties) {
+ public final InternalCache getCache(final Properties properties) {
getSystem(properties);
return getCache();
}
- public final Cache getCache(final boolean client) {
+ public final InternalCache getCache(final boolean client) {
return getCache(client, null);
}
- public final Cache getCache(final boolean client, final CacheFactory factory) {
+ public final InternalCache getCache(final boolean client, final CacheFactory factory) {
synchronized (JUnit4CacheTestCase.class) {
final GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
if (gemFireCache != null && !gemFireCache.isClosed()
@@ -288,7 +290,7 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
*
* @since GemFire 6.5
*/
- public final ClientCache getClientCache(final ClientCacheFactory factory) {
+ public final InternalClientCache getClientCache(final ClientCacheFactory factory) {
synchronized (JUnit4CacheTestCase.class) {
final GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
if (gemFireCache != null && !gemFireCache.isClosed()
@@ -308,12 +310,12 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
if (cache == null || cache.isClosed()) {
cache = null;
disconnectFromDS();
- cache = (Cache) factory.create();
+ cache = (InternalCache) factory.create();
}
if (cache != null) {
IgnoredException.addIgnoredException("java.net.ConnectException");
}
- return (ClientCache) cache;
+ return (InternalClientCache) cache;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVM.java b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVM.java
index 3e8630b..d02ce74 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVM.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVM.java
@@ -24,14 +24,10 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- */
public class RemoteDUnitVM extends UnicastRemoteObject implements RemoteDUnitVMIF {
-
private static final Logger logger = LogService.getLogger();
- public RemoteDUnitVM() throws RemoteException {
+ RemoteDUnitVM() throws RemoteException {
super();
}
@@ -40,37 +36,38 @@ public class RemoteDUnitVM extends UnicastRemoteObject implements RemoteDUnitVMI
* the object. Does this synchronously (does not spawn a thread). This method is used by the unit
* test framework, dunit.
*
- * @param obj the object to execute the method on
+ * @param target the object to execute the method on
* @param methodName the name of the method to execute
* @return the result of method execution
*/
- public MethExecutorResult executeMethodOnObject(Object obj, String methodName) {
- String name = obj.getClass().getName() + "." + methodName + " on object: " + obj;
+ @Override
+ public MethExecutorResult executeMethodOnObject(Object target, String methodName) {
+ String name = target.getClass().getName() + '.' + methodName + " on object: " + target;
long start = start(name);
- MethExecutorResult result = MethExecutor.executeObject(obj, methodName);
+ MethExecutorResult result = MethExecutor.executeObject(target, methodName);
logDelta(name, start, result);
return result;
}
protected long start(String name) {
- logger.info("Received method: " + name);
- long start = System.nanoTime();
- return start;
+ logger.info("Received method: {}", name);
+ return System.nanoTime();
}
- protected void logDelta(String name, long start, MethExecutorResult result) {
+ private void logDelta(String name, long start, MethExecutorResult result) {
long delta = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
- logger.info("Got result: " + result.toString() + " from " + name + " (took " + delta + " ms)");
+ logger.info("Got result: {} from {} (took {} ms)", result, name, delta);
}
/**
* Executes a given instance method on a given object with the given arguments.
*/
- public MethExecutorResult executeMethodOnObject(Object obj, String methodName, Object[] args) {
- String name = obj.getClass().getName() + "." + methodName
- + (args != null ? " with " + args.length + " args" : "") + " on object: " + obj;
+ @Override
+ public MethExecutorResult executeMethodOnObject(Object target, String methodName, Object[] args) {
+ String name = target.getClass().getName() + '.' + methodName
+ + (args != null ? " with " + args.length + " args" : "") + " on object: " + target;
long start = start(name);
- MethExecutorResult result = MethExecutor.executeObject(obj, methodName, args);
+ MethExecutorResult result = MethExecutor.executeObject(target, methodName, args);
logDelta(name, start, result);
return result;
}
@@ -85,7 +82,7 @@ public class RemoteDUnitVM extends UnicastRemoteObject implements RemoteDUnitVMI
* @return the result of method execution
*/
public MethExecutorResult executeMethodOnClass(String className, String methodName) {
- String name = className + "." + methodName;
+ String name = className + '.' + methodName;
long start = start(name);
MethExecutorResult result = MethExecutor.execute(className, methodName);
logDelta(name, start, result);
@@ -96,10 +93,11 @@ public class RemoteDUnitVM extends UnicastRemoteObject implements RemoteDUnitVMI
/**
* Executes a given static method in a given class with the given arguments.
*/
+ @Override
public MethExecutorResult executeMethodOnClass(String className, String methodName,
Object[] args) {
String name =
- className + "." + methodName + (args != null ? " with " + args.length + " args" : "");
+ className + '.' + methodName + (args != null ? " with " + args.length + " args" : "");
long start = start(name);
MethExecutorResult result = MethExecutor.execute(className, methodName, args);
logDelta(name, start, result);
@@ -107,22 +105,25 @@ public class RemoteDUnitVM extends UnicastRemoteObject implements RemoteDUnitVMI
}
public void executeTask(int tsid, int type, int index) throws RemoteException {
- throw new UnsupportedOperationException();
-
+ throw new UnsupportedOperationException("executeTask is not implemented");
}
public void runShutdownHook() throws RemoteException {
-
+ throw new UnsupportedOperationException("runShutdownHook is not implemented");
}
public void notifyDynamicActionComplete(int actionId) throws RemoteException {
- throw new UnsupportedOperationException();
-
+ throw new UnsupportedOperationException("notifyDynamicActionComplete is not implemented");
}
+ @Override
public void shutDownVM() throws RemoteException {
ChildVM.stopVM();
}
- public void disconnectVM() throws RemoteException {}
+ public void disconnectVM() throws RemoteException {
+ throw new UnsupportedOperationException("disconnectVM is not implemented");
+ }
+
+ private static final long serialVersionUID = 251934856609958734L;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVMIF.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVMIF.java b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVMIF.java
index d2cc533..9db6b06 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVMIF.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/RemoteDUnitVMIF.java
@@ -21,12 +21,12 @@ import hydra.MethExecutorResult;
public interface RemoteDUnitVMIF extends Remote {
- MethExecutorResult executeMethodOnObject(Object o, String methodName) throws RemoteException;
+ MethExecutorResult executeMethodOnObject(Object target, String methodName) throws RemoteException;
- MethExecutorResult executeMethodOnObject(Object o, String methodName, Object[] args)
+ MethExecutorResult executeMethodOnObject(Object target, String methodName, Object[] args)
throws RemoteException;
- MethExecutorResult executeMethodOnClass(String name, String methodName, Object[] args)
+ MethExecutorResult executeMethodOnClass(String className, String methodName, Object[] args)
throws RemoteException;
void shutDownVM() throws RemoteException;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
index 07e3171..f680b63 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
@@ -215,7 +215,8 @@ public abstract class CqQueryImpl implements InternalCqQuery {
}
// Set Query ExecutionContext, that will be used in later execution.
- this.setQueryExecutionContext(new QueryExecutionContext(null, this.cqService.getCache()));
+ this.setQueryExecutionContext(
+ new QueryExecutionContext(null, (InternalCache) this.cqService.getCache()));
}
/**
[29/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
index 96a3c83..d0a7299 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
@@ -20,16 +20,15 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.AmbiguousNameException;
import org.apache.geode.cache.query.FunctionDomainException;
@@ -41,7 +40,6 @@ import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.Struct;
import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.cache.query.internal.Bag;
import org.apache.geode.cache.query.internal.CompiledID;
import org.apache.geode.cache.query.internal.CompiledIndexOperation;
import org.apache.geode.cache.query.internal.CompiledIteratorDef;
@@ -60,16 +58,17 @@ import org.apache.geode.cache.query.internal.StructFields;
import org.apache.geode.cache.query.internal.StructImpl;
import org.apache.geode.cache.query.internal.Support;
import org.apache.geode.cache.query.internal.index.IndexStore.IndexStoreEntry;
+import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.internal.types.StructTypeImpl;
-import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.CachedDeserializable;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.RegionEntry;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.persistence.query.CloseableIterator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -85,12 +84,12 @@ import org.apache.geode.pdx.internal.PdxString;
* abstract methods to add and remove entries to an underlying storage structure (e.g. a btree), and
* as part of this algorithm, maintains a map of entries that map to null at the end of the index
* path, and entries that cannot be traversed to the end of the index path (traversal is undefined).
- *
*/
public abstract class AbstractIndex implements IndexProtocol {
private static final Logger logger = LogService.getLogger();
- private static final AtomicIntegerFieldUpdater<RegionEntryToValuesMap> atomicUpdater =
+ // package-private to avoid synthetic accessor
+ static final AtomicIntegerFieldUpdater<RegionEntryToValuesMap> atomicUpdater =
AtomicIntegerFieldUpdater.newUpdater(RegionEntryToValuesMap.class, "numValues");
final String indexName;
@@ -107,45 +106,49 @@ public abstract class AbstractIndex implements IndexProtocol {
final String originalFromClause;
- final String originalProjectionAttributes;
+ private final String originalProjectionAttributes;
final String[] canonicalizedDefinitions;
private boolean isValid;
protected IndexedExpressionEvaluator evaluator;
- // Statistics
- protected InternalIndexStatistics internalIndexStats;
- // For PartitionedIndex for now
+ InternalIndexStatistics internalIndexStats;
+
+ /** For PartitionedIndex for now */
protected Index prIndex;
- // Flag to indicate if index map has keys as PdxString
- // All the keys in the index map should be either Strings or PdxStrings
- protected Boolean isIndexedPdxKeys = false;
- // Flag to indicate if the flag isIndexedPdxKeys is set
- protected Boolean isIndexedPdxKeysFlagSet = false;
+ /**
+ * Flag to indicate if index map has keys as PdxString All the keys in the index map should be
+ * either Strings or PdxStrings
+ */
+ private Boolean isIndexedPdxKeys = false;
+
+ /** Flag to indicate if the flag isIndexedPdxKeys is set */
+ Boolean isIndexedPdxKeysFlagSet = false;
- protected boolean indexOnRegionKeys = false;
+ boolean indexOnRegionKeys = false;
- protected boolean indexOnValues = false;
+ boolean indexOnValues = false;
private final ReadWriteLock removeIndexLock = new ReentrantReadWriteLock();
- // Flag to indicate if the index is populated with data
- protected volatile boolean isPopulated = false;
+ /** Flag to indicate if the index is populated with data */
+ volatile boolean isPopulated = false;
AbstractIndex(String indexName, Region region, String fromClause, String indexedExpression,
- String projectionAttributes, String origFromClause, String origIndxExpr, String[] defintions,
- IndexStatistics stats) {
+ String projectionAttributes, String originalFromClause, String originalIndexedExpression,
+ String[] defintions, IndexStatistics stats) {
+
this.indexName = indexName;
this.region = region;
this.indexedExpression = indexedExpression;
this.fromClause = fromClause;
- this.originalIndexedExpression = origIndxExpr;
- this.originalFromClause = origFromClause;
+ this.originalIndexedExpression = originalIndexedExpression;
+ this.originalFromClause = originalFromClause;
this.canonicalizedDefinitions = defintions;
- if (projectionAttributes == null || projectionAttributes.length() == 0) {
+ if (projectionAttributes == null || projectionAttributes.isEmpty()) {
projectionAttributes = "*";
}
this.projectionAttributes = projectionAttributes;
@@ -170,10 +173,12 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Get statistics information for this index.
*/
+ @Override
public IndexStatistics getStatistics() {
return this.internalIndexStats;
}
+ @Override
public void destroy() {
markValid(false);
if (this.internalIndexStats != null) {
@@ -221,7 +226,7 @@ public abstract class AbstractIndex implements IndexProtocol {
}
public IndexedExpressionEvaluator getEvaluator() {
- return evaluator;
+ return this.evaluator;
}
/**
@@ -229,6 +234,7 @@ public abstract class AbstractIndex implements IndexProtocol {
*
* @return the Region for this index
*/
+ @Override
public Region getRegion() {
return this.region;
}
@@ -236,25 +242,28 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Returns the unique name of this index
*/
+ @Override
public String getName() {
return this.indexName;
}
- // ////////// Index default implementation
+ @Override
public void query(Object key, int operator, Collection results, ExecutionContext context)
throws TypeMismatchException, FunctionDomainException, NameResolutionException,
QueryInvocationTargetException {
+
// get a read lock when doing a lookup
- if (context.getBucketList() != null && (this.region instanceof BucketRegion)) {
- PartitionedRegion pr = ((BucketRegion) region).getPartitionedRegion();
+ if (context.getBucketList() != null && this.region instanceof BucketRegion) {
+ PartitionedRegion pr = ((Bucket) this.region).getPartitionedRegion();
long start = updateIndexUseStats();
try {
- for (Object b : context.getBucketList()) {
- AbstractIndex i = PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) b);
- if (i == null) {
+ for (Object bucketId : context.getBucketList()) {
+ AbstractIndex bucketIndex =
+ PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) bucketId);
+ if (bucketIndex == null) {
continue;
}
- i.lockedQuery(key, operator, results, null/* No Keys to be removed */, context);
+ bucketIndex.lockedQuery(key, operator, results, null/* No Keys to be removed */, context);
}
} finally {
@@ -264,28 +273,30 @@ public abstract class AbstractIndex implements IndexProtocol {
long start = updateIndexUseStats();
try {
lockedQuery(key, operator, results, null/* No Keys to be removed */, context);
- return;
} finally {
updateIndexUseEndStats(start);
}
}
}
+ @Override
public void query(Object key, int operator, Collection results, @Retained CompiledValue iterOp,
- RuntimeIterator indpndntIr, ExecutionContext context, List projAttrib,
+ RuntimeIterator indpndntItr, ExecutionContext context, List projAttrib,
SelectResults intermediateResults, boolean isIntersection) throws TypeMismatchException,
FunctionDomainException, NameResolutionException, QueryInvocationTargetException {
+
// get a read lock when doing a lookup
- if (context.getBucketList() != null && (this.region instanceof BucketRegion)) {
- PartitionedRegion pr = ((BucketRegion) region).getPartitionedRegion();
+ if (context.getBucketList() != null && this.region instanceof BucketRegion) {
+ PartitionedRegion pr = ((Bucket) region).getPartitionedRegion();
long start = updateIndexUseStats();
try {
- for (Object b : context.getBucketList()) {
- AbstractIndex i = PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) b);
- if (i == null) {
+ for (Object bucketId : context.getBucketList()) {
+ AbstractIndex bucketIndex =
+ PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) bucketId);
+ if (bucketIndex == null) {
continue;
}
- i.lockedQuery(key, operator, results, iterOp, indpndntIr, context, projAttrib,
+ bucketIndex.lockedQuery(key, operator, results, iterOp, indpndntItr, context, projAttrib,
intermediateResults, isIntersection);
}
} finally {
@@ -294,29 +305,31 @@ public abstract class AbstractIndex implements IndexProtocol {
} else {
long start = updateIndexUseStats();
try {
- lockedQuery(key, operator, results, iterOp, indpndntIr, context, projAttrib,
+ lockedQuery(key, operator, results, iterOp, indpndntItr, context, projAttrib,
intermediateResults, isIntersection);
} finally {
updateIndexUseEndStats(start);
}
}
- return;
}
+ @Override
public void query(Object key, int operator, Collection results, Set keysToRemove,
ExecutionContext context) throws TypeMismatchException, FunctionDomainException,
NameResolutionException, QueryInvocationTargetException {
+
// get a read lock when doing a lookup
- if (context.getBucketList() != null && (this.region instanceof BucketRegion)) {
- PartitionedRegion pr = ((BucketRegion) region).getPartitionedRegion();
+ if (context.getBucketList() != null && this.region instanceof BucketRegion) {
+ PartitionedRegion pr = ((Bucket) region).getPartitionedRegion();
long start = updateIndexUseStats();
try {
- for (Object b : context.getBucketList()) {
- AbstractIndex i = PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) b);
- if (i == null) {
+ for (Object bucketId : context.getBucketList()) {
+ AbstractIndex bucketIndex =
+ PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) bucketId);
+ if (bucketIndex == null) {
continue;
}
- i.lockedQuery(key, operator, results, keysToRemove, context);
+ bucketIndex.lockedQuery(key, operator, results, keysToRemove, context);
}
} finally {
updateIndexUseEndStats(start);
@@ -329,26 +342,28 @@ public abstract class AbstractIndex implements IndexProtocol {
updateIndexUseEndStats(start);
}
}
- return;
}
+ @Override
public void query(Collection results, Set keysToRemove, ExecutionContext context)
throws TypeMismatchException, FunctionDomainException, NameResolutionException,
QueryInvocationTargetException {
- Iterator itr = keysToRemove.iterator();
- Object temp = itr.next();
- itr.remove();
- if (context.getBucketList() != null && (this.region instanceof BucketRegion)) {
+
+ Iterator iterator = keysToRemove.iterator();
+ Object temp = iterator.next();
+ iterator.remove();
+ if (context.getBucketList() != null && this.region instanceof BucketRegion) {
long start = updateIndexUseStats();
try {
- PartitionedRegion pr = ((BucketRegion) region).getPartitionedRegion();
- for (Object b : context.getBucketList()) {
- AbstractIndex i = PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) b);
- if (i == null) {
+ PartitionedRegion partitionedRegion = ((Bucket) this.region).getPartitionedRegion();
+ for (Object bucketId : context.getBucketList()) {
+ AbstractIndex bucketIndex = PartitionedIndex.getBucketIndex(partitionedRegion,
+ this.indexName, (Integer) bucketId);
+ if (bucketIndex == null) {
continue;
}
- i.lockedQuery(temp, OQLLexerTokenTypes.TOK_NE, results,
- itr.hasNext() ? keysToRemove : null, context);
+ bucketIndex.lockedQuery(temp, OQLLexerTokenTypes.TOK_NE, results,
+ iterator.hasNext() ? keysToRemove : null, context);
}
} finally {
updateIndexUseEndStats(start);
@@ -356,31 +371,33 @@ public abstract class AbstractIndex implements IndexProtocol {
} else {
long start = updateIndexUseStats();
try {
- lockedQuery(temp, OQLLexerTokenTypes.TOK_NE, results, itr.hasNext() ? keysToRemove : null,
- context);
+ lockedQuery(temp, OQLLexerTokenTypes.TOK_NE, results,
+ iterator.hasNext() ? keysToRemove : null, context);
} finally {
updateIndexUseEndStats(start);
}
}
- return;
}
+ @Override
public void query(Object lowerBoundKey, int lowerBoundOperator, Object upperBoundKey,
int upperBoundOperator, Collection results, Set keysToRemove, ExecutionContext context)
throws TypeMismatchException, FunctionDomainException, NameResolutionException,
QueryInvocationTargetException {
+
if (context.getBucketList() != null) {
if (this.region instanceof BucketRegion) {
- PartitionedRegion pr = ((BucketRegion) region).getPartitionedRegion();
+ PartitionedRegion partitionedRegion = ((Bucket) this.region).getPartitionedRegion();
long start = updateIndexUseStats();
try {
- for (Object b : context.getBucketList()) {
- AbstractIndex i = PartitionedIndex.getBucketIndex(pr, this.indexName, (Integer) b);
- if (i == null) {
+ for (Object bucketId : context.getBucketList()) {
+ AbstractIndex bucketIndex = PartitionedIndex.getBucketIndex(partitionedRegion,
+ this.indexName, (Integer) bucketId);
+ if (bucketIndex == null) {
continue;
}
- i.lockedQuery(lowerBoundKey, lowerBoundOperator, upperBoundKey, upperBoundOperator,
- results, keysToRemove, context);
+ bucketIndex.lockedQuery(lowerBoundKey, lowerBoundOperator, upperBoundKey,
+ upperBoundOperator, results, keysToRemove, context);
}
} finally {
updateIndexUseEndStats(start);
@@ -395,13 +412,13 @@ public abstract class AbstractIndex implements IndexProtocol {
updateIndexUseEndStats(start);
}
}
- return;
}
-
+ @Override
public List queryEquijoinCondition(IndexProtocol index, ExecutionContext context)
throws TypeMismatchException, FunctionDomainException, NameResolutionException,
QueryInvocationTargetException {
+
Support.assertionFailed(
" This function should have never got invoked as its meaningful implementation is present only in RangeIndex class");
return null;
@@ -412,6 +429,7 @@ public abstract class AbstractIndex implements IndexProtocol {
*
* @return the projectionAttributes, or "*" if there were none specified at index creation.
*/
+ @Override
public String getProjectionAttributes() {
return this.originalProjectionAttributes;
}
@@ -421,6 +439,7 @@ public abstract class AbstractIndex implements IndexProtocol {
*
* @return the projectionAttributes, or "*" if there were none specified at index creation.
*/
+ @Override
public String getCanonicalizedProjectionAttributes() {
return this.projectionAttributes;
}
@@ -428,6 +447,7 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Get the Original indexedExpression for this index.
*/
+ @Override
public String getIndexedExpression() {
return this.originalIndexedExpression;
}
@@ -435,6 +455,7 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Get the Canonicalized indexedExpression for this index.
*/
+ @Override
public String getCanonicalizedIndexedExpression() {
return this.indexedExpression;
}
@@ -442,6 +463,7 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Get the original fromClause for this index.
*/
+ @Override
public String getFromClause() {
return this.originalFromClause;
}
@@ -449,6 +471,7 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* Get the canonicalized fromClause for this index.
*/
+ @Override
public String getCanonicalizedFromClause() {
return this.fromClause;
}
@@ -457,62 +480,71 @@ public abstract class AbstractIndex implements IndexProtocol {
return false;
}
- // ////////// IndexProtocol default implementation
+ @Override
public boolean addIndexMapping(RegionEntry entry) throws IMQException {
- this.addMapping(entry);
- return true; // if no exception, then success
+ addMapping(entry);
+ // if no exception, then success
+ return true;
}
+ @Override
public boolean addAllIndexMappings(Collection c) throws IMQException {
- Iterator iterator = c.iterator();
- while (iterator.hasNext()) {
- this.addMapping((RegionEntry) iterator.next());
+ for (Object regionEntry : c) {
+ this.addMapping((RegionEntry) regionEntry);
}
- return true; // if no exception, then success
+ // if no exception, then success
+ return true;
}
/**
* @param opCode one of OTHER_OP, BEFORE_UPDATE_OP, AFTER_UPDATE_OP.
*/
+ @Override
public boolean removeIndexMapping(RegionEntry entry, int opCode) throws IMQException {
removeMapping(entry, opCode);
- return true; // if no exception, then success
+ // if no exception, then success
+ return true;
}
+ @Override
public boolean removeAllIndexMappings(Collection c) throws IMQException {
- Iterator iterator = c.iterator();
- while (iterator.hasNext()) {
- removeMapping((RegionEntry) iterator.next(), OTHER_OP);
+ for (Object regionEntry : c) {
+ removeMapping((RegionEntry) regionEntry, OTHER_OP);
}
- return true; // if no exception, then success
+ // if no exception, then success
+ return true;
}
+ @Override
public boolean isValid() {
- return isValid;
+ return this.isValid;
}
+ @Override
public void markValid(boolean b) {
- isValid = b;
+ this.isValid = b;
}
- public boolean isMatchingWithIndexExpression(CompiledValue indexExpr, String conditionExprStr,
+ @Override
+ public boolean isMatchingWithIndexExpression(CompiledValue condnExpr, String condnExprStr,
ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
- return this.indexedExpression.equals(conditionExprStr);
+ return this.indexedExpression.equals(condnExprStr);
}
- private Object verifyAndGetPdxDomainObject(Object value) {
+ // package-private to avoid synthetic accessor
+ Object verifyAndGetPdxDomainObject(Object value) {
if (value instanceof StructImpl) {
// Doing hasPdx check first, since its cheaper.
- if (((StructImpl) value).isHasPdx() && !((GemFireCacheImpl) this.region.getCache())
- .getPdxReadSerializedByAnyGemFireServices()) {
+ if (((StructImpl) value).isHasPdx()
+ && !((InternalCache) this.region.getCache()).getPdxReadSerializedByAnyGemFireServices()) {
// Set the pdx values for the struct object.
StructImpl v = (StructImpl) value;
Object[] fieldValues = v.getPdxFieldValues();
return new StructImpl((StructTypeImpl) v.getStructType(), fieldValues);
}
- } else if (value instanceof PdxInstance && !((GemFireCacheImpl) this.region.getCache())
- .getPdxReadSerializedByAnyGemFireServices()) {
+ } else if (value instanceof PdxInstance
+ && !((InternalCache) this.region.getCache()).getPdxReadSerializedByAnyGemFireServices()) {
return ((PdxInstance) value).getObject();
}
return value;
@@ -520,6 +552,7 @@ public abstract class AbstractIndex implements IndexProtocol {
private void addToResultsWithUnionOrIntersection(Collection results,
SelectResults intermediateResults, boolean isIntersection, Object value) {
+
value = verifyAndGetPdxDomainObject(value);
if (intermediateResults == null) {
@@ -532,7 +565,6 @@ public abstract class AbstractIndex implements IndexProtocol {
intermediateResults.remove(value);
}
} else {
- // intermediateResults.add(value);
results.add(value);
}
}
@@ -540,6 +572,7 @@ public abstract class AbstractIndex implements IndexProtocol {
private void addToStructsWithUnionOrIntersection(Collection results,
SelectResults intermediateResults, boolean isIntersection, Object[] values) {
+
for (int i = 0; i < values.length; i++) {
values[i] = verifyAndGetPdxDomainObject(values[i]);
}
@@ -549,42 +582,42 @@ public abstract class AbstractIndex implements IndexProtocol {
((StructFields) results).addFieldValues(values);
} else {
// The results could be LinkedStructSet or SortedResultsBag or StructSet
- // LinkedStructSet lss = (LinkedStructSet)results;
- SelectResults sr = (SelectResults) results;
- StructImpl structImpl =
- new StructImpl((StructTypeImpl) sr.getCollectionType().getElementType(), values);
+ SelectResults selectResults = (SelectResults) results;
+ StructImpl structImpl = new StructImpl(
+ (StructTypeImpl) selectResults.getCollectionType().getElementType(), values);
// lss.add(structImpl);
- sr.add(structImpl);
+ selectResults.add(structImpl);
}
+
} else {
if (isIntersection) {
if (results instanceof StructFields) {
- int numOcc = intermediateResults.occurrences(values);
- if (numOcc > 0) {
+ int occurrences = intermediateResults.occurrences(values);
+ if (occurrences > 0) {
((StructFields) results).addFieldValues(values);
((StructFields) intermediateResults).removeFieldValues(values);
}
+
} else {
- // LinkedStructSet lss = (LinkedStructSet)results;
// could be LinkedStructSet or SortedResultsBag
- SelectResults sr = (SelectResults) results;
- StructImpl structImpl =
- new StructImpl((StructTypeImpl) sr.getCollectionType().getElementType(), values);
+ SelectResults selectResults = (SelectResults) results;
+ StructImpl structImpl = new StructImpl(
+ (StructTypeImpl) selectResults.getCollectionType().getElementType(), values);
if (intermediateResults.remove(structImpl)) {
- sr.add(structImpl);
+ selectResults.add(structImpl);
}
}
+
} else {
if (results instanceof StructFields) {
((StructFields) results).addFieldValues(values);
} else {
// could be LinkedStructSet or SortedResultsBag
- SelectResults sr = (SelectResults) results;
- // LinkedStructSet lss = (LinkedStructSet)results;
- StructImpl structImpl =
- new StructImpl((StructTypeImpl) sr.getCollectionType().getElementType(), values);
- if (((SelectResults) intermediateResults).remove(structImpl)) {
- sr.add(structImpl);
+ SelectResults selectResults = (SelectResults) results;
+ StructImpl structImpl = new StructImpl(
+ (StructTypeImpl) selectResults.getCollectionType().getElementType(), values);
+ if (intermediateResults.remove(structImpl)) {
+ selectResults.add(structImpl);
}
}
}
@@ -595,26 +628,24 @@ public abstract class AbstractIndex implements IndexProtocol {
Object iterValue, SelectResults intermediateResults, boolean isIntersection)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
+
if (projAttrib == null) {
iterValue = deserializePdxForLocalDistinctQuery(context, iterValue);
this.addToResultsWithUnionOrIntersection(result, intermediateResults, isIntersection,
iterValue);
+
} else {
- // TODO : Asif : Optimize this . This condition looks ugly.
- /*
- * if (result instanceof StructBag || result instanceof LinkedStructSet || result instanceof
- * LinkedStructBag) {
- */
boolean isStruct = result instanceof SelectResults
&& ((SelectResults) result).getCollectionType().getElementType() != null
&& ((SelectResults) result).getCollectionType().getElementType().isStructType();
+
if (isStruct) {
int projCount = projAttrib.size();
Object[] values = new Object[projCount];
Iterator projIter = projAttrib.iterator();
int i = 0;
while (projIter.hasNext()) {
- Object projDef[] = (Object[]) projIter.next();
+ Object[] projDef = (Object[]) projIter.next();
values[i] = deserializePdxForLocalDistinctQuery(context,
((CompiledValue) projDef[1]).evaluate(context));
i++;
@@ -630,34 +661,35 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
- // For local queries with distinct, deserialize all PdxInstances
- // as we do not have a way to compare Pdx and non Pdx objects in case
- // the cache has a mix of pdx and non pdx objects.
- // We still have to honor the cache level readserialized flag in
- // case of all Pdx objects in cache.
- // Also always convert PdxString to String before adding to resultset
- // for remote queries
- private Object deserializePdxForLocalDistinctQuery(ExecutionContext context, Object val)
+ /**
+ * For local queries with distinct, deserialize all PdxInstances as we do not have a way to
+ * compare Pdx and non Pdx objects in case the cache has a mix of pdx and non pdx objects. We
+ * still have to honor the cache level readSerialized flag in case of all Pdx objects in cache.
+ * Also always convert PdxString to String before adding to resultSet for remote queries
+ */
+ private Object deserializePdxForLocalDistinctQuery(ExecutionContext context, Object value)
throws QueryInvocationTargetException {
+
if (!((DefaultQuery) context.getQuery()).isRemoteQuery()) {
- if (context.isDistinct() && val instanceof PdxInstance
+ if (context.isDistinct() && value instanceof PdxInstance
&& !this.region.getCache().getPdxReadSerialized()) {
try {
- val = ((PdxInstance) val).getObject();
+ value = ((PdxInstance) value).getObject();
} catch (Exception ex) {
throw new QueryInvocationTargetException(
"Unable to retrieve domain object from PdxInstance while building the ResultSet. "
+ ex.getMessage());
}
- } else if (val instanceof PdxString) {
- val = ((PdxString) val).toString();
+ } else if (value instanceof PdxString) {
+ value = value.toString();
}
}
- return val;
+ return value;
}
private void removeFromResultsWithUnionOrIntersection(Collection results,
SelectResults intermediateResults, boolean isIntersection, Object value) {
+
if (intermediateResults == null) {
results.remove(value);
} else {
@@ -674,8 +706,8 @@ public abstract class AbstractIndex implements IndexProtocol {
}
private void removeFromStructsWithUnionOrIntersection(Collection results,
- SelectResults intermediateResults, boolean isIntersection, Object values[],
- ExecutionContext context) {
+ SelectResults intermediateResults, boolean isIntersection, Object[] values) {
+
if (intermediateResults == null) {
((StructFields) results).removeFieldValues(values);
} else {
@@ -692,10 +724,11 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
- void removeProjection(List projAttrib, ExecutionContext context, Collection result,
+ private void removeProjection(List projAttrib, ExecutionContext context, Collection result,
Object iterValue, SelectResults intermediateResults, boolean isIntersection)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
+
if (projAttrib == null) {
this.removeFromResultsWithUnionOrIntersection(result, intermediateResults, isIntersection,
iterValue);
@@ -710,7 +743,7 @@ public abstract class AbstractIndex implements IndexProtocol {
values[i++] = ((CompiledValue) projDef[1]).evaluate(context);
}
this.removeFromStructsWithUnionOrIntersection(result, intermediateResults, isIntersection,
- values, context);
+ values);
} else {
Object[] temp = (Object[]) projAttrib.get(0);
Object val = ((CompiledValue) temp[1]).evaluate(context);
@@ -721,37 +754,43 @@ public abstract class AbstractIndex implements IndexProtocol {
}
- /*
- * This function returns the canonicalized defintions of the from clauses used in Index creation
- * TODO:Asif :How to make it final so that it is immutable
+ /**
+ * This function returns the canonicalized definitions of the from clauses used in Index creation
*/
+ @Override
public String[] getCanonicalizedIteratorDefinitions() {
return this.canonicalizedDefinitions;
}
- // Asif : This implementation is for PrimaryKeyIndex. RangeIndex has its
- // own implementation. For PrimaryKeyIndex , this method should not be used
- // TODO: Asif : Check if an Exception should be thrown if the function
- // implementation of this class gets invoked
+ /**
+ * This implementation is for PrimaryKeyIndex. RangeIndex has its own implementation. For
+ * PrimaryKeyIndex , this method should not be used
+ * <p>
+ * TODO: check if an Exception should be thrown if the function implementation of this class gets
+ * invoked
+ */
+ @Override
public boolean containsEntry(RegionEntry entry) {
return false;
}
- void instantiateEvaluator(IndexCreationHelper ich) {}
-
- public void initializeIndex(boolean loadEntries) throws IMQException {}
+ abstract void instantiateEvaluator(IndexCreationHelper indexCreationHelper);
+ @Override
+ public void initializeIndex(boolean loadEntries) throws IMQException {
+ // implement me
+ }
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("Index [");
sb.append(" Name=").append(getName());
sb.append(" Type =").append(getType());
sb.append(" IdxExp=").append(getIndexedExpression());
sb.append(" From=").append(getFromClause());
sb.append(" Proj=").append(getProjectionAttributes());
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
@@ -761,6 +800,7 @@ public abstract class AbstractIndex implements IndexProtocol {
protected abstract InternalIndexStatistics createStats(String indexName);
+ @Override
public abstract ObjectType getResultSetType();
abstract void recreateIndexData() throws IMQException;
@@ -772,14 +812,9 @@ public abstract class AbstractIndex implements IndexProtocol {
abstract void addMapping(Object key, Object value, RegionEntry entry) throws IMQException;
/**
- * Shobhit: This is used to buffer the index entries evaluated from a RegionEntry which is getting
- * updated at present. These buffered index entries are replaced into the index later all together
- * to avoid remove-add sequence.
- *
- * @param key
- * @param value
- * @param entry
- * @throws IMQException
+ * This is used to buffer the index entries evaluated from a RegionEntry which is getting updated
+ * at present. These buffered index entries are replaced into the index later all together to
+ * avoid remove-add sequence.
*/
abstract void saveMapping(Object key, Object value, RegionEntry entry) throws IMQException;
@@ -799,58 +834,58 @@ public abstract class AbstractIndex implements IndexProtocol {
NameResolutionException, QueryInvocationTargetException;
public Index getPRIndex() {
- return prIndex;
+ return this.prIndex;
}
- public void setPRIndex(Index parIndex) {
+ void setPRIndex(Index parIndex) {
this.prIndex = parIndex;
}
-
/**
* Dummy implementation that subclasses can override.
*/
- protected static abstract class InternalIndexStatistics implements IndexStatistics {
+ protected abstract static class InternalIndexStatistics implements IndexStatistics {
+ @Override
public long getNumUpdates() {
return 0L;
}
+ @Override
public long getTotalUpdateTime() {
return 0L;
}
+ @Override
public long getTotalUses() {
return 0L;
}
+ @Override
public long getNumberOfKeys() {
return 0L;
}
+ @Override
public long getNumberOfValues() {
return 0L;
}
+ @Override
public long getNumberOfValues(Object key) {
return 0L;
}
- public long getUpdateTime() {
- return 0L;
- }
-
- public long getUseTime() {
- return 0L;
- }
-
+ @Override
public int getReadLockCount() {
return 0;
}
+ @Override
public long getNumberOfMapIndexKeys() {
return 0;
}
+ @Override
public int getNumberOfBucketIndexes() {
return 0;
}
@@ -884,55 +919,51 @@ public abstract class AbstractIndex implements IndexProtocol {
public void incNumBucketIndexes(int delta) {}
}
- /**
- *
- */
class IMQEvaluator implements IndexedExpressionEvaluator {
- private Cache cache;
+ private final InternalCache cache;
private List fromIterators = null;
private CompiledValue indexedExpr = null;
- final private String[] canonicalIterNames;
+ private final String[] canonicalIterNames;
private ObjectType indexResultSetType = null;
private Map dependencyGraph = null;
/*
- * Asif : The boolean if true indicates that the 0th iterator is on entries . If the 0th
- * iterator is on collection of Region.Entry objects, then the RegionEntry object used in Index
- * data objects is obtained directly from its corresponding Region.Entry object. However if the
- * 0th iterator is not on entries then the boolean is false. In this case the additional
- * projection attribute gives us the original value of the iterator while the Region.Entry
- * object is obtained from 0th iterator. It is possible to have index being created on a Region
- * Entry itself , instead of a Region. A Map operator( Compiled Index Operator) used with Region
- * enables, us to create such indexes. In such case the 0th iterator, even if it represents a
- * collection of Objects which are not Region.Entry objects, still the boolean remains true, as
- * the Entry object can be easily obtained from the 0th iterator. In this case, the additional
- * projection attribute s not null as it is used to evaluate the Entry object from the 0th
- * iterator.
+ * The boolean if true indicates that the 0th iterator is on entries . If the 0th iterator is on
+ * collection of Region.Entry objects, then the RegionEntry object used in Index data objects is
+ * obtained directly from its corresponding Region.Entry object. However if the 0th iterator is
+ * not on entries then the boolean is false. In this case the additional projection attribute
+ * gives us the original value of the iterator while the Region.Entry object is obtained from
+ * 0th iterator. It is possible to have index being created on a Region Entry itself , instead
+ * of a Region. A Map operator( Compiled Index Operator) used with Region enables, us to create
+ * such indexes. In such case the 0th iterator, even if it represents a collection of Objects
+ * which are not Region.Entry objects, still the boolean remains true, as the Entry object can
+ * be easily obtained from the 0th iterator. In this case, the additional projection attribute s
+ * not null as it is used to evaluate the Entry object from the 0th iterator.
*/
private boolean isFirstItrOnEntry = false;
- // Shobhit: The boolean if true indicates that the 0th iterator is on keys.
+ /** The boolean if true indicates that the 0th iterator is on keys. */
private boolean isFirstItrOnKey = false;
- // Asif: List of modified iterators, not null only when the booelan
- // isFirstItrOnEntry is false.
+ /**
+ * List of modified iterators, not null only when the boolean isFirstItrOnEntry is false.
+ */
private List indexInitIterators = null;
- // Asif : The additional Projection attribute representing the value of the
- // original 0th iterator.
- // If the isFirstItrOnEntry is false, then it is not null. However if the
- // isFirstItrOnEntry is
- // true but & still this attribute is not null, this indicates that the 0th
- // iterator
- // is derived using an individual entry thru Map operator on the Region.
+ /**
+ * The additional Projection attribute representing the value of the original 0th iterator. If
+ * the isFirstItrOnEntry is false, then it is not null. However if the isFirstItrOnEntry is true
+ * but & still this attribute is not null, this indicates that the 0th iterator is derived using
+ * an individual entry thru Map operator on the Region.
+ */
private CompiledValue additionalProj = null;
- // Asif : This is not null iff the boolean isFirstItrOnEntry is false.
+ /** This is not null iff the boolean isFirstItrOnEntry is false. */
private CompiledValue modifiedIndexExpr = null;
private ObjectType addnlProjType = null;
@@ -953,58 +984,63 @@ public abstract class AbstractIndex implements IndexProtocol {
this.fromIterators = helper.getIterators();
this.indexedExpr = helper.getCompiledIndexedExpression();
this.rgn = helper.getRegion();
- // Asif : The modified iterators for optmizing Index cxreation
- isFirstItrOnEntry = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionEntry;
- isFirstItrOnKey = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionKey;
- additionalProj = ((FunctionalIndexCreationHelper) helper).additionalProj;
- Object params1[] = {new QRegion(rgn, false)};
- initContext = new ExecutionContext(params1, cache);
+ // The modified iterators for optimizing Index creation
+ this.isFirstItrOnEntry = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionEntry;
+ this.isFirstItrOnKey = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionKey;
+ this.additionalProj = ((FunctionalIndexCreationHelper) helper).additionalProj;
+ Object[] params1 = {new QRegion(this.rgn, false)};
+ this.initContext = new ExecutionContext(params1, this.cache);
this.canonicalIterNames = ((FunctionalIndexCreationHelper) helper).canonicalizedIteratorNames;
- if (isFirstItrOnEntry) {
+ if (this.isFirstItrOnEntry) {
this.indexInitIterators = this.fromIterators;
} else {
this.indexInitIterators = ((FunctionalIndexCreationHelper) helper).indexInitIterators;
- modifiedIndexExpr = ((FunctionalIndexCreationHelper) helper).modifiedIndexExpr;
- addnlProjType = ((FunctionalIndexCreationHelper) helper).addnlProjType;
+ this.modifiedIndexExpr = ((FunctionalIndexCreationHelper) helper).modifiedIndexExpr;
+ this.addnlProjType = ((FunctionalIndexCreationHelper) helper).addnlProjType;
}
this.iteratorSize = this.indexInitIterators.size();
-
}
+ @Override
public String getIndexedExpression() {
return AbstractIndex.this.getCanonicalizedIndexedExpression();
}
+ @Override
public String getProjectionAttributes() {
return AbstractIndex.this.getCanonicalizedProjectionAttributes();
}
+ @Override
public String getFromClause() {
return AbstractIndex.this.getCanonicalizedFromClause();
}
+ @Override
public void expansion(List expandedResults, Object lowerBoundKey, Object upperBoundKey,
int lowerBoundOperator, int upperBoundOperator, Object value) throws IMQException {
// no-op
}
+ @Override
public void evaluate(RegionEntry target, boolean add) throws IMQException {
assert add; // ignored, but should be true here
- DummyQRegion dQRegion = new DummyQRegion(rgn);
+ DummyQRegion dQRegion = new DummyQRegion(this.rgn);
dQRegion.setEntry(target);
- Object params[] = {dQRegion};
+ Object[] params = {dQRegion};
ExecutionContext context = new ExecutionContext(params, this.cache);
context.newScope(IndexCreationHelper.INDEX_QUERY_SCOPE_ID);
+
try {
boolean computeDependency = true;
- if (dependencyGraph != null) {
- context.setDependencyGraph(dependencyGraph);
+ if (this.dependencyGraph != null) {
+ context.setDependencyGraph(this.dependencyGraph);
computeDependency = false;
}
for (int i = 0; i < this.iteratorSize; i++) {
- CompiledIteratorDef iterDef = (CompiledIteratorDef) fromIterators.get(i);
- // Asif: Compute the dependency only once. The call to methods of this
+ CompiledIteratorDef iterDef = (CompiledIteratorDef) this.fromIterators.get(i);
+ // Compute the dependency only once. The call to methods of this
// class are thread safe as for update lock on Index is taken .
if (computeDependency) {
iterDef.computeDependencies(context);
@@ -1013,9 +1049,10 @@ public abstract class AbstractIndex implements IndexProtocol {
context.addToIndependentRuntimeItrMapForIndexCreation(iterDef);
context.bindIterator(rIter);
}
+
// Save the dependency graph for future updates.
- if (dependencyGraph == null) {
- dependencyGraph = context.getDependencyGraph();
+ if (this.dependencyGraph == null) {
+ this.dependencyGraph = context.getDependencyGraph();
}
Support.Assert(this.indexResultSetType != null,
@@ -1032,17 +1069,15 @@ public abstract class AbstractIndex implements IndexProtocol {
}
/**
- * Asif : This function is used for creating Index data at the start
- *
+ * This function is used for creating Index data at the start
*/
+ @Override
public void initializeIndex(boolean loadEntries) throws IMQException {
this.initEntriesUpdated = 0;
try {
- // Asif: Since an index initialization can happen multiple times
- // for a given region, due to clear operation, we are using harcoded
- // scope ID of 1 , as otherwise if obtained from ExecutionContext
- // object,
- // it will get incremented on very index initialization
+ // Since an index initialization can happen multiple times for a given region, due to clear
+ // operation, we are using hardcoded scope ID of 1 , as otherwise if obtained from
+ // ExecutionContext object, it will get incremented on very index initialization
this.initContext.newScope(1);
for (int i = 0; i < this.iteratorSize; i++) {
CompiledIteratorDef iterDef = (CompiledIteratorDef) this.indexInitIterators.get(i);
@@ -1083,28 +1118,27 @@ public abstract class AbstractIndex implements IndexProtocol {
applyProjectionForIndexInit(runtimeIterators);
} else {
RuntimeIterator rIter = (RuntimeIterator) runtimeIterators.get(level);
- // System.out.println("Level = "+level+" Iter = "+rIter.getDef());
- Collection c = rIter.evaluateCollection(this.initContext);
- if (c == null)
+ Collection collection = rIter.evaluateCollection(this.initContext);
+ if (collection == null) {
return;
- Iterator cIter = c.iterator();
- while (cIter.hasNext()) {
- rIter.setCurrent(cIter.next());
+ }
+ for (Object aCollection : collection) {
+ rIter.setCurrent(aCollection);
doNestedIterationsForIndexInit(level + 1, runtimeIterators);
}
}
}
- /*
- * Asif : This function is used to obtain Indxe data at the time of index creation. Each element
- * of the List is an Object Array of size 3. The 0th element of Object Array stores the value of
- * Index Expression. The 1st element of ObjectArray contains the RegionEntry object ( If the
- * booelan isFirstItrOnEntry is false, then the 0th iterator will give us the Region.Entry
- * object which can be used to obtain the underlying RegionEntry object. If the boolean is true
- * & additional projection attribute is not null, then the Region.Entry object can be obtained
- * by evaluating the additional projection attribute. If the boolean isFirstItrOnEntry is tru e&
- * additional projection attribute is null, then teh 0th iterator itself will evaluate to
- * Region.Entry Object.
+ /**
+ * This function is used to obtain Index data at the time of index creation. Each element of the
+ * List is an Object Array of size 3. The 0th element of Object Array stores the value of Index
+ * Expression. The 1st element of ObjectArray contains the RegionEntry object ( If the boolean
+ * isFirstItrOnEntry is false, then the 0th iterator will give us the Region.Entry object which
+ * can be used to obtain the underlying RegionEntry object. If the boolean is true & additional
+ * projection attribute is not null, then the Region.Entry object can be obtained by evaluating
+ * the additional projection attribute. If the boolean isFirstItrOnEntry is true & additional
+ * projection attribute is null, then the 0th iterator itself will evaluate to Region.Entry
+ * Object.
*
* The 2nd element of Object Array contains the Struct object ( tuple) created. If the boolean
* isFirstItrOnEntry is false, then the first attribute of the Struct object is obtained by
@@ -1113,40 +1147,40 @@ public abstract class AbstractIndex implements IndexProtocol {
private void applyProjectionForIndexInit(List currrentRuntimeIters)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException, IMQException {
+
if (QueryMonitor.isLowMemory()) {
throw new IMQException(
LocalizedStrings.IndexCreationMsg_CANCELED_DUE_TO_LOW_MEMORY.toLocalizedString());
}
- LocalRegion.NonTXEntry temp = null;
+ LocalRegion.NonTXEntry temp;
// Evaluate NonTXEntry for index on entries or additional projections
// on Entry or just entry value.
if (this.isFirstItrOnEntry && this.additionalProj != null) {
- temp = (LocalRegion.NonTXEntry) additionalProj.evaluate(this.initContext);
+ temp = (LocalRegion.NonTXEntry) this.additionalProj.evaluate(this.initContext);
} else {
- temp = (LocalRegion.NonTXEntry) (((RuntimeIterator) currrentRuntimeIters.get(0))
- .evaluate(this.initContext));
+ temp = (LocalRegion.NonTXEntry) ((RuntimeIterator) currrentRuntimeIters.get(0))
+ .evaluate(this.initContext);
}
RegionEntry re = temp.getRegionEntry();
- Object indxResultSet = null;
+ Object indxResultSet;
- // Object tuple[] ;
if (this.iteratorSize == 1) {
indxResultSet = this.isFirstItrOnEntry
- ? ((this.additionalProj == null) ? temp
- : ((RuntimeIterator) currrentRuntimeIters.get(0)).evaluate(this.initContext))
- : additionalProj.evaluate(this.initContext);
+ ? this.additionalProj == null ? temp
+ : ((RuntimeIterator) currrentRuntimeIters.get(0)).evaluate(this.initContext)
+ : this.additionalProj.evaluate(this.initContext);
} else {
Object[] tuple = new Object[this.iteratorSize];
- int i = (this.isFirstItrOnEntry) ? 0 : 1;
+ int i = this.isFirstItrOnEntry ? 0 : 1;
for (; i < this.iteratorSize; i++) {
RuntimeIterator iter = (RuntimeIterator) currrentRuntimeIters.get(i);
tuple[i] = iter.evaluate(this.initContext);
}
if (!this.isFirstItrOnEntry)
- tuple[0] = additionalProj.evaluate(this.initContext);
+ tuple[0] = this.additionalProj.evaluate(this.initContext);
Support.Assert(this.indexResultSetType instanceof StructTypeImpl,
"The Index ResultType should have been an instance of StructTypeImpl rather than ObjectTypeImpl. The indxeResultType is "
+ this.indexResultSetType);
@@ -1154,34 +1188,32 @@ public abstract class AbstractIndex implements IndexProtocol {
}
// Key must be evaluated after indexResultSet evaluation is done as Entry might be getting
- // destroyed
- // and so if value is UNDEFINED, key will definitely will be UNDEFINED.
+ // destroyed and so if value is UNDEFINED, key will definitely will be UNDEFINED.
Object indexKey = this.isFirstItrOnEntry ? this.indexedExpr.evaluate(this.initContext)
- : modifiedIndexExpr.evaluate(this.initContext);
+ : this.modifiedIndexExpr.evaluate(this.initContext);
// based on the first key convert the rest to PdxString or String
- if (!isIndexedPdxKeysFlagSet) {
+ if (!AbstractIndex.this.isIndexedPdxKeysFlagSet) {
setPdxStringFlag(indexKey);
}
indexKey = getPdxStringForIndexedPdxKeys(indexKey);
addMapping(indexKey, indxResultSet, re);
}
- // TODO:Asif : This appears to be incorrect.
private void doNestedIterations(int level, ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, FunctionDomainException,
NameResolutionException, QueryInvocationTargetException, IMQException {
+
List iterList = context.getCurrentIterators();
if (level == this.iteratorSize) {
applyProjection(context);
} else {
RuntimeIterator rIter = (RuntimeIterator) iterList.get(level);
- // System.out.println("Level = "+level+" Iter = "+rIter.getDef());
- Collection c = rIter.evaluateCollection(context);
- if (c == null)
+ Collection collection = rIter.evaluateCollection(context);
+ if (collection == null) {
return;
- Iterator cIter = c.iterator();
- while (cIter.hasNext()) {
- rIter.setCurrent(cIter.next());
+ }
+ for (Object aCollection : collection) {
+ rIter.setCurrent(aCollection);
doNestedIterations(level + 1, context);
}
}
@@ -1190,15 +1222,16 @@ public abstract class AbstractIndex implements IndexProtocol {
private void applyProjection(ExecutionContext context)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException, IMQException {
+
List currrentRuntimeIters = context.getCurrentIterators();
- Object indxResultSet = null;
- // int size = currrentRuntimeIters.size();
- Object indexKey = indexedExpr.evaluate(context);
+ Object indexKey = this.indexedExpr.evaluate(context);
// based on the first key convert the rest to PdxString or String
- if (!isIndexedPdxKeysFlagSet) {
+ if (!AbstractIndex.this.isIndexedPdxKeysFlagSet) {
setPdxStringFlag(indexKey);
}
indexKey = getPdxStringForIndexedPdxKeys(indexKey);
+ Object indxResultSet;
+
if (this.iteratorSize == 1) {
RuntimeIterator iter = (RuntimeIterator) currrentRuntimeIters.get(0);
indxResultSet = iter.evaluate(context);
@@ -1214,62 +1247,46 @@ public abstract class AbstractIndex implements IndexProtocol {
indxResultSet = new StructImpl((StructTypeImpl) this.indexResultSetType, tuple);
}
- // Keep Entry value in fly untill all keys are evaluated
+ // Keep Entry value in fly until all keys are evaluated
RegionEntry entry = ((DummyQRegion) context.getBindArgument(1)).getEntry();
saveMapping(indexKey, indxResultSet, entry);
}
- // TODO :Asif: Test this function .
- // The struct type calculation is modified if the
- // 0th iterator is modified to make it dependent on Entry
+ /**
+ * // The struct type calculation is modified if the // 0th iterator is modified to make it
+ * dependent on Entry
+ */
private ObjectType createIndexResultSetType() {
List currentIterators = this.initContext.getCurrentIterators();
int len = currentIterators.size();
- ObjectType type = null;
- // String fieldNames[] = new String[len];
- ObjectType fieldTypes[] = new ObjectType[len];
+ ObjectType[] fieldTypes = new ObjectType[len];
int start = this.isFirstItrOnEntry ? 0 : 1;
for (; start < len; start++) {
RuntimeIterator iter = (RuntimeIterator) currentIterators.get(start);
- // fieldNames[start] = iter.getInternalId();
fieldTypes[start] = iter.getElementType();
}
if (!this.isFirstItrOnEntry) {
- // fieldNames[0] = "iter1";
- fieldTypes[0] = addnlProjType;
- }
- type = (len == 1) ? fieldTypes[0] : new StructTypeImpl(this.canonicalIterNames, fieldTypes);
- return type;
- }
-
- private void printList(List list) {
- System.out.println("results.size = " + list.size());
- for (int i = 0; i < list.size(); i++) {
- Object arr[] = (Object[]) list.get(i);
- System.out.println("Key = " + arr[0]);
- System.out.println("Value =" + arr[1]);
+ fieldTypes[0] = this.addnlProjType;
}
+ return len == 1 ? fieldTypes[0] : new StructTypeImpl(this.canonicalIterNames, fieldTypes);
}
- int getTotalEntriesUpdated() {
- return this.initEntriesUpdated;
- }
-
+ @Override
public ObjectType getIndexResultSetType() {
return this.indexResultSetType;
}
- public boolean isFirstItrOnEntry() {
- return isFirstItrOnEntry;
+ boolean isFirstItrOnEntry() {
+ return this.isFirstItrOnEntry;
}
- public boolean isFirstItrOnKey() {
- return isFirstItrOnKey;
+ boolean isFirstItrOnKey() {
+ return this.isFirstItrOnKey;
}
@Override
public List getAllDependentIterators() {
- return fromIterators;
+ return this.fromIterators;
}
}
@@ -1278,20 +1295,10 @@ public abstract class AbstractIndex implements IndexProtocol {
* non-distinct distinct elements size of result-set is matched against limit passed in as an
* argument.
*
- * @param result
- * @param limit
- * @param context
* @return true if limit is satisfied.
*/
- protected boolean verifyLimit(Collection result, int limit, ExecutionContext context) {
- if (limit > 0) {
- /*
- * if (!context.isDistinct()) { return ((Bag)result).size() == limit; } else if (result.size()
- * == limit) { return true; }
- */
- return result.size() == limit;
- }
- return false;
+ boolean verifyLimit(Collection result, int limit) {
+ return limit > 0 && result.size() == limit;
}
/**
@@ -1312,21 +1319,17 @@ public abstract class AbstractIndex implements IndexProtocol {
* Note: Struct evaluated from RegionEntry can NOT have more field values than Index Value Struct
* as we filter out iterators in query context before evaluating Struct from RegionEntry.
*
- * @param re
- * @param value
- * @param context
* @return True if Region and Index entries are consistent.
*/
- protected boolean verifyEntryAndIndexVaue(RegionEntry re, Object value,
- ExecutionContext context) {
+ // package-private to avoid synthetic accessor
+ boolean verifyEntryAndIndexValue(RegionEntry re, Object value, ExecutionContext context) {
IMQEvaluator evaluator = (IMQEvaluator) getEvaluator();
List valuesInRegion = null;
Object valueInIndex = null;
try {
- // In a RegionEntry key and Entry itself can not be modified else
- // RegionEntry itself will change. So no need to verify anything just return
- // true.
+ // In a RegionEntry key and Entry itself can not be modified else RegionEntry itself will
+ // change. So no need to verify anything just return true.
if (evaluator.isFirstItrOnKey()) {
return true;
} else if (evaluator.isFirstItrOnEntry()) {
@@ -1342,10 +1345,9 @@ public abstract class AbstractIndex implements IndexProtocol {
valuesInRegion = evaluateIndexIteratorsFromRE(val, context);
}
} catch (Exception e) {
- // TODO: Create a new LocalizedString for this.
if (logger.isDebugEnabled()) {
logger.debug(
- "Exception occured while verifying a Region Entry value during a Query when the Region Entry is under update operation",
+ "Exception occurred while verifying a Region Entry value during a Query when the Region Entry is under update operation",
e);
}
}
@@ -1369,8 +1371,6 @@ public abstract class AbstractIndex implements IndexProtocol {
* conditions are possible, Object1 -> Struct Object2-> Struct Object1 -> Struct Object2-> Object
* Object1 -> Object Object2-> Struct Object1 -> Object Object2-> Object
*
- * @param valueInRegion
- * @param valueInIndex
* @return true if valueInRegion's all objects are part of valueInIndex.
*/
private boolean compareStructWithNonStruct(Object valueInRegion, Object valueInIndex) {
@@ -1383,14 +1383,16 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
return true;
- } else if (valueInRegion instanceof Struct && !(valueInIndex instanceof Struct)) {
+
+ } else if (valueInRegion instanceof Struct) {
Object[] fields = ((StructImpl) valueInRegion).getFieldValues();
for (Object field : fields) {
if (field.equals(valueInIndex)) {
return true;
}
}
- } else if (!(valueInRegion instanceof Struct) && valueInIndex instanceof Struct) {
+
+ } else if (valueInIndex instanceof Struct) {
Object[] fields = ((StructImpl) valueInIndex).getFieldValues();
for (Object field : fields) {
if (field.equals(valueInRegion)) {
@@ -1409,14 +1411,11 @@ public abstract class AbstractIndex implements IndexProtocol {
*
* @param context passed here is query context.
* @return Evaluated second level collection.
- * @throws QueryInvocationTargetException
- * @throws NameResolutionException
- * @throws TypeMismatchException
- * @throws FunctionDomainException
*/
- protected List evaluateIndexIteratorsFromRE(Object value, ExecutionContext context)
+ private List evaluateIndexIteratorsFromRE(Object value, ExecutionContext context)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
+
// We need NonTxEntry to call getValue() on it. RegionEntry does
// NOT have public getValue() method.
if (value instanceof RegionEntry) {
@@ -1425,24 +1424,24 @@ public abstract class AbstractIndex implements IndexProtocol {
// Get all Independent and dependent iterators for this Index.
List itrs = getAllDependentRuntimeIterators(context);
- List values = evaluateLastColl(value, context, itrs, 0);
- return values;
+ return evaluateLastColl(value, context, itrs, 0);
}
private List evaluateLastColl(Object value, ExecutionContext context, List itrs, int level)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- // A tuple is a value generated from RegionEntry value which could be
- // a StructType (Multiple Dependent Iterators) or ObjectType (Single
- // Iterator) value.
+
+ // A tuple is a value generated from RegionEntry value which could be a StructType (Multiple
+ // Dependent Iterators) or ObjectType (Single Iterator) value.
List tuples = new ArrayList(1);
RuntimeIterator currItrator = (RuntimeIterator) itrs.get(level);
currItrator.setCurrent(value);
+
// If its last iterator then just evaluate final struct.
- if ((itrs.size() - 1) == level) {
+ if (itrs.size() - 1 == level) {
if (itrs.size() > 1) {
- Object tuple[] = new Object[itrs.size()];
+ Object[] tuple = new Object[itrs.size()];
for (int i = 0; i < itrs.size(); i++) {
RuntimeIterator iter = (RuntimeIterator) itrs.get(i);
tuple[i] = iter.evaluate(context);
@@ -1457,8 +1456,7 @@ public abstract class AbstractIndex implements IndexProtocol {
RuntimeIterator nextItr = (RuntimeIterator) itrs.get(level + 1);
Collection nextLevelValues = nextItr.evaluateCollection(context);
- // If value is null or INVALID then the evaluated collection would be
- // Null.
+ // If value is null or INVALID then the evaluated collection would be Null.
if (nextLevelValues != null) {
for (Object nextLevelValue : nextLevelValues) {
tuples.addAll(evaluateLastColl(nextLevelValue, context, itrs, level + 1));
@@ -1478,20 +1476,17 @@ public abstract class AbstractIndex implements IndexProtocol {
* collection reference in given context and must be contained at 0th index in
* {@link AbstractIndex#canonicalizedDefinitions}.
*
- * @param context
* @return {@link RuntimeIterator} this should not be null ever.
*/
- public RuntimeIterator getRuntimeIteratorForThisIndex(ExecutionContext context) {
+ RuntimeIterator getRuntimeIteratorForThisIndex(ExecutionContext context) {
List<RuntimeIterator> indItrs = context.getCurrentIterators();
Region rgn = this.getRegion();
if (rgn instanceof BucketRegion) {
- rgn = ((BucketRegion) rgn).getPartitionedRegion();
+ rgn = ((Bucket) rgn).getPartitionedRegion();
}
String regionPath = rgn.getFullPath();
String definition = this.getCanonicalizedIteratorDefinitions()[0];
for (RuntimeIterator itr : indItrs) {
- // GemFireCacheImpl.getInstance().getLogger().fine("Shobhit: "+ itr.getDefinition() + " "+
- // this.getRegion().getFullPath());
if (itr.getDefinition().equals(regionPath) || itr.getDefinition().equals(definition)) {
return itr;
}
@@ -1503,20 +1498,18 @@ public abstract class AbstractIndex implements IndexProtocol {
* Similar to {@link #getRuntimeIteratorForThisIndex(ExecutionContext)} except that this one also
* matches the iterator name if present with alias used in the {@link IndexInfo}
*
- * @param context
- * @param info
* @return {@link RuntimeIterator}
*/
- public RuntimeIterator getRuntimeIteratorForThisIndex(ExecutionContext context, IndexInfo info) {
+ RuntimeIterator getRuntimeIteratorForThisIndex(ExecutionContext context, IndexInfo info) {
List<RuntimeIterator> indItrs = context.getCurrentIterators();
Region rgn = this.getRegion();
if (rgn instanceof BucketRegion) {
- rgn = ((BucketRegion) rgn).getPartitionedRegion();
+ rgn = ((Bucket) rgn).getPartitionedRegion();
}
String regionPath = rgn.getFullPath();
String definition = this.getCanonicalizedIteratorDefinitions()[0];
for (RuntimeIterator itr : indItrs) {
- if ((itr.getDefinition().equals(regionPath) || itr.getDefinition().equals(definition))) {
+ if (itr.getDefinition().equals(regionPath) || itr.getDefinition().equals(definition)) {
// if iterator has name alias must be used in the query
if (itr.getName() != null) {
CompiledValue path = info._path();
@@ -1541,7 +1534,7 @@ public abstract class AbstractIndex implements IndexProtocol {
} else if (path instanceof CompiledOperation) {
return getReceiverNameFromPath(path.getReceiver());
} else if (path instanceof CompiledIndexOperation) {
- return getReceiverNameFromPath(((CompiledIndexOperation) path).getReceiver());
+ return getReceiverNameFromPath(path.getReceiver());
}
return "";
}
@@ -1554,13 +1547,13 @@ public abstract class AbstractIndex implements IndexProtocol {
* @param context from executing query.
* @return List of all iterators pertaining to this Index.
*/
- public List getAllDependentRuntimeIterators(ExecutionContext context) {
+ private List getAllDependentRuntimeIterators(ExecutionContext context) {
List<RuntimeIterator> indItrs = context
.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(getRuntimeIteratorForThisIndex(context));
List<String> definitions = Arrays.asList(this.getCanonicalizedIteratorDefinitions());
// These are the common iterators between query from clause and index from clause.
- ArrayList itrs = new ArrayList();
+ List itrs = new ArrayList();
for (RuntimeIterator itr : indItrs) {
if (definitions.contains(itr.getDefinition())) {
@@ -1576,12 +1569,10 @@ public abstract class AbstractIndex implements IndexProtocol {
*
* This map does NOT provide an iterator. To iterate over its element caller has to get inside the
* map itself through addValuesToCollection() calls.
- *
- *
*/
class RegionEntryToValuesMap {
protected Map map;
- private boolean useList;
+ private final boolean useList;
volatile int numValues;
RegionEntryToValuesMap(boolean useList) {
@@ -1597,26 +1588,22 @@ public abstract class AbstractIndex implements IndexProtocol {
/**
* We do NOT use any locks here as every add is for a RegionEntry which is locked before coming
* here. No two threads can be entering in this method together for a RegionEntry.
- *
- * @param entry
- * @param value
*/
public void add(RegionEntry entry, Object value) {
assert value != null;
- // Values must NOT be null and ConcurrentHashMap does not
- // support null values.
+ // Values must NOT be null and ConcurrentHashMap does not support null values.
if (value == null) {
return;
}
- Object object = map.get(entry);
+ Object object = this.map.get(entry);
if (object == null) {
- map.put(entry, value);
+ this.map.put(entry, value);
} else if (object instanceof Collection) {
Collection coll = (Collection) object;
// If its a list query might get ConcurrentModificationException.
// This can only happen for Null mapped or Undefined entries in a
// RangeIndex. So we are synchronizing on ArrayList.
- if (useList) {
+ if (this.useList) {
synchronized (coll) {
coll.add(value);
}
@@ -1624,28 +1611,28 @@ public abstract class AbstractIndex implements IndexProtocol {
coll.add(value);
}
} else {
- Collection coll = useList ? new ArrayList(2) : new IndexConcurrentHashSet(2, 0.75f, 1);
+ Collection coll = this.useList ? new ArrayList(2) : new IndexConcurrentHashSet(2, 0.75f, 1);
coll.add(object);
coll.add(value);
- map.put(entry, coll);
+ this.map.put(entry, coll);
}
atomicUpdater.incrementAndGet(this);
}
public void addAll(RegionEntry entry, Collection values) {
- Object object = map.get(entry);
+ Object object = this.map.get(entry);
if (object == null) {
- Collection coll = useList ? new ArrayList(values.size())
+ Collection coll = this.useList ? new ArrayList(values.size())
: new IndexConcurrentHashSet(values.size(), 0.75f, 1);
coll.addAll(values);
- map.put(entry, coll);
+ this.map.put(entry, coll);
atomicUpdater.addAndGet(this, values.size());
} else if (object instanceof Collection) {
Collection coll = (Collection) object;
// If its a list query might get ConcurrentModificationException.
// This can only happen for Null mapped or Undefined entries in a
// RangeIndex. So we are synchronizing on ArrayList.
- if (useList) {
+ if (this.useList) {
synchronized (coll) {
coll.addAll(values);
}
@@ -1653,37 +1640,34 @@ public abstract class AbstractIndex implements IndexProtocol {
coll.addAll(values);
}
} else {
- Collection coll = useList ? new ArrayList(values.size() + 1)
+ Collection coll = this.useList ? new ArrayList(values.size() + 1)
: new IndexConcurrentHashSet(values.size() + 1, 0.75f, 1);
coll.addAll(values);
coll.add(object);
- map.put(entry, coll);
+ this.map.put(entry, coll);
}
atomicUpdater.addAndGet(this, values.size());
}
public Object get(RegionEntry entry) {
- return map.get(entry);
+ return this.map.get(entry);
}
/**
* We do NOT use any locks here as every remove is for a RegionEntry which is locked before
* coming here. No two threads can be entering in this method together for a RegionEntry.
- *
- * @param entry
- * @param value
*/
public void remove(RegionEntry entry, Object value) {
- Object object = map.get(entry);
+ Object object = this.map.get(entry);
if (object == null)
return;
if (object instanceof Collection) {
Collection coll = (Collection) object;
- boolean removed = false;
+ boolean removed;
// If its a list query might get ConcurrentModificationException.
// This can only happen for Null mapped or Undefined entries in a
// RangeIndex. So we are synchronizing on ArrayList.
- if (useList) {
+ if (this.useList) {
synchronized (coll) {
removed = coll.remove(value);
}
@@ -1692,29 +1676,29 @@ public abstract class AbstractIndex implements IndexProtocol {
}
if (removed) {
if (coll.size() == 0) {
- map.remove(entry);
+ this.map.remove(entry);
}
atomicUpdater.decrementAndGet(this);
}
} else {
if (object.equals(value)) {
- map.remove(entry);
+ this.map.remove(entry);
}
atomicUpdater.decrementAndGet(this);
}
}
public Object remove(RegionEntry entry) {
- Object retVal = map.remove(entry);
+ Object retVal = this.map.remove(entry);
if (retVal != null) {
atomicUpdater.addAndGet(this,
- (retVal instanceof Collection) ? -((Collection) retVal).size() : -1);
+ retVal instanceof Collection ? -((Collection) retVal).size() : -1);
}
return retVal;
}
- public int getNumValues(RegionEntry entry) {
- Object object = map.get(entry);
+ int getNumValues(RegionEntry entry) {
+ Object object = this.map.get(entry);
if (object == null)
return 0;
if (object instanceof Collection) {
@@ -1730,19 +1714,17 @@ public abstract class AbstractIndex implements IndexProtocol {
}
public int getNumEntries() {
- return map.keySet().size();
+ return this.map.keySet().size();
}
- public void addValuesToCollection(Collection result, int limit, ExecutionContext context) {
-
- Iterator entriesIter = map.entrySet().iterator();
- while (entriesIter.hasNext()) {
+ void addValuesToCollection(Collection result, int limit, ExecutionContext context) {
+ for (final Object o : this.map.entrySet()) {
// Check if query execution on this thread is canceled.
QueryMonitor.isQueryExecutionCanceled();
- if (this.verifylimit(result, limit, context)) {
+ if (this.verifyLimit(result, limit, context)) {
return;
}
- Map.Entry e = (Map.Entry) entriesIter.next();
+ Entry e = (Entry) o;
Object value = e.getValue();
assert value != null;
@@ -1754,11 +1736,9 @@ public abstract class AbstractIndex implements IndexProtocol {
// RangeIndex. So we are synchronizing on ArrayList.
if (this.useList) {
synchronized (value) {
- Iterator itr = ((Collection) value).iterator();
- while (itr.hasNext()) {
- Object val = itr.next();
- // Shobhit: Compare the value in index with in RegionEntry.
- if (!reUpdateInProgress || verifyEntryAndIndexVaue(re, val, context)) {
+ for (Object val : (Iterable) value) {
+ // Compare the value in index with in RegionEntry.
+ if (!reUpdateInProgress || verifyEntryAndIndexValue(re, val, context)) {
result.add(val);
}
if (limit != -1) {
@@ -1769,22 +1749,20 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
} else {
- Iterator itr = ((Collection) value).iterator();
- while (itr.hasNext()) {
- Object val = itr.next();
- // Shobhit: Compare the value in index with in RegionEntry.
- if (!reUpdateInProgress || verifyEntryAndIndexVaue(re, val, context)) {
+ for (Object val : (Iterable) value) {
+ // Compare the value in index with in RegionEntry.
+ if (!reUpdateInProgress || verifyEntryAndIndexValue(re, val, context)) {
result.add(val);
}
if (limit != -1) {
- if (this.verifylimit(result, limit, context)) {
+ if (this.verifyLimit(result, limit, context)) {
return;
}
}
}
}
} else {
- if (!reUpdateInProgress || verifyEntryAndIndexVaue(re, value, context)) {
+ if (!reUpdateInProgress || verifyEntryAndIndexValue(re, value, context)) {
if (context.isCqQueryContext()) {
result.add(new CqEntry(((RegionEntry) e.getKey()).getKey(), value));
} else {
@@ -1795,25 +1773,24 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
- public void addValuesToCollection(Collection result, CompiledValue iterOp,
- RuntimeIterator runtimeItr, ExecutionContext context, List projAttrib,
- SelectResults intermediateResults, boolean isIntersection, int limit)
- throws FunctionDomainException, TypeMismatchException, NameResolutionException,
- QueryInvocationTargetException {
- if (this.verifylimit(result, limit, context)) {
+ void addValuesToCollection(Collection result, CompiledValue iterOp, RuntimeIterator runtimeItr,
+ ExecutionContext context, List projAttrib, SelectResults intermediateResults,
+ boolean isIntersection, int limit) throws FunctionDomainException, TypeMismatchException,
+ NameResolutionException, QueryInvocationTargetException {
+
+ if (this.verifyLimit(result, limit, context)) {
return;
}
- // Iterator valuesIter = map.values().iterator();
- Iterator entries = map.entrySet().iterator();
- while (entries.hasNext()) {
+
+ for (Object o : this.map.entrySet()) {
// Check if query execution on this thread is canceled.
QueryMonitor.isQueryExecutionCanceled();
- Map.Entry e = (Map.Entry) entries.next();
+ Entry e = (Entry) o;
Object value = e.getValue();
// Key is a RegionEntry here.
RegionEntry entry = (RegionEntry) e.getKey();
- boolean reUpdateInProgress = false;
if (value != null) {
+ boolean reUpdateInProgress = false;
if (entry.isUpdateInProgress()) {
reUpdateInProgress = true;
}
@@ -1823,56 +1800,50 @@ public abstract class AbstractIndex implements IndexProtocol {
// RangeIndex. So we are synchronizing on ArrayList.
if (this.useList) {
synchronized (value) {
- Iterator itr = ((Collection) value).iterator();
- while (itr.hasNext()) {
+ for (Object o1 : ((Iterable) value)) {
boolean ok = true;
- Object val = itr.next();
if (reUpdateInProgress) {
- // Shobhit: Compare the value in index with value in RegionEntry.
- ok = verifyEntryAndIndexVaue(entry, val, context);
+ // Compare the value in index with value in RegionEntry.
+ ok = verifyEntryAndIndexValue(entry, o1, context);
}
if (ok && runtimeItr != null) {
- runtimeItr.setCurrent(val);
+ runtimeItr.setCurrent(o1);
ok = QueryUtils.applyCondition(iterOp, context);
}
if (ok) {
- applyProjection(projAttrib, context, result, val, intermediateResults,
+ applyProjection(projAttrib, context, result, o1, intermediateResults,
isIntersection);
if (limit != -1 && result.size() == limit) {
return;
}
- // return pResultSet;
}
}
}
} else {
- Iterator itr = ((Collection) value).iterator();
- while (itr.hasNext()) {
+ for (Object o1 : ((Iterable) value)) {
boolean ok = true;
- Object val = itr.next();
if (reUpdateInProgress) {
- // Shobhit: Compare the value in index with value in RegionEntry.
- ok = verifyEntryAndIndexVaue(entry, val, context);
+ // Compare the value in index with value in RegionEntry.
+ ok = verifyEntryAndIndexValue(entry, o1, context);
}
if (ok && runtimeItr != null) {
- runtimeItr.setCurrent(val);
+ runtimeItr.setCurrent(o1);
ok = QueryUtils.applyCondition(iterOp, context);
}
if (ok) {
- applyProjection(projAttrib, context, result, val, intermediateResults,
+ applyProjection(projAttrib, context, result, o1, intermediateResults,
isIntersection);
- if (this.verifylimit(result, limit, context)) {
+ if (this.verifyLimit(result, limit, context)) {
return;
}
- // return pResultSet;
}
}
}
} else {
boolean ok = true;
if (reUpdateInProgress) {
- // Shobhit: Compare the value in index with in RegionEntry.
- ok = verifyEntryAndIndexVaue(entry, value, context);
+ // Compare the value in index with in RegionEntry.
+ ok = verifyEntryAndIndexValue(entry, value, context);
}
if (ok && runtimeItr != null) {
runtimeItr.setCurrent(value);
@@ -1891,65 +1862,10 @@ public abstract class AbstractIndex implements IndexProtocol {
}
}
- public void removeValuesFromCollection(Collection result, CompiledValue iterOps,
- RuntimeIterator runtimeItr, ExecutionContext context, List projAttrib,
- SelectResults intermediateResults, boolean isIntersection) throws FunctionDomainException,
- TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
- // Iterator valuesIter = map.values().iterator();
- Iterator entries = map.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry e = (Map.Entry) entries.next();
- Object value = e.getValue();
- if (value instanceof Collection) {
- Iterator itr = ((Collection) value).iterator();
- while (itr.hasNext()) {
- boolean ok = true;
- Object val = itr.next();
- if (runtimeItr != null) {
- runtimeItr.setCurrent(val);
- ok = QueryUtils.applyCondition(iterOps, context);
-
- }
- if (ok) {
- removeProjection(projAttrib, context, result, val, intermediateResults,
- isIntersection);
- }
- }
- } else {
- boolean ok = true;
- if (runtimeItr != null) {
- // Attempt to remove only if it was apossibly added
- runtimeItr.setCurrent(value);
- ok = QueryUtils.applyCondition(iterOps, context);
- }
- if (ok) {
- if (context.isCqQueryContext()) {
- result.remove(new CqEntry(((RegionEntry) e.getKey()).getKey(), value));
- } else {
- removeProjection(projAttrib, context, result, value, intermediateResults,
- isIntersection);
- }
- }
-
- }
- }
- }
-
- public void removeValuesFromCollection(Collection result) {
- Iterator valuesIter = map.values().iterator();
- while (valuesIter.hasNext()) {
- Object value = valuesIter.next();
- if (value instanceof Collection)
- result.removeAll((Collection) value);
- else
- result.remove(value);
- }
- }
-
- private boolean verifylimit(Collection result, int limit, ExecutionContext context) {
+ private boolean verifyLimit(Collection result, int limit, ExecutionContext context) {
if (limit > 0) {
if (!context.isDistinct()) {
- return ((Bag) result).size() == limit;
+ return result.size() == limit;
} else if (result.size() == limit) {
return true;
}
@@ -1958,7 +1874,7 @@ public abstract class AbstractIndex implements IndexProtocol {
}
public boolean containsEntry(RegionEntry entry) {
- return map.containsKey(entry);
+ return this.map.containsKey(entry);
}
public boolean containsValue(Object value) {
@@ -1967,50 +1883,37 @@ public abstract class AbstractIndex implements IndexProtocol {
}
public void clear() {
- map.clear();
+ this.map.clear();
atomicUpdater.set(this, 0);
}
public Set entrySet() {
- return map.entrySet();
+ return this.map.entrySet();
}
/**
* This replaces a key's value along with updating the numValues correctly.
- *
- * @param entry
- * @param values
*/
public void replace(RegionEntry entry, Object values) {
int numOldValues = getNumValues(entry);
this.map.put(entry, values);
atomicUpdater.addAndGet(this,
- ((values instanceof Collection) ? ((Collection) values).size() : 1) - numOldValues);
+ (values instanceof Collection ? ((Collection) values).size() : 1) - numOldValues);
}
}
/**
- * This will populate resultset from both type of indexes, {@link CompactRangeIndex} and
+ * This will populate resultSet from both type of indexes, {@link CompactRangeIndex} and
* {@link RangeIndex}.
- *
- * @param list
- * @param outerEntries
- * @param innerEntries
- * @param context
- * @param key
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
- protected void populateListForEquiJoin(List list, Object outerEntries, Object innerEntries,
+ void populateListForEquiJoin(List list, Object outerEntries, Object innerEntries,
ExecutionContext context, Object key) throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
- Assert.assertTrue((outerEntries != null && innerEntries != null),
+ Assert.assertTrue(outerEntries != null && innerEntries != null,
"OuterEntries or InnerEntries must not be null");
- Object values[][] = new Object[2][];
+ Object[][] values = new Object[2][];
Iterator itr = null;
int j = 0;
@@ -2031,7 +1934,6 @@ public abstract class AbstractIndex implements IndexProtocol {
itr = (Iterator) innerEntries;
}
}
- // TODO :Asif Identify appropriate size of the List
// extract the values from the RegionEntries
List dummy = new ArrayList();
@@ -2048,7 +1950,7 @@ public abstract class AbstractIndex implements IndexProtocol {
Map.Entry entry = (Map.Entry) itr.next();
val = entry.getValue();
if (val instanceof Collection) {
- entryVal = ((Collection) val).iterator().next();
+ entryVal = ((Iterable) val).iterator().next();
} else {
entryVal = val;
}
@@ -2056,12 +1958,13 @@ public abstract class AbstractIndex implements IndexProtocol {
} else {
ie = (IndexStoreEntry) itr.next();
}
+
// Bug#41010: We need to verify if Inner and Outer Entries
// are consistent with index key values.
boolean ok = true;
if (isRangeIndex) {
if (re.isUpdateInProgress()) {
- ok = ((RangeIndex) indInfo._getIndex()).verifyEntryAndIndexVaue(re, entryVal, context);
+ ok = ((RangeIndex) indInfo._getIndex()).verifyEntryAndIndexValue(re, entryVal, context);
}
} else if (ie.isUpdateInProgress()) {
ok = ((CompactRangeIndex) indInfo._getIndex()).verifyInnerAndOuterEntryValues(ie, context,
@@ -2095,56 +1998,37 @@ public abstract class AbstractIndex implements IndexProtocol {
* Sets the isIndexedPdxKeys flag indicating if all the keys in the index are Strings or
* PdxStrings. Also sets another flag isIndexedPdxKeysFlagSet that indicates isIndexedPdxKeys has
* been set/reset to avoid frequent calculation of map size
- *
- * @param key
*/
- public synchronized void setPdxStringFlag(Object key) {
+ synchronized void setPdxStringFlag(Object key) {
// For Null and Undefined keys do not set the isIndexedPdxKeysFlagSet flag
if (key == null || key == IndexManager.NULL || key == QueryService.UNDEFINED) {
return;
}
- if (!isIndexedPdxKeys) {
+ if (!this.isIndexedPdxKeys) {
if (key instanceof PdxString) {
- isIndexedPdxKeys = true;
+ this.isIndexedPdxKeys = true;
}
}
- isIndexedPdxKeysFlagSet = true;
+ this.isIndexedPdxKeysFlagSet = true;
}
/**
* Converts Strings to PdxStrings and vice-versa based on the isIndexedPdxKeys flag
*
- * @param key
* @return PdxString or String based on isIndexedPdxKeys flag
*/
- public Object getPdxStringForIndexedPdxKeys(Object key) {
- if (isIndexedPdxKeys) {
+ Object getPdxStringForIndexedPdxKeys(Object key) {
+ if (this.isIndexedPdxKeys) {
if (key instanceof String) {
<TRUNCATED>
[09/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXSynchronizationRunnable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXSynchronizationRunnable.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXSynchronizationRunnable.java
index cebf3e6..35b0e75 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXSynchronizationRunnable.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXSynchronizationRunnable.java
@@ -16,7 +16,6 @@ package org.apache.geode.internal.cache;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.logging.LogService;
/**
@@ -26,7 +25,6 @@ import org.apache.geode.internal.logging.LogService;
* behavior.
*
* @since GemFire 6.6
- *
*/
public class TXSynchronizationRunnable implements Runnable {
private static final Logger logger = LogService.getLogger();
@@ -55,7 +53,7 @@ public class TXSynchronizationRunnable implements Runnable {
}
this.firstRunnableCompleted = true;
this.firstRunnable = null;
- this.firstRunnableSync.notify();
+ this.firstRunnableSync.notifyAll();
}
}
synchronized (this.secondRunnableSync) {
@@ -68,11 +66,11 @@ public class TXSynchronizationRunnable implements Runnable {
logger.trace("waiting for afterCompletion notification");
}
this.secondRunnableSync.wait(1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
// eat the interrupt and check for exit conditions
}
if (this.secondRunnable == null) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null || cache.getCancelCriterion().isCancelInProgress()) {
return;
}
@@ -91,7 +89,7 @@ public class TXSynchronizationRunnable implements Runnable {
}
this.secondRunnableCompleted = true;
this.secondRunnable = null;
- this.secondRunnableSync.notify();
+ this.secondRunnableSync.notifyAll();
}
}
}
@@ -104,12 +102,12 @@ public class TXSynchronizationRunnable implements Runnable {
while (!this.firstRunnableCompleted) {
try {
this.firstRunnableSync.wait(1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
// eat the interrupt and check for exit conditions
}
// we really need the Cache Server's cancel criterion here, not the cache's
// but who knows how to get it?
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
return;
}
@@ -121,22 +119,20 @@ public class TXSynchronizationRunnable implements Runnable {
/**
* run the afterCompletion portion of synchronization. This method schedules execution of the
* given runnable and then waits for it to finish running
- *
- * @param r
*/
public void runSecondRunnable(Runnable r) {
synchronized (this.secondRunnableSync) {
this.secondRunnable = r;
- this.secondRunnableSync.notify();
+ this.secondRunnableSync.notifyAll();
while (!this.secondRunnableCompleted && !this.abort) {
try {
this.secondRunnableSync.wait(1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
// eat the interrupt and check for exit conditions
}
// we really need the Cache Server's cancel criterion here, not the cache's
// but who knows how to get it?
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
return;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
index 0df27c8..bf5b97c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
@@ -14,6 +14,24 @@
*/
package org.apache.geode.internal.cache;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Predicate;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.CancelException;
import org.apache.geode.SystemFailure;
@@ -30,15 +48,6 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.size.ReflectionSingleObjectSizer;
import org.apache.geode.internal.util.concurrent.StoppableReentrantLock;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.Predicate;
/**
* Tombstones are region entries that have been destroyed but are held for future concurrency
@@ -46,7 +55,6 @@ import java.util.function.Predicate;
* possibility of concurrent modification conflicts.
* <p>
* The cache holds a tombstone service that is responsible for tracking and timing out tombstones.
- *
*/
public class TombstoneService {
private static final Logger logger = LogService.getLogger();
@@ -61,7 +69,7 @@ public class TombstoneService {
* The default is 600,000 milliseconds (10 minutes).
*/
public static long REPLICATE_TOMBSTONE_TIMEOUT =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "tombstone-timeout", 600000L).longValue();
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "tombstone-timeout", 600000L);
/**
* The default tombstone expiration period in millis for non-replicate/partition regions. This
@@ -111,13 +119,11 @@ public class TombstoneService {
private final ReplicateTombstoneSweeper replicatedTombstoneSweeper;
private final NonReplicateTombstoneSweeper nonReplicatedTombstoneSweeper;
- public static TombstoneService initialize(GemFireCacheImpl cache) {
- TombstoneService instance = new TombstoneService(cache);
- // cache.getResourceManager().addResourceListener(instance); experimental
- return instance;
+ public static TombstoneService initialize(InternalCache cache) {
+ return new TombstoneService(cache);
}
- private TombstoneService(GemFireCacheImpl cache) {
+ private TombstoneService(InternalCache cache) {
this.replicatedTombstoneSweeper =
new ReplicateTombstoneSweeper(cache, cache.getCachePerfStats(), cache.getCancelCriterion(),
cache.getDistributionManager().getWaitingThreadPool());
@@ -165,11 +171,8 @@ public class TombstoneService {
}
}
-
/**
* remove all tombstones for the given region. Do this when the region is cleared or destroyed.
- *
- * @param r
*/
public void unscheduleTombstones(LocalRegion r) {
getSweeper(r).unscheduleTombstones(r);
@@ -225,7 +228,7 @@ public class TombstoneService {
destroyingMember = myId;
}
Long maxReclaimedRV = regionGCVersions.get(destroyingMember);
- if (maxReclaimedRV != null && t.getRegionVersion() <= maxReclaimedRV.longValue()) {
+ if (maxReclaimedRV != null && t.getRegionVersion() <= maxReclaimedRV) {
removals.add(t);
return true;
}
@@ -303,7 +306,6 @@ public class TombstoneService {
/**
* For test purposes only, force the expiration of a number of tombstones for replicated regions.
*
- * @throws InterruptedException
* @return true if the expiration occurred
*/
public boolean forceBatchExpirationForTests(int count) throws InterruptedException {
@@ -847,7 +849,7 @@ public class TombstoneService {
}
try {
this.sweeperThread.join(100);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -892,7 +894,7 @@ public class TombstoneService {
checkOldestUnexpired(now);
purgeObsoleteTombstones(now);
doSleep();
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
break;
} catch (VirtualMachineError err) { // GemStoneAddition
SystemFailure.initiateFailure(err);
@@ -926,7 +928,7 @@ public class TombstoneService {
}
try {
this.wait(sleepTime);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
}
}
}
@@ -945,7 +947,6 @@ public class TombstoneService {
return;
}
lastPurgeTimestamp = now;
- long start = now;
// see if any have been superseded
boolean removedObsoleteTombstone = removeIf(tombstone -> {
if (tombstone.region.getRegionMap().isTombstoneNotNeeded(tombstone.entry,
@@ -960,7 +961,7 @@ public class TombstoneService {
if (removedObsoleteTombstone) {
sleepTime = 0;
} else {
- long elapsed = getNow() - start;
+ long elapsed = getNow() - now;
sleepTime -= elapsed;
if (sleepTime <= 0) {
minimumPurgeTime = elapsed;
@@ -991,7 +992,7 @@ public class TombstoneService {
try {
tombstones.remove();
expireTombstone(oldest);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// nothing needed
} catch (Exception e) {
logger.warn(
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapIntKey.java
index 016392d..626cf5a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapIntKey.java
@@ -68,7 +68,7 @@ public class VMStatsDiskLRURegionEntryHeapIntKey extends VMStatsDiskLRURegionEnt
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapLongKey.java
index 4e6f8fa..ccdf897 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapLongKey.java
@@ -68,7 +68,7 @@ public class VMStatsDiskLRURegionEntryHeapLongKey extends VMStatsDiskLRURegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapObjectKey.java
index 5fb7e66..4bfef6a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapObjectKey.java
@@ -70,7 +70,7 @@ public class VMStatsDiskLRURegionEntryHeapObjectKey extends VMStatsDiskLRURegion
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey1.java
index dafc106..88d49e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey1.java
@@ -87,7 +87,7 @@ public class VMStatsDiskLRURegionEntryHeapStringKey1 extends VMStatsDiskLRURegio
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey2.java
index 25a6355..b9a5952 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapStringKey2.java
@@ -99,7 +99,7 @@ public class VMStatsDiskLRURegionEntryHeapStringKey2 extends VMStatsDiskLRURegio
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java
index fdb5cfb..e8ef637 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java
@@ -70,7 +70,7 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java
index 8741b26..d812e7c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java
@@ -127,7 +127,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java
index b45e619..f090677 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java
@@ -127,7 +127,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java
index 88424a4..7b3b17a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java
@@ -128,7 +128,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java
index 82ffbd3..0c6073c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java
@@ -145,7 +145,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java
index 0741319..f0b6550 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java
@@ -157,7 +157,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapUUIDKey.java
index f0bf1f6..76428b1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapUUIDKey.java
@@ -129,7 +129,7 @@ public class VMStatsDiskLRURegionEntryOffHeapUUIDKey extends VMStatsDiskLRURegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntry.java
index c033ed1..8e445fd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntry.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.internal.cache;
/**
@@ -20,8 +19,6 @@ package org.apache.geode.internal.cache;
* statistics Disk -> entries can be on disk
*
* @since GemFire 3.5.1
- *
- *
*/
public abstract class VMStatsDiskRegionEntry extends AbstractOplogDiskRegionEntry {
protected VMStatsDiskRegionEntry(RegionEntryContext context, Object value) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java
index de8ecb4..c81af7b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java
@@ -67,7 +67,7 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java
index 3b57a84..5c17dec 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java
@@ -67,7 +67,7 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java
index a9f91b9..2ae6d7a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java
@@ -67,7 +67,7 @@ public class VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryH
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java
index 87a4810..44b1962 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java
@@ -85,7 +85,7 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java
index 5dfaf0f..9b481c9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java
@@ -97,7 +97,7 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java
index 1eefa4b..e2d498d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java
@@ -69,7 +69,7 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
index 85b791e..e7c90b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
@@ -125,7 +125,7 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
index 49b2b12..62e6cc7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
@@ -125,7 +125,7 @@ public class VMStatsDiskRegionEntryOffHeapLongKey extends VMStatsDiskRegionEntry
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
index f7d3b96..5cde18e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
@@ -126,7 +126,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
index 9902c2f..c42095c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
@@ -143,7 +143,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java
index 4bd9357..515c555 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java
@@ -155,7 +155,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java
index fbe196f..214990e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java
@@ -127,7 +127,7 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java
index fe90f47..0c43b40 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java
@@ -66,7 +66,7 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java
index 53e40ca..0c97faa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java
@@ -66,7 +66,7 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java
index ad42a88..0ff7bb9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java
@@ -66,7 +66,7 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java
index 3b9fc67..b6605d1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java
@@ -84,7 +84,7 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey2.java
index a4cd7e1..27de44b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey2.java
@@ -96,7 +96,7 @@ public class VMStatsLRURegionEntryHeapStringKey2 extends VMStatsLRURegionEntryHe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapUUIDKey.java
index 9b29eb7..bb03660 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapUUIDKey.java
@@ -68,7 +68,7 @@ public class VMStatsLRURegionEntryHeapUUIDKey extends VMStatsLRURegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
index 641ab31..49c1990 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
@@ -124,7 +124,7 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
index 7b6f008..acb3604 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
@@ -124,7 +124,7 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
index 655ef11..0eb9671 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
@@ -125,7 +125,7 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
index fde5c86..93b5dd9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
@@ -142,7 +142,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
index 1a6d1bb..6335543 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
@@ -154,7 +154,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
index 9bf13a3..debb712 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
@@ -126,7 +126,7 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapIntKey.java
index c5dd2db..8f9650e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapIntKey.java
@@ -64,7 +64,7 @@ public class VMStatsRegionEntryHeapIntKey extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapLongKey.java
index 29b526c..e6311d2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapLongKey.java
@@ -64,7 +64,7 @@ public class VMStatsRegionEntryHeapLongKey extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapObjectKey.java
index 6d48091..28f2ff7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapObjectKey.java
@@ -64,7 +64,7 @@ public class VMStatsRegionEntryHeapObjectKey extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey1.java
index 6810d99..e3485a9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey1.java
@@ -82,7 +82,7 @@ public class VMStatsRegionEntryHeapStringKey1 extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey2.java
index cc1fcc9..63a0908 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapStringKey2.java
@@ -94,7 +94,7 @@ public class VMStatsRegionEntryHeapStringKey2 extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapUUIDKey.java
index 5e498c5..829d16e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeapUUIDKey.java
@@ -66,7 +66,7 @@ public class VMStatsRegionEntryHeapUUIDKey extends VMStatsRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapIntKey.java
index b319d11..da05e2d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapIntKey.java
@@ -122,7 +122,7 @@ public class VMStatsRegionEntryOffHeapIntKey extends VMStatsRegionEntryOffHeap {
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapLongKey.java
index 0300542..5caaa68 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapLongKey.java
@@ -122,7 +122,7 @@ public class VMStatsRegionEntryOffHeapLongKey extends VMStatsRegionEntryOffHeap
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapObjectKey.java
index be89d07..8821a7b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapObjectKey.java
@@ -122,7 +122,7 @@ public class VMStatsRegionEntryOffHeapObjectKey extends VMStatsRegionEntryOffHea
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey1.java
index eea14f6..164454b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey1.java
@@ -139,7 +139,7 @@ public class VMStatsRegionEntryOffHeapStringKey1 extends VMStatsRegionEntryOffHe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey2.java
index d7adbec..4776dad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapStringKey2.java
@@ -151,7 +151,7 @@ public class VMStatsRegionEntryOffHeapStringKey2 extends VMStatsRegionEntryOffHe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapUUIDKey.java
index c7071b7..a69b31c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeapUUIDKey.java
@@ -124,7 +124,7 @@ public class VMStatsRegionEntryOffHeapUUIDKey extends VMStatsRegionEntryOffHeap
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapIntKey.java
index dd3e5db..a8023eb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapIntKey.java
@@ -68,7 +68,7 @@ public class VMThinDiskLRURegionEntryHeapIntKey extends VMThinDiskLRURegionEntry
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapLongKey.java
index f8f0cb6..30eeece 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapLongKey.java
@@ -68,7 +68,7 @@ public class VMThinDiskLRURegionEntryHeapLongKey extends VMThinDiskLRURegionEntr
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapObjectKey.java
index 0a79e41..2723b1f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapObjectKey.java
@@ -70,7 +70,7 @@ public class VMThinDiskLRURegionEntryHeapObjectKey extends VMThinDiskLRURegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey1.java
index ac7d52b..515ea72 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey1.java
@@ -87,7 +87,7 @@ public class VMThinDiskLRURegionEntryHeapStringKey1 extends VMThinDiskLRURegionE
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey2.java
index c4ed061..9d0d247 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapStringKey2.java
@@ -99,7 +99,7 @@ public class VMThinDiskLRURegionEntryHeapStringKey2 extends VMThinDiskLRURegionE
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapUUIDKey.java
index 87fcd5f..6480016 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeapUUIDKey.java
@@ -70,7 +70,7 @@ public class VMThinDiskLRURegionEntryHeapUUIDKey extends VMThinDiskLRURegionEntr
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapIntKey.java
index f970843..642d4f7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapIntKey.java
@@ -127,7 +127,7 @@ public class VMThinDiskLRURegionEntryOffHeapIntKey extends VMThinDiskLRURegionEn
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapLongKey.java
index ee939c0..6915625 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapLongKey.java
@@ -127,7 +127,7 @@ public class VMThinDiskLRURegionEntryOffHeapLongKey extends VMThinDiskLRURegionE
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapObjectKey.java
index 9aa4ec6..86277c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapObjectKey.java
@@ -128,7 +128,7 @@ public class VMThinDiskLRURegionEntryOffHeapObjectKey extends VMThinDiskLRURegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey1.java
index 05923e1..9048454 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey1.java
@@ -145,7 +145,7 @@ public class VMThinDiskLRURegionEntryOffHeapStringKey1 extends VMThinDiskLRURegi
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey2.java
index 8113149..a90d9bf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapStringKey2.java
@@ -157,7 +157,7 @@ public class VMThinDiskLRURegionEntryOffHeapStringKey2 extends VMThinDiskLRURegi
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapUUIDKey.java
index 07d4814..e4b0365 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeapUUIDKey.java
@@ -129,7 +129,7 @@ public class VMThinDiskLRURegionEntryOffHeapUUIDKey extends VMThinDiskLRURegionE
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapIntKey.java
index 1838cc3..9233157 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapIntKey.java
@@ -65,7 +65,7 @@ public class VMThinDiskRegionEntryHeapIntKey extends VMThinDiskRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapLongKey.java
index 116c3ef..6515ddb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapLongKey.java
@@ -65,7 +65,7 @@ public class VMThinDiskRegionEntryHeapLongKey extends VMThinDiskRegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapObjectKey.java
index 4904542..e60c2f1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapObjectKey.java
@@ -65,7 +65,7 @@ public class VMThinDiskRegionEntryHeapObjectKey extends VMThinDiskRegionEntryHea
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey1.java
index 015e44b..b2012ad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey1.java
@@ -83,7 +83,7 @@ public class VMThinDiskRegionEntryHeapStringKey1 extends VMThinDiskRegionEntryHe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey2.java
index 86e6a82..72206c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapStringKey2.java
@@ -95,7 +95,7 @@ public class VMThinDiskRegionEntryHeapStringKey2 extends VMThinDiskRegionEntryHe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapUUIDKey.java
index 39a3044..b4cab22 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeapUUIDKey.java
@@ -67,7 +67,7 @@ public class VMThinDiskRegionEntryHeapUUIDKey extends VMThinDiskRegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapIntKey.java
index 7c22916..38b6bc2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapIntKey.java
@@ -123,7 +123,7 @@ public class VMThinDiskRegionEntryOffHeapIntKey extends VMThinDiskRegionEntryOff
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapLongKey.java
index 3776696..303c91b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapLongKey.java
@@ -123,7 +123,7 @@ public class VMThinDiskRegionEntryOffHeapLongKey extends VMThinDiskRegionEntryOf
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapObjectKey.java
index 1f36b65..d604f75 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapObjectKey.java
@@ -124,7 +124,7 @@ public class VMThinDiskRegionEntryOffHeapObjectKey extends VMThinDiskRegionEntry
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey1.java
index 40a31ba..ac94dc6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey1.java
@@ -141,7 +141,7 @@ public class VMThinDiskRegionEntryOffHeapStringKey1 extends VMThinDiskRegionEntr
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey2.java
index 0ebc581..584f382 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapStringKey2.java
@@ -153,7 +153,7 @@ public class VMThinDiskRegionEntryOffHeapStringKey2 extends VMThinDiskRegionEntr
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapUUIDKey.java
index 4c4b7d1..a619574 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeapUUIDKey.java
@@ -125,7 +125,7 @@ public class VMThinDiskRegionEntryOffHeapUUIDKey extends VMThinDiskRegionEntryOf
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapIntKey.java
index 077cb20..5472679 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapIntKey.java
@@ -66,7 +66,7 @@ public class VMThinLRURegionEntryHeapIntKey extends VMThinLRURegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapLongKey.java
index 0f535fb..e025232 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapLongKey.java
@@ -66,7 +66,7 @@ public class VMThinLRURegionEntryHeapLongKey extends VMThinLRURegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapObjectKey.java
index 6faec9a..edfb327 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapObjectKey.java
@@ -66,7 +66,7 @@ public class VMThinLRURegionEntryHeapObjectKey extends VMThinLRURegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey1.java
index 733eb93..1ee29b3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey1.java
@@ -84,7 +84,7 @@ public class VMThinLRURegionEntryHeapStringKey1 extends VMThinLRURegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey2.java
index 78ceffe..8d3afdb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapStringKey2.java
@@ -96,7 +96,7 @@ public class VMThinLRURegionEntryHeapStringKey2 extends VMThinLRURegionEntryHeap
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapUUIDKey.java
index a04dc2c..ac2ee13 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeapUUIDKey.java
@@ -68,7 +68,7 @@ public class VMThinLRURegionEntryHeapUUIDKey extends VMThinLRURegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapIntKey.java
index dc6d52e..2f14906 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapIntKey.java
@@ -124,7 +124,7 @@ public class VMThinLRURegionEntryOffHeapIntKey extends VMThinLRURegionEntryOffHe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapLongKey.java
index d2960c5..da80f16 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapLongKey.java
@@ -124,7 +124,7 @@ public class VMThinLRURegionEntryOffHeapLongKey extends VMThinLRURegionEntryOffH
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapObjectKey.java
index 5e5707c..c44fd79 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapObjectKey.java
@@ -124,7 +124,7 @@ public class VMThinLRURegionEntryOffHeapObjectKey extends VMThinLRURegionEntryOf
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey1.java
index 25b1438..4f5ab15 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey1.java
@@ -142,7 +142,7 @@ public class VMThinLRURegionEntryOffHeapStringKey1 extends VMThinLRURegionEntryO
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey2.java
index c412854..2687672 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapStringKey2.java
@@ -154,7 +154,7 @@ public class VMThinLRURegionEntryOffHeapStringKey2 extends VMThinLRURegionEntryO
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
[17/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 0c967c9..4bdd67d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -12,14 +12,54 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.InvalidDeltaException;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheEvent;
+import org.apache.geode.cache.CacheListener;
+import org.apache.geode.cache.CacheLoader;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.DiskAccessException;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.LossAction;
+import org.apache.geode.cache.MembershipAttributes;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.RegionAccessException;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.RegionDistributionException;
+import org.apache.geode.cache.RegionMembershipListener;
+import org.apache.geode.cache.ResumptionAction;
+import org.apache.geode.cache.RoleException;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionException;
@@ -31,9 +71,14 @@ import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.LockServiceDestroyedException;
import org.apache.geode.distributed.Role;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionAdvisee;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
import org.apache.geode.distributed.internal.DistributionAdvisor.ProfileVisitor;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.distributed.internal.locks.DLockRemoteToken;
import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -45,9 +90,21 @@ import org.apache.geode.internal.cache.InitialImageOperation.GIIStatus;
import org.apache.geode.internal.cache.RemoteFetchVersionMessage.FetchVersionResponse;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryEvent;
-import org.apache.geode.internal.cache.execute.*;
+import org.apache.geode.internal.cache.execute.DistributedRegionFunctionExecutor;
+import org.apache.geode.internal.cache.execute.DistributedRegionFunctionResultSender;
+import org.apache.geode.internal.cache.execute.DistributedRegionFunctionResultWaiter;
+import org.apache.geode.internal.cache.execute.FunctionStats;
+import org.apache.geode.internal.cache.execute.LocalResultCollector;
+import org.apache.geode.internal.cache.execute.RegionFunctionContextImpl;
+import org.apache.geode.internal.cache.execute.ServerToClientFunctionResultSender;
import org.apache.geode.internal.cache.lru.LRUEntry;
-import org.apache.geode.internal.cache.persistence.*;
+import org.apache.geode.internal.cache.partitioned.Bucket;
+import org.apache.geode.internal.cache.persistence.CreatePersistentRegionProcessor;
+import org.apache.geode.internal.cache.persistence.PersistenceAdvisor;
+import org.apache.geode.internal.cache.persistence.PersistenceAdvisorImpl;
+import org.apache.geode.internal.cache.persistence.PersistentMemberID;
+import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
+import org.apache.geode.internal.cache.persistence.PersistentMemberView;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
@@ -63,21 +120,7 @@ import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.sequencelog.RegionLogger;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-/**
- *
- */
@SuppressWarnings("deprecation")
public class DistributedRegion extends LocalRegion implements CacheDistributionAdvisee {
private static final Logger logger = LogService.getLogger();
@@ -91,17 +134,17 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
final CacheDistributionAdvisor distAdvisor;
/**
- * @guarded.By {@link #dlockMonitor}
+ * GuardedBy {@link #dlockMonitor}
*/
private DistributedLockService dlockService;
- protected final AdvisorListener advisorListener = new AdvisorListener();
+ final AdvisorListener advisorListener = new AdvisorListener();
/** Set of currently missing required roles */
- protected final HashSet missingRequiredRoles = new HashSet();
+ final HashSet missingRequiredRoles = new HashSet(); // package-private to avoid synthetic accessor
/** True if this region is currently missing any required roles */
- protected volatile boolean isMissingRequiredRoles = false;
+ private volatile boolean isMissingRequiredRoles = false;
/**
* True if this region is has any required roles defined and the LossAction is either NO_ACCESS or
@@ -113,7 +156,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* Latch that is opened after initialization waits for required roles up to the
* <a href="DistributedSystem#member-timeout">member-timeout </a>.
*/
- protected final StoppableCountDownLatch initializationLatchAfterMemberTimeout;
+ private final StoppableCountDownLatch initializationLatchAfterMemberTimeout;
private final PersistenceAdvisor persistenceAdvisor;
@@ -134,11 +177,11 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*/
private final Object clearLock = new Object();
- private static AtomicBoolean loggedNetworkPartitionWarning = new AtomicBoolean(false);
+ private static final AtomicBoolean loggedNetworkPartitionWarning = new AtomicBoolean(false);
/** Creates a new instance of DistributedRegion */
protected DistributedRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
- GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs) {
+ InternalCache cache, InternalRegionArguments internalRegionArgs) {
super(regionName, attrs, parentRegion, cache, internalRegionArgs);
this.initializationLatchAfterMemberTimeout =
new StoppableCountDownLatch(getCancelCriterion(), 1);
@@ -196,20 +239,19 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
diskStats = null;
}
PersistentMemberManager memberManager = cache.getPersistentMemberManager();
- this.persistenceAdvisor = new PersistenceAdvisorImpl(distAdvisor, dl, storage,
+ this.persistenceAdvisor = new PersistenceAdvisorImpl(this.distAdvisor, dl, storage,
this.getFullPath(), diskStats, memberManager);
- } catch (Exception e) {
+ } catch (Exception ignore) { // TODO: wrap exception in throw
throw new InternalGemFireError("Couldn't recover persistence");
}
} else {
this.persistenceAdvisor = null;
}
if (this.persistenceAdvisor != null) {
- this.persistentId = persistenceAdvisor.generatePersistentID();
+ this.persistentId = this.persistenceAdvisor.generatePersistentID();
} else {
this.persistentId = null;
}
-
}
@Override
@@ -225,10 +267,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*/
protected CacheDistributionAdvisor createDistributionAdvisor(
InternalRegionArguments internalRegionArgs) {
- return CacheDistributionAdvisor.createCacheDistributionAdvisor(this); // Warning: potential
- // early escape of object
- // before full
- // construction
+ // Warning: potential early escape of object before full construction
+ return CacheDistributionAdvisor.createCacheDistributionAdvisor(this);
}
/**
@@ -256,14 +296,11 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
if (!this.generateVersionTag) {
return true;
}
- return this.concurrencyChecksEnabled && (this.srp == null) && !isTX()
+ return this.concurrencyChecksEnabled && (this.serverRegionProxy == null) && !isTX()
&& this.scope.isDistributed() && !this.dataPolicy.withReplication();
}
- /**
- * @see LocalRegion#virtualPut(EntryEventImpl, boolean, boolean, Object, boolean, long, boolean)
- */
@Override
protected boolean virtualPut(EntryEventImpl event, boolean ifNew, boolean ifOld,
Object expectedOldValue, boolean requireOldValue, long lastModified,
@@ -276,8 +313,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
!event.isNetSearch() && // search and load processor handles own locking
!event.isNetLoad() &&
// @todo darrel/kirk: what about putAll?
- !event.isLocalLoad() && !event.isSingleHopPutOp()) { // Single Hop Op means dlock is already
- // taken at origin node.
+ !event.isLocalLoad() && !event.isSingleHopPutOp()) {
+ // Single Hop Op means dlock is already taken at origin node.
dlock = this.getDistributedLockIfGlobal(event.getKey());
}
if (isTraceEnabled) {
@@ -332,10 +369,10 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
logger.trace("DR.virtualPut: this cache has already seen this event {}", event);
}
- // Gester, Fix 39014: when hasSeenEvent, put will still distribute
+ // Fix 39014: when hasSeenEvent, put will still distribute
// event, but putAll did not. We add the logic back here, not to put
// back into DR.distributeUpdate() because we moved this part up into
- // LR.basicPutPart3 in purpose. Reviewed by Bruce.
+ // LR.basicPutPart3 in purpose.
if (event.isBulkOpInProgress() && !event.isOriginRemote()) {
event.getPutAllOperation().addEntry(event, true);
}
@@ -409,7 +446,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
event.getRemoveAllOperation().addEntry(event);
} else {
basicDestroy(event, true, null);
- // getSharedDataView().destroyExistingEntry(event, true, null);
}
}
@@ -448,7 +484,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- protected void setGeneratedVersionTag(boolean generateVersionTag) {
+ void setGeneratedVersionTag(boolean generateVersionTag) {
// there is at-least one other persistent member, so turn on concurrencyChecks
enableConcurrencyChecks();
@@ -470,7 +506,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
|| !this.generateVersionTag) {
return false;
}
- if (this.srp != null) { // client
+ if (this.serverRegionProxy != null) { // client
return false;
}
if (event.getVersionTag() != null && !event.getVersionTag().isGatewayTag()) {
@@ -513,8 +549,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
Set roles = Collections.unmodifiableSet(new HashSet(this.missingRequiredRoles));
throw new RegionAccessException(
LocalizedStrings.DistributedRegion_OPERATION_IS_DISALLOWED_BY_LOSSACTION_0_BECAUSE_THESE_REQUIRED_ROLES_ARE_MISSING_1
- .toLocalizedString(
- new Object[] {getMembershipAttributes().getLossAction(), roles}),
+ .toLocalizedString(getMembershipAttributes().getLossAction(), roles),
getFullPath(), roles);
}
}
@@ -540,8 +575,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
Assert.assertTrue(!roles.isEmpty());
throw new RegionAccessException(
LocalizedStrings.DistributedRegion_OPERATION_IS_DISALLOWED_BY_LOSSACTION_0_BECAUSE_THESE_REQUIRED_ROLES_ARE_MISSING_1
- .toLocalizedString(
- new Object[] {getMembershipAttributes().getLossAction(), roles}),
+ .toLocalizedString(getMembershipAttributes().getLossAction(), roles),
getFullPath(), roles);
}
}
@@ -550,30 +584,30 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
@Override
protected void handleReliableDistribution(Set successfulRecipients) {
- handleReliableDistribution(successfulRecipients, Collections.EMPTY_SET, Collections.EMPTY_SET);
+ handleReliableDistribution(successfulRecipients, Collections.emptySet(),
+ Collections.emptySet());
}
- protected void handleReliableDistribution(Set successfulRecipients, Set otherRecipients1,
+ private void handleReliableDistribution(Set successfulRecipients, Set otherRecipients1,
Set otherRecipients2) {
if (this.requiresReliabilityCheck) {
MembershipAttributes ra = getMembershipAttributes();
- Set recipients = successfulRecipients;
// determine the successful roles
Set roles = new HashSet();
- for (Iterator iter = recipients.iterator(); iter.hasNext();) {
- InternalDistributedMember mbr = (InternalDistributedMember) iter.next();
+ for (Object successfulRecipient : successfulRecipients) {
+ InternalDistributedMember mbr = (InternalDistributedMember) successfulRecipient;
if (mbr != null) {
roles.addAll(mbr.getRoles());
}
}
- for (Iterator iter = otherRecipients1.iterator(); iter.hasNext();) {
- InternalDistributedMember mbr = (InternalDistributedMember) iter.next();
+ for (Object anOtherRecipients1 : otherRecipients1) {
+ InternalDistributedMember mbr = (InternalDistributedMember) anOtherRecipients1;
if (mbr != null) {
roles.addAll(mbr.getRoles());
}
}
- for (Iterator iter = otherRecipients2.iterator(); iter.hasNext();) {
- InternalDistributedMember mbr = (InternalDistributedMember) iter.next();
+ for (Object anOtherRecipients2 : otherRecipients2) {
+ InternalDistributedMember mbr = (InternalDistributedMember) anOtherRecipients2;
if (mbr != null) {
roles.addAll(mbr.getRoles());
}
@@ -581,22 +615,18 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// determine the missing roles
Set failedRoles = new HashSet(ra.getRequiredRoles());
failedRoles.removeAll(roles);
- if (failedRoles.isEmpty())
+ if (failedRoles.isEmpty()) {
return;
- // if (rp.isAllAccessWithQueuing()) {
- // this.rmq.add(data, failedRoles);
- // } else {
+ }
throw new RegionDistributionException(
LocalizedStrings.DistributedRegion_OPERATION_DISTRIBUTION_MAY_HAVE_FAILED_TO_NOTIFY_THESE_REQUIRED_ROLES_0
.toLocalizedString(failedRoles),
getFullPath(), failedRoles);
- // }
}
}
/**
- *
* Called when we do a distributed operation and don't have anyone to distributed it too. Since
* this is only called when no distribution was done (i.e. no recipients) we do not check
* isMissingRequiredRoles because it might not longer be true due to race conditions
@@ -607,18 +637,14 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* LIMITED_ACCESS.
* @since GemFire 5.0
*/
- protected boolean isNoDistributionOk() {
+ boolean isNoDistributionOk() {
if (this.requiresReliabilityCheck) {
MembershipAttributes ra = getMembershipAttributes();
- // if (ra.getLossAction().isAllAccessWithQueuing()) {
- // return !ra.hasRequiredRoles();
- // } else {
- Set failedRoles = ra.getRequiredRoles();
+ Set<Role> failedRoles = ra.getRequiredRoles();
throw new RegionDistributionException(
LocalizedStrings.DistributedRegion_OPERATION_DISTRIBUTION_WAS_NOT_DONE_TO_THESE_REQUIRED_ROLES_0
.toLocalizedString(failedRoles),
getFullPath(), failedRoles);
- // }
}
return true;
}
@@ -633,76 +659,11 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return false;
}
-
@Override
public boolean shouldSyncForCrashedMember(InternalDistributedMember id) {
return !doesNotDistribute() && super.shouldSyncForCrashedMember(id);
}
-
- /**
- * Adjust the specified set of recipients by removing any of them that are currently having their
- * data queued.
- *
- * @param recipients the set of recipients that a message is to be distributed too. Recipients
- * that are currently having their data queued will be removed from this set.
- * @return the set, possibly null, of recipients that are currently having their data queued.
- * @since GemFire 5.0
- */
- protected Set adjustForQueuing(Set recipients) {
- Set result = null;
- // if (this.requiresReliabilityCheck) {
- // MembershipAttributes ra = getMembershipAttributes();
- // if (ra.getLossAction().isAllAccessWithQueuing()) {
- // Set currentQueuedRoles = this.rmq.getQueuingRoles();
- // if (currentQueuedRoles != null) {
- // // foreach recipient see if any of his roles are queued and if
- // // they are remove him from recipients and add him to result
- // Iterator it = recipients.iterator();
- // while (it.hasNext()) {
- // DistributedMember dm = (DistributedMember)it.next();
- // Set dmRoles = dm.getRoles();
- // if (!dmRoles.isEmpty()) {
- // if (intersects(dmRoles, currentQueuedRoles)) {
- // it.remove(); // fix for bug 34447
- // if (result == null) {
- // result = new HashSet();
- // }
- // result.add(dm);
- // }
- // }
- // }
- // }
- // }
- // }
- return result;
- }
-
- /**
- * Returns true if the two sets intersect
- *
- * @param a a non-null non-empty set
- * @param b a non-null non-empty set
- * @return true if sets a and b intersect; false if not
- * @since GemFire 5.0
- */
- public static boolean intersects(Set a, Set b) {
- Iterator it;
- Set target;
- if (a.size() <= b.size()) {
- it = a.iterator();
- target = b;
- } else {
- it = b.iterator();
- target = a;
- }
- while (it.hasNext()) {
- if (target.contains(it.next()))
- return true;
- }
- return false;
- }
-
@Override
public boolean requiresReliabilityCheck() {
return this.requiresReliabilityCheck;
@@ -736,7 +697,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*
* @return true if asynchronous resumption is triggered
*/
- protected boolean resumeReliability(InternalDistributedMember id, Set newlyAcquiredRoles) {
+ private boolean resumeReliability(InternalDistributedMember id, Set newlyAcquiredRoles) {
boolean async = false;
try {
ResumptionAction ra = getMembershipAttributes().getResumptionAction();
@@ -763,6 +724,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
final Set newlyAcquiredRoles) throws RejectedExecutionException {
final ResumptionAction ra = getMembershipAttributes().getResumptionAction();
getDistributionManager().getWaitingThreadPool().execute(new Runnable() {
+ @Override
public void run() {
try {
if (ra.isReinitialize()) {
@@ -834,8 +796,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*
* @return true if asynchronous resumption is triggered
*/
- protected boolean lostReliability(final InternalDistributedMember id,
- final Set newlyMissingRoles) {
+ private boolean lostReliability(final InternalDistributedMember id, final Set newlyMissingRoles) {
if (DistributedRegion.ignoreReconnect) { // test hook
return false;
}
@@ -844,7 +805,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
try {
if (getMembershipAttributes().getLossAction().isReconnect()) {
async = true;
- if (isInitializingThread) {
+ if (this.isInitializingThread) {
doLostReliability(true, id, newlyMissingRoles);
} else {
doLostReliability(false, id, newlyMissingRoles);
@@ -852,18 +813,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// we don't do this in the waiting pool because we're going to
// disconnect
// the distributed system, and it will wait for the pool to empty
- /*
- * moved to a new method called doLostReliablity. Thread t = new
- * Thread("Reconnect Distributed System") { public void run() { try { // TODO: may need to
- * check isReconnecting and checkReadiness... initializationLatchAfterMemberTimeout.await();
- * // TODO: call reconnect here getSystem().tryReconnect((GemFireCache)getCache()); // added
- * for reconnect. synchronized (missingRequiredRoles) { // any number of threads may be
- * waiting on missingRequiredRoles missingRequiredRoles.notifyAll(); // need to fire an
- * event if id is not null if (hasListener() && id != null) { RoleEventImpl relEvent = new
- * RoleEventImpl( DistributedRegion.this, Operation.CACHE_RECONNECT, null, true, id,
- * newlyMissingRoles); dispatchListenerEvent( EnumListenerEvent.AFTER_ROLE_LOSS, relEvent);
- * } } } catch (Exception e) { } } }; t.setDaemon(true); t.start();
- */
}
} catch (CancelException cce) {
throw cce;
@@ -879,7 +828,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
try {
if (!isInitializing) {
// moved code to a new thread.
- Thread t = new Thread(
+ Thread thread = new Thread(
LocalizedStrings.DistributedRegion_RECONNECT_DISTRIBUTED_SYSTEM.toLocalizedString()) {
@Override
public void run() {
@@ -907,15 +856,15 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
};
- t.setDaemon(true);
- t.start();
+ thread.setDaemon(true);
+ thread.start();
} else {
getSystem().tryReconnect(false, "Role Loss", getCache()); // added for
// reconnect.
- synchronized (missingRequiredRoles) {
+ synchronized (this.missingRequiredRoles) {
// any number of threads may be waiting on missingRequiredRoles
- missingRequiredRoles.notifyAll();
+ this.missingRequiredRoles.notifyAll();
// need to fire an event if id is not null
if (hasListener() && id != null) {
RoleEventImpl relEvent = new RoleEventImpl(DistributedRegion.this,
@@ -923,10 +872,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
dispatchListenerEvent(EnumListenerEvent.AFTER_ROLE_LOSS, relEvent);
}
}
- // } catch (CancelException cce){
-
- // }
-
}
} catch (CancelException ignor) {
throw ignor;
@@ -934,12 +879,11 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
logger.fatal(LocalizedMessage.create(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION),
e);
}
-
}
- protected void lockCheckReadiness() {
+ void lockCheckReadiness() { // package-private to avoid synthetic accessor
// fix for bug 32610
- cache.getCancelCriterion().checkCancelInProgress(null);
+ this.cache.getCancelCriterion().checkCancelInProgress(null);
checkReadiness();
}
@@ -956,9 +900,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /**
- * @see LocalRegion#localDestroyNoCallbacks(Object)
- */
@Override
public void localDestroyNoCallbacks(Object key) {
super.localDestroyNoCallbacks(key);
@@ -970,9 +911,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /**
- * @see LocalRegion#localDestroy(Object, Object)
- */
@Override
public void localDestroy(Object key, Object aCallbackArgument) throws EntryNotFoundException {
super.localDestroy(key, aCallbackArgument);
@@ -984,9 +922,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /**
- * @see LocalRegion#invalidate(Object, Object)
- */
@Override
public void invalidate(Object key, Object aCallbackArgument)
throws TimeoutException, EntryNotFoundException {
@@ -996,7 +931,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
checkForLimitedOrNoAccess();
Lock dlock = this.getDistributedLockIfGlobal(key);
try {
- super.validatedInvalidate(key, aCallbackArgument);
+ validatedInvalidate(key, aCallbackArgument);
} finally {
if (dlock != null)
dlock.unlock();
@@ -1037,8 +972,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* Called while NOT holding lock on parent's subregions
*
* @throws IllegalStateException if region is not compatible with a region in another VM.
- *
- * @see LocalRegion#initialize(InputStream, InternalDistributedMember, InternalRegionArguments)
*/
@Override
protected void initialize(InputStream snapshotInputStream, InternalDistributedMember imageTarget,
@@ -1060,7 +993,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
try {
try {
- PersistentMemberID persistentId = null;
+ PersistentMemberID persistentMemberId = null;
boolean recoverFromDisk = isRecoveryNeeded();
DiskRegion dskRgn = getDiskRegion();
if (recoverFromDisk) {
@@ -1071,7 +1004,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
if (logger.isDebugEnabled()) {
logger.debug("DistributedRegion.getInitialImageAndRecovery: Finished Recovery");
}
- persistentId = dskRgn.getMyPersistentID();
+ persistentMemberId = dskRgn.getMyPersistentID();
}
// Create OQL indexes before starting GII.
@@ -1079,7 +1012,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
if (getDataPolicy().withReplication() || getDataPolicy().withPreloaded()) {
getInitialImageAndRecovery(snapshotInputStream, imageTarget, internalRegionArgs,
- recoverFromDisk, persistentId);
+ recoverFromDisk, persistentMemberId);
} else {
new CreateRegionProcessor(this).initializeRegion();
if (snapshotInputStream != null) {
@@ -1093,9 +1026,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
initMembershipRoles();
- isInitializingThread = false;
- super.initialize(null, null, null); // makes sure all latches are released if they haven't
- // been already
+ this.isInitializingThread = false;
+ // makes sure all latches are released if they haven't been already
+ super.initialize(null, null, null);
} finally {
if (this.eventTracker != null) {
this.eventTracker.setInitialized();
@@ -1114,40 +1047,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/**
* A reference counter to protected the memoryThresholdReached boolean
*/
- private final Set<DistributedMember> memoryThresholdReachedMembers =
- new CopyOnWriteArraySet<DistributedMember>();
-
- /** Sets and returns giiMissingRequiredRoles */
- private boolean checkInitialImageForReliability(InternalDistributedMember imageTarget,
- CacheDistributionAdvisor.InitialImageAdvice advice) {
- // assumption: required roles are interesting to GII only if Reinitialize...
- // if (true)
- return false;
- // if (getMembershipAttributes().hasRequiredRoles()
- // && getMembershipAttributes().getResumptionAction().isReinitialize()) {
- // // are any required roles missing for GII with Reinitialize?
- // Set missingRR = new HashSet(getMembershipAttributes().getRequiredRoles());
- // missingRR.removeAll(getSystem().getDistributedMember().getRoles());
- // for (Iterator iter = advice.replicates.iterator(); iter.hasNext();) {
- // DistributedMember member = (DistributedMember)iter.next();
- // missingRR.removeAll(member.getRoles());
- // }
- // for (Iterator iter = advice.others.iterator(); iter.hasNext();) {
- // DistributedMember member = (DistributedMember)iter.next();
- // missingRR.removeAll(member.getRoles());
- // }
- // for (Iterator iter = advice.preloaded.iterator(); iter.hasNext();) {
- // DistributedMember member = (DistributedMember)iter.next();
- // missingRR.removeAll(member.getRoles());
- // }
- // if (!missingRR.isEmpty()) {
- // // entering immediate loss condition, which will cause reinit on resume
- // this.giiMissingRequiredRoles = true;
- // }
- // }
- // return this.giiMissingRequiredRoles;
- }
+ private final Set<DistributedMember> memoryThresholdReachedMembers = new CopyOnWriteArraySet<>();
+ // TODO: cleanup getInitialImageAndRecovery
private void getInitialImageAndRecovery(InputStream snapshotInputStream,
InternalDistributedMember imageSrc, InternalRegionArguments internalRegionArgs,
boolean recoverFromDisk, PersistentMemberID persistentId) throws TimeoutException {
@@ -1158,17 +1060,16 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
imgState.init();
boolean targetRecreated = internalRegionArgs.getRecreateFlag();
Boolean isCBool = (Boolean) isConversion.get();
- boolean isForConversion = isCBool != null ? isCBool.booleanValue() : false;
+ boolean isForConversion = isCBool != null ? isCBool : false;
if (recoverFromDisk && snapshotInputStream != null && !isForConversion) {
throw new InternalGemFireError(
LocalizedStrings.DistributedRegion_IF_LOADING_A_SNAPSHOT_THEN_SHOULD_NOT_BE_RECOVERING_ISRECOVERING_0_SNAPSHOTSTREAM_1
- .toLocalizedString(
- new Object[] {Boolean.valueOf(recoverFromDisk), snapshotInputStream}));
+ .toLocalizedString(new Object[] {true, snapshotInputStream}));
}
ProfileExchangeProcessor targetProvider;
- if (dataPolicy.withPersistence()) {
+ if (this.dataPolicy.withPersistence()) {
targetProvider =
new CreatePersistentRegionProcessor(this, getPersistenceAdvisor(), recoverFromDisk);
} else {
@@ -1177,15 +1078,15 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
imgState.setInRecovery(false);
RegionVersionVector recovered_rvv = null;
- if (dataPolicy.withPersistence()) {
- recovered_rvv = (this.getVersionVector() == null ? null
- : this.getVersionVector().getCloneForTransmission());
+ if (this.dataPolicy.withPersistence()) {
+ recovered_rvv = this.getVersionVector() == null ? null
+ : this.getVersionVector().getCloneForTransmission();
}
// initializeRegion will send out our profile
targetProvider.initializeRegion();
- if (persistenceAdvisor != null) {
- persistenceAdvisor.initialize();
+ if (this.persistenceAdvisor != null) {
+ this.persistenceAdvisor.initialize();
}
// Register listener here so that the remote members are known
@@ -1193,7 +1094,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// remote members
if (!isInternalRegion()) {
if (!this.isDestroyed) {
- cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
+ this.cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
}
}
@@ -1212,9 +1113,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
loadSnapshotDuringInitialization(snapshotInputStream);
} catch (IOException e) {
- throw new RuntimeException(e); // @todo change this exception?
+ throw new RuntimeException(e); // TODO: change this exception?
} catch (ClassNotFoundException e) {
- throw new RuntimeException(e); // @todo change this exception?
+ throw new RuntimeException(e); // TODO: change this exception?
}
cleanUpDestroyedTokensAndMarkGIIComplete(GIIStatus.NO_GII);
return;
@@ -1227,25 +1128,11 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// or not)
InitialImageOperation iiop = new InitialImageOperation(this, this.entries);
- // [defunct] Special case GII for PR admin regions (which are always
- // replicates and always writers
- // bruce: this was commented out after adding the GIIAckRequest logic to
- // force
- // consistency before the gii operation begins
- // if (isUsedForPartitionedRegionAdmin() ||
- // isUsedForPartitionedRegionBucket()) {
- // releaseBeforeGetInitialImageLatch();
- // iiop.getFromAll(this.distAdvisor.adviseGeneric(), false);
- // cleanUpDestroyedTokens();
- // return;
- // }
-
CacheDistributionAdvisor.InitialImageAdvice advice = null;
boolean done = false;
while (!done && !isDestroyed()) {
advice = targetProvider.getInitialImageAdvice(advice);
- checkInitialImageForReliability(imageSrc, advice);
boolean attemptGetFromOne = imageSrc != null // we were given a specific member
|| this.dataPolicy.withPreloaded() && !advice.preloaded.isEmpty() // this is a preloaded
// region
@@ -1331,12 +1218,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /*
- * no more union GII // do union getInitialImage Set rest = new HashSet();
- * rest.addAll(advice.others); rest.addAll(advice.preloaded); // push profile w/ recovery
- * flag turned off at same time that we // do a union getInitialImage boolean pushProfile
- * = recoverFromDisk; iiop.getFromAll(rest, pushProfile);
- */
cleanUpDestroyedTokensAndMarkGIIComplete(GIIStatus.NO_GII);
done = true;
return;
@@ -1344,13 +1225,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
break;
}
}
-
- return;
- }
-
- private void synchronizeWith(InternalDistributedMember target, VersionSource idToRecover) {
- InitialImageOperation op = new InitialImageOperation(this, this.entries);
- op.synchronizeWith(target, idToRecover, null);
}
/**
@@ -1359,7 +1233,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*/
public void synchronizeForLostMember(InternalDistributedMember lostMember,
VersionSource lostVersionID) {
- if (this.concurrencyChecksEnabled == false) {
+ if (!this.concurrencyChecksEnabled) {
return;
}
CacheDistributionAdvisor advisor = getCacheDistributionAdvisor();
@@ -1379,11 +1253,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
op.synchronizeWith(target, versionMember, lostMember);
}
- /**
- * invoked just before an initial image is requested from another member
- */
/** remove any partial entries received in a failed GII */
- protected void cleanUpAfterFailedGII(boolean recoverFromDisk) {
+ void cleanUpAfterFailedGII(boolean recoverFromDisk) {
DiskRegion dskRgn = getDiskRegion();
// if we have a persistent region, instead of deleting everything on disk,
// we will just reset the "recovered from disk" flag. After
@@ -1428,8 +1299,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// remove all the roles we are playing since they will never be
// missing
this.missingRequiredRoles.removeAll(getSystem().getDistributedMember().getRoles());
- for (Iterator iter = others.iterator(); iter.hasNext();) {
- DistributedMember other = (DistributedMember) iter.next();
+ for (Object other1 : others) {
+ DistributedMember other = (DistributedMember) other1;
this.missingRequiredRoles.removeAll(other.getRoles());
}
}
@@ -1445,7 +1316,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
try {
if (this.giiMissingRequiredRoles) {
// force reliability loss and possibly resumption
- isInitializingThread = true;
+ this.isInitializingThread = true;
synchronized (this.advisorListener) {
synchronized (this.missingRequiredRoles) {
// forcing state of loss because of bad GII
@@ -1462,7 +1333,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
logger.debug("GetInitialImage had missing required roles.");
}
// TODO: will this work with RECONNECT and REINITIALIZE?
- isInitializingThread = true;
+ this.isInitializingThread = true;
lostReliability(null, null);
if (this.missingRequiredRoles.isEmpty()) {
// all required roles are present so force resumption
@@ -1477,7 +1348,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// pur code to increment the stats.
boolean async = resumeReliability(null, null);
if (async) {
- advisorListener.destroyed = true;
+ this.advisorListener.destroyed = true;
}
}
}
@@ -1508,7 +1379,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
logger.debug("Initialization completed with missing required roles: {}",
this.missingRequiredRoles);
}
- isInitializingThread = true;
+ this.isInitializingThread = true;
lostReliability(null, null);
}
}
@@ -1516,10 +1387,10 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
} catch (RegionDestroyedException ignore) {
// ignore to fix bug 34639 may be thrown by waitForRequiredRoles
- } catch (CancelException ignore) {
+ } catch (CancelException e) {
// ignore to fix bug 34639 may be thrown by waitForRequiredRoles
- if (isInitializingThread) {
- throw ignore;
+ if (this.isInitializingThread) {
+ throw e;
}
} catch (Exception e) {
logger.fatal(
@@ -1538,7 +1409,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// called by InitialImageOperation to clean up destroyed tokens
// release afterGetInitialImageInitializationLatch before unlocking
// cleanUpLock
- @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "UL_UNRELEASED_LOCK")
+ @SuppressWarnings("UL_UNRELEASED_LOCK")
protected void cleanUpDestroyedTokensAndMarkGIIComplete(GIIStatus giiStatus) {
// We need to clean up the disk before we release the after get initial image latch
DiskRegion dskRgn = getDiskRegion();
@@ -1564,8 +1435,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
clearEntries(rvv);
}
// need to do this before we release the afterGetInitialImageLatch
- if (persistenceAdvisor != null) {
- persistenceAdvisor.setOnline(GIIStatus.didGII(giiStatus), false, getPersistentID());
+ if (this.persistenceAdvisor != null) {
+ this.persistenceAdvisor.setOnline(GIIStatus.didGII(giiStatus), false, getPersistentID());
}
} finally {
// release after gii lock first so basicDestroy will see isInitialized()
@@ -1588,14 +1459,10 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
LocalizedStrings.DistributedRegion_INITIALIZING_REGION_COMPLETED_0, this.getName()));
}
- /**
- * @see LocalRegion#basicDestroy(EntryEventImpl, boolean, Object)
- */
@Override
protected void basicDestroy(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue)
throws EntryNotFoundException, CacheWriterException, TimeoutException {
// disallow local destruction for mirrored keysvalues regions
- boolean invokeWriter = cacheWrite;
boolean hasSeen = false;
if (hasSeenEvent(event)) {
hasSeen = true;
@@ -1603,11 +1470,12 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
checkIfReplicatedAndLocalDestroy(event);
try {
+ boolean invokeWriter = cacheWrite;
if (this.requiresOneHopForMissingEntry(event)) {
// bug #45704: see if a one-hop must be done for this operation
RegionEntry re = getRegionEntry(event.getKey());
if (re == null /* || re.isTombstone() */ || !this.generateVersionTag) {
- if (this.srp == null) {
+ if (this.serverRegionProxy == null) {
// only assert for non-client regions.
Assert.assertTrue(!this.dataPolicy.withReplication() || !this.generateVersionTag);
}
@@ -1651,7 +1519,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- return;
} finally {
if (hasSeen) {
if (event.isBulkOpInProgress() && !event.isOriginRemote()) {
@@ -1699,10 +1566,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return evictDestroyWasDone;
}
-
- /**
- * @see LocalRegion#basicInvalidateRegion(RegionEventImpl)
- */
@Override
void basicInvalidateRegion(RegionEventImpl event) {
// disallow local invalidation for replicated regions
@@ -1721,7 +1584,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* decide if InvalidateRegionOperation should be sent to peers. broken out so that BucketRegion
* can override
*
- * @param event
* @return true if {@link InvalidateRegionOperation} should be distributed, false otherwise
*/
protected boolean shouldDistributeInvalidateRegion(RegionEventImpl event) {
@@ -1738,9 +1600,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
new InvalidateRegionOperation(event).distribute();
}
- /**
- * @see LocalRegion#basicDestroyRegion(RegionEventImpl, boolean, boolean, boolean)
- */
@Override
void basicDestroyRegion(RegionEventImpl event, boolean cacheWrite, boolean lock,
boolean callbackEvents) throws CacheWriterException, TimeoutException {
@@ -1749,7 +1608,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// when another member concurrently creates this region. See bug 42051.
boolean isClose = event.getOperation().isClose();
if (!isClose) {
- cache.beginDestroy(path, this);
+ this.cache.beginDestroy(path, this);
}
try {
super.basicDestroyRegion(event, cacheWrite, lock, callbackEvents);
@@ -1772,17 +1631,16 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
} finally {
if (!isClose) {
- cache.endDestroy(path, this);
+ this.cache.endDestroy(path, this);
}
RegionLogger.logDestroy(path, getMyId(), getPersistentID(), isClose);
}
}
-
@Override
protected void distributeDestroyRegion(RegionEventImpl event, boolean notifyOfRegionDeparture) {
- if (persistenceAdvisor != null) {
- persistenceAdvisor.releaseTieLock();
+ if (this.persistenceAdvisor != null) {
+ this.persistenceAdvisor.releaseTieLock();
}
new DestroyRegionOperation(event, notifyOfRegionDeparture).distribute();
}
@@ -1790,16 +1648,14 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/**
* Return true if invalidation occurred; false if it did not, for example if it was already
* invalidated
- *
- * @see LocalRegion#basicInvalidate(EntryEventImpl)
*/
@Override
void basicInvalidate(EntryEventImpl event) throws EntryNotFoundException {
-
boolean hasSeen = false;
if (hasSeenEvent(event)) {
hasSeen = true;
}
+
try {
// disallow local invalidation for replicated regions
if (event.isLocalInvalid() && !event.getOperation().isLocal() && getScope().isDistributed()
@@ -1812,7 +1668,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// bug #45704: see if a one-hop must be done for this operation
RegionEntry re = getRegionEntry(event.getKey());
if (re == null/* || re.isTombstone() */ || !this.generateVersionTag) {
- if (this.srp == null) {
+ if (this.serverRegionProxy == null) {
// only assert for non-client regions.
Assert.assertTrue(!this.dataPolicy.withReplication() || !this.generateVersionTag);
}
@@ -1838,7 +1694,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
super.basicInvalidate(event);
- return;
} finally {
if (hasSeen) {
if (!getConcurrencyChecksEnabled() || event.hasValidVersionTag()) {
@@ -1871,26 +1726,25 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
@Override
void basicUpdateEntryVersion(EntryEventImpl event) throws EntryNotFoundException {
- LocalRegion lr = event.getLocalRegion();
- AbstractRegionMap arm = ((AbstractRegionMap) lr.getRegionMap());
+ LocalRegion localRegion = event.getLocalRegion();
+ AbstractRegionMap regionMap = (AbstractRegionMap) localRegion.getRegionMap();
try {
- arm.lockForCacheModification(lr, event);
+ regionMap.lockForCacheModification(localRegion, event);
try {
if (!hasSeenEvent(event)) {
super.basicUpdateEntryVersion(event);
}
- return;
} finally {
if (!getConcurrencyChecksEnabled() || event.hasValidVersionTag()) {
distributeUpdateEntryVersion(event);
}
}
} finally {
- arm.releaseCacheModificationLock(lr, event);
+ regionMap.releaseCacheModificationLock(localRegion, event);
}
}
- protected void distributeUpdateEntryVersion(EntryEventImpl event) {
+ void distributeUpdateEntryVersion(EntryEventImpl event) {
if (!this.regionInvalid && event.isDistributed() && !event.isOriginRemote()
&& !isTX() /* only distribute if non-tx */) {
if (event.isDistributed() && !event.isOriginRemote()) {
@@ -1902,10 +1756,10 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
@Override
- protected void basicClear(RegionEventImpl ev) {
+ protected void basicClear(RegionEventImpl regionEvent) {
Lock dlock = this.getRegionDistributedLockIfGlobal();
try {
- super.basicClear(ev);
+ super.basicClear(regionEvent);
} finally {
if (dlock != null)
dlock.unlock();
@@ -1919,7 +1773,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
do {
// non-replicate regions must defer to a replicate for clear/invalidate of region
Set<InternalDistributedMember> repls = this.distAdvisor.adviseReplicates();
- if (repls.size() > 0) {
+ if (!repls.isEmpty()) {
InternalDistributedMember mbr = repls.iterator().next();
RemoteRegionOperation op = RemoteRegionOperation.clear(mbr, this);
try {
@@ -1949,7 +1803,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// to suspend locking, which is what distributedLockForClear() does. We don't
// want that to happen, so we'll synchronize to make sure only one thread on
// this member performs a clear.
- synchronized (clearLock) {
+ synchronized (this.clearLock) {
if (enableRVV) {
distributedLockForClear();
@@ -2016,9 +1870,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/**
* obtain locks preventing generation of new versions in other members
- *
- * @param participants
- **/
+ */
private void obtainWriteLocksForClear(RegionEventImpl regionEvent,
Set<InternalDistributedMember> participants) {
lockLocallyForClear(getDistributionManager(), getMyId(), regionEvent);
@@ -2029,12 +1881,13 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* pause local operations so that a clear() can be performed and flush comm channels to the given
* member
*/
- public void lockLocallyForClear(DM dm, InternalDistributedMember locker, CacheEvent event) {
+ void lockLocallyForClear(DM dm, InternalDistributedMember locker, CacheEvent event) {
RegionVersionVector rvv = getVersionVector();
- ARMLockTestHook alth = getRegionMap().getARMLockTestHook();
- if (alth != null)
- alth.beforeLock(this, event);
+ ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook();
+ if (armLockTestHook != null) {
+ armLockTestHook.beforeLock(this, event);
+ }
if (rvv != null) {
// block new operations from being applied to the region map
@@ -2044,46 +1897,44 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
checkReadiness();
// Only need to flush if NOACK at this point
if (this.getAttributes().getScope().isDistributedNoAck()) {
- Set<InternalDistributedMember> mbrs = getDistributionAdvisor().adviseCacheOp();
- StateFlushOperation.flushTo(mbrs, this);
+ Set<InternalDistributedMember> members = getDistributionAdvisor().adviseCacheOp();
+ StateFlushOperation.flushTo(members, this);
}
}
- if (alth != null)
- alth.afterLock(this, null);
-
+ if (armLockTestHook != null) {
+ armLockTestHook.afterLock(this, null);
+ }
}
/**
* releases the locks obtained in obtainWriteLocksForClear
- *
- * @param participants
*/
private void releaseWriteLocksForClear(RegionEventImpl regionEvent,
Set<InternalDistributedMember> participants) {
- ARMLockTestHook alth = getRegionMap().getARMLockTestHook();
- if (alth != null)
- alth.beforeRelease(this, regionEvent);
+ ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook();
+ if (armLockTestHook != null) {
+ armLockTestHook.beforeRelease(this, regionEvent);
+ }
getVersionVector().unlockForClear(getMyId());
DistributedClearOperation.releaseLocks(regionEvent, participants);
- if (alth != null)
- alth.afterRelease(this, regionEvent);
-
+ if (armLockTestHook != null) {
+ armLockTestHook.afterRelease(this, regionEvent);
+ }
}
/**
* Wait for in progress clears that were initiated by this member.
*/
private void waitForInProgressClear() {
-
RegionVersionVector rvv = getVersionVector();
if (rvv != null) {
- synchronized (clearLock) {
+ synchronized (this.clearLock) {
// do nothing;
- // DAN - I'm a little scared that the compiler might optimize
+ // I'm a little scared that the compiler might optimize
// away this synchronization if we really do nothing. Hence
// my fine log message below. This might not be necessary.
if (logger.isDebugEnabled()) {
@@ -2107,12 +1958,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return eventId;
}
- // test hook for DistributedAckRegionCCEDUnitTest
- public static boolean LOCALCLEAR_TESTHOOK;
-
@Override
void basicLocalClear(RegionEventImpl rEvent) {
- if (getScope().isDistributed() && getDataPolicy().withReplication() && !LOCALCLEAR_TESTHOOK) {
+ if (getScope().isDistributed() && getDataPolicy().withReplication()) {
throw new UnsupportedOperationException(
LocalizedStrings.DistributedRegion_LOCALCLEAR_IS_NOT_SUPPORTED_ON_DISTRIBUTED_REPLICATED_REGIONS
.toLocalizedString());
@@ -2124,64 +1972,63 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return getSystem().getDistributionManager().getConfig();
}
- /*
- * @see SearchLoadAndWriteProcessor#initialize(LocalRegion, Object, Object)
- */
- public final CacheDistributionAdvisor getDistributionAdvisor() {
+ @Override
+ public CacheDistributionAdvisor getDistributionAdvisor() {
return this.distAdvisor;
}
+ @Override
public CacheDistributionAdvisor getCacheDistributionAdvisor() {
return this.distAdvisor;
}
- public final PersistenceAdvisor getPersistenceAdvisor() {
+ public PersistenceAdvisor getPersistenceAdvisor() {
return this.persistenceAdvisor;
}
- public final PersistentMemberID getPersistentID() {
+ public PersistentMemberID getPersistentID() {
return this.persistentId;
}
/** Returns the distribution profile; lazily creates one if needed */
+ @Override
public Profile getProfile() {
return this.distAdvisor.createProfile();
}
- public void fillInProfile(Profile p) {
- assert p instanceof CacheProfile;
- CacheProfile profile = (CacheProfile) p;
- profile.dataPolicy = getDataPolicy();
- profile.hasCacheLoader = basicGetLoader() != null;
- profile.hasCacheWriter = basicGetWriter() != null;
- profile.hasCacheListener = hasListener();
+ @Override
+ public void fillInProfile(Profile profile) {
+ assert profile instanceof CacheProfile;
+ CacheProfile cacheProfile = (CacheProfile) profile;
+ cacheProfile.dataPolicy = getDataPolicy();
+ cacheProfile.hasCacheLoader = basicGetLoader() != null;
+ cacheProfile.hasCacheWriter = basicGetWriter() != null;
+ cacheProfile.hasCacheListener = hasListener();
Assert.assertTrue(this.scope.isDistributed());
- profile.scope = this.scope;
- profile.inRecovery = getImageState().getInRecovery();
- profile.isPersistent = getDataPolicy().withPersistence();
- profile.setSubscriptionAttributes(getSubscriptionAttributes());
- // Kishor : Below PDX check is added for rolling upgrade support. We are
+ cacheProfile.scope = this.scope;
+ cacheProfile.inRecovery = getImageState().getInRecovery();
+ cacheProfile.isPersistent = getDataPolicy().withPersistence();
+ cacheProfile.setSubscriptionAttributes(getSubscriptionAttributes());
+
+ // Below PDX check is added for rolling upgrade support. We are
// removing Old wan in this checkin. PDX region are always gatewayEnabled
// irrespective whether gatewayHub is configured or not.
// Old version Pdx region always has this attribute true so to avoid region
// attribute comparison across member we are setting it to true.
- if (this.isPdxTypesRegion()) {
- profile.isGatewayEnabled = true;
- } else {
- profile.isGatewayEnabled = false;
- }
- profile.serialNumber = getSerialNumber();
- profile.regionInitialized = this.isInitialized();
- profile.persistentID = getPersistentID();
+
+ cacheProfile.isGatewayEnabled = isPdxTypesRegion();
+ cacheProfile.serialNumber = getSerialNumber();
+ cacheProfile.regionInitialized = isInitialized();
+ cacheProfile.persistentID = getPersistentID();
if (getPersistenceAdvisor() != null) {
- profile.persistenceInitialized = getPersistenceAdvisor().isOnline();
+ cacheProfile.persistenceInitialized = getPersistenceAdvisor().isOnline();
}
- profile.hasCacheServer = ((this.cache.getCacheServers().size() > 0) ? true : false);
- profile.requiresOldValueInEvents = this.dataPolicy.withReplication()
+ cacheProfile.hasCacheServer = this.cache.getCacheServers().size() > 0 ? true : false;
+ cacheProfile.requiresOldValueInEvents = this.dataPolicy.withReplication()
&& this.filterProfile != null && this.filterProfile.hasCQs();
- profile.gatewaySenderIds = getGatewaySenderIds();
- profile.asyncEventQueueIds = getVisibleAsyncEventQueueIds();
- profile.isOffHeap = getOffHeap();
+ cacheProfile.gatewaySenderIds = getGatewaySenderIds();
+ cacheProfile.asyncEventQueueIds = getVisibleAsyncEventQueueIds();
+ cacheProfile.isOffHeap = getOffHeap();
}
/**
@@ -2190,25 +2037,20 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
*/
public DistributedLockService getLockService() {
synchronized (this.dlockMonitor) {
- // Assert.assertTrue(this.scope.isGlobal()); since 7.0 this is used for distributing clear()
- // ops
-
- String svcName = getFullPath();
+ String dlsName = getFullPath();
if (this.dlockService == null) {
- this.dlockService = DistributedLockService.getServiceNamed(svcName);
+ this.dlockService = DistributedLockService.getServiceNamed(dlsName);
if (this.dlockService == null) {
- this.dlockService = DLockService.create(getFullPath(), getSystem(),
- true /* distributed */, false /* destroyOnDisconnect */, // region destroy will
- // destroy dls
- false /* automateFreeResources */); // manual freeResources only
+ // region destroy will destroy dls and manual freeResources only
+ this.dlockService = DLockService.create(getFullPath(), getSystem(), true, false, false);
}
// handle is-lock-grantor region attribute...
if (this.isLockGrantor) {
this.dlockService.becomeLockGrantor();
}
if (logger.isDebugEnabled()) {
- logger.debug("LockService for {} is using LockLease={}, LockTimeout=", svcName,
+ logger.debug("LockService for {} is using LockLease={}, LockTimeout={}", dlsName,
getCache().getLockLease(), getCache().getLockTimeout());
}
}
@@ -2216,21 +2058,14 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /**
- * @see LocalRegion#isCurrentlyLockGrantor()
- */
@Override
protected boolean isCurrentlyLockGrantor() {
- if (!this.scope.isGlobal())
- return false;
- return getLockService().isLockGrantor();
+ return this.scope.isGlobal() && getLockService().isLockGrantor();
}
@Override
public boolean isLockGrantor() {
- if (!this.scope.isGlobal())
- return false;
- return this.isLockGrantor;
+ return this.scope.isGlobal() && this.isLockGrantor;
}
@Override
@@ -2261,13 +2096,13 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/** @return the deserialized value */
@Override
@Retained
- protected Object findObjectInSystem(KeyInfo keyInfo, boolean isCreate, TXStateInterface txState,
+ protected Object findObjectInSystem(KeyInfo keyInfo, boolean isCreate, TXStateInterface tx,
boolean generateCallbacks, Object localValue, boolean disableCopyOnRead, boolean preferCD,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
boolean returnTombstones) throws CacheLoaderException, TimeoutException {
+
checkForLimitedOrNoAccess();
- RegionEntry re = null;
final Object key = keyInfo.getKey();
final Object aCallbackArgument = keyInfo.getCallbackArg();
Operation op;
@@ -2276,30 +2111,26 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
} else {
op = Operation.UPDATE;
}
- long lastModified = 0L;
- boolean fromServer = false;
@Released
EntryEventImpl event = null;
- @Retained
- Object result = null;
try {
- {
- if (this.srp != null) {
- VersionTagHolder holder = new VersionTagHolder();
- Object value = this.srp.get(key, aCallbackArgument, holder);
- fromServer = value != null;
- if (fromServer) {
- event = EntryEventImpl.create(this, op, key, value, aCallbackArgument, false, getMyId(),
- generateCallbacks);
- event.setVersionTag(holder.getVersionTag());
- event.setFromServer(fromServer); // fix for bug 39358
- if (clientEvent != null && clientEvent.getVersionTag() == null) {
- clientEvent.setVersionTag(holder.getVersionTag());
- }
+ boolean fromServer = false;
+ if (this.serverRegionProxy != null) {
+ VersionTagHolder holder = new VersionTagHolder();
+ Object value = this.serverRegionProxy.get(key, aCallbackArgument, holder);
+ fromServer = value != null;
+ if (fromServer) {
+ event = EntryEventImpl.create(this, op, key, value, aCallbackArgument, false, getMyId(),
+ generateCallbacks);
+ event.setVersionTag(holder.getVersionTag());
+ event.setFromServer(true); // fix for bug 39358
+ if (clientEvent != null && clientEvent.getVersionTag() == null) {
+ clientEvent.setVersionTag(holder.getVersionTag());
}
}
}
+ long lastModified = 0L;
if (!fromServer) {
// Do not generate Event ID
event = EntryEventImpl.create(this, op, key, null /* newValue */, aCallbackArgument, false,
@@ -2315,7 +2146,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
try {
processor.initialize(this, key, aCallbackArgument);
// processor fills in event
- processor.doSearchAndLoad(event, txState, localValue);
+ processor.doSearchAndLoad(event, tx, localValue);
if (clientEvent != null && clientEvent.getVersionTag() == null) {
clientEvent.setVersionTag(event.getVersionTag());
}
@@ -2325,15 +2156,17 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("DistributedRegion.findObjectInSystem skipping loader for region="
- + getFullPath() + "; key=" + key);
+ logger.debug(
+ "DistributedRegion.findObjectInSystem skipping loader for region={}; key={}",
+ getFullPath(), key);
}
}
}
+ RegionEntry re = null;
if (event.hasNewValue() && !isMemoryThresholdReachedForLoad()) {
try {
// Set eventId. Required for interested clients.
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
long startPut = CachePerfStats.getStatTime();
validateKey(key);
@@ -2345,17 +2178,17 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// set the tail key so that the event is passed to GatewaySender queues.
// if the tailKey is not set, the event gets filtered out in ParallelGatewaySenderQueue
if (this instanceof BucketRegion) {
- if (((BucketRegion) this).getPartitionedRegion().isParallelWanEnabled())
+ if (((Bucket) this).getPartitionedRegion().isParallelWanEnabled())
((BucketRegion) this).handleWANEvent(event);
}
re = basicPutEntry(event, lastModified);
- } catch (ConcurrentCacheModificationException e) {
+ } catch (ConcurrentCacheModificationException ignore) {
// the cache was modified while we were searching for this entry and
// the netsearch result was elided. Return the current value from the cache
re = getRegionEntry(key);
if (re != null) {
- event.setNewValue(re.getValue(this)); // OFFHEAP: need to incrc, copy to heap to
- // setNewValue, decrc
+ // OFFHEAP: need to incrc, copy to heap to setNewValue, decrc
+ event.setNewValue(re.getValue(this));
}
}
if (!isTX()) {
@@ -2371,6 +2204,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
recordMiss(re, key);
}
+ @Retained
+ Object result;
if (preferCD) {
result = event.getRawNewValueAsHeapObject();
} else {
@@ -2385,17 +2220,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
/**
- * hook for subclasses to note that a cache load was performed
- *
- * @see BucketRegion#performedLoad
- */
- // void performedLoad(EntryEventImpl event, long lastModifiedTime, TXState txState)
- // throws CacheWriterException {
- // // no action in DistributedRegion
- // }
-
- /**
- * @see LocalRegion#cacheWriteBeforeDestroy(EntryEventImpl, Object)
* @return true if cacheWrite was performed
*/
@Override
@@ -2430,9 +2254,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return result;
}
- /**
- * @see LocalRegion#cacheWriteBeforeRegionDestroy(RegionEventImpl)
- */
@Override
boolean cacheWriteBeforeRegionDestroy(RegionEventImpl event)
throws CacheWriterException, TimeoutException {
@@ -2441,7 +2262,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
CacheWriter localWriter = basicGetWriter();
Set netWriteRecipients = localWriter == null ? this.distAdvisor.adviseNetWrite() : null;
- if (localWriter != null || (netWriteRecipients != null && !netWriteRecipients.isEmpty())) {
+ if (localWriter != null || netWriteRecipients != null && !netWriteRecipients.isEmpty()) {
final long start = getCachePerfStats().startCacheWriterCall();
try {
SearchLoadAndWriteProcessor processor = SearchLoadAndWriteProcessor.getProcessor();
@@ -2473,16 +2294,16 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- if (persistenceAdvisor != null) {
+ if (this.persistenceAdvisor != null) {
this.persistenceAdvisor.close(); // fix for bug 41094
}
this.distAdvisor.close();
- DLockService dls = null;
// Fix for bug 46338. Wait for in progress clears before destroying the
// lock service, because destroying the service immediately releases the dlock
waitForInProgressClear();
+ DLockService dls = null;
synchronized (this.dlockMonitor) {
if (this.dlockService != null) {
dls = (DLockService) this.dlockService;
@@ -2533,13 +2354,13 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
Set others = this.advisorListener.getInitialMembers();
CacheListener[] listeners = fetchCacheListenersField();
if (listeners != null) {
- for (int i = 0; i < listeners.length; i++) {
- if (listeners[i] instanceof RegionMembershipListener) {
- RegionMembershipListener rml = (RegionMembershipListener) listeners[i];
+ for (CacheListener listener : listeners) {
+ if (listener instanceof RegionMembershipListener) {
+ RegionMembershipListener regionMembershipListener = (RegionMembershipListener) listener;
try {
DistributedMember[] otherDms = new DistributedMember[others.size()];
others.toArray(otherDms);
- rml.initialMembers(this, otherDms);
+ regionMembershipListener.initialMembers(this, otherDms);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -2562,7 +2383,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
Set<String> allGatewaySenderIds = getAllGatewaySenderIds();
if (!allGatewaySenderIds.isEmpty()) {
- for (GatewaySender sender : cache.getAllGatewaySenders()) {
+ for (GatewaySender sender : this.cache.getAllGatewaySenders()) {
if (sender.isParallel() && allGatewaySenderIds.contains(sender.getId())) {
// Fix for Bug#51491. Once decided to support this configuration we have call
// addShadowPartitionedRegionForUserRR
@@ -2576,13 +2397,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
throw new GatewaySenderConfigurationException(
LocalizedStrings.ParallelGatewaySender_0_CAN_NOT_BE_USED_WITH_REPLICATED_REGION_1
.toLocalizedString(new Object[] {sender.getId(), this.getFullPath()}));
-
- // if (sender.isRunning()) {
- // ConcurrentParallelGatewaySenderQueue parallelQueue =
- // (ConcurrentParallelGatewaySenderQueue)((ParallelGatewaySenderImpl)sender)
- // .getQueues().toArray(new RegionQueue[1])[0];
- // parallelQueue.addShadowPartitionedRegionForUserRR(this);
- // }
}
}
}
@@ -2592,8 +2406,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/**
* Free resources held by this region. This method is invoked after isDestroyed has been set to
* true.
- *
- * @see LocalRegion#postDestroyRegion(boolean, RegionEventImpl)
*/
@Override
protected void postDestroyRegion(boolean destroyDiskRegion, RegionEventImpl event) {
@@ -2605,7 +2417,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// I don't think this should ever happens: bulletproofing for bug 39454
logger.warn("postDestroyRegion: encountered cancellation", e);
}
-
}
@Override
@@ -2616,9 +2427,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
generateEventID());
distributeDestroyRegion(ev, true);
distributedRegionCleanup(null);
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// someone else must have concurrently destroyed the region (maybe a distributed destroy)
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// cache or DS is closed, ignore
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -2629,13 +2440,10 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
- /**
- * @see LocalRegion#handleCacheClose(Operation)
- */
@Override
- void handleCacheClose(Operation op) {
+ void handleCacheClose(Operation operation) {
try {
- super.handleCacheClose(op);
+ super.handleCacheClose(operation);
} finally {
distributedRegionCleanup(null);
}
@@ -2643,8 +2451,6 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
/**
* invoke a cache writer before a put is performed elsewhere
- *
- * @see LocalRegion#cacheWriteBeforePut(EntryEventImpl, Set, CacheWriter, boolean, Object)
*/
@Override
protected void cacheWriteBeforePut(EntryEventImpl event, Set netWriteRecipients,
@@ -2700,28 +2506,33 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
}
+ @Override
public void addGatewaySenderId(String gatewaySenderId) {
super.addGatewaySenderId(gatewaySenderId);
new UpdateAttributesProcessor(this).distribute();
}
+ @Override
public void removeGatewaySenderId(String gatewaySenderId) {
super.removeGatewaySenderId(gatewaySenderId);
new UpdateAttributesProcessor(this).distribute();
}
+ @Override
public void addAsyncEventQueueId(String asyncEventQueueId) {
super.addAsyncEventQueueId(asyncEventQueueId);
new UpdateAttributesProcessor(this).distribute();
}
+ @Override
public void removeAsyncEventQueueId(String asyncEventQueueId) {
super.removeAsyncEventQueueId(asyncEventQueueId);
new UpdateAttributesProcessor(this).distribute();
}
+ @Override
public void checkSameSenderIdsAvailableOnAllNodes() {
- List senderIds =
+ List<Set<String>> senderIds =
this.getCacheDistributionAdvisor().adviseSameGatewaySenderIds(getGatewaySenderIds());
if (!senderIds.isEmpty()) {
throw new GatewaySenderConfigurationException(
@@ -2730,7 +2541,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
new Object[] {this.getName(), senderIds.get(0), senderIds.get(1)}));
}
- List asycnQueueIds = this.getCacheDistributionAdvisor()
+ List<Set<String>> asycnQueueIds = this.getCacheDistributionAdvisor()
.adviseSameAsyncEventQueueIds(getVisibleAsyncEventQueueIds());
if (!asycnQueueIds.isEmpty()) {
throw new GatewaySenderConfigurationException(
@@ -2778,8 +2589,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
if (!dlock.tryLock(timeLeft, TimeUnit.SECONDS)) {
msg =
LocalizedStrings.DistributedRegion_ATTEMPT_TO_ACQUIRE_DISTRIBUTED_LOCK_FOR_0_FAILED_AFTER_WAITING_1_SECONDS;
- msgArgs =
- new Object[] {key, Long.valueOf((System.currentTimeMillis() - start) / 1000L)};
+ msgArgs = new Object[] {key, (System.currentTimeMillis() - start) / 1000L};
break;
}
@@ -2787,9 +2597,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
} catch (InterruptedException ex) {
interrupted = true;
this.cache.getCancelCriterion().checkCancelInProgress(ex);
- // FIXME Why is it OK to keep going?
+ // TODO: Why is it OK to keep going?
if (lockTimeout > -1) {
- timeLeft = getCache().getLockTimeout() - ((System.currentTimeMillis() - start) / 1000L);
+ timeLeft = getCache().getLockTimeout() - (System.currentTimeMillis() - start) / 1000L;
}
} finally {
if (interrupted) {
@@ -2800,7 +2610,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
if (msg == null) {
msg =
LocalizedStrings.DistributedRegion_TIMED_OUT_AFTER_WAITING_0_SECONDS_FOR_THE_DISTRIBUTED_LOCK_FOR_1;
- msgArgs = new Object[] {Integer.valueOf(getCache().getLockTimeout()), key};
+ msgArgs = new Object[] {getCache().getLockTimeout(), key};
}
throw new TimeoutException(msg.toLocalizedString(msgArgs));
} else {
@@ -2812,10 +2622,9 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* Checks if the entry is a valid entry
*
* @return true if entry not null or entry is not removed
- *
*/
protected boolean checkEntryNotValid(RegionEntry mapEntry) {
- return (mapEntry == null || (mapEntry.isRemoved() && !mapEntry.isTombstone()));
+ return mapEntry == null || mapEntry.isRemoved() && !mapEntry.isTombstone();
}
/**
@@ -2823,6 +2632,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* an iterator that uses hash ordering from the entry map, or, in the case of an overflow region,
* an iterator that iterates over the entries in disk order.
*/
+ @Override
public Iterator<RegionEntry> getBestIterator(boolean includeValues) {
DiskRegion dr = this.getDiskRegion();
@@ -2830,20 +2640,12 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
// Wait for the disk region to recover values first.
dr.waitForAsyncRecovery();
if (dr.getNumOverflowOnDisk() > 0) {
- return new DiskSavyIterator();
+ return new DiskSavvyIterator();
}
}
return this.entries.regionEntries().iterator();
}
- // /**
- // * The maximum number of entries that can be put into the diskMap before
- // * some of them are read from disk and returned by this iterator.
- // * The larger this number the more memory this iterator is allowed to consume
- // * and the better it will do in optimally reading the pending entries.
- // */
- // static final long MAX_PENDING_ENTRIES = Long.getLong("gemfire.MAX_PENDING_ENTRIES",
- // 1000000).longValue();
/**
* Should only be used if this region has entries on disk that are not in memory. This currently
* happens for overflow and for recovery when values are not recovered. The first iteration does a
@@ -2851,26 +2653,19 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* it saves it in a list sorted by the location on disk. Once the regionEntries iterator has
* nothing more to iterate it starts iterating over, in disk order, the entries on disk.
*/
- private class DiskSavyIterator implements Iterator<RegionEntry> {
+ private class DiskSavvyIterator implements Iterator<RegionEntry> {
private boolean usingIt = true;
+
private Iterator<?> it = entries.regionEntries().iterator();
+
// iterator for nested ArrayLists
private Iterator<RegionEntry> subIt = null;
- // private final ArrayList<DiskPosition> diskList = new ArrayList<DiskPosition>(/*@todo presize
- // based on number of entries only on disk*/);
- // value will be either RegionEntry or an ArrayList<RegionEntry>
- // private long pendingCount = 0;
- private final java.util.TreeMap<DiskPage, Object> diskMap =
- new java.util.TreeMap<DiskPage, Object>();
- // /**
- // * used to iterate over the fullest pages at the time we have
- // * added MAX_PENDING_ENTRIES to diskMap;
- // */
- // private Iterator<Map.Entry<DiskPage, Object>> sortedDiskIt;
+ private final TreeMap<DiskPage, Object> diskMap = new TreeMap<>();
- public DiskSavyIterator() {}
+ DiskSavvyIterator() {}
+ @Override
public boolean hasNext() {
boolean result;
if (this.subIt != null) {
@@ -2881,128 +2676,68 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
return result;
}
}
- // if (this.sortedDiskIt != null) {
- // result = this.sortedDiskIt.hasNext();
- // if (!result) {
- // this.sortedDiskIt = null;
- // } else {
- // return result;
- // }
- // }
+
result = this.it.hasNext();
if (this.usingIt && !result) {
this.usingIt = false;
- // long start = System.currentTimeMillis();
- // Collections.sort(this.diskList);
- // long end = System.currentTimeMillis();
this.it = this.diskMap.values().iterator();
result = this.it.hasNext();
}
return result;
}
+ @Override
public RegionEntry next() {
for (;;) {
if (this.subIt != null) {
return this.subIt.next();
- // } else if (this.sortedDiskIt != null) {
- // Map.Entry<DiskPage, Object> me = this.sortedDiskIt.next();
- // // remove the page from the diskMap.
- // this.diskMap.remove(me.getKey());
- // Object v = me.getValue();
- // int size = 1;
- // if (v instanceof ArrayList) {
- // ArrayList al = (ArrayList)v;
- // size = al.size();
- // // set up the iterator to start returning the entries on that page
- // this.subIt = al.iterator();
- // v = this.subIt.next();
- // }
-
- // // decrement pendingCount by the number of entries on the page
- // this.pendingCount -= size;
- // // return the first region entry on this page
- // return v;
}
if (this.usingIt) {
- RegionEntry re = (RegionEntry) this.it.next();
- DiskPosition dp = new DiskPosition();
- if (re.isOverflowedToDisk(DistributedRegion.this, dp)) {
- // add dp to sorted list
- DiskPage dPage = new DiskPage(dp);
- Object v = this.diskMap.get(dPage);
- if (v == null) {
- this.diskMap.put(dPage, re);
- } else if (v instanceof ArrayList) {
- ArrayList al = (ArrayList) v;
- al.add(re);
+ RegionEntry regionEntry = (RegionEntry) this.it.next();
+ DiskPosition diskPosition = new DiskPosition();
+ if (regionEntry.isOverflowedToDisk(DistributedRegion.this, diskPosition)) {
+ // add diskPosition to sorted list
+ DiskPage dPage = new DiskPage(diskPosition);
+ Object value = this.diskMap.get(dPage);
+ if (value == null) {
+ this.diskMap.put(dPage, regionEntry);
+ } else if (value instanceof ArrayList) {
+ List list = (List) value;
+ list.add(regionEntry);
} else {
- ArrayList al = new ArrayList();
- al.add(v);
- al.add(re);
- this.diskMap.put(dPage, al);
+ List list = new ArrayList();
+ list.add(value);
+ list.add(regionEntry);
+ this.diskMap.put(dPage, list);
}
if (!hasNext()) {
assert false; // must be true
}
- // this.pendingCount++;
- // if (this.usingIt && this.pendingCount >= MAX_PENDING_ENTRIES) {
- // // find the pages that have the most entries
- // int largestPage = 1;
- // ArrayList<Map.Entry<DiskPage, Object>> largestPages
- // = new ArrayList<Map.Entry<DiskPage, Object>>();
- // for (Map.Entry<DiskPage, Object> me: this.diskMap.entrySet()) {
- // int meSize = 1;
- // if (me.getValue() instanceof ArrayList) {
- // meSize = ((ArrayList)me.getValue()).size();
- // }
- // if (meSize > largestPage) {
- // largestPage = meSize;
- // largestPages.clear(); // throw away smaller pages
- // largestPages.add(me);
- // } else if (meSize == largestPage) {
- // largestPages.add(me);
- // } else {
- // // ignore this page
- // }
- // }
- // Collections.sort(largestPages, new Comparator
- // <Map.Entry<DiskPage, Object>>() {
- // /**
- // * Note: this comparator imposes orderings that are inconsistent
- // * with equals.
- // */
- // public int compare(Map.Entry<DiskPage, Object> o1, Map.Entry<DiskPage, Object> o2) {
- // return o1.getKey().compareTo(o2.getKey());
- // }
- // });
- // this.sortedDiskIt = largestPages.iterator();
- // // loop around and fetch first value from sortedDiskIt
- // }
} else {
- return re;
+ return regionEntry;
}
} else {
- Object v = this.it.next();
- if (v instanceof ArrayList) {
- ArrayList al = (ArrayList) v;
- this.subIt = al.iterator();
+ Object value = this.it.next();
+ if (value instanceof ArrayList) {
+ List list = (List) value;
+ this.subIt = list.iterator();
return this.subIt.next();
} else {
- return (RegionEntry) v;
+ return (RegionEntry) value;
}
}
}
}
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
}
public static class DiskPosition implements Comparable<DiskPosition> {
- private long oplogId;
- private long offset;
+ long oplogId; // package-private to avoid synthetic accessor
+ long offset; // package-private to avoid synthetic accessor
DiskPosition() {}
@@ -3013,19 +2748,21 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
@Override
public int hashCode() {
+ // TODO: Object instantiation inside 'hashCode()' is bad
return Long.valueOf(this.oplogId ^ this.offset).hashCode();
}
@Override
- public boolean equals(Object o) {
- if (o instanceof DiskPosition) {
- DiskPosition other = (DiskPosition) o;
+ public boolean equals(Object obj) {
+ if (obj instanceof DiskPosition) {
+ DiskPosition other = (DiskPosition) obj;
return this.oplogId == other.oplogId && this.offset == other.offset;
} else {
return false;
}
}
+ @Override
public int compareTo(DiskPosition o) {
int result = Long.signum(this.oplogId - o.oplogId);
if (result == 0) {
@@ -3036,18 +2773,19 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("<").append(this.oplogId).append(":").append(this.offset).append(">");
+ StringBuilder sb = new StringBuilder();
+ sb.append('<').append(this.oplogId).append(':').append(this.offset).append('>');
return sb.toString();
}
}
+
static class DiskPage extends DiskPosition {
static final long DISK_PAGE_SIZE =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "DISK_PAGE_SIZE", 8 * 1024L).longValue();
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "DISK_PAGE_SIZE", 8 << 10);
- DiskPage(DiskPosition dp) {
- this.setPosition(dp.oplogId, dp.offset / DISK_PAGE_SIZE);
+ DiskPage(DiskPosition diskPosition) {
+ this.setPosition(diskPosition.oplogId, diskPosition.offset / DISK_PAGE_SIZE);
}
}
@@ -3055,7 +2793,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
* Returns the lock lease value to use for DistributedLock and RegionDistributedLock. -1 is
* supported as non-expiring lock.
*/
- protected long getLockLeaseForLock() {
+ long getLockLeaseForLock() { // package-private to avoid synthetic accessor
if (getCache().getLockLease() == -1) {
return -1;
}
@@ -3066,24 +2804,22 @@ public class DistributedReg
<TRUNCATED>
[11/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
index 08dac6e..fe76863 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.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.internal.cache;
import java.io.IOException;
@@ -47,7 +46,6 @@ import org.apache.geode.cache.Scope;
import org.apache.geode.cache.partition.PartitionNotAvailableException;
import org.apache.geode.cache.util.CacheListenerAdapter;
import org.apache.geode.cache.util.CacheWriterAdapter;
-import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DM;
@@ -63,21 +61,12 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-/**
- */
public class PartitionedRegionHelper {
private static final Logger logger = LogService.getLogger();
- // ///////////// All the final variable //////////////////
/** 1 MB */
static final long BYTES_PER_MB = 1024 * 1024;
- /** Name of allPartitionedRegions Region * */
- // static final String PARTITIONED_REGION_CONFIG_NAME = "__Config";
-
- /** Prefix for the bucket2Node Region name defined in the global space. */
- // static final String BUCKET_2_NODE_TABLE_PREFIX = "_B2N_";
-
/**
* The administrative region used for storing Partitioned Region meta data sub regions *
*/
@@ -121,8 +110,6 @@ public class PartitionedRegionHelper {
ALLOWED_DATA_POLICIES = Collections.unmodifiableSet(policies);
}
-
-
/**
* This function is used for cleaning the config meta data for the failed or closed
* PartitionedRegion node.
@@ -132,7 +119,7 @@ public class PartitionedRegionHelper {
* @param cache GemFire cache.
*/
static void removeGlobalMetadataForFailedNode(Node failedNode, String regionIdentifier,
- GemFireCacheImpl cache) {
+ InternalCache cache) {
removeGlobalMetadataForFailedNode(failedNode, regionIdentifier, cache, true);
}
@@ -146,13 +133,11 @@ public class PartitionedRegionHelper {
* @param lock True if this removal should acquire and release the RegionLock
*/
static void removeGlobalMetadataForFailedNode(Node failedNode, String regionIdentifier,
- GemFireCacheImpl cache, final boolean lock) {
+ InternalCache cache, final boolean lock) {
Region root = PartitionedRegionHelper.getPRRoot(cache, false);
if (root == null) {
return; // no partitioned region info to clean up
}
- // Region allPartitionedRegions = PartitionedRegionHelper.getPRConfigRegion(
- // root, cache);
PartitionRegionConfig prConfig = (PartitionRegionConfig) root.get(regionIdentifier);
if (null == prConfig || !prConfig.containsNode(failedNode)) {
return;
@@ -163,9 +148,6 @@ public class PartitionedRegionHelper {
try {
if (lock) {
rl.lock();
- // if (!rl.lock()) {
- // return;
- // }
}
prConfig = (PartitionRegionConfig) root.get(regionIdentifier);
if (prConfig != null && prConfig.containsNode(failedNode)) {
@@ -204,7 +186,7 @@ public class PartitionedRegionHelper {
/**
* Return a region that is the root for all Partitioned Region metadata on this node
*/
- public static LocalRegion getPRRoot(final Cache cache) {
+ public static LocalRegion getPRRoot(final InternalCache cache) {
return getPRRoot(cache, true);
}
@@ -215,9 +197,8 @@ public class PartitionedRegionHelper {
*
* @return a GLOBLAL scoped root region used for PartitionedRegion administration
*/
- public static LocalRegion getPRRoot(final Cache cache, boolean createIfAbsent) {
- GemFireCacheImpl gemCache = (GemFireCacheImpl) cache;
- DistributedRegion root = (DistributedRegion) gemCache.getRegion(PR_ROOT_REGION_NAME, true);
+ public static LocalRegion getPRRoot(final InternalCache cache, boolean createIfAbsent) {
+ DistributedRegion root = (DistributedRegion) cache.getRegion(PR_ROOT_REGION_NAME, true);
if (root == null) {
if (!createIfAbsent) {
return null;
@@ -287,13 +268,13 @@ public class PartitionedRegionHelper {
};
try {
- root = (DistributedRegion) gemCache.createVMRegion(PR_ROOT_REGION_NAME, ra,
+ root = (DistributedRegion) cache.createVMRegion(PR_ROOT_REGION_NAME, ra,
new InternalRegionArguments().setIsUsedForPartitionedRegionAdmin(true)
.setInternalRegion(true).setCachePerfStatsHolder(prMetaStatsHolder));
root.getDistributionAdvisor().addMembershipListener(new MemberFailureListener());
- } catch (RegionExistsException silly) {
+ } catch (RegionExistsException ignore) {
// we avoid this before hand, but yet we have to catch it
- root = (DistributedRegion) gemCache.getRegion(PR_ROOT_REGION_NAME, true);
+ root = (DistributedRegion) cache.getRegion(PR_ROOT_REGION_NAME, true);
} catch (IOException ieo) {
Assert.assertTrue(false, "IOException creating Partitioned Region root: " + ieo);
} catch (ClassNotFoundException cne) {
@@ -326,7 +307,7 @@ public class PartitionedRegionHelper {
*/
public static void cleanUpMetaDataOnNodeFailure(DistributedMember failedMemId) {
try {
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null || cache.getCancelCriterion().isCancelInProgress()) {
return;
}
@@ -343,13 +324,13 @@ public class PartitionedRegionHelper {
final ArrayList<String> ks = new ArrayList<String>(rootReg.keySet());
if (ks.size() > 1) {
- Collections.shuffle(ks, PartitionedRegion.rand);
+ Collections.shuffle(ks, PartitionedRegion.RANDOM);
}
for (String prName : ks) {
try {
cleanUpMetaDataForRegion(cache, prName, failedMemId, null);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// okay to ignore this - metadata will be cleaned up by cache close operation
} catch (Exception e) {
if (logger.isDebugEnabled()) {
@@ -357,12 +338,12 @@ public class PartitionedRegionHelper {
}
}
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// ignore
}
}
- public static void cleanUpMetaDataForRegion(final GemFireCacheImpl cache, final String prName,
+ public static void cleanUpMetaDataForRegion(final InternalCache cache, final String prName,
final DistributedMember failedMemId, final Runnable postCleanupTask) {
boolean runPostCleanUp = true;
try {
@@ -373,7 +354,7 @@ public class PartitionedRegionHelper {
}
try {
prConf = (PartitionRegionConfig) rootReg.get(prName);
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignore) {
return;
}
if (prConf == null) {
@@ -419,7 +400,7 @@ public class PartitionedRegionHelper {
* This is a function for cleaning the config meta data (both the configuration data and the
* buckets) for a Node that hosted a PartitionedRegion
*/
- private static void cleanPartitionedRegionMetaDataForNode(GemFireCacheImpl cache, Node node,
+ private static void cleanPartitionedRegionMetaDataForNode(InternalCache cache, Node node,
PartitionRegionConfig prConf, String regionIdentifier) {
if (logger.isDebugEnabled()) {
logger.debug(
@@ -691,7 +672,6 @@ public class PartitionedRegionHelper {
/**
* Find a ProxyBucketRegion by parsing the region fullPath
*
- * @param cache
* @param fullPath full region path to parse
* @param postInit true if caller should wait for bucket initialization to complete
* @return ProxyBucketRegion as Bucket or null if not found
@@ -780,15 +760,15 @@ public class PartitionedRegionHelper {
public static String escapePRPath(String prFullPath) {
String escaped = prFullPath.replace("_", "__");
- escaped = escaped.replace(LocalRegion.SEPARATOR_CHAR, '_');
+ escaped = escaped.replace(Region.SEPARATOR_CHAR, '_');
return escaped;
}
- public static String TWO_SEPARATORS = LocalRegion.SEPARATOR + LocalRegion.SEPARATOR;
+ public static String TWO_SEPARATORS = Region.SEPARATOR + Region.SEPARATOR;
public static String unescapePRPath(String escapedPath) {
- String path = escapedPath.replace('_', LocalRegion.SEPARATOR_CHAR);
+ String path = escapedPath.replace('_', Region.SEPARATOR_CHAR);
path = path.replace(TWO_SEPARATORS, "_");
return path;
}
@@ -841,33 +821,9 @@ public class PartitionedRegionHelper {
}
/**
- * This method returns true if the member is found in the membership list of this member, else
- * false.
- *
- * @param mem
- * @param cache
- * @return true if mem is found in membership list of this member.
- */
- public static boolean isMemberAlive(DistributedMember mem, GemFireCacheImpl cache) {
- return getMembershipSet(cache).contains(mem);
- }
-
- /**
- * Returns the current membership Set for this member.
- *
- * @param cache
- * @return membership Set.
- */
- public static Set getMembershipSet(GemFireCacheImpl cache) {
- return cache.getInternalDistributedSystem().getDistributionManager()
- .getDistributionManagerIds();
- }
-
- /**
* Utility method to print warning when nodeList in b2n region is found empty. This will signify
* potential data loss scenario.
*
- * @param partitionedRegion
* @param bucketId Id of Bucket whose nodeList in b2n is empty.
* @param callingMethod methodName of the calling method.
*/
@@ -887,7 +843,7 @@ public class PartitionedRegionHelper {
Set members = partitionedRegion.getDistributionManager().getDistributionManagerIds();
logger.warn(LocalizedMessage.create(
LocalizedStrings.PartitionedRegionHelper_DATALOSS___0____SIZE_OF_NODELIST_AFTER_VERIFYBUCKETNODES_FOR_BUKID___1__IS_0,
- new Object[] {callingMethod, Integer.valueOf(bucketId)}));
+ new Object[] {callingMethod, bucketId}));
logger.warn(LocalizedMessage.create(
LocalizedStrings.PartitionedRegionHelper_DATALOSS___0____NODELIST_FROM_PRCONFIG___1,
new Object[] {callingMethod, printCollection(prConfig.getNodes())}));
@@ -899,12 +855,11 @@ public class PartitionedRegionHelper {
/**
* Utility method to print a collection.
*
- * @param c
* @return String
*/
public static String printCollection(Collection c) {
if (c != null) {
- StringBuffer sb = new StringBuffer("[");
+ StringBuilder sb = new StringBuilder("[");
Iterator itr = c.iterator();
while (itr.hasNext()) {
sb.append(itr.next());
@@ -919,42 +874,6 @@ public class PartitionedRegionHelper {
}
}
- /**
- * Destroys and removes the distributed lock service. This is called from cache closure operation.
- *
- * @see PartitionedRegion#afterRegionsClosedByCacheClose(GemFireCacheImpl)
- */
- static void destroyLockService() {
- DistributedLockService dls = null;
- synchronized (dlockMonitor) {
- dls = DistributedLockService.getServiceNamed(PARTITION_LOCK_SERVICE_NAME);
- }
- if (dls != null) {
- try {
- DistributedLockService.destroy(PARTITION_LOCK_SERVICE_NAME);
- } catch (IllegalArgumentException ex) {
- // Our dlockService is already destroyed,
- // probably by another thread - ignore
- }
- }
- }
-
- public static boolean isBucketPrimary(Bucket buk) {
- return buk.getBucketAdvisor().isPrimary();
- }
-
- public static boolean isRemotePrimaryAvailable(PartitionedRegion region,
- FixedPartitionAttributesImpl fpa) {
- List<FixedPartitionAttributesImpl> fpaList = region.getRegionAdvisor().adviseSameFPAs(fpa);
-
- for (FixedPartitionAttributes remotefpa : fpaList) {
- if (remotefpa.isPrimary()) {
- return true;
- }
- }
- return false;
- }
-
public static FixedPartitionAttributesImpl getFixedPartitionAttributesForBucket(
PartitionedRegion pr, int bucketId) {
List<FixedPartitionAttributesImpl> localFPAs = pr.getFixedPartitionAttributesImpl();
@@ -974,7 +893,7 @@ public class PartitionedRegionHelper {
return fpa;
}
}
- Object[] prms = new Object[] {pr.getName(), Integer.valueOf(bucketId)};
+ Object[] prms = new Object[] {pr.getName(), bucketId};
throw new PartitionNotAvailableException(
LocalizedStrings.PartitionedRegionHelper_FOR_FIXED_PARTITIONED_REGION_0_FIXED_PARTITION_IS_NOT_AVAILABLE_FOR_BUCKET_1_ON_ANY_DATASTORE
.toLocalizedString(prms));
@@ -1027,42 +946,41 @@ public class PartitionedRegionHelper {
List<InternalDistributedMember> remaining) {}
}
-}
-
-class FixedPartitionAttributesListener extends CacheListenerAdapter {
- private static final Logger logger = LogService.getLogger();
+ static class FixedPartitionAttributesListener extends CacheListenerAdapter {
+ private static final Logger logger = LogService.getLogger();
- public void afterCreate(EntryEvent event) {
- PartitionRegionConfig prConfig = (PartitionRegionConfig) event.getNewValue();
- if (!prConfig.getElderFPAs().isEmpty()) {
- updatePartitionMap(prConfig);
+ public void afterCreate(EntryEvent event) {
+ PartitionRegionConfig prConfig = (PartitionRegionConfig) event.getNewValue();
+ if (!prConfig.getElderFPAs().isEmpty()) {
+ updatePartitionMap(prConfig);
+ }
}
- }
- public void afterUpdate(EntryEvent event) {
- PartitionRegionConfig prConfig = (PartitionRegionConfig) event.getNewValue();
- if (!prConfig.getElderFPAs().isEmpty()) {
- updatePartitionMap(prConfig);
+ public void afterUpdate(EntryEvent event) {
+ PartitionRegionConfig prConfig = (PartitionRegionConfig) event.getNewValue();
+ if (!prConfig.getElderFPAs().isEmpty()) {
+ updatePartitionMap(prConfig);
+ }
}
- }
- private void updatePartitionMap(PartitionRegionConfig prConfig) {
- int prId = prConfig.getPRId();
- PartitionedRegion pr = null;
+ private void updatePartitionMap(PartitionRegionConfig prConfig) {
+ int prId = prConfig.getPRId();
+ PartitionedRegion pr = null;
- try {
- pr = PartitionedRegion.getPRFromId(prId);
- if (pr != null) {
- Map<String, Integer[]> partitionMap = pr.getPartitionsMap();
- for (FixedPartitionAttributesImpl fxPrAttr : prConfig.getElderFPAs()) {
- partitionMap.put(fxPrAttr.getPartitionName(),
- new Integer[] {fxPrAttr.getStartingBucketID(), fxPrAttr.getNumBuckets()});
+ try {
+ pr = PartitionedRegion.getPRFromId(prId);
+ if (pr != null) {
+ Map<String, Integer[]> partitionMap = pr.getPartitionsMap();
+ for (FixedPartitionAttributesImpl fxPrAttr : prConfig.getElderFPAs()) {
+ partitionMap.put(fxPrAttr.getPartitionName(),
+ new Integer[] {fxPrAttr.getStartingBucketID(), fxPrAttr.getNumBuckets()});
+ }
}
+ } catch (PRLocallyDestroyedException e) {
+ logger.debug("PRLocallyDestroyedException : Region ={} is locally destroyed on this node",
+ prConfig.getPRId(), e);
}
- } catch (PRLocallyDestroyedException e) {
- logger.debug("PRLocallyDestroyedException : Region ={} is locally destroyed on this node",
- prConfig.getPRId(), e);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
index ef7cf03..00f50d2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
@@ -14,6 +14,19 @@
*/
package org.apache.geode.internal.cache;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheException;
@@ -28,18 +41,6 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.pdx.internal.TypeRegistry;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
/**
* Implementation of PoolFactory.
@@ -217,7 +218,7 @@ public class PoolFactoryImpl implements PoolFactory {
InetAddress hostAddr = InetAddress.getByName(host);
InetSocketAddress sockAddr = new InetSocketAddress(hostAddr, port);
l.add(sockAddr);
- } catch (UnknownHostException cause) {
+ } catch (UnknownHostException ignore) {
// IllegalArgumentException ex = new IllegalArgumentException("Unknown host " + host);
// ex.initCause(cause);
// throw ex;
@@ -310,7 +311,7 @@ public class PoolFactoryImpl implements PoolFactory {
* @since GemFire 5.7
*/
public Pool create(String name) throws CacheException {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
TypeRegistry registry = cache.getPdxRegistry();
if (registry != null && !attributes.isGateway()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
index 06378f2..9d4b5e2 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
@@ -206,7 +206,7 @@ public final class ProxyBucketRegion implements Bucket {
+ getPartitionedRegion().getBucketName(this.bid);
}
- public GemFireCacheImpl getCache() {
+ public InternalCache getCache() {
return this.partitionedRegion.getCache();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
index 8ed07f8..01b7041 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
@@ -280,8 +280,8 @@ final class ProxyRegionMap implements RegionMap {
List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
ClientProxyMembershipID bridgeContext, TXEntryState txEntryState, VersionTag versionTag,
long tailKey) {
- this.owner.txApplyInvalidatePart2(markerEntry, key, didDestroy, true,
- false /* Clear conflic occured */);
+ this.owner.txApplyInvalidatePart2(markerEntry, key, didDestroy, true
+ /* Clear conflic occured */);
if (this.owner.isInitialized()) {
if (txEvent != null) {
txEvent.addInvalidate(this.owner, markerEntry, key, newValue, aCallbackArgument);
@@ -318,7 +318,7 @@ final class ProxyRegionMap implements RegionMap {
long tailKey) {
Operation putOp = p_putOp.getCorrespondingCreateOp();
long lastMod = owner.cacheTimeMillis();
- this.owner.txApplyPutPart2(markerEntry, key, newValue, lastMod, true, didDestroy,
+ this.owner.txApplyPutPart2(markerEntry, key, lastMod, true, didDestroy,
false /* Clear conflict occured */);
if (this.owner.isInitialized()) {
if (txEvent != null) {
@@ -582,12 +582,6 @@ final class ProxyRegionMap implements RegionMap {
.toLocalizedString(DataPolicy.EMPTY));
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.RegionEntry#getSerializedValueOnDisk(org.apache.geode.
- * internal.cache.LocalRegion)
- */
public Object getSerializedValueOnDisk(LocalRegion localRegion) {
throw new UnsupportedOperationException(
LocalizedStrings.ProxyRegionMap_NO_ENTRY_SUPPORT_ON_REGIONS_WITH_DATAPOLICY_0
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionEvictorTask.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionEvictorTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionEvictorTask.java
index da6a671..0d754c6 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionEvictorTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionEvictorTask.java
@@ -14,25 +14,24 @@
*/
package org.apache.geode.internal.cache;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.cache.lru.HeapEvictor;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.Callable;
/**
- *
* Takes delta to be evicted and tries to evict the least no of LRU entry which would make
* evictedBytes more than or equal to the delta
*
* @since GemFire 6.0
- *
*/
public class RegionEvictorTask implements Callable<Object> {
@@ -77,7 +76,7 @@ public class RegionEvictorTask implements Callable<Object> {
}
}
- private GemFireCacheImpl getGemFireCache() {
+ private InternalCache getInternalCache() {
return getHeapEvictor().getGemFireCache();
}
@@ -86,12 +85,12 @@ public class RegionEvictorTask implements Callable<Object> {
}
public Object call() throws Exception {
- getGemFireCache().getCachePerfStats().incEvictorJobsStarted();
+ getInternalCache().getCachePerfStats().incEvictorJobsStarted();
long bytesEvicted = 0;
long totalBytesEvicted = 0;
try {
while (true) {
- getGemFireCache().getCachePerfStats();
+ getInternalCache().getCachePerfStats();
final long start = CachePerfStats.getStatTime();
synchronized (this.regionSet) {
if (this.regionSet.isEmpty()) {
@@ -120,15 +119,15 @@ public class RegionEvictorTask implements Callable<Object> {
logger.warn(LocalizedMessage.create(LocalizedStrings.Eviction_EVICTOR_TASK_EXCEPTION,
new Object[] {e.getMessage()}), e);
} finally {
- getGemFireCache().getCachePerfStats();
+ getInternalCache().getCachePerfStats();
long end = CachePerfStats.getStatTime();
- getGemFireCache().getCachePerfStats().incEvictWorkTime(end - start);
+ getInternalCache().getCachePerfStats().incEvictWorkTime(end - start);
}
}
}
}
} finally {
- getGemFireCache().getCachePerfStats().incEvictorJobsCompleted();
+ getInternalCache().getCachePerfStats().incEvictorJobsCompleted();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionFactoryImpl.java
index b6989f9..813f3c6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionFactoryImpl.java
@@ -14,33 +14,29 @@
*/
package org.apache.geode.internal.cache;
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.geode.CancelException;
-import org.apache.geode.cache.*;
-import org.apache.geode.cache.client.ClientNotReadyException;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
/**
- * <code>RegionFactoryImpl</code> extends RegionFactory adding {@link RegionShortcut} support.
+ * {@code RegionFactoryImpl} extends RegionFactory adding {@link RegionShortcut} support.
*
* @since GemFire 6.5
*/
-
public class RegionFactoryImpl<K, V> extends RegionFactory<K, V> {
- public RegionFactoryImpl(GemFireCacheImpl cache) {
+ public RegionFactoryImpl(InternalCache cache) {
super(cache);
}
- public RegionFactoryImpl(GemFireCacheImpl cache, RegionShortcut pra) {
+ public RegionFactoryImpl(InternalCache cache, RegionShortcut pra) {
super(cache, pra);
}
- public RegionFactoryImpl(GemFireCacheImpl cache, RegionAttributes ra) {
+ public RegionFactoryImpl(InternalCache cache, RegionAttributes ra) {
super(cache, ra);
}
- public RegionFactoryImpl(GemFireCacheImpl cache, String regionAttributesId) {
+ public RegionFactoryImpl(InternalCache cache, String regionAttributesId) {
super(cache, regionAttributesId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
index 2c3fc95..765f707 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
@@ -43,8 +43,6 @@ import org.apache.geode.distributed.internal.ReplyMessage;
import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.partitioned.PutMessage;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -77,6 +75,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
* The unique transaction Id on the sending member, used to construct a TXId on the receiving side
*/
private int txUniqId = TXManagerImpl.NOTX;
+
private InternalDistributedMember txMemberId = null;
protected transient short flags;
@@ -84,8 +83,9 @@ public abstract class RemoteOperationMessage extends DistributionMessage
/* TODO [DISTTX] Convert into flag */
protected boolean isTransactionDistributed = false;
- public RemoteOperationMessage() {}
-
+ public RemoteOperationMessage() {
+ // do nothing
+ }
public RemoteOperationMessage(InternalDistributedMember recipient, String regionPath,
ReplyProcessor21 processor) {
@@ -93,7 +93,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
setRecipient(recipient);
this.regionPath = regionPath;
this.processorId = processor == null ? 0 : processor.getProcessorId();
- if (processor != null && this.isSevereAlertCompatible()) {
+ if (processor != null && isSevereAlertCompatible()) {
processor.enableSevereAlertProcessing();
}
this.txUniqId = TXManagerImpl.getCurrentTXUniqueId();
@@ -108,7 +108,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
setRecipients(recipients);
this.regionPath = regionPath;
this.processorId = processor == null ? 0 : processor.getProcessorId();
- if (processor != null && this.isSevereAlertCompatible()) {
+ if (processor != null && isSevereAlertCompatible()) {
processor.enableSevereAlertProcessing();
}
this.txUniqId = TXManagerImpl.getCurrentTXUniqueId();
@@ -121,8 +121,6 @@ public abstract class RemoteOperationMessage extends DistributionMessage
/**
* Copy constructor that initializes the fields declared in this class
- *
- * @param other
*/
public RemoteOperationMessage(RemoteOperationMessage other) {
this.regionPath = other.regionPath;
@@ -152,7 +150,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
/**
* @return the full path of the region
*/
- public final String getRegionPath() {
+ public String getRegionPath() {
return regionPath;
}
@@ -161,30 +159,15 @@ public abstract class RemoteOperationMessage extends DistributionMessage
* is required.
*/
@Override
- public final int getProcessorId() {
+ public int getProcessorId() {
return this.processorId;
}
/**
- * @param processorId1 the {@link org.apache.geode.distributed.internal.ReplyProcessor21} id
- * associated with the message, null if no acknowlegement is required.
- */
- public final void registerProcessor(int processorId1) {
- this.processorId = processorId1;
- }
-
- public void setCacheOpRecipients(Collection cacheOpRecipients) {
- // TODO need to implement this for other remote ops
- assert this instanceof RemotePutMessage;
- }
-
-
- /**
* check to see if the cache is closing
*/
public boolean checkCacheClosing(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- // return (cache != null && cache.isClosed());
+ InternalCache cache = GemFireCacheImpl.getInstance();
return cache == null || cache.isClosed();
}
@@ -218,14 +201,14 @@ public abstract class RemoteOperationMessage extends DistributionMessage
.toLocalizedString(dm.getId()));
return;
}
- GemFireCacheImpl gfc = getCache(dm);
- r = getRegionByPath(gfc);
+ InternalCache cache = getCache(dm);
+ r = getRegionByPath(cache);
if (r == null && failIfRegionMissing()) {
// if the distributed system is disconnecting, don't send a reply saying
// the partitioned region can't be found (bug 36585)
thr = new RegionDestroyedException(
- LocalizedStrings.RemoteOperationMessage_0_COULD_NOT_FIND_REGION_1.toLocalizedString(
- new Object[] {dm.getDistributionManagerId(), regionPath}),
+ LocalizedStrings.RemoteOperationMessage_0_COULD_NOT_FIND_REGION_1
+ .toLocalizedString(dm.getDistributionManagerId(), regionPath),
regionPath);
return; // reply sent in finally block below
}
@@ -233,7 +216,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
thr = UNHANDLED_EXCEPTION;
// [bruce] r might be null here, so we have to go to the cache instance to get the txmgr
- TXManagerImpl txMgr = getTXManager(gfc);
+ TXManagerImpl txMgr = getTXManager(cache);
TXStateProxy tx = txMgr.masqueradeAs(this);
if (tx == null) {
sendReply = operateOnRegion(dm, r, startTime);
@@ -315,16 +298,16 @@ public abstract class RemoteOperationMessage extends DistributionMessage
}
}
- TXManagerImpl getTXManager(GemFireCacheImpl cache) {
+ TXManagerImpl getTXManager(InternalCache cache) {
return cache.getTxManager();
}
- LocalRegion getRegionByPath(GemFireCacheImpl gfc) {
- return gfc.getRegionByPathForProcessing(this.regionPath);
+ LocalRegion getRegionByPath(InternalCache internalCache) {
+ return internalCache.getRegionByPathForProcessing(this.regionPath);
}
- GemFireCacheImpl getCache(final DistributionManager dm) {
- return (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache getCache(final DistributionManager dm) {
+ return (InternalCache) CacheFactory.getInstance(dm.getSystem());
}
/**
@@ -441,7 +424,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
}
}
- protected final InternalDistributedMember getTXMemberId() {
+ protected InternalDistributedMember getTXMemberId() {
return txMemberId;
}
@@ -502,12 +485,11 @@ public abstract class RemoteOperationMessage extends DistributionMessage
/**
* @return the txUniqId
*/
- public final int getTXUniqId() {
+ public int getTXUniqId() {
return txUniqId;
}
-
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
}
@@ -583,15 +565,15 @@ public abstract class RemoteOperationMessage extends DistributionMessage
if (removeMember(id, true)) {
this.prce = new ForceReattemptException(
LocalizedStrings.PartitionMessage_PARTITIONRESPONSE_GOT_MEMBERDEPARTED_EVENT_FOR_0_CRASHED_1
- .toLocalizedString(new Object[] {id, Boolean.valueOf(crashed)}));
+ .toLocalizedString(id, crashed));
}
checkIfDone();
} else {
Exception e = new Exception(
LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID.toLocalizedString());
logger.info(LocalizedMessage.create(
- LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0,
- Boolean.valueOf(crashed)), e);
+ LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0, crashed),
+ e);
}
}
@@ -599,9 +581,8 @@ public abstract class RemoteOperationMessage extends DistributionMessage
* Waits for the response from the {@link RemoteOperationMessage}'s recipient
*
* @throws CacheException if the recipient threw a cache exception during message processing
- * @throws PrimaryBucketException
*/
- final public void waitForCacheException()
+ public void waitForCacheException()
throws CacheException, RemoteOperationException, PrimaryBucketException {
try {
waitForRepliesUninterruptibly();
@@ -630,8 +611,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
throw new PrimaryBucketException(
LocalizedStrings.PartitionMessage_PEER_FAILED_PRIMARY_TEST.toLocalizedString(), t);
} else if (t instanceof RegionDestroyedException) {
- RegionDestroyedException rde = (RegionDestroyedException) t;
- throw rde;
+ throw (RegionDestroyedException) t;
} else if (t instanceof CancelException) {
if (logger.isDebugEnabled()) {
logger.debug(
@@ -677,7 +657,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
* For Distributed Tx
*/
private void setIfTransactionDistributed() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
if (cache.getTxManager() != null) {
this.isTransactionDistributed = cache.getTxManager().isDistributed();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutMessage.java
index 889c019..acf77ba 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutMessage.java
@@ -52,19 +52,13 @@ import org.apache.geode.internal.cache.versions.DiskVersionTag;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Unretained;
-import org.apache.geode.internal.util.BlobHelper;
-import org.apache.geode.internal.util.Breadcrumbs;
import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
-import static org.apache.geode.internal.cache.DistributedCacheOperation.VALUE_IS_BYTES;
-import static org.apache.geode.internal.cache.DistributedCacheOperation.VALUE_IS_SERIALIZED_OBJECT;
-import static org.apache.geode.internal.cache.DistributedCacheOperation.VALUE_IS_OBJECT;
/**
* A Replicate Region update message. Meant to be sent only to the peer who hosts transactional
@@ -479,11 +473,6 @@ public final class RemotePutMessage extends RemoteOperationMessageWithDirectRepl
this.op = operation;
}
- @Override
- public void setCacheOpRecipients(Collection cacheOpRecipients) {
- this.cacheOpRecipients = cacheOpRecipients;
- }
-
/**
* sets the instance variable hasOldValue to the giving boolean value.
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
index 65cda5d..34f6b73 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
@@ -12,16 +12,56 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
-/* enumerate each imported class because conflict with dl.u.c.TimeoutException */
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+
+import org.apache.logging.log4j.Logger;
-import org.apache.geode.*;
-import org.apache.geode.cache.*;
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.CancelException;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.GemFireException;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.cache.CacheEvent;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheLoader;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.LoaderHelper;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.RegionEvent;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.util.ObjectSizer;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
+import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.PooledDistributionMessage;
+import org.apache.geode.distributed.internal.ProcessorKeeper21;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.SerialDistributionMessage;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.InternalDataSerializer;
@@ -31,19 +71,9 @@ import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+import org.apache.geode.internal.offheap.Releasable;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.NotSerializableException;
-import java.util.*;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-
/**
* Implementation for distributed search, load and write operations in the GemFire system. Provides
@@ -54,18 +84,15 @@ import java.util.concurrent.locks.Lock;
* times.netLoad happens as a one phase operation in all cases except where the scope is GLOBAL At
* the receiving end, the request is converted into an appropriate message whose process method
* responds to the request.
- *
*/
-
public class SearchLoadAndWriteProcessor implements MembershipListener {
private static final Logger logger = LogService.getLogger();
public static final int SMALL_BLOB_SIZE =
- Integer.getInteger("DistributionManager.OptimizedUpdateByteLimit", 2000).intValue();
+ Integer.getInteger("DistributionManager.OptimizedUpdateByteLimit", 2000);
static final long RETRY_TIME =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "search-retry-interval", 2000).longValue();
-
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "search-retry-interval", 2000);
private volatile InternalDistributedMember selectedNode;
private boolean selectedNodeDead = false;
@@ -200,7 +227,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
} finally {
if (event != listenerEvent) {
if (listenerEvent instanceof EntryEventImpl) {
- ((EntryEventImpl) listenerEvent).release();
+ ((Releasable) listenerEvent).release();
}
}
}
@@ -334,7 +361,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
if (this.advisor != null) {
this.advisor.removeMembershipListener(this);
}
- } catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException ignore) {
} finally {
getProcessorKeeper().remove(this.processorId);
}
@@ -343,13 +370,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
void remove() {
getProcessorKeeper().remove(this.processorId);
-
}
-
-
void initialize(LocalRegion theRegion, Object theKey, Object theCallbackArg) {
-
this.region = theRegion;
this.regionName = theRegion.getFullPath();
this.key = theKey;
@@ -358,10 +381,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
Scope scope = attrs.getScope();
if (scope.isDistributed()) {
this.advisor = ((CacheDistributionAdvisee) this.region).getCacheDistributionAdvisor();
- this.distributionManager = ((CacheDistributionAdvisee) theRegion).getDistributionManager();
+ this.distributionManager = theRegion.getDistributionManager();
this.timeout = getSearchTimeout();
this.advisor.addMembershipListener(this);
-
}
}
@@ -369,7 +391,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
this.key = key;
}
- /************** Protected Methods ********************/
protected void setSelectedNode(InternalDistributedMember selectedNode) {
this.selectedNode = selectedNode;
this.selectedNodeDead = false;
@@ -383,18 +404,14 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
return this.key;
}
- /************** Package Methods **********************/
-
InternalDistributedMember getSelectedNode() {
return this.selectedNode;
}
- /************** Private Methods **********************/
/**
* Even though SearchLoadAndWriteProcessor may be in invoked in the context of a local region,
* most of the services it provides are relevant to distribution only. The 3 services it provides
* are netSearch, netLoad, netWrite
- *
*/
private SearchLoadAndWriteProcessor() {
resetResults();
@@ -410,7 +427,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
this.responseQueue = null;
}
-
/**
* If we have a local cache loader and the region is not global, then invoke the loader If the
* region is local, or the result is non-null, then return whatever the loader returned do a
@@ -614,7 +630,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
.toLocalizedString(key));
}
break;
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
region.getCancelCriterion().checkCancelInProgress(null);
// continue;
@@ -871,7 +887,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
} finally {
if (event != pevent) {
if (event instanceof EntryEventImpl) {
- ((EntryEventImpl) event).release();
+ ((Releasable) event).release();
}
}
}
@@ -1005,7 +1021,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
this.remoteGetInProgress = true;
setSelectedNode(sender);
return; // sendValueRequest does the rest of the work
- } catch (RejectedExecutionException ex) {
+ } catch (RejectedExecutionException ignore) {
// just fall through since we must be shutting down.
}
}
@@ -1195,7 +1211,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
if (waitTimeMs <= 0) {
throw new TimeoutException(
LocalizedStrings.SearchLoadAndWriteProcessor_TIMED_OUT_WHILE_DOING_NETSEARCHNETLOADNETWRITE_PROCESSORID_0_KEY_IS_1
- .toLocalizedString(new Object[] {Integer.valueOf(this.processorId), this.key}));
+ .toLocalizedString(new Object[] {this.processorId, this.key}));
}
boolean interrupted = Thread.interrupted();
@@ -1229,14 +1245,14 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
sb.append(" msRemaining=").append(waitTimeMs);
}
if (lastNS != 0) {
- sb.append(" lastNotifySpot=" + lastNS);
+ sb.append(" lastNotifySpot=").append(lastNS);
}
throw new TimeoutException(
LocalizedStrings.SearchLoadAndWriteProcessor_TIMEOUT_DURING_NETSEARCHNETLOADNETWRITE_DETAILS_0
.toLocalizedString(sb));
}
return;
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
region.getCancelCriterion().checkCancelInProgress(null);
// keep waiting until we are done
@@ -1305,14 +1321,14 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
DiskRegion dr = rgn.getDiskRegion();
if (dr != null) {
dr.setClearCountReference();
- } ;
+ }
}
protected static void removeClearCountReference(LocalRegion rgn) {
DiskRegion dr = rgn.getDiskRegion();
if (dr != null) {
dr.removeClearCountReference();
- } ;
+ }
}
/**
@@ -1326,12 +1342,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
nMsg.doGet((DistributionManager) this.distributionManager);
}
- /*****************************************************************************
- * INNER CLASSES
- *****************************************************************************/
-
-
-
/**
* A QueryMessage is broadcast to every node that has the region defined, to find out who has a
* valid copy of the requested object.
@@ -1368,7 +1378,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
private static final short HAS_IDLE_TIME = (HAS_TTL << 1);
private static final short ALWAYS_SEND_RESULT = (HAS_IDLE_TIME << 1);
- public QueryMessage() {};
+ public QueryMessage() {
+ // do nothing
+ }
/**
* Using a new or pooled message instance, create and send the query to all nodes.
@@ -1492,8 +1504,8 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
try {
// check to see if we would have to wait on initialization latch (if global)
// if so abort and reply with null
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
- if (gfc.isGlobalRegionInitializing(this.regionName)) {
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+ if (cache.isGlobalRegionInitializing(this.regionName)) {
replyWithNull(dm);
if (logger.isDebugEnabled()) {
logger.debug("Global Region not initialized yet");
@@ -1512,31 +1524,28 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
if (entry != null) {
synchronized (entry) {
assert region.isInitialized();
- {
- if (dm.cacheTimeMillis() - startTime < timeoutMs) {
- o = region.getNoLRU(this.key, false, true, true); // OFFHEAP: incrc, copy bytes,
- // decrc
- if (o != null && !Token.isInvalid(o) && !Token.isRemoved(o)
- && !region.isExpiredWithRegardTo(this.key, this.ttl, this.idleTime)) {
- isPresent = true;
- VersionStamp stamp = entry.getVersionStamp();
- if (stamp != null && stamp.hasValidVersion()) {
- tag = stamp.asVersionTag();
- }
- long lastModified = entry.getLastModified();
- lastModifiedCacheTime = lastModified;
- isSer = o instanceof CachedDeserializable;
- if (isSer) {
- o = ((CachedDeserializable) o).getSerializedValue();
- }
- if (isPresent && (this.alwaysSendResult
- || (ObjectSizer.DEFAULT.sizeof(o) < SMALL_BLOB_SIZE))) {
- sendResult = true;
- }
+ if (dm.cacheTimeMillis() - startTime < timeoutMs) {
+ o = region.getNoLRU(this.key, false, true, true); // OFFHEAP: incrc, copy bytes,
+ // decrc
+ if (o != null && !Token.isInvalid(o) && !Token.isRemoved(o)
+ && !region.isExpiredWithRegardTo(this.key, this.ttl, this.idleTime)) {
+ isPresent = true;
+ VersionStamp stamp = entry.getVersionStamp();
+ if (stamp != null && stamp.hasValidVersion()) {
+ tag = stamp.asVersionTag();
+ }
+ lastModifiedCacheTime = entry.getLastModified();
+ isSer = o instanceof CachedDeserializable;
+ if (isSer) {
+ o = ((CachedDeserializable) o).getSerializedValue();
+ }
+ if (isPresent && (this.alwaysSendResult
+ || (ObjectSizer.DEFAULT.sizeof(o) < SMALL_BLOB_SIZE))) {
+ sendResult = true;
}
- } else {
- requestorTimedOut = true;
}
+ } else {
+ requestorTimedOut = true;
}
}
} else if (logger.isDebugEnabled()) {
@@ -1549,10 +1558,10 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
ResponseMessage.sendMessage(this.key, this.getSender(), processorId,
(sendResult ? o : null), lastModifiedCacheTime, isPresent, isSer, requestorTimedOut, dm,
tag);
- } catch (RegionDestroyedException rde) {
+ } catch (RegionDestroyedException ignore) {
logger.debug("Region Destroyed Exception in QueryMessage doGet, null");
replyWithNull(dm);
- } catch (CancelException cce) {
+ } catch (CancelException ignore) {
logger.debug("CacheClosedException in QueryMessage doGet, null");
replyWithNull(dm);
} catch (VirtualMachineError err) {
@@ -1577,14 +1586,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
private void replyWithNull(DistributionManager dm) {
ResponseMessage.sendMessage(this.key, this.getSender(), processorId, null, 0, false, false,
false, dm, null);
-
}
-
}
- /********************* ResponseMessage ***************************************/
-
-
/**
* The ResponseMessage is a reply to a QueryMessage, and contains the object's value, if it is
* below the byte limit, otherwise an indication of whether the sender has the value.
@@ -1605,7 +1609,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
/** is the value present */
private boolean isPresent;
-
/** Is blob serialized? */
private boolean isSerialized;
@@ -1865,11 +1868,10 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
// bytes, decrc
if (eov != null) {
if (eov == Token.INVALID || eov == Token.LOCAL_INVALID) {
- // ebv = null; (redundant assignment)
+ // nothing?
} else if (dm.cacheTimeMillis() - startTime < timeoutMs) {
if (!region.isExpiredWithRegardTo(this.key, this.ttl, this.idleTime)) {
- long lastModified = entry.getLastModified();
- lastModifiedCacheTime = lastModified;
+ lastModifiedCacheTime = entry.getLastModified();
if (eov instanceof CachedDeserializable) {
CachedDeserializable cd = (CachedDeserializable) eov;
if (!cd.isSerialized()) {
@@ -1911,10 +1913,10 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
NetSearchReplyMessage.sendMessage(NetSearchRequestMessage.this.getSender(), processorId,
this.key, ebv, ebvObj, ebvLen, lastModifiedCacheTime, isSer, requestorTimedOut,
authoritative, dm, versionTag);
- } catch (RegionDestroyedException rde) {
+ } catch (RegionDestroyedException ignore) {
replyWithNull(dm);
- } catch (CancelException cce) {
+ } catch (CancelException ignore) {
replyWithNull(dm);
} catch (VirtualMachineError err) {
@@ -1940,13 +1942,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
private void replyWithNull(DistributionManager dm) {
NetSearchReplyMessage.sendMessage(NetSearchRequestMessage.this.getSender(), processorId,
this.key, null, null, 0, 0, false, false, false, dm, null);
-
}
-
}
- /********************* NetSearchReplyMessage ***************************************/
-
/**
* The NetSearchReplyMessage is a reply to a NetSearchRequestMessage, and contains the object's
* value.
@@ -1961,8 +1959,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
/** The gemfire id of the SearchLoadAndWrite object waiting for response */
private int processorId;
-
-
/** The object value being transferred */
private byte[] value;
@@ -2150,7 +2146,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
try {
processor.distributionManager.putOutgoingUserData(msg);
- } catch (NotSerializableException e) {
+ } catch (NotSerializableException ignore) {
throw new IllegalArgumentException(
LocalizedStrings.SearchLoadAndWriteProcessor_MESSAGE_NOT_SERIALIZABLE
.toLocalizedString());
@@ -2210,13 +2206,11 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
+ "\" in region \"" + this.regionName + "\", processorId " + processorId;
}
-
-
private void doLoad(DistributionManager dm) {
long startTime = dm.cacheTimeMillis();
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
LocalRegion region = (LocalRegion) gfc.getRegion(this.regionName);
if (region != null && region.isInitialized()
&& (dm.cacheTimeMillis() - startTime < timeoutMs)) {
@@ -2282,16 +2276,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
void replyWithException(Exception e, DistributionManager dm) {
NetLoadReplyMessage.sendMessage(NetLoadRequestMessage.this.getSender(), processorId, null, dm,
this.aCallbackArgument, e, false, false);
-
}
-
-
}
-
-
- /********************* NetLoadReplyMessage ***************************************/
-
/**
* The NetLoadReplyMessage is a reply to a RequestMessage, and contains the object's value.
*/
@@ -2303,7 +2290,6 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
/** The object value being transferred */
private Object result;
-
/** Loader parameter returned to sender */
private Object aCallbackArgument;
@@ -2481,7 +2467,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
long startTime = dm.cacheTimeMillis();
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
LocalRegion region = (LocalRegion) gfc.getRegion(this.regionName);
if (region != null && region.isInitialized()
&& (dm.cacheTimeMillis() - startTime < timeoutMs)) {
@@ -2560,7 +2546,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
true);
}
- } catch (RegionDestroyedException rde) {
+ } catch (RegionDestroyedException ignore) {
NetWriteReplyMessage.sendMessage(NetWriteRequestMessage.this.getSender(), processorId, dm,
false, null, false);
@@ -2594,16 +2580,9 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
} finally {
LocalRegion.setThreadInitLevelRequirement(oldLevel);
}
-
-
-
}
-
-
}
- /********************* NetWriteReplyMessage *********************************/
-
/**
* The NetWriteReplyMessage is a reply to a NetWriteRequestMessage, and contains the success code
* or exception that is propagated back to the requestor
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
index aa37880..7f28d5a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
@@ -56,7 +56,7 @@ public class ServerPingMessage extends PooledDistributionMessage {
*
* @return true if all the recipients are pingable
*/
- public static boolean send(GemFireCacheImpl cache, Set<InternalDistributedMember> recipients) {
+ public static boolean send(InternalCache cache, Set<InternalDistributedMember> recipients) {
InternalDistributedSystem ids = cache.getInternalDistributedSystem();
DM dm = ids.getDistributionManager();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index eb93b76..c745754 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.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.internal.cache;
import java.io.DataInput;
@@ -100,18 +99,16 @@ public class StateFlushOperation {
private DM dm;
-
/** flush current ops to the given members for the given region */
public static void flushTo(Set<InternalDistributedMember> targets, DistributedRegion region) {
DM dm = region.getDistributionManager();
- DistributedRegion r = region;
- boolean initialized = r.isInitialized();
+ boolean initialized = region.isInitialized();
if (initialized) {
- r.getDistributionAdvisor().forceNewMembershipVersion(); // force a new "view" so we can track
- // current ops
+ // force a new "view" so we can track current ops
+ region.getDistributionAdvisor().forceNewMembershipVersion();
try {
- r.getDistributionAdvisor().waitForCurrentOperations();
- } catch (RegionDestroyedException e) {
+ region.getDistributionAdvisor().waitForCurrentOperations();
+ } catch (RegionDestroyedException ignore) {
return;
}
}
@@ -137,14 +134,14 @@ public class StateFlushOperation {
processors.add(processor);
}
- if (r.getRegionMap().getARMLockTestHook() != null) {
- r.getRegionMap().getARMLockTestHook().beforeStateFlushWait();
+ if (region.getRegionMap().getARMLockTestHook() != null) {
+ region.getRegionMap().getARMLockTestHook().beforeStateFlushWait();
}
for (ReplyProcessor21 processor : processors) {
try {
processor.waitForReplies();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
return;
}
@@ -319,7 +316,7 @@ public class StateFlushOperation {
// 36175)
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
Region r = gfc.getRegionByPathForProcessing(this.regionPath);
if (r instanceof DistributedRegion) {
region = (DistributedRegion) r;
@@ -336,9 +333,9 @@ public class StateFlushOperation {
// 36175)
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
Set<DistributedRegion> result = new HashSet();
- for (LocalRegion r : gfc.getAllRegions()) {
+ for (LocalRegion r : cache.getAllRegions()) {
// it's important not to check if the cache is closing, so access
// the isDestroyed boolean directly
if (r instanceof DistributedRegion && !r.isDestroyed) {
@@ -400,7 +397,7 @@ public class StateFlushOperation {
}
try {
r.getDistributionAdvisor().waitForCurrentOperations();
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// continue with the next region
}
}
@@ -422,7 +419,7 @@ public class StateFlushOperation {
}
}
}
- } catch (CancelException cce) {
+ } catch (CancelException ignore) {
// cache is closed - no distribution advisor available for the region so nothing to do but
// send the stabilization message
} catch (Exception e) {
@@ -530,7 +527,7 @@ public class StateFlushOperation {
return "unknown channelState content";
} else {
Map csmap = (Map) state;
- StringBuffer result = new StringBuffer(200);
+ StringBuilder result = new StringBuilder(200);
for (Iterator it = csmap.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
result.append(entry.getKey()).append('=').append(entry.getValue());
@@ -565,7 +562,7 @@ public class StateFlushOperation {
try {
dm.getMembershipManager().waitForMessageState(getSender(), channelState);
break;
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -697,7 +694,7 @@ public class StateFlushOperation {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("StateStabilizedMessage ");
sb.append(this.processorId);
if (super.getSender() != null) {
[02/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/IndexManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/IndexManagerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/IndexManagerJUnitTest.java
index 929bd46..da439f0 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/IndexManagerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/IndexManagerJUnitTest.java
@@ -12,8 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- */
package org.apache.geode.cache.query.internal;
import static org.junit.Assert.assertFalse;
@@ -42,18 +40,16 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
public class IndexManagerJUnitTest {
@Before
- public void setUp() throws java.lang.Exception {
+ public void setUp() throws Exception {
CacheUtils.startCache();
Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
for (int i = 0; i < 4; i++) {
region.put("" + i, new Portfolio(i));
- // CacheUtils.log(new Portfolio(i));
}
-
}
@After
- public void tearDown() throws java.lang.Exception {
+ public void tearDown() throws Exception {
CacheUtils.closeCache();
}
@@ -66,7 +62,7 @@ public class IndexManagerJUnitTest {
* start time, we can assume that it needs to be reevaluated
*/
@Test
- public void testSafeQueryTime() {
+ public void testSafeQueryTime() throws Exception {
IndexManager.resetIndexBufferTime();
// fake entry update at LMT of 0 and actual time of 10
// safe query time set in index manager is going to be 20
@@ -103,7 +99,7 @@ public class IndexManagerJUnitTest {
// Let's test for negative delta's or a system that is slower than others in the cluster
@Test
- public void testSafeQueryTimeForASlowNode() {
+ public void testSafeQueryTimeForASlowNode() throws Exception {
IndexManager.resetIndexBufferTime();
// fake entry update at LMT of 0 and actual time of 10
// safe query time set in index manager is going to be -10
@@ -130,7 +126,6 @@ public class IndexManagerJUnitTest {
assertFalse(IndexManager.needsRecalculation(212, 210));
}
-
@Test
public void testBestIndexPick() throws Exception {
QueryService qs;
@@ -140,7 +135,7 @@ public class IndexManagerJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolios pf");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
Iterator iter = list.iterator();
while (iter.hasNext()) {
@@ -171,7 +166,6 @@ public class IndexManagerJUnitTest {
Assert.assertEquals(id2.getMapping()[0], 1);
Assert.assertEquals(id2.getMapping()[1], 2);
Assert.assertEquals(id2.getMapping()[2], 0);
-
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryFromClauseCanonicalizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryFromClauseCanonicalizationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryFromClauseCanonicalizationJUnitTest.java
index e625afe..c18e8cb 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryFromClauseCanonicalizationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryFromClauseCanonicalizationJUnitTest.java
@@ -162,7 +162,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
List list = compiler.compileFromClause("/pos pf");
ExecutionContext context =
new ExecutionContext(new Object[] {"bindkey"}, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
Iterator iter = list.iterator();
while (iter.hasNext()) {
@@ -177,7 +177,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
List args = new ArrayList();
args.add(cl);
CompiledOperation cop = new CompiledOperation(cp, "get", args);
- StringBuffer sbuff = new StringBuffer();
+ StringBuilder sbuff = new StringBuilder();
cop.generateCanonicalizedExpression(sbuff, context);
assertEquals(sbuff.toString(), "iter1.positions.get('key1')");
@@ -187,7 +187,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
// args.add(cb);
// cop = new CompiledOperation(cp, "get", args);
//// context.setBindArguments(new Object[]{"bindkey"});
- // sbuff = new StringBuffer();
+ // sbuff = new StringBuilder();
// cop.generateCanonicalizedExpression(sbuff, context);
// assertIndexDetailsEquals(sbuff.toString(),"iter1.positions.get('bindkey')");
//
@@ -197,7 +197,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
// args = new ArrayList();
// args.add(cb);
// cop = new CompiledOperation(cp, "get", args);
- // sbuff = new StringBuffer();
+ // sbuff = new StringBuilder();
// cop.generateCanonicalizedExpression(sbuff, context);
// assertIndexDetailsEquals(sbuff.toString(),"iter1.positions().get('bindkey')");
//
@@ -207,7 +207,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
// args = new ArrayList();
// args.add(cb);
// cop = new CompiledOperation(cp, "get", args);
- // sbuff = new StringBuffer();
+ // sbuff = new StringBuilder();
// cop.generateCanonicalizedExpression(sbuff, context);
// assertIndexDetailsEquals(sbuff.toString(),"iter1.positions.get('bindkey')");
@@ -216,7 +216,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
args = new ArrayList();
args.add(cp1);
cop = new CompiledOperation(cp, "get", args);
- sbuff = new StringBuffer();
+ sbuff = new StringBuilder();
cop.generateCanonicalizedExpression(sbuff, context);
assertEquals(sbuff.toString(), "iter1.positions.get(iter1.pkid)");
@@ -224,7 +224,7 @@ public class QueryFromClauseCanonicalizationJUnitTest {
cp = new CompiledPath(new CompiledID("pf"), "getPositions");
cp1 = new CompiledPath(new CompiledID("pf"), "pkid");
CompiledIndexOperation ciop = new CompiledIndexOperation(cp, cp1);
- sbuff = new StringBuffer();
+ sbuff = new StringBuilder();
ciop.generateCanonicalizedExpression(sbuff, context);
assertEquals(sbuff.toString(), "iter1.positions[iter1.pkid]");
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
index bb13665..bda8338 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
@@ -91,7 +91,7 @@ public class QueryUtilsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new ExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
RuntimeIterator[] indexToItrMappping = new RuntimeIterator[1];
RuntimeIterator expand = null;
boolean set = false;
@@ -162,7 +162,7 @@ public class QueryUtilsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions, /employees e");
ExecutionContext context = new ExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
RuntimeIterator[] indexToItrMappping = new RuntimeIterator[1];
RuntimeIterator expand[] = new RuntimeIterator[2];
boolean set = false;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java
index 302a633..67ab9a4 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.cache.query.internal.index;
import static org.junit.Assert.assertEquals;
@@ -52,15 +49,13 @@ import org.apache.geode.cache.query.internal.RuntimeIterator;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.test.junit.categories.IntegrationTest;
-/**
- *
- */
@Category(IntegrationTest.class)
public class RangeIndexAPIJUnitTest {
+
private Region region = null;
@Before
- public void setUp() throws java.lang.Exception {
+ public void setUp() throws Exception {
CacheUtils.startCache();
IndexManager.ENABLE_UPDATE_IN_PROGRESS_INDEX_CALCULATION = false;
region = CacheUtils.createRegion("portfolios", Portfolio.class);
@@ -77,7 +72,7 @@ public class RangeIndexAPIJUnitTest {
}
@After
- public void tearDown() throws java.lang.Exception {
+ public void tearDown() throws Exception {
IndexManager.ENABLE_UPDATE_IN_PROGRESS_INDEX_CALCULATION = true;
CacheUtils.closeCache();
}
@@ -132,8 +127,6 @@ public class RangeIndexAPIJUnitTest {
* of RangeJunctionCondnEvaluator. Such null or undefined conditions are treated as separate
* filter operands. This test checks the query method of Index which takes a set of keys which
* need to be removed from the set
- *
- * @throws Exception
*/
@Test
public void testQueryMethod_2() throws Exception {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
index 2f372bc..63a7ba7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
@@ -92,7 +92,7 @@ public class AbstractRegionEntryTest {
}
@Override
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return 0;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
index be1df18..1fba56d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
@@ -45,6 +45,7 @@ import org.apache.geode.cache.query.QueryInvocationTargetException;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.TypeMismatchException;
import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.extension.ExtensionPoint;
import org.apache.geode.internal.cache.extension.SimpleExtensionPoint;
@@ -78,7 +79,7 @@ public class AbstractRegionJUnitTest {
private static class MockRegion extends AbstractRegion {
/**
- * @see AbstractRegion#AbstractRegion(GemFireCacheImpl, int, boolean, long, long)
+ * @see AbstractRegion#AbstractRegion(InternalCache, int, boolean, long, long)
*/
@SuppressWarnings("deprecation")
private MockRegion(GemFireCacheImpl cache, int serialNumber, boolean isPdxTypeRegion,
@@ -479,7 +480,7 @@ public class AbstractRegionJUnitTest {
}
@Override
- protected DistributedMember getMyId() {
+ protected InternalDistributedMember getMyId() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
index 5d81724..caa2ce5 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
@@ -14,14 +14,11 @@
*/
package org.apache.geode.internal.cache;
-import static junit.framework.TestCase.assertNotNull;
import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
@@ -58,20 +55,15 @@ import java.util.Collections;
import java.util.Properties;
import java.util.Random;
-/**
- *
- */
@Category(IntegrationTest.class)
public class BackupJUnitTest {
- protected static GemFireCacheImpl cache = null;
- protected static File TMP_DIR;
- protected static File cacheXmlFile;
- protected static DistributedSystem ds = null;
- protected static Properties props = new Properties();
+ protected GemFireCacheImpl cache = null;
+ private File tmpDir;
+ protected File cacheXmlFile;
- static {
- }
+ protected DistributedSystem ds = null;
+ protected Properties props = new Properties();
private File backupDir;
private File[] diskDirs;
@@ -83,11 +75,11 @@ public class BackupJUnitTest {
@Before
public void setUp() throws Exception {
- if (TMP_DIR == null) {
+ if (tmpDir == null) {
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
String tmpDirName = System.getProperty("java.io.tmpdir");
- TMP_DIR = tmpDirName == null ? new File("") : new File(tmpDirName);
+ tmpDir = new File(tmpDirName == null ? "" : tmpDirName);
try {
URL url = BackupJUnitTest.class.getResource("BackupJUnitTest.cache.xml");
cacheXmlFile = new File(url.toURI().getPath());
@@ -100,12 +92,12 @@ public class BackupJUnitTest {
createCache();
- backupDir = new File(TMP_DIR, getName() + "backup_Dir");
+ backupDir = new File(tmpDir, getName() + "backup_Dir");
backupDir.mkdir();
diskDirs = new File[2];
- diskDirs[0] = new File(TMP_DIR, getName() + "_diskDir1");
+ diskDirs[0] = new File(tmpDir, getName() + "_diskDir1");
diskDirs[0].mkdir();
- diskDirs[1] = new File(TMP_DIR, getName() + "_diskDir2");
+ diskDirs[1] = new File(tmpDir, getName() + "_diskDir2");
diskDirs[1].mkdir();
}
@@ -134,8 +126,7 @@ public class BackupJUnitTest {
backupAndRecover(new RegionCreator() {
public Region createRegion() {
DiskStoreImpl ds = createDiskStore();
- Region region = BackupJUnitTest.this.createRegion();
- return region;
+ return BackupJUnitTest.this.createRegion();
}
});
}
@@ -151,8 +142,7 @@ public class BackupJUnitTest {
DiskWriteAttributesFactory daf = new DiskWriteAttributesFactory();
daf.setMaxOplogSize(1);
rf.setDiskWriteAttributes(daf.create());
- Region region = rf.create("region");
- return region;
+ return rf.create("region");
}
});
}
@@ -189,7 +179,7 @@ public class BackupJUnitTest {
// restore the deleted entry.
region.put(2047, getBytes(2047));
- for (DiskStoreImpl store : cache.listDiskStoresIncludingRegionOwned()) {
+ for (DiskStore store : cache.listDiskStoresIncludingRegionOwned()) {
store.flush();
}
@@ -400,7 +390,7 @@ public class BackupJUnitTest {
while ((line = br.readLine()) != null) {
System.out.println("OUTPUT:" + line);
// TODO validate output
- } ;
+ }
int result = process.waitFor();
boolean isWindows = script.getName().endsWith("bat");
@@ -420,8 +410,7 @@ public class BackupJUnitTest {
RegionFactory rf = new RegionFactory();
rf.setDiskStoreName("diskStore");
rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
- Region region = rf.create("region");
- return region;
+ return rf.create("region");
}
private Region createOverflowRegion() {
@@ -430,12 +419,11 @@ public class BackupJUnitTest {
rf.setEvictionAttributes(
EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK));
rf.setDataPolicy(DataPolicy.NORMAL);
- Region region = rf.create("region");
- return region;
+ return rf.create("region");
}
private DiskStore findDiskStore() {
- return this.cache.findDiskStore("diskStore");
+ return cache.findDiskStore("diskStore");
}
private DiskStoreImpl createDiskStore() {
@@ -443,12 +431,11 @@ public class BackupJUnitTest {
dsf.setDiskDirs(diskDirs);
dsf.setMaxOplogSize(1);
String name = "diskStore";
- DiskStoreImpl ds = (DiskStoreImpl) dsf.create(name);
- return ds;
+ return (DiskStoreImpl) dsf.create(name);
}
- private static interface RegionCreator {
- public Region createRegion();
+ private interface RegionCreator {
+ Region createRegion();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
index 02eaf06..995de03 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
@@ -41,23 +41,19 @@ public class CacheLifecycleListenerJUnitTest {
@Test
public void testRemoveNonExistent() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final TestCacheLifecycleListener listener =
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
GemFireCacheImpl.removeCacheLifecycleListener(listener);
}
@Test
public void testCallbacks() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
- final TestCacheLifecycleListener listener =
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
try {
GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -67,11 +63,11 @@ public class CacheLifecycleListenerJUnitTest {
// assert no close callback
assertTrue(cacheClosedCallbacks.isEmpty());
- final Properties props = new Properties();
+ Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache = (InternalCache) new CacheFactory(props).create();
try {
// assert one create callback
assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -98,12 +94,10 @@ public class CacheLifecycleListenerJUnitTest {
@Test
public void testRemoveBeforeCreate() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
- final TestCacheLifecycleListener listener =
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
try {
GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -114,11 +108,11 @@ public class CacheLifecycleListenerJUnitTest {
// assert no close callback
assertTrue(cacheClosedCallbacks.isEmpty());
- final Properties props = new Properties();
+ Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache = (InternalCache) new CacheFactory(props).create();
try {
// assert no create callback
assertTrue(cacheCreatedCallbacks.isEmpty());
@@ -139,12 +133,10 @@ public class CacheLifecycleListenerJUnitTest {
@Test
public void testRemoveBeforeClose() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
- final TestCacheLifecycleListener listener =
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
try {
GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -154,11 +146,11 @@ public class CacheLifecycleListenerJUnitTest {
// assert no close callback
assertTrue(cacheClosedCallbacks.isEmpty());
- final Properties props = new Properties();
+ Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache = (InternalCache) new CacheFactory(props).create();
try {
// assert one create callback
assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -184,12 +176,10 @@ public class CacheLifecycleListenerJUnitTest {
@Test
public void testCallbacksRepeat() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
- final TestCacheLifecycleListener listener =
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
try {
GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -199,11 +189,11 @@ public class CacheLifecycleListenerJUnitTest {
// assert no close callback
assertTrue(cacheClosedCallbacks.isEmpty());
- final Properties props = new Properties();
+ Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- final GemFireCacheImpl cache1 = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache1 = (InternalCache) new CacheFactory(props).create();
try {
// assert one create callback
assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -224,7 +214,7 @@ public class CacheLifecycleListenerJUnitTest {
assertEquals(1, cacheClosedCallbacks.size());
assertEquals(cache1, cacheClosedCallbacks.get(0).getCache());
- final GemFireCacheImpl cache2 = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache2 = (InternalCache) new CacheFactory(props).create();
try {
// assert two create callback
assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -256,23 +246,21 @@ public class CacheLifecycleListenerJUnitTest {
@Test
public void testAddAfterCreate() throws Exception {
- final List<CacheLifecycleCallback> cacheCreatedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
- final List<CacheLifecycleCallback> cacheClosedCallbacks =
- new ArrayList<CacheLifecycleCallback>();
+ List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+ List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
- final TestCacheLifecycleListener listener =
+ TestCacheLifecycleListener listener =
new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
// assert no create callback
assertTrue(cacheCreatedCallbacks.isEmpty());
// assert no close callback
assertTrue(cacheClosedCallbacks.isEmpty());
- final Properties props = new Properties();
+ Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+ InternalCache cache = (InternalCache) new CacheFactory(props).create();
try {
try {
// assert no create callback
@@ -296,25 +284,23 @@ public class CacheLifecycleListenerJUnitTest {
}
}
- private static final class CacheLifecycleCallback {
+ private static class CacheLifecycleCallback {
- private final GemFireCacheImpl cache;
- private final long timeStamp;
+ private InternalCache cache;
- CacheLifecycleCallback(GemFireCacheImpl cache) {
+ CacheLifecycleCallback(InternalCache cache) {
this.cache = cache;
- this.timeStamp = System.currentTimeMillis();
}
- GemFireCacheImpl getCache() {
+ InternalCache getCache() {
return this.cache;
}
}
- private static final class TestCacheLifecycleListener implements CacheLifecycleListener {
+ private static class TestCacheLifecycleListener implements CacheLifecycleListener {
- private final List<CacheLifecycleCallback> cacheCreatedCallbacks;
- private final List<CacheLifecycleCallback> cacheClosedCallbacks;
+ private List<CacheLifecycleCallback> cacheCreatedCallbacks;
+ private List<CacheLifecycleCallback> cacheClosedCallbacks;
TestCacheLifecycleListener(List<CacheLifecycleCallback> cacheCreatedCallbacks,
List<CacheLifecycleCallback> cacheClosedCallbacks) {
@@ -323,12 +309,12 @@ public class CacheLifecycleListenerJUnitTest {
}
@Override
- public void cacheCreated(GemFireCacheImpl cache) {
+ public void cacheCreated(InternalCache cache) {
this.cacheCreatedCallbacks.add(new CacheLifecycleCallback(cache));
}
@Override
- public void cacheClosed(GemFireCacheImpl cache) {
+ public void cacheClosed(InternalCache cache) {
this.cacheClosedCallbacks.add(new CacheLifecycleCallback(cache));
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
index 5333726..913d56d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- * DiskRegionTestingBase: This class is extended to write more JUnit tests for Disk Regions.
- */
package org.apache.geode.internal.cache;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_TIME_STATISTICS;
@@ -51,6 +48,8 @@ import java.util.Iterator;
import java.util.Properties;
/**
+ * DiskRegionTestingBase: This class is extended to write more JUnit tests for Disk Regions.
+ * <p>
* All disk region unit tests extend this base class , common method to be used in all tests are
* present here.
*
@@ -144,14 +143,14 @@ public abstract class DiskRegionTestingBase {
root.localDestroyRegion("teardown");
logWriter.info(
"<ExpectedException action=remove>RegionDestroyedException</ExpectedException>");
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// ignore
}
}
}
- for (DiskStoreImpl dstore : ((GemFireCacheImpl) cache).listDiskStoresIncludingRegionOwned()) {
- dstore.waitForClose();
+ for (DiskStore dstore : ((InternalCache) cache).listDiskStoresIncludingRegionOwned()) {
+ ((DiskStoreImpl) dstore).waitForClose();
}
} finally {
closeCache();
@@ -216,7 +215,7 @@ public abstract class DiskRegionTestingBase {
ioe = e;
try {
Thread.sleep(1000);
- } catch (Exception igore) {
+ } catch (Exception ignore) {
}
}
}
@@ -253,7 +252,7 @@ public abstract class DiskRegionTestingBase {
*/
protected void put100Int() {
for (int i = 0; i < 100; i++) {
- region.put(new Integer(i), new Integer(i));
+ region.put(i, i);
}
}
@@ -266,7 +265,7 @@ public abstract class DiskRegionTestingBase {
assertEquals(100, region.size());
}
for (int i = 0; i < 100; i++) {
- Integer key = new Integer(i);
+ Integer key = i;
assertTrue(region.containsKey(key));
assertEquals(key, region.get(key));
}
@@ -278,7 +277,7 @@ public abstract class DiskRegionTestingBase {
protected void putTillOverFlow(Region region) {
int i = 0;
for (i = 0; i < 1010; i++) {
- region.put(new Integer(i + 200), new Integer(i + 200));
+ region.put(i + 200, i + 200);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
index 0dbe75f..ee3d7f7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
@@ -14,31 +14,29 @@
*/
package org.apache.geode.internal.cache;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.file.Files;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import org.apache.geode.internal.ClassPathLoader;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.RegexFileFilter;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import org.apache.geode.admin.AdminDistributedSystem;
import org.apache.geode.admin.AdminDistributedSystemFactory;
import org.apache.geode.admin.AdminException;
@@ -47,6 +45,7 @@ import org.apache.geode.admin.DistributedSystemConfig;
import org.apache.geode.admin.internal.AdminDistributedSystemImpl;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.RegionShortcut;
@@ -54,8 +53,8 @@ import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.internal.ClassBuilder;
+import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.DeployedJar;
-import org.apache.geode.internal.JarDeployer;
import org.apache.geode.internal.cache.persistence.BackupManager;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.internal.util.TransformUtils;
@@ -68,22 +67,6 @@ import org.apache.geode.test.dunit.Wait;
import org.apache.geode.test.dunit.WaitCriterion;
import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
/**
* Tests for the incremental backup feature.
@@ -104,12 +87,12 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/**
* End value for data load.
*/
- private int dataEnd = dataStart + DATA_INCREMENT;
+ private int dataEnd = this.dataStart + DATA_INCREMENT;
/**
* Regular expression used to search for member operation log files.
*/
- private final static String OPLOG_REGEX = ".*\\.[kdc]rf$";
+ private static final String OPLOG_REGEX = ".*\\.[kdc]rf$";
/**
* Creates test regions for a member.
@@ -123,22 +106,18 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
getRegionFactory(cache).setDiskStoreName("fooStore").create("fooRegion");
getRegionFactory(cache).setDiskStoreName("barStore").create("barRegion");
}
-
};
- protected RegionFactory<Integer, String> getRegionFactory(Cache cache) {
+ private RegionFactory<Integer, String> getRegionFactory(Cache cache) {
return cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT);
}
/**
* A FileFilter that looks for a timestamped gemfire backup directory.
*/
- private final static FileFilter backupDirFilter = new FileFilter() {
- @Override
- public boolean accept(File file) {
- // This will break in about 90 years...
- return (file.isDirectory() && file.getName().startsWith("20"));
- }
+ private static final FileFilter backupDirFilter = file -> {
+ // This will break in about 90 years...
+ return file.isDirectory() && file.getName().startsWith("20");
};
/**
@@ -213,7 +192,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
@SuppressWarnings("unchecked")
private Set<PersistentID> getMissingMembers(VM vm) {
return (Set<PersistentID>) vm.invoke(new SerializableCallable("getMissingMembers") {
-
+ @Override
public Object call() {
return AdminDistributedSystemImpl
.getMissingPersistentMembers(getSystem().getDistributionManager());
@@ -229,7 +208,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
*/
private BackupStatus baseline(VM vm) {
return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+ @Override
public Object call() {
DistributedSystemConfig config;
AdminDistributedSystem adminDS = null;
@@ -258,7 +237,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
*/
private BackupStatus incremental(VM vm) {
return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+ @Override
public Object call() {
DistributedSystemConfig config;
AdminDistributedSystem adminDS = null;
@@ -287,7 +266,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
*/
private BackupStatus incremental2(VM vm) {
return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+ @Override
public Object call() {
DistributedSystemConfig config;
AdminDistributedSystem adminDS = null;
@@ -343,23 +322,17 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
* @return a PersistentID for a member's disk store.
*/
private PersistentID getPersistentID(final VM vm, final String diskStoreName) {
- final PersistentID id = (PersistentID) vm.invoke(new SerializableCallable() {
- @Override
- public Object call() {
- PersistentID id = null;
- Collection<DiskStoreImpl> diskStores = ((GemFireCacheImpl) getCache()).listDiskStores();
- for (DiskStoreImpl diskStore : diskStores) {
- if (diskStore.getName().equals(diskStoreName)) {
- id = diskStore.getPersistentID();
- break;
- }
+ return vm.invoke(() -> {
+ PersistentID id = null;
+ Collection<DiskStore> diskStores = ((InternalCache) getCache()).listDiskStores();
+ for (DiskStore diskStore : diskStores) {
+ if (diskStore.getName().equals(diskStoreName)) {
+ id = ((DiskStoreImpl) diskStore).getPersistentID();
+ break;
}
-
- return id;
}
+ return id;
});
-
- return id;
}
/**
@@ -380,22 +353,19 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
* disconnected).
*/
private PersistentID disconnect(final VM disconnectVM, final VM testVM) {
- final PersistentID id = (PersistentID) disconnectVM.invoke(new SerializableCallable() {
- @Override
- public Object call() {
- PersistentID id = null;
- Collection<DiskStoreImpl> diskStores = ((GemFireCacheImpl) getCache()).listDiskStores();
- for (DiskStoreImpl diskStore : diskStores) {
- if (diskStore.getName().equals("fooStore")) {
- id = diskStore.getPersistentID();
- break;
- }
+ final PersistentID id = disconnectVM.invoke(() -> {
+ PersistentID persistentID = null;
+ Collection<DiskStore> diskStores = ((InternalCache) getCache()).listDiskStores();
+ for (DiskStore diskStore : diskStores) {
+ if (diskStore.getName().equals("fooStore")) {
+ persistentID = ((DiskStoreImpl) diskStore).getPersistentID();
+ break;
}
+ }
- getSystem().disconnect();
+ getSystem().disconnect();
- return id;
- }
+ return persistentID;
});
final Set<PersistentID> missingMembers = new HashSet<>();
@@ -405,7 +375,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
missingMembers.clear();
missingMembers.addAll(getMissingMembers(testVM));
- return (missingMembers.contains(id));
+ return missingMembers.contains(id);
}
@Override
@@ -423,7 +393,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
* @param vm a member of the distributed system.
*/
private void openCache(VM vm) {
- vm.invoke(createRegions);
+ vm.invoke(this.createRegions);
}
/**
@@ -435,15 +405,14 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
vm.invoke(new SerializableRunnable() {
@Override
public void run() {
- Collection<DiskStoreImpl> backupInProgress =
- ((GemFireCacheImpl) getCache()).listDiskStores();
+ Collection<DiskStore> backupInProgress = ((InternalCache) getCache()).listDiskStores();
List<DiskStoreImpl> backupCompleteList = new LinkedList<>();
while (backupCompleteList.size() < backupInProgress.size()) {
- for (DiskStoreImpl diskStore : backupInProgress) {
- if ((null == diskStore.getInProgressBackup())
- && (!backupCompleteList.contains(diskStore))) {
- backupCompleteList.add(diskStore);
+ for (DiskStore diskStore : backupInProgress) {
+ if (((DiskStoreImpl) diskStore).getInProgressBackup() == null
+ && !backupCompleteList.contains(diskStore)) {
+ backupCompleteList.add((DiskStoreImpl) diskStore);
}
}
}
@@ -470,9 +439,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
}
/**
- * Peforms a second incremental backup.
- *
- * @return
+ * Performs a second incremental backup.
*/
private BackupStatus performIncremental2() {
return incremental2(Host.getHost(0).getVM(1));
@@ -519,7 +486,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
File[] memberDirs = dateDirs[0].listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
- return (file.isDirectory() && (file.getName().contains(memberId)));
+ return file.isDirectory() && file.getName().contains(memberId);
}
});
@@ -546,9 +513,8 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
*
* @param command a shell command.
* @return the exit value of processing the shell command.
- * @throws Exception bad, really bad.
*/
- private int execute(String command) throws Exception {
+ private int execute(String command) throws IOException, InterruptedException {
final ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true);
final Process process = builder.start();
@@ -559,11 +525,11 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
new Thread(new Runnable() {
@Override
public void run() {
- BufferedReader reader = null;
try {
- reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
- String line = null;
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line;
do {
line = reader.readLine();
@@ -572,7 +538,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
reader.close();
} catch (IOException e) {
- log("Excecute: error while reading standard in: " + e.getMessage());
+ log("Execute: error while reading standard in: " + e.getMessage());
}
}
}).start();
@@ -583,11 +549,10 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
new Thread(new Runnable() {
@Override
public void run() {
- BufferedReader reader = null;
-
try {
- reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String line = null;
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ String line;
do {
line = reader.readLine();
@@ -608,7 +573,8 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
*
* @param backupDir the member's backup directory containing the restore script.
*/
- private void performRestore(File memberDir, File backupDir) throws Exception {
+ private void performRestore(File memberDir, File backupDir)
+ throws IOException, InterruptedException {
/*
* The restore script will not restore if there is an if file in the copy to directory. Remove
* these files first.
@@ -699,7 +665,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
@Override
public final void postSetUp() throws Exception {
createDataRegions();
- createRegions.run();
+ this.createRegions.run();
loadMoreData();
log("Data region created and populated.");
@@ -720,8 +686,6 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
* present in both the baseline and member's disk store should not be copied during the
* incremental backup. Additionally, the restore script should reference and copy operation logs
* from the baseline backup.
- *
- * @throws Exception
*/
@Test
public void testIncrementalBackup() throws Exception {
@@ -900,7 +864,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
public boolean done() {
missingMembers.clear();
missingMembers.addAll(getMissingMembers(Host.getHost(0).getVM(1)));
- return (!missingMembers.contains(missingMember));
+ return !missingMembers.contains(missingMember);
}
@Override
@@ -1028,13 +992,14 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
* Custom incremental backup callable that retrieves the current baseline before deletion.
*/
SerializableCallable callable = new SerializableCallable("Backup all members.") {
- private File baselineDir = getBaselineBackupDir();
+ private final File baselineDir = getBaselineBackupDir();
+ @Override
public Object call() {
- DistributedSystemConfig config;
AdminDistributedSystem adminDS = null;
try {
- config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
+ DistributedSystemConfig config =
+ AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
return adminDS.backupAllMembers(getIncrementalDir(), this.baselineDir);
@@ -1079,8 +1044,6 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/**
* Successful if a user deployed jar file is included as part of the backup.
- *
- * @throws Exception
*/
@Test
public void testBackupUserDeployedJarFiles() throws Exception {
@@ -1094,13 +1057,10 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/*
* Deploy a "dummy"�jar to the VM.
*/
- File deployedJarFile = (File) vm0.invoke(new SerializableCallable() {
- @Override
- public Object call() throws Exception {
- DeployedJar deployedJar =
- ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, classBytes);
- return deployedJar.getFile();
- }
+ File deployedJarFile = vm0.invoke(() -> {
+ DeployedJar deployedJar =
+ ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, classBytes);
+ return deployedJar.getFile();
});
assertTrue(deployedJarFile.exists());
@@ -1124,12 +1084,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/*
* Get the VM's user directory.
*/
- final String vmDir = (String) vm0.invoke(new SerializableCallable() {
- @Override
- public Object call() throws Exception {
- return System.getProperty("user.dir");
- }
- });
+ final String vmDir = vm0.invoke(() -> System.getProperty("user.dir"));
File backupDir = getBackupDirForMember(getBaselineDir(), getMemberId(vm0));
@@ -1138,7 +1093,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/*
* Cleanup "dummy" jar from file system.
*/
- Pattern pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
+ Pattern pattern = Pattern.compile('^' + jarName + ".*#\\d++$");
deleteMatching(new File("."), pattern);
// Execute the restore
@@ -1179,7 +1134,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/*
* Cleanup "dummy" jar from file system.
*/
- pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
+ pattern = Pattern.compile('^' + jarName + ".*#\\d++$");
deleteMatching(new File(vmDir), pattern);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
index 81e9794..4027680 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
@@ -148,7 +148,7 @@ public class PartitionedRegionCacheCloseDUnitTest extends PartitionedRegionDUnit
public void run2() {
- Cache cache = getCache();
+ InternalCache cache = (InternalCache) getCache();
LogWriter logger = cache.getLogger();
final Region root = PartitionedRegionHelper.getPRRoot(cache);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
index 9b8f400..692515e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
@@ -561,7 +561,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
registerPrRegion = new CacheSerializableRunnable("register") {
@Override
public void run2() throws CacheException {
- Cache cache = getCache();
+ InternalCache cache = (InternalCache) getCache();
Region root = PartitionedRegionHelper.getPRRoot(cache);
// Region allPartitionedRegions = PartitionedRegionHelper
// .getPRConfigRegion(root, cache);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
index c22c68d..a38a3d9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
@@ -195,7 +195,7 @@ public class PartitionedRegionDestroyDUnitTest extends PartitionedRegionDUnitTes
public void run2() throws CacheException {
- Cache cache = getCache();
+ InternalCache cache = getCache();
Region rootRegion = PartitionedRegionHelper.getPRRoot(cache);
// Region allPRs = PartitionedRegionHelper.getPRConfigRegion(rootRegion,
// getCache());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
index 9364390..0d69fa6 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
@@ -124,8 +124,8 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
private static final long serialVersionUID = 1L;
public void run() {
- Cache c = getCache();
- Region rootReg = PartitionedRegionHelper.getPRRoot(c);
+ InternalCache cache = (InternalCache) getCache();
+ Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
rootReg.getAttributesMutator()
.addCacheListener(new CertifiableTestCacheListener(LogWriterUtils.getLogWriter()));
}
@@ -144,8 +144,8 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
public void run() {
try {
- Cache c = getCache();
- Region rootReg = PartitionedRegionHelper.getPRRoot(c);
+ InternalCache cache = getCache();
+ Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
CacheListener[] cls = rootReg.getAttributes().getCacheListeners();
assertEquals(2, cls.length);
CertifiableTestCacheListener ctcl = (CertifiableTestCacheListener) cls[1];
@@ -256,7 +256,7 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
SerializableRunnable validator =
new CacheSerializableRunnable("validateNodeFailMetaDataCleanUp") {
public void run2() throws CacheException {
- Cache cache = getCache();
+ InternalCache cache = getCache();
Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
CacheListener[] cls = rootReg.getAttributes().getCacheListeners();
assertEquals(2, cls.length);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
index f19ba1c..169e270 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
@@ -153,7 +153,7 @@ public class PartitionedRegionQueryEvaluatorIntegrationTest {
}
private void clearAllPartitionedRegion(PartitionedRegion pr) {
- Cache cache = pr.getCache();
+ InternalCache cache = pr.getCache();
Region allPR = PartitionedRegionHelper.getPRRoot(cache);
allPR.clear();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
index 2824d74..18bc2a1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
@@ -37,7 +37,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
public class PartitionedRegionTestHelper
{
- static Cache cache = null;
+ static InternalCache cache = null;
/**
* This method creates a partitioned region with all the default values. The cache created is a
@@ -194,18 +194,18 @@ public class PartitionedRegionTestHelper
*
* @return
*/
- public static synchronized Cache createCache() {
+ public static synchronized InternalCache createCache() {
if (cache == null) {
Properties dsp = new Properties();
dsp.setProperty(MCAST_PORT, "0");
dsp.setProperty(LOCATORS, "");
DistributedSystem sys = DistributedSystem.connect(dsp);
try {
- cache = CacheFactory.create(sys);
+ cache = (InternalCache) CacheFactory.create(sys);
} catch (CacheExistsException exp) {
- cache = CacheFactory.getInstance(sys);
+ cache = (InternalCache) CacheFactory.getInstance(sys);
} catch (RegionExistsException rex) {
- cache = CacheFactory.getInstance(sys);
+ cache = (InternalCache) CacheFactory.getInstance(sys);
}
}
return cache;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
index 2e6225b..8eecaec 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
@@ -51,7 +51,7 @@ public class TXManagerImplTest {
@Before
public void setUp() {
- Cache cache = Fakes.cache();
+ InternalCache cache = Fakes.cache();
dm = mock(DistributionManager.class);
txMgr = new TXManagerImpl(mock(CachePerfStats.class), cache);
txid = new TXId(null, 0);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java
index b802b8e..2f0d138 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/BlockingHARegionJUnitTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.*;
import java.util.Properties;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.Before;
import org.junit.Ignore;
@@ -37,7 +38,7 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
@Category({IntegrationTest.class, ClientSubscriptionTest.class})
public class BlockingHARegionJUnitTest {
- private static Cache cache = null;
+ private static InternalCache cache = null;
/** boolean to record an exception occurence in another thread **/
private static volatile boolean exceptionOccured = false;
@@ -53,7 +54,7 @@ public class BlockingHARegionJUnitTest {
if (cache != null) {
cache.close(); // fault tolerance
}
- cache = CacheFactory.create(DistributedSystem.connect(props));
+ cache = (InternalCache) CacheFactory.create(DistributedSystem.connect(props));
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAExpiryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAExpiryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAExpiryDUnitTest.java
index e568896..3dda4c8 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAExpiryDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAExpiryDUnitTest.java
@@ -18,6 +18,7 @@ import static org.junit.Assert.*;
import java.util.Properties;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -65,7 +66,7 @@ public class HAExpiryDUnitTest extends JUnit4DistributedTestCase {
VM vm3 = null;
- protected static Cache cache = null;
+ protected static InternalCache cache = null;
static String regionQueueName = "regionQueue1";
@@ -227,7 +228,7 @@ public class HAExpiryDUnitTest extends JUnit4DistributedTestCase {
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
- cache = CacheFactory.create(ds);
+ cache = (InternalCache) CacheFactory.create(ds);
assertNotNull(cache);
}
@@ -242,7 +243,7 @@ public class HAExpiryDUnitTest extends JUnit4DistributedTestCase {
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
- CacheListener serverListener = new vmListener();
+ CacheListener serverListener = new VMListener();
factory.setCacheListener(serverListener);
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
@@ -255,24 +256,22 @@ public class HAExpiryDUnitTest extends JUnit4DistributedTestCase {
cache.getDistributedSystem().disconnect();
}
}
-}
-
-
-/**
- * This listener performs the put of Conflatable object in the regionqueue.
- */
-class vmListener extends CacheListenerAdapter {
- public void afterCreate(EntryEvent event) {
- Cache cache = event.getRegion().getCache();
- HARegion regionForQueue = (HARegion) cache.getRegion(
- Region.SEPARATOR + HARegionQueue.createRegionName(HAExpiryDUnitTest.regionQueueName));
- HARegionQueue regionqueue = regionForQueue.getOwner();
- try {
- regionqueue.put(new ConflatableObject(event.getKey(), event.getNewValue(),
- new EventID(new byte[] {1}, 1, 1), false, "region1"));
- } catch (Exception e) {
- e.printStackTrace();
+ /**
+ * This listener performs the put of Conflatable object in the regionqueue.
+ */
+ static class VMListener extends CacheListenerAdapter {
+ public void afterCreate(EntryEvent event) {
+ Cache cache = event.getRegion().getCache();
+ HARegion regionForQueue = (HARegion) cache.getRegion(
+ Region.SEPARATOR + HARegionQueue.createRegionName(HAExpiryDUnitTest.regionQueueName));
+ HARegionQueue regionqueue = regionForQueue.getOwner();
+ try {
+ regionqueue.put(new ConflatableObject(event.getKey(), event.getNewValue(),
+ new EventID(new byte[] {1}, 1, 1), false, "region1"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAGIIBugDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAGIIBugDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAGIIBugDUnitTest.java
index 27777e1..c2e778e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAGIIBugDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAGIIBugDUnitTest.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.Ignore;
import org.junit.Test;
@@ -72,7 +73,7 @@ public class HAGIIBugDUnitTest extends JUnit4DistributedTestCase {
VM vm3 = null;
- protected static Cache cache = null;
+ protected static InternalCache cache = null;
static String regionQueueName = "regionQueue1";
@@ -135,7 +136,7 @@ public class HAGIIBugDUnitTest extends JUnit4DistributedTestCase {
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
- cache = CacheFactory.create(ds);
+ cache = (InternalCache) CacheFactory.create(ds);
assertNotNull(cache);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAHelper.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAHelper.java
index bff156d..0d67544 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAHelper.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HAHelper.java
@@ -17,15 +17,15 @@ package org.apache.geode.internal.cache.ha;
import java.util.Map;
import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.ha.HARegionQueue.MapWrapper;
/**
* Helper class to access the required functions of this package from outside the package.
*/
-
public class HAHelper {
public static String getRegionQueueName(String proxyId) {
- return HARegionQueue.createRegionName(proxyId.toString());
+ return HARegionQueue.createRegionName(proxyId);
}
public static HARegionQueue getRegionQueue(HARegion hr) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
index 5fb0295..470426e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
@@ -22,6 +22,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.ha.HARegionQueue.MapWrapper;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.apache.logging.log4j.Logger;
import org.junit.After;
@@ -54,7 +56,7 @@ public class HARQAddOperationJUnitTest {
private static final Logger logger = LogService.getLogger();
/** The cache instance */
- protected Cache cache = null;
+ protected InternalCache cache = null;
/** Logger for this test */
protected LogWriter logWriter = null;
@@ -92,8 +94,8 @@ public class HARQAddOperationJUnitTest {
/**
* Creates the cache instance for the test
*/
- private Cache createCache() throws CacheException {
- return new CacheFactory().set(MCAST_PORT, "0").create();
+ private InternalCache createCache() throws CacheException {
+ return (InternalCache) new CacheFactory().set(MCAST_PORT, "0").create();
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionDUnitTest.java
index e46782a..c73fa68 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionDUnitTest.java
@@ -18,6 +18,7 @@ import static org.junit.Assert.*;
import java.util.Properties;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -50,7 +51,7 @@ public class HARegionDUnitTest extends JUnit4DistributedTestCase {
VM vm1 = null;
- private static Cache cache = null;
+ private static InternalCache cache = null;
private static final String REGION_NAME = "HARegionDUnitTest_region";
/** constructor */
@@ -83,13 +84,13 @@ public class HARegionDUnitTest extends JUnit4DistributedTestCase {
* @return
* @throws Exception
*/
- private Cache createCache() throws Exception {
+ private InternalCache createCache() throws Exception {
Properties props = new Properties();
DistributedSystem ds = getSystem(props);
ds.disconnect();
ds = getSystem(props);
- Cache cache = null;
- cache = CacheFactory.create(ds);
+ InternalCache cache = null;
+ cache = (InternalCache) CacheFactory.create(ds);
if (cache == null) {
throw new Exception("CacheFactory.create() returned null ");
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java
index 14be90e..6ead4c1 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.Ignore;
import org.junit.Test;
@@ -59,7 +60,7 @@ public class HARegionQueueDUnitTest extends JUnit4DistributedTestCase {
private static volatile boolean toCnt = true;
private static volatile Thread createQueuesThread;
- private static Cache cache = null;
+ private static InternalCache cache = null;
private static HARegionQueue hrq = null;
private static Thread[] opThreads;
@@ -98,13 +99,13 @@ public class HARegionQueueDUnitTest extends JUnit4DistributedTestCase {
/**
* create cache
*/
- private Cache createCache() throws CacheException {
+ private InternalCache createCache() throws CacheException {
Properties props = new Properties();
DistributedSystem ds = getSystem(props);
ds.disconnect();
ds = getSystem(props);
- Cache cache = null;
- cache = CacheFactory.create(ds);
+ InternalCache cache = null;
+ cache = (InternalCache) CacheFactory.create(ds);
if (cache == null) {
throw new CacheException("CacheFactory.create() returned null ") {};
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
index 796b27f..ae91f68 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
import org.awaitility.Awaitility;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.junit.After;
import org.junit.Before;
@@ -63,7 +64,7 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
public class HARegionQueueJUnitTest {
/** The cache instance */
- protected Cache cache = null;
+ protected InternalCache cache = null;
/** Logger for this test */
protected LogWriter logger;
@@ -95,8 +96,8 @@ public class HARegionQueueJUnitTest {
/**
* Creates the cache instance for the test
*/
- private Cache createCache() throws CacheException {
- return new CacheFactory().set(MCAST_PORT, "0").create();
+ private InternalCache createCache() throws CacheException {
+ return (InternalCache) new CacheFactory().set(MCAST_PORT, "0").create();
}
/**
@@ -817,7 +818,7 @@ public class HARegionQueueJUnitTest {
*/
static class HARQTestClass extends HARegionQueue.TestOnlyHARegionQueue {
- public HARQTestClass(String REGION_NAME, Cache cache, HARegionQueueJUnitTest test)
+ public HARQTestClass(String REGION_NAME, InternalCache cache, HARegionQueueJUnitTest test)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
super(REGION_NAME, cache);
}
@@ -1544,7 +1545,7 @@ public class HARegionQueueJUnitTest {
props.put(LOG_LEVEL, "config");
// props.put("mcast-port","11111");
try {
- cache = CacheFactory.create(DistributedSystem.connect(props));
+ cache = (InternalCache) CacheFactory.create(DistributedSystem.connect(props));
} catch (Exception e1) {
throw new AssertionError("Test failed because of exception. Exception=", e1);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStartStopJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStartStopJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStartStopJUnitTest.java
index 3445b33..f7ee8eb 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStartStopJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStartStopJUnitTest.java
@@ -23,6 +23,7 @@ import org.apache.geode.cache.CacheFactory;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.RegionQueue;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.apache.geode.test.junit.categories.IntegrationTest;
@@ -48,11 +49,11 @@ public class HARegionQueueStartStopJUnitTest {
* @return the cache instance
* @throws CacheException - thrown if any exception occurs in cache creation
*/
- private Cache createCache() throws CacheException {
+ private InternalCache createCache() throws CacheException {
final Properties props = new Properties();
props.setProperty(LOCATORS, "");
props.setProperty(MCAST_PORT, "0");
- return CacheFactory.create(DistributedSystem.connect(props));
+ return (InternalCache) CacheFactory.create(DistributedSystem.connect(props));
}
/**
@@ -64,7 +65,7 @@ public class HARegionQueueStartStopJUnitTest {
* @throws CacheException
* @throws InterruptedException
*/
- private RegionQueue createHARegionQueue(String name, Cache cache)
+ private RegionQueue createHARegionQueue(String name, InternalCache cache)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
RegionQueue regionqueue = HARegionQueue.getHARegionQueueInstance(name, cache,
HARegionQueue.NON_BLOCKING_HA_QUEUE, false);
@@ -75,7 +76,7 @@ public class HARegionQueueStartStopJUnitTest {
public void testStartStop() {
try {
boolean exceptionOccured = false;
- Cache cache = createCache();
+ InternalCache cache = createCache();
createHARegionQueue("test", cache);
Assert.assertTrue(HARegionQueue.getDispatchedMessagesMapForTesting() != null);
HARegionQueue.stopHAServices();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStatsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStatsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStatsJUnitTest.java
index 49efed7..f7fe5de 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStatsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARegionQueueStatsJUnitTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache.ha;
import org.apache.geode.cache.*;
import org.apache.geode.internal.cache.Conflatable;
import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.apache.geode.test.junit.categories.IntegrationTest;
import org.junit.After;
@@ -39,7 +40,7 @@ import static org.junit.Assert.assertNotNull;
public class HARegionQueueStatsJUnitTest {
/** The cache instance */
- protected Cache cache = null;
+ protected InternalCache cache = null;
/**
* Create the cache in setup. Currently the HA related stats are active under fine logging only.
@@ -67,8 +68,8 @@ public class HARegionQueueStatsJUnitTest {
* @return the cache instance
* @throws CacheException - thrown if any exception occurs in cache creation
*/
- private Cache createCache() throws CacheException {
- return new CacheFactory().set(MCAST_PORT, "0").create();
+ private InternalCache createCache() throws CacheException {
+ return (InternalCache) new CacheFactory().set(MCAST_PORT, "0").create();
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/TestBlockingHARegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/TestBlockingHARegionQueue.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/TestBlockingHARegionQueue.java
index c445d60..2ae699e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/TestBlockingHARegionQueue.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/TestBlockingHARegionQueue.java
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheException;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
/**
@@ -43,7 +44,7 @@ public class TestBlockingHARegionQueue extends HARegionQueue.TestOnlyHARegionQue
boolean takeWhenPeekInProgress = false;
- public TestBlockingHARegionQueue(String regionName, Cache cache)
+ public TestBlockingHARegionQueue(String regionName, InternalCache cache)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
super(regionName, cache);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
index 11254e7..7b88679 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
@@ -51,6 +51,7 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.cache.CacheLifecycleListener;
import org.apache.geode.internal.cache.DiskRegion;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceObserver;
@@ -209,13 +210,13 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
AsyncInvocation<?> asyncCreate = vm0.invokeAsync(() -> {
cll = new CacheLifecycleListener() {
@Override
- public void cacheCreated(GemFireCacheImpl cache) {
+ public void cacheCreated(InternalCache cache) {
calledCreateCache.set(true);
Awaitility.await().atMost(90, TimeUnit.SECONDS).until(() -> cache.isCacheAtShutdownAll());
}
@Override
- public void cacheClosed(GemFireCacheImpl cache) {
+ public void cacheClosed(InternalCache cache) {
calledCloseCache.set(true);
}
};
@@ -544,9 +545,6 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
assertEquals(vm0Buckets, getBucketList(vm0, "region"));
- // checkRecoveredFromDisk(vm0, 0, true);
- // checkRecoveredFromDisk(vm1, 0, false);
-
checkData(vm0, 0, numBuckets, "a", "region");
checkData(vm1, 0, numBuckets, "a", "region");
@@ -554,20 +552,8 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
checkData(vm0, numBuckets, 113, "b", "region");
}
-
- // public void testRepeat() throws Throwable {
- // for (int i=0; i<10; i++) {
- // System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> run #"+i);
- // testShutdownAllWithMembersWaiting();
- // tearDown();
- // setUp();
- // }
- // }
-
/**
* Test for 43551. Do a shutdown all with some members waiting on recovery.
- *
- * @throws Throwable
*/
@Test
public void testShutdownAllWithMembersWaiting() throws Throwable {
@@ -664,11 +650,9 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
private SerializableRunnable getCreateDRRunnable(final String regionName,
final String diskStoreName) {
- SerializableRunnable createDR = new SerializableRunnable("create DR") {
- Cache cache;
-
+ return new SerializableRunnable("create DR") {
public void run() {
- cache = getCache();
+ Cache cache = ShutdownAllDUnitTest.this.getCache();
DiskStore ds = cache.findDiskStore(diskStoreName);
if (ds == null) {
@@ -681,7 +665,6 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
cache.createRegion(regionName, af.create());
}
};
- return createDR;
}
protected void addCacheServer(VM vm, final int port) {
@@ -723,8 +706,8 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
private SerializableRunnable getCreatePRRunnable(final String regionName,
final String diskStoreName, final int redundancy) {
- SerializableRunnable createPR = new SerializableRunnable("create pr") {
-
+ return new SerializableRunnable("create pr") {
+ @Override
public void run() {
final CountDownLatch recoveryDone;
if (redundancy > 0) {
@@ -741,7 +724,7 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
recoveryDone = null;
}
- Cache cache = getCache();
+ Cache cache = ShutdownAllDUnitTest.this.getCache();
if (diskStoreName != null) {
DiskStore ds = cache.findDiskStore(diskStoreName);
@@ -772,7 +755,6 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
}
}
};
- return createPR;
}
protected void createData(VM vm, final int startKey, final int endKey, final String value,
@@ -888,7 +870,7 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
public void afterUpdate(EntryEvent event) {
try {
latch.await();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
index 5d4096e..de06a5e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
@@ -42,6 +42,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.FixedPartitionAttributesImpl;
import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionRegionConfig;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PartitionedRegionHelper;
@@ -94,7 +95,7 @@ public class FixedPartitioningTestBase extends JUnit4DistributedTestCase {
protected static VM member4 = null;
- static Cache cache = null;
+ static InternalCache cache = null;
protected static PartitionedRegion region_FPR = null;
@@ -148,7 +149,7 @@ public class FixedPartitioningTestBase extends JUnit4DistributedTestCase {
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
- cache = CacheFactory.create(ds);
+ cache = (InternalCache) CacheFactory.create(ds);
assertNotNull(cache);
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("Failed while creating the cache", e);
[28/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractMapIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractMapIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractMapIndex.java
index 2956649..d7d6351 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractMapIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractMapIndex.java
@@ -26,6 +26,7 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.query.AmbiguousNameException;
import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.Index;
import org.apache.geode.cache.query.IndexStatistics;
import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.NameResolutionException;
@@ -43,7 +44,7 @@ import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.RegionEntry;
public abstract class AbstractMapIndex extends AbstractIndex {
- final protected boolean isAllKeys;
+ final boolean isAllKeys;
final String[] patternStr;
@@ -187,7 +188,7 @@ public abstract class AbstractMapIndex extends AbstractIndex {
public long getNumberOfValues(Object key) {
long numValues = 0;
for (Object ind : mapKeyToValueIndex.values()) {
- numValues += ((AbstractIndex) ind).getStatistics().getNumberOfValues(key);
+ numValues += ((Index) ind).getStatistics().getNumberOfValues(key);
}
return numValues;
}
@@ -199,13 +200,12 @@ public abstract class AbstractMapIndex extends AbstractIndex {
return this.vsdStats.getReadLockCount();
}
-
public void close() {
this.vsdStats.close();
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("No Keys = ").append(getNumberOfKeys()).append("\n");
sb.append("No Map Index Keys = ").append(getNumberOfMapIndexKeys()).append("\n");
sb.append("No Values = ").append(getNumberOfValues()).append("\n");
@@ -222,8 +222,8 @@ public abstract class AbstractMapIndex extends AbstractIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
- this.evaluator = new IMQEvaluator(ich);
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
+ this.evaluator = new IMQEvaluator(indexCreationHelper);
}
@Override
@@ -375,7 +375,7 @@ public abstract class AbstractMapIndex extends AbstractIndex {
if (condnExpr instanceof MapIndexable) {
MapIndexable mi = (MapIndexable) condnExpr;
CompiledValue recvr = mi.getRecieverSansIndexArgs();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
recvr.generateCanonicalizedExpression(sb, context);
sb.append('[').append(']');
return sb.toString().equals(this.patternStr[0]);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactMapRangeIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactMapRangeIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactMapRangeIndex.java
index 3bffc9c..43aeabc 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactMapRangeIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactMapRangeIndex.java
@@ -46,9 +46,9 @@ public class CompactMapRangeIndex extends AbstractMapIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
- this.evaluator = new IMQEvaluator(ich);
- this.ich = ich;
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
+ this.evaluator = new IMQEvaluator(indexCreationHelper);
+ this.ich = indexCreationHelper;
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
index 80568f5..139ce54 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.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.query.internal.index;
import java.util.ArrayList;
@@ -24,7 +23,8 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import org.apache.geode.cache.Cache;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.EntryDestroyedException;
import org.apache.geode.cache.Region;
@@ -62,15 +62,16 @@ import org.apache.geode.cache.query.internal.types.StructTypeImpl;
import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.cache.query.types.StructType;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionEntry;
import org.apache.geode.internal.cache.RegionEntryContext;
import org.apache.geode.internal.cache.VMThinRegionEntryHeap;
import org.apache.geode.internal.cache.persistence.query.CloseableIterator;
import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.pdx.internal.PdxString;
-// @todo Extend to support the keys or entries of a region.
/**
* A CompactRangeIndex is a range index that has simple data structures to minimize its footprint,
* at the expense of doing extra work at index maintenance. It is selected as the index
@@ -84,6 +85,7 @@ import org.apache.geode.pdx.internal.PdxString;
* @since GemFire 6.0
*/
public class CompactRangeIndex extends AbstractIndex {
+ private static final Logger logger = LogService.getLogger();
private static TestHook testHook;
@@ -194,13 +196,11 @@ public class CompactRangeIndex extends AbstractIndex {
Object innerEntry = null;
Object outerKey = null;
Object innerKey = null;
- // boolean incrementOuter = true;
boolean incrementInner = true;
outer: while (outer.hasNext()) {
- // if (incrementOuter) {
outerEntry = outer.next();
- // }
outerKey = outerEntry.getDeserializedKey();
+ // TODO: eliminate all labels
inner: while (!incrementInner || inner.hasNext()) {
if (incrementInner) {
innerEntry = inner.next();
@@ -234,14 +234,14 @@ public class CompactRangeIndex extends AbstractIndex {
incrementInner = true;
continue outer;
} else if (compare < 0) {
- // Asif :The outer key is smaller than the inner key. That means
+ // The outer key is smaller than the inner key. That means
// that we need
// to increment the outer loop without moving inner loop.
// incrementOuter = true;
incrementInner = false;
continue outer;
} else {
- // Asif : The outer key is greater than inner key , so increment the
+ // The outer key is greater than inner key , so increment the
// inner loop without changing outer
incrementInner = true;
}
@@ -269,15 +269,7 @@ public class CompactRangeIndex extends AbstractIndex {
*
* This method is called only for Memory indexstore
*
- * @param entry
- * @param context
- * @param indexInfo
- * @param keyVal
* @return true if entry value and index value are consistent.
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
protected boolean verifyInnerAndOuterEntryValues(IndexStoreEntry entry, ExecutionContext context,
IndexInfo indexInfo, Object keyVal) throws FunctionDomainException, TypeMismatchException,
@@ -437,7 +429,7 @@ public class CompactRangeIndex extends AbstractIndex {
}
break;
}
- } catch (EntryDestroyedException e) {
+ } catch (EntryDestroyedException ignore) {
return Integer.MAX_VALUE;
} finally {
updateIndexUseEndStats(start, false);
@@ -457,8 +449,8 @@ public class CompactRangeIndex extends AbstractIndex {
int limit = -1;
Boolean applyLimit = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_LIMIT_AT_INDEX);
- if (applyLimit != null && applyLimit.booleanValue()) {
- limit = ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)).intValue();
+ if (applyLimit != null && applyLimit) {
+ limit = (Integer) context.cacheGet(CompiledValue.RESULT_LIMIT);
}
Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
@@ -466,7 +458,7 @@ public class CompactRangeIndex extends AbstractIndex {
boolean asc = true;
List orderByAttrs = null;
boolean multiColOrderBy = false;
- if (orderByClause != null && orderByClause.booleanValue()) {
+ if (orderByClause != null && orderByClause) {
orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
CompiledSortCriterion csc = (CompiledSortCriterion) orderByAttrs.get(0);
asc = !csc.getCriterion();
@@ -494,15 +486,15 @@ public class CompactRangeIndex extends AbstractIndex {
int limit = -1;
Boolean applyLimit = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_LIMIT_AT_INDEX);
- if (applyLimit != null && applyLimit.booleanValue()) {
- limit = ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)).intValue();
+ if ((applyLimit != null) && applyLimit.booleanValue()) {
+ limit = (Integer) context.cacheGet(CompiledValue.RESULT_LIMIT);
}
Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
List orderByAttrs = null;
boolean asc = true;
boolean multiColOrderBy = false;
- if (orderByClause != null && orderByClause.booleanValue()) {
+ if (orderByClause != null && orderByClause) {
orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
CompiledSortCriterion csc = (CompiledSortCriterion) orderByAttrs.get(0);
asc = !csc.getCriterion();
@@ -669,8 +661,8 @@ public class CompactRangeIndex extends AbstractIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
- this.evaluator = new IMQEvaluator(ich);
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
+ this.evaluator = new IMQEvaluator(indexCreationHelper);
}
// Only used by CompactMapRangeIndex. This is due to the way the index initialization happens
@@ -726,7 +718,7 @@ public class CompactRangeIndex extends AbstractIndex {
QueryObserver observer = QueryObserverHolder.getInstance();
boolean limitApplied = false;
- if (entriesIter == null || (limitApplied = verifyLimit(result, limit, context))) {
+ if (entriesIter == null || (limitApplied = verifyLimit(result, limit))) {
if (limitApplied) {
if (observer != null) {
observer.limitAppliedAtIndexLevel(this, limit, result);
@@ -755,7 +747,7 @@ public class CompactRangeIndex extends AbstractIndex {
IndexStoreEntry indexEntry = null;
try {
indexEntry = entriesIter.next();
- } catch (NoSuchElementException ex) {
+ } catch (NoSuchElementException ignore) {
// We are done with all the elements in array.
// Continue from while.
continue;
@@ -769,48 +761,7 @@ public class CompactRangeIndex extends AbstractIndex {
continue;
}
seenKey.add(rk);
- // Some code that we might be able to use to optimize skipping the
- // expansion of a value if no expansion is needed
- // if
- // (((CompactRangeIndex.IMQEvaluator)evaluator).getInitContext().getCurrentIterators().size()
- // == 1) {
- // boolean structType = (evaluator.getIndexResultSetType() instanceof
- // StructType);
- // if (!structType) {
- // boolean ok = true;
- // if (indexEntry.isUpdateInProgress()) {
- // IndexInfo indexInfo =
- // (IndexInfo)context.cacheGet(CompiledValue.INDEX_INFO);
- // if (runtimeItr == null) {
- // runtimeItr = getRuntimeIteratorForThisIndex(context, indexInfo);
- // }
- // runtimeItr.setCurrent(value);
- // // Verify index key in region entry value.
- // ok = evaluateEntry((IndexInfo) indexInfo, context, null);
- // }
- // if (runtimeItr != null) {
- // runtimeItr.setCurrent(value);
- // }
- // if (ok && runtimeItr != null && iterOps != null) {
- // ok = QueryUtils.applyCondition(iterOps, context);
- // }
- // if (ok) {
- // if (context != null && context.isCqQueryContext()) {
- // result.add(new CqEntry(indexEntry.getDeserializedRegionKey(),
- // value));
- // } else {
- // applyProjection(projAttrib, context, result, value,
- // intermediateResults, isIntersection);
- // }
- // if (verifyLimit(result, limit, context)) {
- // observer.limitAppliedAtIndexLevel(this, limit, result);
- // return;
- // }
- // }
- // continue;
- // }
- // }
- //
+
List expandedResults = expandValue(context, lowerBoundKey, upperBoundKey,
lowerBoundOperator, upperBoundOperator, value);
Iterator iterator = ((Collection) expandedResults).iterator();
@@ -818,19 +769,7 @@ public class CompactRangeIndex extends AbstractIndex {
value = iterator.next();
if (value != null) {
boolean ok = true;
- // We should not need to call the commented out code if expansion
- // is occuring as we already reevaluate the index key per value
- // if (indexEntry.isUpdateInProgress()) {
- // IndexInfo indexInfo =
- // (IndexInfo)context.cacheGet(CompiledValue.INDEX_INFO);
- // if (runtimeItr == null) {
- // runtimeItr = getRuntimeIteratorForThisIndex(context,
- // indexInfo);
- // }
- // runtimeItr.setCurrent(value);
- // // Verify index key in region entry value.
- // ok = evaluateEntry((IndexInfo) indexInfo, context, null);
- // }
+
if (runtimeItr != null) {
runtimeItr.setCurrent(value);
}
@@ -844,7 +783,7 @@ public class CompactRangeIndex extends AbstractIndex {
applyProjection(projAttrib, context, result, value, intermediateResults,
isIntersection);
}
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
@@ -885,16 +824,14 @@ public class CompactRangeIndex extends AbstractIndex {
applyProjection(projAttrib, context, result, value, intermediateResults,
isIntersection);
}
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
}
}
}
- } catch (ClassCastException e) {
-
- } catch (EntryDestroyedException e) {
+ } catch (ClassCastException | EntryDestroyedException ignore) {
// ignore it
}
}
@@ -908,7 +845,7 @@ public class CompactRangeIndex extends AbstractIndex {
upperBoundOperator, value);
return expandedResults;
} catch (IMQException e) {
- e.printStackTrace();
+ // TODO: never throw an anonymous inner class
throw new CacheException(e) {};
}
}
@@ -921,14 +858,7 @@ public class CompactRangeIndex extends AbstractIndex {
* Note: IndexInfo is created for each query separately based on the condition being evaluated
* using the Index.
*
- * @param indexInfo
- * @param context
- * @param keyVal
* @return true if RegionEntry value satisfies the where condition (contained in IndexInfo).
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
protected boolean evaluateEntry(IndexInfo indexInfo, ExecutionContext context, Object keyVal)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
@@ -989,7 +919,7 @@ public class CompactRangeIndex extends AbstractIndex {
return Boolean.FALSE;
}
} else {
- return ((Boolean) result).booleanValue();
+ return (Boolean) result;
}
}
}
@@ -1124,7 +1054,7 @@ public class CompactRangeIndex extends AbstractIndex {
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("No Keys = ").append(getNumberOfKeys()).append("\n");
sb.append("No Values = ").append(getNumberOfValues()).append("\n");
sb.append("No Uses = ").append(getTotalUses()).append("\n");
@@ -1134,43 +1064,39 @@ public class CompactRangeIndex extends AbstractIndex {
}
}
- /**
- *
- */
class IMQEvaluator implements IndexedExpressionEvaluator {
- private Cache cache;
+ private InternalCache cache;
private List fromIterators = null;
private CompiledValue indexedExpr = null;
- final private String[] canonicalIterNames;
+ private final String[] canonicalIterNames;
private ObjectType indexResultSetType = null;
private Region rgn = null;
private Map dependencyGraph = null;
/*
- * Asif : The boolean if true indicates that the 0th iterator is on entries . If the 0th
- * iterator is on collection of Region.Entry objects, then the RegionEntry object used in Index
- * data objects is obtained directly from its corresponding Region.Entry object. However if the
- * 0th iterator is not on entries then the boolean is false. In this case the additional
- * projection attribute gives us the original value of the iterator while the Region.Entry
- * object is obtained from 0th iterator. It is possible to have index being created on a Region
- * Entry itself , instead of a Region. A Map operator( Compiled Index Operator) used with Region
- * enables, us to create such indexes. In such case the 0th iterator, even if it represents a
- * collection of Objects which are not Region.Entry objects, still the boolean remains true, as
- * the Entry object can be easily obtained from the 0th iterator. In this case, the additional
- * projection attribute s not null as it is used to evaluate the Entry object from the 0th
- * iterator.
+ * The boolean if true indicates that the 0th iterator is on entries . If the 0th iterator is on
+ * collection of Region.Entry objects, then the RegionEntry object used in Index data objects is
+ * obtained directly from its corresponding Region.Entry object. However if the 0th iterator is
+ * not on entries then the boolean is false. In this case the additional projection attribute
+ * gives us the original value of the iterator while the Region.Entry object is obtained from
+ * 0th iterator. It is possible to have index being created on a Region Entry itself , instead
+ * of a Region. A Map operator( Compiled Index Operator) used with Region enables, us to create
+ * such indexes. In such case the 0th iterator, even if it represents a collection of Objects
+ * which are not Region.Entry objects, still the boolean remains true, as the Entry object can
+ * be easily obtained from the 0th iterator. In this case, the additional projection attribute s
+ * not null as it is used to evaluate the Entry object from the 0th iterator.
*/
private boolean isFirstItrOnEntry = false;
- // Asif: List of modified iterators, not null only when the boolean
+ // List of modified iterators, not null only when the boolean
// isFirstItrOnEntry is false.
private List indexInitIterators = null;
- // Asif : The additional Projection attribute representing the value of the
+ // The additional Projection attribute representing the value of the
// original 0th iterator. If the isFirstItrOnEntry is false, then it is not
// null. However if the isFirstItrOnEntry is true and this attribute is not
// null, this indicates that the 0th iterator is derived using an individual
// entry thru Map operator on the Region.
private CompiledValue additionalProj = null;
- // Asif : This is not null iff the boolean isFirstItrOnEntry is false.
+ // This is not null iff the boolean isFirstItrOnEntry is false.
private CompiledValue modifiedIndexExpr = null;
private ObjectType addnlProjType = null;
private int initEntriesUpdated = 0;
@@ -1187,7 +1113,7 @@ public class CompactRangeIndex extends AbstractIndex {
this.canonicalIterNames = ((FunctionalIndexCreationHelper) helper).canonicalizedIteratorNames;
this.rgn = helper.getRegion();
- // Asif : The modified iterators for optmizing Index cxreation
+ // The modified iterators for optmizing Index cxreation
isFirstItrOnEntry = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionEntry;
additionalProj = ((FunctionalIndexCreationHelper) helper).additionalProj;
Object params1[] = {new QRegion(rgn, false)};
@@ -1239,7 +1165,7 @@ public class CompactRangeIndex extends AbstractIndex {
doNestedExpansion(1, expansionContext, expandedResults, lowerBoundKey, upperBoundKey,
lowerBoundOperator, upperBoundOperator, value);
} catch (Exception e) {
- throw new IMQException(e) {};
+ throw new IMQException(e);
}
}
@@ -1268,16 +1194,8 @@ public class CompactRangeIndex extends AbstractIndex {
}
/**
- *
- * @param expansionContext
- * @param expandedResults
- * @param lowerBoundKey
* @param upperBoundKey if null, we do not do an upperbound check (may need to change this if we
* ever use null in a range query)
- * @param lowerBoundOperator
- * @param upperBoundOperator
- * @param value
- * @throws IMQException
*/
public void expand(ExecutionContext expansionContext, List expandedResults,
Object lowerBoundKey, Object upperBoundKey, int lowerBoundOperator, int upperBoundOperator,
@@ -1297,7 +1215,7 @@ public class CompactRangeIndex extends AbstractIndex {
compResult = TypeUtils.compare(tupleIndexKey, upperBoundKey, upperBoundOperator);
if (compResult instanceof Boolean) {
Boolean ok = (Boolean) compResult;
- if (!ok.booleanValue()) {
+ if (!ok) {
return;
}
}
@@ -1318,7 +1236,7 @@ public class CompactRangeIndex extends AbstractIndex {
compResult = TypeUtils.compare(tupleIndexKey, lowerBoundKey, lowerBoundOperator);
if (compResult instanceof Boolean) {
Boolean ok = (Boolean) compResult;
- if (!ok.booleanValue()) {
+ if (!ok) {
return;
}
}
@@ -1385,10 +1303,8 @@ public class CompactRangeIndex extends AbstractIndex {
Support.Assert(this.indexResultSetType != null,
"IMQEvaluator::evaluate:The StrcutType should have been initialized during index creation");
} catch (Exception e) {
- e.printStackTrace(System.out);
+ logger.warn(e);
throw new Error("Unable to reevaluate, this should not happen");
- } finally {
-
}
return context;
}
@@ -1411,7 +1327,7 @@ public class CompactRangeIndex extends AbstractIndex {
CompiledIteratorDef iterDef = (CompiledIteratorDef) fromIterators.get(i);
// We are re-using the same ExecutionContext on every evaluate -- this
// is not how ExecutionContext was intended to be used.
- // Asif: Compute the dependency only once. The call to methods of this
+ // Compute the dependency only once. The call to methods of this
// class are thread safe as for update lock on Index is taken .
if (this.dependencyGraph == null) {
iterDef.computeDependencies(context);
@@ -1450,13 +1366,12 @@ public class CompactRangeIndex extends AbstractIndex {
}
/**
- * Asif : This function is used for creating Index data at the start
- *
+ * This function is used for creating Index data at the start
*/
public void initializeIndex(boolean loadEntries) throws IMQException {
this.initEntriesUpdated = 0;
try {
- // Asif: Since an index initialization can happen multiple times
+ // Since an index initialization can happen multiple times
// for a given region, due to clear operation, we are using harcoded
// scope ID of 1 , as otherwise if obtained from ExecutionContext
// object, it will get incremented on very index initialization
@@ -1512,15 +1427,15 @@ public class CompactRangeIndex extends AbstractIndex {
}
/*
- * Asif : This function is used to obtain Index data at the time of index creation. Each element
- * of the List is an Object Array of size 3. The 0th element of Object Array stores the value of
- * Index Expression. The 1st element of ObjectArray contains the RegionEntry object ( If the
- * booelan isFirstItrOnEntry is false, then the 0th iterator will give us the Region.Entry
- * object which can be used to obtain the underlying RegionEntry object. If the boolean is true
- * & additional projection attribute is not null, then the Region.Entry object can be obtained
- * by evaluating the additional projection attribute. If the boolean isFirstItrOnEntry is tru e&
- * additional projection attribute is null, then teh 0th iterator itself will evaluate to
- * Region.Entry Object.
+ * This function is used to obtain Index data at the time of index creation. Each element of the
+ * List is an Object Array of size 3. The 0th element of Object Array stores the value of Index
+ * Expression. The 1st element of ObjectArray contains the RegionEntry object ( If the booelan
+ * isFirstItrOnEntry is false, then the 0th iterator will give us the Region.Entry object which
+ * can be used to obtain the underlying RegionEntry object. If the boolean is true & additional
+ * projection attribute is not null, then the Region.Entry object can be obtained by evaluating
+ * the additional projection attribute. If the boolean isFirstItrOnEntry is tru e& additional
+ * projection attribute is null, then teh 0th iterator itself will evaluate to Region.Entry
+ * Object.
*
* The 2nd element of Object Array contains the Struct object ( tuple) created. If the boolean
* isFirstItrOnEntry is false, then the first attribute of the Struct object is obtained by
@@ -1559,7 +1474,6 @@ public class CompactRangeIndex extends AbstractIndex {
/**
* @param add true if adding to index, false if removing
- * @param context
*/
private void doNestedIterations(int level, boolean add, ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, FunctionDomainException,
@@ -1583,7 +1497,6 @@ public class CompactRangeIndex extends AbstractIndex {
/**
* @param add true if adding, false if removing from index
- * @param context
*/
private void applyProjection(boolean add, ExecutionContext context)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
@@ -1637,23 +1550,19 @@ public class CompactRangeIndex extends AbstractIndex {
}
}
- // TODO :Asif: Test this function .
// The struct type calculation is modified if the
// 0th iterator is modified to make it dependent on Entry
private ObjectType createIndexResultSetType() {
List currentIterators = this.initContext.getCurrentIterators();
int len = currentIterators.size();
ObjectType type = null;
- // String fieldNames[] = new String[len];
ObjectType fieldTypes[] = new ObjectType[len];
int start = this.isFirstItrOnEntry ? 0 : 1;
for (; start < len; start++) {
RuntimeIterator iter = (RuntimeIterator) currentIterators.get(start);
- // fieldNames[start] = iter.getInternalId();
fieldTypes[start] = iter.getElementType();
}
if (!this.isFirstItrOnEntry) {
- // fieldNames[0] = "iter1";
fieldTypes[0] = addnlProjType;
}
type = (len == 1) ? fieldTypes[0] : new StructTypeImpl(this.canonicalIterNames, fieldTypes);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/DummyQRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/DummyQRegion.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/DummyQRegion.java
index 2b16686..3bee7d2 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/DummyQRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/DummyQRegion.java
@@ -12,12 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * DummyQRegion.java
- *
- * Created on March 15, 2005, 6:40 PM
- */
-
package org.apache.geode.cache.query.internal.index;
import java.util.ArrayList;
@@ -34,18 +28,14 @@ import org.apache.geode.cache.query.internal.ResultsSet;
import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.internal.cache.CachedDeserializable;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.HasCachePerfStats;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionEntry;
-import org.apache.geode.internal.cache.RegionEntryContext;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
-/**
- *
- */
public class DummyQRegion extends QRegion {
private RegionEntry entry = null;
@@ -67,7 +57,7 @@ public class DummyQRegion extends QRegion {
constraint = region.getAttributes().getKeyConstraint();
if (constraint != null)
keyType = TypeUtils.getObjectType(constraint);
- values = new ResultsBag(((GemFireCacheImpl) region.getCache()).getCachePerfStats());
+ values = new ResultsBag(((HasCachePerfStats) region.getCache()).getCachePerfStats());
values.setElementType(valueType);
keys = new ResultsSet();
keys.setElementType(keyType);
@@ -107,7 +97,7 @@ public class DummyQRegion extends QRegion {
@Override
public Set keySet() {
- return (ResultsSet) getKeys();
+ return (Set) getKeys();
}
@Override
@@ -173,7 +163,7 @@ public class DummyQRegion extends QRegion {
@Override
public SelectResults getValues() {
if (values == null) {
- values = new ResultsBag(((GemFireCacheImpl) getRegion().getCache()).getCachePerfStats());
+ values = new ResultsBag(((HasCachePerfStats) getRegion().getCache()).getCachePerfStats());
values.setElementType(valueType);
}
values.clear();
@@ -218,7 +208,7 @@ public class DummyQRegion extends QRegion {
@Override
public Set entries(boolean recursive) {
- return (ResultsSet) getEntries();
+ return (Set) getEntries();
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java
index eb16207..4b61ae4 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java
@@ -12,17 +12,11 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * IndexCreationHelper.java
- *
- * Created on March 16, 2005, 6:20 PM
- */
package org.apache.geode.cache.query.internal.index;
import java.util.ArrayList;
import java.util.List;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.AmbiguousNameException;
import org.apache.geode.cache.query.IndexInvalidException;
@@ -47,50 +41,62 @@ import org.apache.geode.cache.query.internal.QRegion;
import org.apache.geode.cache.query.internal.RuntimeIterator;
import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.types.ObjectType;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- *
- */
class FunctionalIndexCreationHelper extends IndexCreationHelper {
+
private boolean isMapTypeIndex;
- // If true means pattern is *, if false & still map type index that means
- // more than 1 specific keys
+
+ /**
+ * If true means pattern is *, if false & still map type index that means more than 1 specific
+ * keys
+ */
private boolean isAllKeys = false;
ExecutionContext context = null;
- CompiledValue indexedExpr;
- List fromClauseIterators;
+
+ private CompiledValue indexedExpr;
+
+ private List fromClauseIterators;
+
QRegion region;
+
String[] multiIndexKeysPattern;
+
Object[] mapKeys;
+
/**
- * Asif : The Iterators for index creation are different then those which are used for index
- * updates as in case of Index creation the 0th iterator is modified such that it always
- * represents collection of Region.Entry objects. As a result all the rest of iterators as well as
- * indexed expression have to be modified to appropriately resolve the dependency on 0th
- * iterator.The missing link indicates the dependency. The original 0th iterator is evaluated as
- * additional projection attribute. These changes provide significant improvement in Index
- * creation as compared to previous method. In this approach the IMQ acts on all the entries of
- * the region while in previous , it iterated over the individual entry of the Region & applied
- * IMQ to it.
+ * The Iterators for index creation are different then those which are used for index updates as
+ * in case of Index creation the 0th iterator is modified such that it always represents
+ * collection of Region.Entry objects. As a result all the rest of iterators as well as indexed
+ * expression have to be modified to appropriately resolve the dependency on 0th iterator.The
+ * missing link indicates the dependency. The original 0th iterator is evaluated as additional
+ * projection attribute. These changes provide significant improvement in Index creation as
+ * compared to previous method. In this approach the IMQ acts on all the entries of the region
+ * while in previous , it iterated over the individual entry of the Region & applied IMQ to it.
*/
-
List indexInitIterators = null;
+
CompiledValue missingLink = null;
+
CompiledValue additionalProj = null;
+
ObjectType addnlProjType = null;
+
CompiledValue modifiedIndexExpr = null;
+
boolean isFirstIteratorRegionEntry = false;
+
boolean isFirstIteratorRegionKey = false;
- final String imports;
- // TODO: Asif Remove the fromClause being passed as parameter to the
- // constructor
+ private final String imports;
+
+ // TODO: Remove the fromClause being passed as parameter to the constructor
FunctionalIndexCreationHelper(String fromClause, String indexedExpression,
- String projectionAttributes, String imports, Cache cache, ExecutionContext externalContext,
- IndexManager imgr) throws IndexInvalidException {
+ String projectionAttributes, String imports, InternalCache cache,
+ ExecutionContext externalContext, IndexManager imgr) throws IndexInvalidException {
super(fromClause, projectionAttributes, cache);
if (externalContext == null) {
this.context = new ExecutionContext(null, cache);
@@ -102,27 +108,30 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
prepareFromClause(imgr);
prepareIndexExpression(indexedExpression);
prepareProjectionAttributes(projectionAttributes);
- Object data[] = modfiyIterDefToSuiteIMQ((CompiledIteratorDef) fromClauseIterators.get(0));
+ Object[] data = modiyyIterDefToSuiteIMQ((CompiledIteratorDef) this.fromClauseIterators.get(0));
if (data[0] == null || data[1] == null) {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_FROM_CLAUSE_0
.toLocalizedString(fromClause));
}
- fromClauseIterators.remove(0);
- fromClauseIterators.add(0, data[1]);
- region = (QRegion) data[0];
+ this.fromClauseIterators.remove(0);
+ this.fromClauseIterators.add(0, data[1]);
+ this.region = (QRegion) data[0];
}
+ @Override
public List getIterators() {
- return fromClauseIterators;
+ return this.fromClauseIterators;
}
+ @Override
public CompiledValue getCompiledIndexedExpression() {
- return indexedExpr;
+ return this.indexedExpr;
}
+ @Override
public Region getRegion() {
- return region.getRegion();
+ return this.region.getRegion();
}
@Override
@@ -134,60 +143,56 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
return this.isAllKeys;
}
-
-
- /*
- * Asif : The function is modified to optmize the index creation code. If the 0th iterator of from
+ /**
+ * The function is modified to optimize the index creation code. If the 0th iterator of from
* clause is not on Entries, then the 0th iterator is replaced with that of entries & the value
* corresponding to original iterator is derived from the 0th iterator as additional projection
* attribute. All the other iterators & index expression if were dependent on 0th iterator are
* also appropriately modified such that they are correctly derived on the modified 0th iterator.
+ * <p>
+ * TODO: method is too complex for IDE to analyze -- refactor prepareFromClause
*/
private void prepareFromClause(IndexManager imgr) throws IndexInvalidException {
- if (imports != null) {
+ if (this.imports != null) {
this.compiler.compileImports(this.imports);
}
- List list = this.compiler.compileFromClause(fromClause);
+ List list = this.compiler.compileFromClause(this.fromClause);
if (list == null) {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_FROM_CLAUSE_0
- .toLocalizedString(fromClause));
+ .toLocalizedString(this.fromClause));
}
- boolean isFromClauseNull = true;
int size = list.size();
this.canonicalizedIteratorNames = new String[size];
this.canonicalizedIteratorDefinitions = new String[size];
- CompiledIteratorDef newItr = null;
- StringBuffer tempBuff = new StringBuffer();
+ StringBuilder tempBuff = new StringBuilder();
+ boolean isFromClauseNull = true;
+
try {
PartitionedRegion pr = this.context.getPartitionedRegion();
for (int i = 0; i < size; i++) {
CompiledIteratorDef iterDef = (CompiledIteratorDef) list.get(i);
iterDef.computeDependencies(this.context);
RuntimeIterator rIter = iterDef.getRuntimeIterator(this.context);
- context.addToIndependentRuntimeItrMapForIndexCreation(iterDef);
+ this.context.addToIndependentRuntimeItrMapForIndexCreation(iterDef);
this.context.bindIterator(rIter);
if (i != 0 && !iterDef.isDependentOnCurrentScope(this.context)) {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_FROM_CLAUSE_0_SUBSEQUENT_ITERATOR_EXPRESSIONS_IN_FROM_CLAUSE_MUST_BE_DEPENDENT_ON_PREVIOUS_ITERATORS
- .toLocalizedString(fromClause));
+ .toLocalizedString(this.fromClause));
}
+
String definition = rIter.getDefinition();
this.canonicalizedIteratorDefinitions[i] = definition;
- // Asif: Bind the Index_Internal_ID to the RuntimeIterator
+
+ // Bind the Index_Internal_ID to the RuntimeIterator
this.canonicalizedIteratorNames[i] = imgr.putCanonicalizedIteratorNameIfAbsent(definition);
if (pr != null) {
- // if (iterDef.getCollectionExpr() instanceof CompiledRegion ||
- // iterDef.getCollectionExpr() instanceof CompiledPath) {
- // pr.getIndexManager().putCanonicalizedIteratorName(pr.getFullPath(),
- // this.canonicalizedIteratorNames[i]);
- // } else {
this.canonicalizedIteratorNames[i] =
pr.getIndexManager().putCanonicalizedIteratorNameIfAbsent(definition);
- // }
} else {
this.canonicalizedIteratorNames[i] =
imgr.putCanonicalizedIteratorNameIfAbsent(definition);
@@ -197,133 +202,132 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
tempBuff.append(definition).append(' ').append(this.canonicalizedIteratorNames[i])
.append(", ");
isFromClauseNull = false;
+ CompiledIteratorDef newItr;
+
if (i == 0) {
CompiledValue cv = iterDef.getCollectionExpr();
- addnlProjType = rIter.getElementType();
- String name = null;
- if ((name = iterDef.getName()) == null || name.equals("")) {
- // In case the name of iterator is null or balnk set it to
- // index_internal_id
+ this.addnlProjType = rIter.getElementType();
+ String name;
+ if ((name = iterDef.getName()) == null || name.isEmpty()) {
+ // In case the name of iterator is null or blank set it to index_internal_id
name = this.canonicalizedIteratorNames[i];
}
CompiledValue newCollExpr = new CompiledPath(new CompiledBindArgument(1), "entries");
- // TODO Asif : What if cv is not an instance of CompiledRegion
+
+ // TODO: What if cv is not an instance of CompiledRegion
if (cv instanceof CompiledRegion) {
- missingLink = new CompiledPath(new CompiledID(name), "value");
- // missingLinkPath = name + ".value";
- additionalProj = missingLink;
+ this.missingLink = new CompiledPath(new CompiledID(name), "value");
+ this.additionalProj = this.missingLink;
+
} else if (cv instanceof CompiledOperation || cv instanceof CompiledPath
|| cv instanceof CompiledIndexOperation) {
- CompiledValue prevCV = null;
+ CompiledValue prevCV;
List reconstruct = new ArrayList();
while (!(cv instanceof CompiledRegion)) {
prevCV = cv;
if (cv instanceof CompiledOperation) {
reconstruct.add(0, ((CompiledOperation) cv).getArguments());
reconstruct.add(0, ((CompiledOperation) cv).getMethodName());
- cv = ((CompiledOperation) cv).getReceiver(context);
+ cv = ((CompiledOperation) cv).getReceiver(this.context);
} else if (cv instanceof CompiledPath) {
reconstruct.add(0, ((CompiledPath) cv).getTailID());
- cv = ((CompiledPath) cv).getReceiver();
+ cv = cv.getReceiver();
} else if (cv instanceof CompiledIndexOperation) {
reconstruct.add(0, ((CompiledIndexOperation) cv).getExpression());
- cv = ((CompiledIndexOperation) cv).getReceiver();
+ cv = cv.getReceiver();
} else {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSEFROM_CLAUSE_IS_NEITHER_A_COMPILEDPATH_NOR_COMPILEDOPERATION
.toLocalizedString());
}
- reconstruct.add(0, Integer.valueOf(prevCV.getType()));
+ reconstruct.add(0, prevCV.getType());
}
- int firstTokenType = ((Integer) reconstruct.get(0)).intValue();
+
+ int firstTokenType = (Integer) reconstruct.get(0);
if (firstTokenType == CompiledValue.PATH) {
- // CompiledPath cp = (CompiledPath) reconstruct.get(1);
String tailID = (String) reconstruct.get(1);
+
if (tailID.equals("asList") || tailID.equals("asSet") || tailID.equals("values")
|| tailID.equals("toArray") || tailID.equals("getValues")) {
- missingLink = new CompiledPath(new CompiledID(name), "value");
- // missingLinkPath = name + ".value";
+ this.missingLink = new CompiledPath(new CompiledID(name), "value");
} else if (tailID.equals("keys") || tailID.equals("getKeys")
|| tailID.equals("keySet")) {
- missingLink = new CompiledPath(new CompiledID(name), "key");
- isFirstIteratorRegionKey = true;
- // missingLinkPath = name + ".key";
+ this.missingLink = new CompiledPath(new CompiledID(name), "key");
+ this.isFirstIteratorRegionKey = true;
} else if (tailID.equals("entries") || tailID.equals("getEntries")
|| tailID.equals("entrySet")) {
- isFirstIteratorRegionEntry = true;
+ this.isFirstIteratorRegionEntry = true;
} else {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSEFROM_CLAUSE_DOES_NOT_EVALUATE_TO_VALID_COLLECTION
.toLocalizedString());
}
+
remove(reconstruct, 2, 0);
- int secondTokenType =
- (reconstruct.size() > 1) ? ((Integer) reconstruct.get(0)).intValue() : -1;
- if (!isFirstIteratorRegionEntry
- && (secondTokenType == OQLLexerTokenTypes.TOK_LBRACK)) {
- // Asif: If the field just next to region , is values or
- // getValues & next to it is
- // CompiledIndexOpn, it indirectly means Map operation & we are
- // able to take care of it by adding a flag in CompiledIndexOp
- // which
- // indicates to it whether to return entry or value.But if the
- // field
- // is asList or toArray , we have a problem as we don't have a
- // corresponding
- // list of entries. If the field is keys , an exception should
- // be thrown
- // as IndexOpn on set is not defined.
+ int secondTokenType = reconstruct.size() > 1 ? (Integer) reconstruct.get(0) : -1;
+ if (!this.isFirstIteratorRegionEntry
+ && secondTokenType == OQLLexerTokenTypes.TOK_LBRACK) {
+
+ // If the field just next to region , is values or getValues & next to it is
+ // CompiledIndexOpn, it indirectly means Map operation & we are able to take care of
+ // it by adding a flag in CompiledIndexOp which indicates to it whether to return
+ // entry or value. But if the field is asList or toArray , we have a problem as we
+ // don't have a corresponding list of entries. If the field is keys , an exception
+ // should be thrown as IndexOpn on set is not defined.
if (tailID.equals("values") || tailID.equals("getValues")) {
boolean returnEntryForRegionCollection = true;
- additionalProj = new CompiledIndexOperation(new CompiledBindArgument(1),
+ this.additionalProj = new CompiledIndexOperation(new CompiledBindArgument(1),
(CompiledValue) reconstruct.get(1), returnEntryForRegionCollection);
this.isFirstIteratorRegionEntry = true;
+
} else if (tailID.equals("toList") || tailID.equals("toArray")) {
- // TODO:Asif . This needs to be supported
+ // TODO: add support for toList and toArray
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSETOLIST_TOARRAY_NOT_SUPPORTED
.toLocalizedString());
+
} else {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSETOLIST_TOARRAY_NOT_SUPPORTED
.toLocalizedString());
}
remove(reconstruct, 2, 0);
- } else if (!isFirstIteratorRegionEntry
+
+ } else if (!this.isFirstIteratorRegionEntry
&& (secondTokenType == OQLLexerTokenTypes.METHOD_INV
|| secondTokenType == CompiledValue.PATH)
&& (tailID.equals("values") || tailID.equals("getValues")
|| tailID.equals("keySet") || tailID.equals("keys")
|| tailID.equals("getKeys"))) {
- // Asif :Check if the second token name is toList or toArray or
- // asSet.We need to remove those
+
+ // Check if the second token name is toList or toArray or asSet.We need to remove
+ // those
String secTokName = (String) reconstruct.get(1);
if (secTokName.equals("asList") || secTokName.equals("asSet")
|| secTokName.equals("toArray")) {
- remove(reconstruct, ((secondTokenType == OQLLexerTokenTypes.METHOD_INV) ? 3 : 2),
- 0);
+ remove(reconstruct, secondTokenType == OQLLexerTokenTypes.METHOD_INV ? 3 : 2, 0);
}
}
+
} else if (firstTokenType == OQLLexerTokenTypes.TOK_LBRACK) {
boolean returnEntryForRegionCollection = true;
- additionalProj = new CompiledIndexOperation(new CompiledBindArgument(1),
+ this.additionalProj = new CompiledIndexOperation(new CompiledBindArgument(1),
(CompiledValue) reconstruct.get(1), returnEntryForRegionCollection);
this.isFirstIteratorRegionEntry = true;
+
} else if (firstTokenType == OQLLexerTokenTypes.METHOD_INV) {
String methodName = (String) reconstruct.get(1);
if (methodName.equals("asList") || methodName.equals("asSet")
|| methodName.equals("values") || methodName.equals("toArray")
|| methodName.equals("getValues")) {
- missingLink = new CompiledPath(new CompiledID(name), "value");
- // missingLinkPath = name + ".value";
+ this.missingLink = new CompiledPath(new CompiledID(name), "value");
} else if (methodName.equals("keys") || methodName.equals("getKeys")
|| methodName.equals("keySet")) {
- missingLink = new CompiledPath(new CompiledID(name), "key");
- isFirstIteratorRegionKey = true;
- // missingLinkPath = name + ".key";
+ this.missingLink = new CompiledPath(new CompiledID(name), "key");
+ this.isFirstIteratorRegionKey = true;
} else if (methodName.equals("entries") || methodName.equals("getEntries")
|| methodName.equals("entrySet")) {
- isFirstIteratorRegionEntry = true;
+ this.isFirstIteratorRegionEntry = true;
List args = (List) reconstruct.get(2);
if (args != null && args.size() == 1) {
Object obj = args.get(0);
@@ -334,17 +338,18 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
}
}
}
+
remove(reconstruct, 3, 0);
- int secondTokenType =
- (reconstruct.size() > 1) ? ((Integer) reconstruct.get(0)).intValue() : -1;
- if (!isFirstIteratorRegionEntry
- && (secondTokenType == OQLLexerTokenTypes.TOK_LBRACK)) {
+ int secondTokenType = reconstruct.size() > 1 ? (Integer) reconstruct.get(0) : -1;
+ if (!this.isFirstIteratorRegionEntry
+ && secondTokenType == OQLLexerTokenTypes.TOK_LBRACK) {
+
if (methodName.equals("values") || methodName.equals("getValues")) {
boolean returnEntryForRegionCollection = true;
newCollExpr = new CompiledIndexOperation(new CompiledBindArgument(1),
(CompiledValue) reconstruct.get(1), returnEntryForRegionCollection);
} else if (methodName.equals("toList") || methodName.equals("toArray")) {
- // TODO:Asif . This needs to be supported
+ // TODO: add support for toList and toArray
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSETOLIST_TOARRAY_NOT_SUPPORTED_YET
.toLocalizedString());
@@ -353,38 +358,40 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSETOLIST_TOARRAY_NOT_SUPPORTED_YET
.toLocalizedString());
}
+
remove(reconstruct, 2, 0);
- } else if (!isFirstIteratorRegionEntry
+ } else if (!this.isFirstIteratorRegionEntry
&& (secondTokenType == OQLLexerTokenTypes.METHOD_INV
|| secondTokenType == CompiledValue.PATH)
&& (methodName.equals("values") || methodName.equals("getValues")
|| methodName.equals("keys") || methodName.equals("getKeys")
|| methodName.equals("keySet"))) {
- // Asif :Check if the second token name is toList or toArray or
- // asSet.We need to remove those
+
+ // Check if the second token name is toList or toArray or asSet.We need to remove
+ // those
String secTokName = (String) reconstruct.get(1);
if (secTokName.equals("asList") || secTokName.equals("asSet")
|| secTokName.equals("toArray")) {
- remove(reconstruct, ((secondTokenType == OQLLexerTokenTypes.METHOD_INV) ? 3 : 2),
- 0);
+ remove(reconstruct, secondTokenType == OQLLexerTokenTypes.METHOD_INV ? 3 : 2, 0);
}
}
}
- if (!isFirstIteratorRegionEntry) {
- additionalProj = missingLink;
+
+ if (!this.isFirstIteratorRegionEntry) {
+ this.additionalProj = this.missingLink;
int len = reconstruct.size();
for (int j = 0; j < len; ++j) {
Object obj = reconstruct.get(j);
if (obj instanceof Integer) {
- int tokenType = ((Integer) obj).intValue();
+ int tokenType = (Integer) obj;
if (tokenType == CompiledValue.PATH) {
- additionalProj =
- new CompiledPath(additionalProj, (String) reconstruct.get(++j));
+ this.additionalProj =
+ new CompiledPath(this.additionalProj, (String) reconstruct.get(++j));
} else if (tokenType == OQLLexerTokenTypes.TOK_LBRACK) {
- additionalProj = new CompiledIndexOperation(additionalProj,
+ this.additionalProj = new CompiledIndexOperation(this.additionalProj,
(CompiledValue) reconstruct.get(++j));
} else if (tokenType == OQLLexerTokenTypes.METHOD_INV) {
- additionalProj = new CompiledOperation(additionalProj,
+ this.additionalProj = new CompiledOperation(this.additionalProj,
(String) reconstruct.get(++j), (List) reconstruct.get(++j));
}
}
@@ -395,41 +402,44 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSEFROM_CLAUSE_IS_NEITHER_A_COMPILEDPATH_NOR_COMPILEDOPERATION
.toLocalizedString());
}
+
if (!this.isFirstIteratorRegionEntry) {
newItr = new CompiledIteratorDef(name, null, newCollExpr);
this.indexInitIterators = new ArrayList();
- indexInitIterators.add(newItr);
+ this.indexInitIterators.add(newItr);
}
+
} else if (!this.isFirstIteratorRegionEntry) {
newItr = iterDef;
- if (rIter.getDefinition().indexOf(this.canonicalizedIteratorNames[0]) != -1) {
- newItr =
- (CompiledIteratorDef) getModifiedDependentCompiledValue(context, i, iterDef, true);
+ if (rIter.getDefinition().contains(this.canonicalizedIteratorNames[0])) {
+ newItr = (CompiledIteratorDef) getModifiedDependentCompiledValue(this.context, i,
+ iterDef, true);
}
this.indexInitIterators.add(newItr);
}
}
+ } catch (IndexInvalidException e) {
+ throw e;
} catch (Exception e) {
- if (e instanceof IndexInvalidException)
- throw (IndexInvalidException) e;
throw new IndexInvalidException(e);
}
if (isFromClauseNull)
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_FROM_CLAUSE_0
- .toLocalizedString(fromClause));
+ .toLocalizedString(this.fromClause));
this.fromClause = tempBuff.substring(0, tempBuff.length() - 2);
this.fromClauseIterators = list;
}
- /*
- * Asif: This fuinction is modified so that if the indexed expression has any dependency on the
- * 0th iterator, then it needs to modified by using the missing link so that it is derivable from
- * the 0th iterator.
+ /**
+ * This function is modified so that if the indexed expression has any dependency on the 0th
+ * iterator, then it needs to modified by using the missing link so that it is derivable from the
+ * 0th iterator.
+ * <p>
+ * TODO: refactor large method prepareIndexExpression
*/
private void prepareIndexExpression(String indexedExpression) throws IndexInvalidException {
CompiledValue expr = this.compiler.compileQuery(indexedExpression);
- // List indexedExprs = this.compiler.compileProjectionAttributes(indexedExpression);
if (expr == null) {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_INDEXED_EXPRESSION_0
@@ -438,73 +448,73 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
if (expr instanceof CompiledUndefined || expr instanceof CompiledLiteral
|| expr instanceof CompiledComparison || expr instanceof CompiledBindArgument
- || expr instanceof CompiledNegation)
+ || expr instanceof CompiledNegation) {
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_INDEXED_EXPRESSION_0
.toLocalizedString(indexedExpression));
+ }
+
try {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (expr instanceof MapIndexable) {
MapIndexable mi = (MapIndexable) expr;
- // CompiledIndexOperation cio = (CompiledIndexOperation)expr;
List<CompiledValue> indexingKeys = mi.getIndexingKeys();
+
if (indexingKeys.size() == 1 && indexingKeys.get(0) == CompiledValue.MAP_INDEX_ALL_KEYS) {
this.isMapTypeIndex = true;
this.isAllKeys = true;
// Strip the index operator
expr = mi.getRecieverSansIndexArgs();
- expr.generateCanonicalizedExpression(sb, context);
+ expr.generateCanonicalizedExpression(sb, this.context);
sb.append('[').append('*').append(']');
} else if (indexingKeys.size() == 1) {
- expr.generateCanonicalizedExpression(sb, context);
+ expr.generateCanonicalizedExpression(sb, this.context);
+
} else {
this.isMapTypeIndex = true;
this.multiIndexKeysPattern = new String[indexingKeys.size()];
this.mapKeys = new Object[indexingKeys.size()];
expr = mi.getRecieverSansIndexArgs();
- expr.generateCanonicalizedExpression(sb, context);
+ expr.generateCanonicalizedExpression(sb, this.context);
sb.append('[');
String prefixStr = sb.toString();
- StringBuffer buff2 = new StringBuffer();
+ StringBuilder sb2 = new StringBuilder();
int size = indexingKeys.size();
for (int j = 0; j < size; ++j) {
CompiledValue cv = indexingKeys.get(size - j - 1);
- this.mapKeys[size - j - 1] = cv.evaluate(context);
- StringBuffer sbuff = new StringBuffer();
- cv.generateCanonicalizedExpression(sbuff, context);
- sbuff.insert(0, prefixStr);
- sbuff.append(']');
- this.multiIndexKeysPattern[j] = sbuff.toString();
- cv.generateCanonicalizedExpression(buff2, context);
- buff2.insert(0, ',');
+ this.mapKeys[size - j - 1] = cv.evaluate(this.context);
+ StringBuilder sb3 = new StringBuilder();
+ cv.generateCanonicalizedExpression(sb3, this.context);
+ sb3.insert(0, prefixStr);
+ sb3.append(']');
+ this.multiIndexKeysPattern[j] = sb3.toString();
+ cv.generateCanonicalizedExpression(sb2, this.context);
+ sb2.insert(0, ',');
}
- buff2.deleteCharAt(0);
- sb.append(buff2.toString());
+ sb2.deleteCharAt(0);
+ sb.append(sb2);
sb.append(']');
}
} else {
- expr.generateCanonicalizedExpression(sb, context);
+ expr.generateCanonicalizedExpression(sb, this.context);
}
- // expr.generateCanonicalizedExpression(sb, this.context);
this.indexedExpression = sb.toString();
- // String tempStr = this.indexedExpression;
- modifiedIndexExpr = expr;
+ this.modifiedIndexExpr = expr;
if (!this.isFirstIteratorRegionEntry
- && this.indexedExpression.indexOf(this.canonicalizedIteratorNames[0]) >= 0) {
- modifiedIndexExpr = getModifiedDependentCompiledValue(context, -1, expr, true);
+ && this.indexedExpression.contains(this.canonicalizedIteratorNames[0])) {
+ this.modifiedIndexExpr = getModifiedDependentCompiledValue(this.context, -1, expr, true);
}
} catch (Exception e) {
- // e.printStackTrace();
throw new IndexInvalidException(
LocalizedStrings.FunctionalIndexCreationHelper_INVALID_INDEXED_EXPRESSION_0
.toLocalizedString(indexedExpression),
e);
}
- indexedExpr = expr;
+ this.indexedExpr = expr;
}
private void prepareProjectionAttributes(String projectionAttributes)
@@ -517,30 +527,30 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
this.projectionAttributes = projectionAttributes;
}
- private Object[] modfiyIterDefToSuiteIMQ(CompiledIteratorDef iterDef)
+ private Object[] modiyyIterDefToSuiteIMQ(CompiledIteratorDef iterDef)
throws IndexInvalidException {
- Object retValues[] = {null, null};
+ Object[] retValues = {null, null};
try {
CompiledValue def = iterDef.getCollectionExpr();
- // System.out.println("def = "+def);
if (def instanceof CompiledRegion) {
CompiledBindArgument bindArg = new CompiledBindArgument(1);
CompiledIteratorDef newDef = new CompiledIteratorDef(iterDef.getName(), null, bindArg);
- retValues[0] = def.evaluate(context);
+ retValues[0] = def.evaluate(this.context);
retValues[1] = newDef;
return retValues;
}
+
if (def instanceof CompiledPath || def instanceof CompiledOperation
|| def instanceof CompiledIndexOperation) {
CompiledValue cv = def;
- CompiledValue prevCV = null;
List reconstruct = new ArrayList();
+
while (!(cv instanceof CompiledRegion)) {
- prevCV = cv;
+ CompiledValue prevCV = cv;
if (cv instanceof CompiledOperation) {
reconstruct.add(0, ((CompiledOperation) cv).getArguments());
reconstruct.add(0, ((CompiledOperation) cv).getMethodName());
- cv = ((CompiledOperation) cv).getReceiver(context);
+ cv = ((CompiledOperation) cv).getReceiver(this.context);
} else if (cv instanceof CompiledPath) {
reconstruct.add(0, ((CompiledPath) cv).getTailID());
cv = ((CompiledPath) cv).getReceiver();
@@ -552,15 +562,16 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
LocalizedStrings.FunctionalIndexCreationHelper_FUNCTIONALINDEXCREATIONHELPERPREPAREFROMCLAUSEFROM_CLAUSE_IS_NEITHER_A_COMPILEDPATH_NOR_COMPILEDOPERATION
.toLocalizedString());
}
- reconstruct.add(0, Integer.valueOf(prevCV.getType()));
+ reconstruct.add(0, prevCV.getType());
}
+
CompiledValue v = cv;
cv = new CompiledBindArgument(1);
int len = reconstruct.size();
for (int j = 0; j < len; ++j) {
Object obj = reconstruct.get(j);
if (obj instanceof Integer) {
- int tokenType = ((Integer) obj).intValue();
+ int tokenType = (Integer) obj;
if (tokenType == CompiledValue.PATH) {
cv = new CompiledPath(cv, (String) reconstruct.get(++j));
} else if (tokenType == OQLLexerTokenTypes.TOK_LBRACK) {
@@ -571,8 +582,9 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
}
}
}
+
CompiledIteratorDef newDef = new CompiledIteratorDef(iterDef.getName(), null, cv);
- retValues[0] = v.evaluate(context);
+ retValues[0] = v.evaluate(this.context);
retValues[1] = newDef;
return retValues;
}
@@ -582,46 +594,49 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
return retValues;
}
- /*
- * Asif : This function is used to correct the complied value's dependency , in case the
- * compiledvalue is dependent on the 0th RuntimeIterator in some way. Thus the dependent compiled
- * value is prefixed with the missing link so that it is derivable from the 0th iterator.
+ /**
+ * This function is used to correct the complied value's dependency , in case the compiledValue is
+ * dependent on the 0th RuntimeIterator in some way. Thus the dependent compiled value is prefixed
+ * with the missing link so that it is derivable from the 0th iterator.
*/
private CompiledValue getModifiedDependentCompiledValue(ExecutionContext context, int currItrID,
CompiledValue cv, boolean isDependent)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
+
if (cv instanceof CompiledIteratorDef) {
CompiledIteratorDef iterDef = (CompiledIteratorDef) cv;
RuntimeIterator rItr = (RuntimeIterator) context.getCurrentIterators().get(currItrID);
String canonFrmClause = rItr.getDefinition();
- if (canonFrmClause.startsWith(this.canonicalizedIteratorNames[0]))
- isDependent = true;
- else
- isDependent = false;
+
+ // TODO: original value of isDependent is always ignored
+ isDependent = canonFrmClause.startsWith(this.canonicalizedIteratorNames[0]);
+
return new CompiledIteratorDef(iterDef.getName(), rItr.getElementType(),
getModifiedDependentCompiledValue(context, currItrID, iterDef.getCollectionExpr(),
isDependent));
+
} else if (cv instanceof CompiledPath) {
CompiledPath path = (CompiledPath) cv;
return new CompiledPath(
getModifiedDependentCompiledValue(context, currItrID, path.getReceiver(), isDependent),
path.getTailID());
+
} else if (cv instanceof CompiledOperation) {
CompiledOperation oper = (CompiledOperation) cv;
List list = oper.getArguments();
- int len = list.size();
List newList = new ArrayList();
- for (int i = 0; i < len; ++i) {
- CompiledValue cv1 = (CompiledValue) list.get(i);
- StringBuffer sbuff = new StringBuffer();
- cv1.generateCanonicalizedExpression(sbuff, context);
- if (sbuff.toString().startsWith(this.canonicalizedIteratorNames[0])) {
+ for (Object aList : list) {
+ CompiledValue cv1 = (CompiledValue) aList;
+ StringBuilder sb = new StringBuilder();
+ cv1.generateCanonicalizedExpression(sb, context);
+ if (sb.toString().startsWith(this.canonicalizedIteratorNames[0])) {
newList.add(getModifiedDependentCompiledValue(context, currItrID, cv1, true));
} else {
newList.add(getModifiedDependentCompiledValue(context, currItrID, cv1, false));
}
}
- // Asif: What if the receiver is null?
+
+ // What if the receiver is null?
CompiledValue rec = oper.getReceiver(context);
if (rec == null) {
if (isDependent) {
@@ -633,6 +648,7 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
getModifiedDependentCompiledValue(context, currItrID, rec, isDependent),
oper.getMethodName(), newList);
}
+
} else if (cv instanceof CompiledFunction) {
CompiledFunction cf = (CompiledFunction) cv;
CompiledValue[] cvArray = cf.getArguments();
@@ -641,37 +657,38 @@ class FunctionalIndexCreationHelper extends IndexCreationHelper {
CompiledValue[] newCvArray = new CompiledValue[len];
for (int i = 0; i < len; ++i) {
CompiledValue cv1 = cvArray[i];
- StringBuffer sbuff = new StringBuffer();
- cv1.generateCanonicalizedExpression(sbuff, context);
- if (sbuff.toString().startsWith(this.canonicalizedIteratorNames[0])) {
+ StringBuilder sb = new StringBuilder();
+ cv1.generateCanonicalizedExpression(sb, context);
+ if (sb.toString().startsWith(this.canonicalizedIteratorNames[0])) {
newCvArray[i] = getModifiedDependentCompiledValue(context, currItrID, cv1, true);
} else {
newCvArray[i] = getModifiedDependentCompiledValue(context, currItrID, cv1, false);
}
}
return new CompiledFunction(newCvArray, function);
+
} else if (cv instanceof CompiledID) {
CompiledID id = (CompiledID) cv;
RuntimeIterator rItr0 = (RuntimeIterator) context.getCurrentIterators().get(0);
if (isDependent) {
- String name = null;
+ String name;
if ((name = rItr0.getName()) != null && name.equals(id.getId())) {
- // Asif: The CompiledID is a RuneTimeIterator & so it needs to be
- // replaced by the missing link
+ // The CompiledID is a RuneTimeIterator & so it needs to be replaced by the missing link
return this.missingLink;
} else {
- // Asif: The compiledID is a compiledpath
- return new CompiledPath(missingLink, id.getId());
+ // The compiledID is a compiledPath
+ return new CompiledPath(this.missingLink, id.getId());
}
} else {
return cv;
}
+
} else if (cv instanceof CompiledIndexOperation) {
CompiledIndexOperation co = (CompiledIndexOperation) cv;
CompiledValue cv1 = co.getExpression();
- StringBuffer sbuff = new StringBuffer();
- cv1.generateCanonicalizedExpression(sbuff, context);
- if (sbuff.toString().startsWith(this.canonicalizedIteratorNames[0])) {
+ StringBuilder sb = new StringBuilder();
+ cv1.generateCanonicalizedExpression(sb, context);
+ if (sb.toString().startsWith(this.canonicalizedIteratorNames[0])) {
cv1 = getModifiedDependentCompiledValue(context, currItrID, cv1, true);
} else {
cv1 = getModifiedDependentCompiledValue(context, currItrID, cv1, false);
[13/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java b/geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java
index 65ea728..6098d4b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java
@@ -47,7 +47,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
* An oplog used for overflow-only regions. For regions that are persistent (i.e. they can be
* recovered) see {@link Oplog}.
*
- *
* @since GemFire prPersistSprint2
*/
class OverflowOplog implements CompactableOplog, Flushable {
@@ -63,10 +62,9 @@ class OverflowOplog implements CompactableOplog, Flushable {
private volatile boolean closed;
private final OplogFile crf = new OplogFile();
+
private final ByteBuffer[] bbArray = new ByteBuffer[2];
- /** preallocated space available for writing to* */
- // volatile private long opLogSpace = 0L;
/** The stats for this store */
private final DiskStoreStats stats;
@@ -99,52 +97,9 @@ class OverflowOplog implements CompactableOplog, Flushable {
private final OplogDiskEntry liveEntries = new OplogDiskEntry();
- private static final ByteBuffer EMPTY = ByteBuffer.allocate(0);
-
- // ///////////////////// Constructors ////////////////////////
- // /**
- // * Creates new <code>Oplog</code> for the given region.
- // *
- // * @param oplogId
- // * int identifying the new oplog
- // * @param dirHolder
- // * The directory in which to create new Oplog
- // *
- // * @throws DiskAccessException
- // * if the disk files can not be initialized
- // */
- // OverflowOplog(int oplogId, DiskStoreImpl parent, DirectoryHolder dirHolder) {
- // this.oplogId = oplogId;
- // this.parent = parent;
- // this.dirHolder = dirHolder;
- // this.opState = new OpState();
- // long maxOplogSizeParam = this.parent.getMaxOplogSizeInBytes();
- // long availableSpace = this.dirHolder.getAvailableSpace();
- // if (availableSpace < maxOplogSizeParam) {
- // this.maxOplogSize = availableSpace;
- // } else {
- // this.maxOplogSize = maxOplogSizeParam;
- // }
- // this.stats = this.parent.getStats();
-
- // this.closed = false;
- // String n = this.parent.getName();
- // this.diskFile = new File(this.dirHolder.getDir(),
- // "OVERFLOW"
- // + n + "_" + oplogId);
- // try {
- // createCrf();
- // }
- // catch (IOException ex) {
- // throw new
- // DiskAccessException(LocalizedStrings.Oplog_FAILED_CREATING_OPERATION_LOG_BECAUSE_0.toLocalizedString(ex),
- // this.parent);
- // }
- // }
-
/**
- * Asif: A copy constructor used for creating a new oplog based on the previous Oplog. This
- * constructor is invoked only from the function switchOplog
+ * A copy constructor used for creating a new oplog based on the previous Oplog. This constructor
+ * is invoked only from the function switchOplog
*
* @param oplogId integer identifying the new oplog
* @param dirHolder The directory in which to create new Oplog
@@ -201,26 +156,15 @@ class OverflowOplog implements CompactableOplog, Flushable {
try {
olf.raf.setLength(this.maxOplogSize);
olf.raf.seek(0);
- } catch (IOException ioe) {
- // @todo need a warning since this can impact perf.
+ } catch (IOException ignore) {
+ // TODO: need a warning since this can impact perf.
// I don't think I need any of this. If setLength throws then
// the file is still ok.
- // raf.close();
- // if (!this.opLogFile.delete() && this.opLogFile.exists()) {
- // throw new
- // DiskAccessException(LocalizedStrings.NewLBHTreeDiskRegion_COULD_NOT_DELETE__0_.toLocalizedString(this.opLogFile.getAbsolutePath()),
- // this.owner);
- // }
- // f = new File(this.diskFile.getPath() + OPLOG_FILE_EXT);
- // this.opLogFile = f;
- // raf = new RandomAccessFile(f, "rw");
}
}
/**
* Creates the crf oplog file
- *
- * @throws IOException
*/
private void createCrf(OverflowOplog previous) throws IOException {
File f = new File(this.diskFile.getPath() + CRF_FILE_EXT);
@@ -245,7 +189,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
result = previous.consumeWriteBuf();
}
if (result == null) {
- result = ByteBuffer.allocateDirect(Integer.getInteger("WRITE_BUF_SIZE", 32768).intValue());
+ result = ByteBuffer.allocateDirect(Integer.getInteger("WRITE_BUF_SIZE", 32768));
}
return result;
}
@@ -266,20 +210,11 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- * Flushes any pending writes to disk.
- *
- * public final void flush() { forceFlush(); }
- */
-
- /**
* Test Method to be used only for testing purposes. Gets the underlying File object for the Oplog
* . Oplog class uses this File object to obtain the RandomAccessFile object. Before returning the
* File object , the dat present in the buffers of the RandomAccessFile object is flushed.
* Otherwise, for windows the actual file length does not match with the File size obtained from
* the File object
- *
- * @throws IOException
- * @throws SyncFailedException
*/
File getOplogFile() throws SyncFailedException, IOException {
synchronized (this.crf) {
@@ -305,7 +240,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
* present. @param faultingIn @param bitOnly boolean indicating whether to extract just the
* UserBit or UserBit with value @return BytesAndBits object wrapping the value & user bit
*/
- public final BytesAndBits getBytesAndBits(DiskRegionView dr, DiskId id, boolean faultingIn,
+ public BytesAndBits getBytesAndBits(DiskRegionView dr, DiskId id, boolean faultingIn,
boolean bitOnly) {
OverflowOplog retryOplog = null;
long offset = 0;
@@ -326,22 +261,19 @@ class OverflowOplog implements CompactableOplog, Flushable {
BytesAndBits bb = null;
long start = this.stats.startRead();
- // Asif: If the offset happens to be -1, still it is possible that
+ // If the offset happens to be -1, still it is possible that
// the data is present in the current oplog file.
if (offset == -1) {
- // Asif: Since it is given that a get operation has alreadty
+ // Since it is given that a get operation has alreadty
// taken a
// lock on an entry , no put operation could have modified the
// oplog ID
// there fore synchronization is not needed
// synchronized (id) {
- // if (id.getOplogId() == this.oplogId) {
offset = id.getOffsetInOplog();
- // }
- // }
}
- // Asif :If the current OpLog is not destroyed ( its opLogRaf file
+ // If the current OpLog is not destroyed ( its opLogRaf file
// is still open) we can retrieve the value from this oplog.
try {
bb = basicGet(dr, offset, bitOnly, id.getValueLength(), id.getUserBits());
@@ -351,22 +283,18 @@ class OverflowOplog implements CompactableOplog, Flushable {
id), dae);
throw dae;
}
- // Asif: If bb is still null then entry has been compacted to the Htree
+ // If bb is still null then entry has been compacted to the Htree
// or in case of concurrent get & put , to a new OpLog ( Concurrent Get
// &
// Put is not possible at this point).
- // Asif: Since the compacter takes a lock on Entry as well as DiskId , the
+ // Since the compacter takes a lock on Entry as well as DiskId , the
// situation below
// will not be possible and hence commenting the code
- /*
- * if (bb == null) { // TODO: added by mitul, remove it later Assert.assertTrue(id.getOplogId()
- * != this.oplogId);
- */
if (bb == null) {
throw new EntryDestroyedException(
LocalizedStrings.Oplog_NO_VALUE_WAS_FOUND_FOR_ENTRY_WITH_DISK_ID_0_ON_A_REGION_WITH_SYNCHRONOUS_WRITING_SET_TO_1
- .toLocalizedString(new Object[] {id, Boolean.valueOf(dr.isSync())}));
+ .toLocalizedString(new Object[] {id, dr.isSync()}));
}
if (bitOnly) {
dr.endRead(start, this.stats.endRead(start, 1), 1);
@@ -374,7 +302,6 @@ class OverflowOplog implements CompactableOplog, Flushable {
dr.endRead(start, this.stats.endRead(start, bb.getBytes().length), bb.getBytes().length);
}
return bb;
-
}
/**
@@ -384,17 +311,14 @@ class OverflowOplog implements CompactableOplog, Flushable {
* HTree with the oplog being destroyed
*
* @param id A DiskId object for which the value on disk will be fetched
- *
*/
- public final BytesAndBits getNoBuffer(DiskRegion dr, DiskId id) {
+ public BytesAndBits getNoBuffer(DiskRegion dr, DiskId id) {
if (logger.isTraceEnabled()) {
logger.trace("Oplog::getNoBuffer:Before invoking Oplog.basicGet for DiskID ={}", id);
}
try {
- BytesAndBits bb =
- basicGet(dr, id.getOffsetInOplog(), false, id.getValueLength(), id.getUserBits());
- return bb;
+ return basicGet(dr, id.getOffsetInOplog(), false, id.getValueLength(), id.getUserBits());
} catch (DiskAccessException dae) {
logger.error(LocalizedMessage.create(
LocalizedStrings.Oplog_OPLOGGETNOBUFFEREXCEPTION_IN_RETRIEVING_VALUE_FROM_DISK_FOR_DISKID_0,
@@ -415,7 +339,6 @@ class OverflowOplog implements CompactableOplog, Flushable {
/**
* Call this when the cache is closed or region is destroyed. Deletes the lock files and if it is
* Overflow only, deletes the oplog file as well
- *
*/
public void close() {
if (this.closed) {
@@ -525,21 +448,16 @@ class OverflowOplog implements CompactableOplog, Flushable {
/**
* Modifies a key/value pair from a region entry on disk. Updates all of the necessary
* {@linkplain DiskStoreStats statistics} and invokes basicModify
+ * <p>
+ * Modified the code so as to reuse the already created ByteBuffer during transition. Minimizing
+ * the synchronization allowing multiple put operations for different entries to proceed
+ * concurrently for asynch mode
*
* @param entry DiskEntry object representing the current Entry
* @param value byte array representing the value
- *
- * @throws DiskAccessException
- * @throws IllegalStateException
- */
- /*
- * Asif: Modified the code so as to reuse the already created ByteBuffer during transition.
- * Minimizing the synchronization allowing multiple put operations for different entries to
- * proceed concurrently for asynch mode
- *
* @return true if modify was done; false if this file did not have room
*/
- public final boolean modify(DiskRegion dr, DiskEntry entry, ValueWrapper value, boolean async) {
+ public boolean modify(DiskRegion dr, DiskEntry entry, ValueWrapper value, boolean async) {
try {
byte userBits = calcUserBits(value);
return basicModify(entry, value, userBits, async);
@@ -557,7 +475,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
}
- public final boolean copyForwardForOverflowCompact(DiskEntry entry, byte[] value, int length,
+ public boolean copyForwardForOverflowCompact(DiskEntry entry, byte[] value, int length,
byte userBits) {
try {
ValueWrapper vw = new DiskEntry.Helper.CompactorValueWrapper(value, length);
@@ -578,15 +496,13 @@ class OverflowOplog implements CompactableOplog, Flushable {
/**
- * Asif: A helper function which identifies whether to modify the entry in the current oplog or to
- * make the switch to the next oplog. This function enables us to reuse the byte buffer which got
+ * A helper function which identifies whether to modify the entry in the current oplog or to make
+ * the switch to the next oplog. This function enables us to reuse the byte buffer which got
* created for an oplog which no longer permits us to use itself. It will also take acre of
* compaction if required
*
* @param entry DiskEntry object representing the current Entry
* @return true if modify was done; false if this file did not have room
- * @throws IOException
- * @throws InterruptedException
*/
private boolean basicModify(DiskEntry entry, ValueWrapper value, byte userBits, boolean async)
throws IOException, InterruptedException {
@@ -654,7 +570,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
*
* @param entry DiskEntry object on which remove operation is called
*/
- public final void remove(DiskRegion dr, DiskEntry entry) {
+ public void remove(DiskRegion dr, DiskEntry entry) {
try {
basicRemove(dr, entry);
} catch (IOException ex) {
@@ -672,14 +588,11 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- *
- * Asif: A helper function which identifies whether to record a removal of entry in the current
- * oplog or to make the switch to the next oplog. This function enables us to reuse the byte
- * buffer which got created for an oplog which no longer permits us to use itself.
+ * A helper function which identifies whether to record a removal of entry in the current oplog or
+ * to make the switch to the next oplog. This function enables us to reuse the byte buffer which
+ * got created for an oplog which no longer permits us to use itself.
*
* @param entry DiskEntry object representing the current Entry
- * @throws IOException
- * @throws InterruptedException
*/
private void basicRemove(DiskRegion dr, DiskEntry entry)
throws IOException, InterruptedException {
@@ -700,23 +613,17 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
}
-
- // /**
- // * This is only used for an assertion check.
- // */
- // private long lastWritePos = -1;
-
/**
* test hook
*/
- public final ByteBuffer getWriteBuf() {
+ public ByteBuffer getWriteBuf() {
return this.crf.writeBuf;
}
private static final int MAX_CHANNEL_RETRIES = 5;
@Override
- public final void flush() throws IOException {
+ public void flush() throws IOException {
final OplogFile olf = this.crf;
synchronized (olf) {
if (olf.RAFClosed) {
@@ -780,7 +687,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
@Override
- public final void flush(ByteBuffer b1, ByteBuffer b2) throws IOException {
+ public void flush(ByteBuffer b1, ByteBuffer b2) throws IOException {
final OplogFile olf = this.crf;
synchronized (olf) {
if (olf.RAFClosed) {
@@ -809,7 +716,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
}
- public final void flushAll() {
+ public void flushAll() {
try {
flush();
} catch (IOException ex) {
@@ -820,13 +727,13 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Since the ByteBuffer being writen to can have additional bytes which are used for
- * extending the size of the file, it is necessary that the ByteBuffer provided should have limit
- * which is set to the position till which it contains the actual bytes. If the mode is synched
- * write then only we will write up to the capacity & opLogSpace variable have any meaning. For
- * asynch mode it will be zero. Also this method must be synchronized on the file , whether we use
- * synch or asynch write because the fault in operations can clash with the asynch writing. Write
- * the specified bytes to the oplog. Note that since extending a file is expensive this code will
+ * Since the ByteBuffer being writen to can have additional bytes which are used for extending the
+ * size of the file, it is necessary that the ByteBuffer provided should have limit which is set
+ * to the position till which it contains the actual bytes. If the mode is synched write then only
+ * we will write up to the capacity & opLogSpace variable have any meaning. For asynch mode it
+ * will be zero. Also this method must be synchronized on the file , whether we use synch or
+ * asynch write because the fault in operations can clash with the asynch writing. Write the
+ * specified bytes to the oplog. Note that since extending a file is expensive this code will
* possibly write OPLOG_EXTEND_SIZE zero bytes to reduce the number of times the file is extended.
*
*
@@ -843,7 +750,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
Assert.assertTrue(false, toString() + " for store " + this.parent.getName()
+ " has been closed for synch mode while writing is going on. This should not happen");
}
- // Asif : It is assumed that the file pointer is already at the
+ // It is assumed that the file pointer is already at the
// appropriate position in the file so as to allow writing at the end.
// Any fault in operations will set the pointer back to the write location.
// Also it is only in case of synch writing, we are writing more
@@ -892,30 +799,24 @@ class OverflowOplog implements CompactableOplog, Flushable {
private BytesAndBits attemptGet(DiskRegionView dr, long offsetInOplog, int valueLength,
byte userBits) throws IOException {
synchronized (this.crf) {
- // if (this.closed || this.deleted.get()) {
- // throw new DiskAccessException("attempting get on "
- // + (this.deleted.get() ? "destroyed" : "closed")
- // + " oplog #" + getOplogId(), this.owner);
- // }
- final long readPosition = offsetInOplog;
- assert readPosition >= 0;
+ assert offsetInOplog >= 0;
RandomAccessFile myRAF = this.crf.raf;
BytesAndBits bb = null;
long writePosition = 0;
if (!this.doneAppending) {
writePosition = myRAF.getFilePointer();
- bb = attemptWriteBufferGet(writePosition, readPosition, valueLength, userBits);
+ bb = attemptWriteBufferGet(writePosition, offsetInOplog, valueLength, userBits);
if (bb == null) {
if (/*
* !getParent().isSync() since compactor groups writes &&
- */ (readPosition + valueLength) > this.crf.bytesFlushed && !this.closed) {
+ */ (offsetInOplog + valueLength) > this.crf.bytesFlushed && !this.closed) {
flushAll(); // fix for bug 41205
writePosition = myRAF.getFilePointer();
}
}
}
if (bb == null) {
- myRAF.seek(readPosition);
+ myRAF.seek(offsetInOplog);
try {
this.stats.incOplogSeeks();
byte[] valueBytes = new byte[valueLength];
@@ -965,7 +866,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Extracts the Value byte array & UserBit from the OpLog
+ * Extracts the Value byte array & UserBit from the OpLog
*
* @param offsetInOplog The starting position from which to read the data in the opLog
* @param bitOnly boolean indicating whether the value needs to be extracted along with the
@@ -996,7 +897,8 @@ class OverflowOplog implements CompactableOplog, Flushable {
try {
bb = attemptGet(dr, offsetInOplog, valueLength, userBits);
break;
- } catch (InterruptedIOException e) { // bug 39756
+ } catch (InterruptedIOException ignore) {
+ // bug 39756
// ignore, we'll clear and retry.
} finally {
if (interrupted) {
@@ -1007,10 +909,8 @@ class OverflowOplog implements CompactableOplog, Flushable {
} catch (IOException ex) {
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FROM_0_OPLOGID_1_OFFSET_BEING_READ_2_CURRENT_OPLOG_SIZE_3_ACTUAL_FILE_SIZE_4_IS_ASYNCH_MODE_5_IS_ASYNCH_WRITER_ALIVE_6
- .toLocalizedString(new Object[] {this.diskFile.getPath(),
- Long.valueOf(this.oplogId), Long.valueOf(offsetInOplog),
- Long.valueOf(this.crf.currSize), Long.valueOf(this.crf.bytesFlushed),
- Boolean.valueOf(!dr.isSync()), Boolean.valueOf(false)}),
+ .toLocalizedString(this.diskFile.getPath(), (long) this.oplogId, offsetInOplog,
+ this.crf.currSize, this.crf.bytesFlushed, !dr.isSync(), false),
ex, dr.getName());
} catch (IllegalStateException ex) {
checkClosed();
@@ -1082,6 +982,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
* The HighWaterMark of recentValues.
*/
private final AtomicLong totalCount = new AtomicLong(0);
+
/**
* The number of records in this oplog that contain the most recent value of the entry.
*/
@@ -1146,8 +1047,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
tlc = 0;
}
double rv = tlc;
- double rvHWM = rvHWMtmp;
- if (((rv / rvHWM) * 100) <= parent.getCompactionThreshold()) {
+ if (((rv / (double) rvHWMtmp) * 100) <= parent.getCompactionThreshold()) {
return true;
}
} else {
@@ -1199,10 +1099,6 @@ class OverflowOplog implements CompactableOplog, Flushable {
getOplogSet().addOverflowToBeCompacted(this);
}
- private GemFireCacheImpl getGemFireCache() {
- return this.parent.getCache();
- }
-
long testGetOplogFileLength() throws IOException {
long result = 0;
@@ -1212,29 +1108,10 @@ class OverflowOplog implements CompactableOplog, Flushable {
return result;
}
- private final OplogFile getOLF() {
+ private OplogFile getOLF() {
return this.crf;
}
- // // Comparable code //
- // public int compareTo(Oplog o) {
- // return getOplogId() - o.getOplogId();
- // }
- // public boolean equals(Object o) {
- // if (o instanceof Oplog) {
- // return compareTo((Oplog)o) == 0;
- // } else {
- // return false;
- // }
- // }
- // public int hashCode() {
- // return getOplogId();
- // }
-
- // //////// Methods used during recovery //////////////
-
- // ////////////////////Inner Classes //////////////////////
-
private static class OplogFile {
public File f;
public RandomAccessFile raf;
@@ -1251,14 +1128,17 @@ class OverflowOplog implements CompactableOplog, Flushable {
*/
private class OpState {
private byte userBits;
+
/**
* How many bytes it will be when serialized
*/
private int size;
+
private boolean needsValue;
+
private ValueWrapper value;
- public final int getSize() {
+ public int getSize() {
return this.size;
}
@@ -1269,7 +1149,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
this.value = null;
}
- private final void write(ValueWrapper vw) throws IOException {
+ private void write(ValueWrapper vw) throws IOException {
vw.sendTo(getOLF().writeBuf, OverflowOplog.this);
}
@@ -1329,7 +1209,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
this.compacting = true;
}
- private final static ThreadLocal isCompactorThread = new ThreadLocal();
+ private static final ThreadLocal isCompactorThread = new ThreadLocal();
private boolean calledByCompactorThread() {
if (!this.compacting)
@@ -1361,7 +1241,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
handleNoLiveValues();
return 0;
}
- // Asif:Start with a fresh wrapper on every compaction so that
+ // Start with a fresh wrapper on every compaction so that
// if previous run used some high memory byte array which was
// exceptional, it gets garbage collected.
long opStart = getStats().getStatTime();
@@ -1433,7 +1313,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
totalCount++;
getStats().endCompactionUpdate(opStart);
opStart = getStats().getStatTime();
- // Asif: Check if the value byte array happens to be any of the constant
+ // Check if the value byte array happens to be any of the constant
// static byte arrays or references the value byte array of underlying RegionEntry.
// If so for preventing data corruption across regions
// ( in case of static byte arrays) & for RegionEntry,
@@ -1459,10 +1339,10 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- * Asif:This function retrieves the value for an entry being compacted subject to entry
- * referencing the oplog being compacted. Attempt is made to retrieve the value from in memory ,
- * if available, else from asynch buffers ( if asynch mode is enabled), else from the Oplog being
- * compacted. It is invoked from switchOplog as well as OplogCompactor's compact function.
+ * This function retrieves the value for an entry being compacted subject to entry referencing the
+ * oplog being compacted. Attempt is made to retrieve the value from in memory , if available,
+ * else from asynch buffers ( if asynch mode is enabled), else from the Oplog being compacted. It
+ * is invoked from switchOplog as well as OplogCompactor's compact function.
*
* @param entry DiskEntry being compacted referencing the Oplog being compacted
* @param wrapper Object of type BytesAndBitsForCompactor. The data if found is set in the wrapper
@@ -1477,7 +1357,7 @@ class OverflowOplog implements CompactableOplog, Flushable {
long oplogOffset = did.getOffsetInOplog();
boolean foundData = false;
if (entry.isValueNull()) {
- // Asif: If the mode is synch it is guaranteed to be present in the disk
+ // If the mode is synch it is guaranteed to be present in the disk
foundData = basicGetForCompactor(oplogOffset, false, did.getValueLength(), did.getUserBits(),
wrapper);
// after we have done the get do one more check to see if the
@@ -1518,8 +1398,8 @@ class OverflowOplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Extracts the Value byte array & UserBit from the OpLog and inserts it in the wrapper
- * Object of type BytesAndBitsForCompactor which is passed
+ * Extracts the Value byte array & UserBit from the OpLog and inserts it in the wrapper Object of
+ * type BytesAndBitsForCompactor which is passed
*
* @param offsetInOplog The starting position from which to read the data in the opLog
* @param bitOnly boolean indicating whether the value needs to be extracted along with the
@@ -1547,33 +1427,26 @@ class OverflowOplog implements CompactableOplog, Flushable {
} else {
try {
synchronized (this.crf) {
- final long readPosition = offsetInOplog;
if (/*
* !getParent().isSync() since compactor groups writes &&
- */ (readPosition + valueLength) > this.crf.bytesFlushed && !this.closed) {
+ */ (offsetInOplog + valueLength) > this.crf.bytesFlushed && !this.closed) {
flushAll(); // fix for bug 41205
}
final long writePosition =
(this.doneAppending) ? this.crf.bytesFlushed : this.crf.raf.getFilePointer();
- if ((readPosition + valueLength) > writePosition) {
+ if ((offsetInOplog + valueLength) > writePosition) {
throw new DiskAccessException(
LocalizedStrings.Oplog_TRIED_TO_SEEK_TO_0_BUT_THE_FILE_LENGTH_IS_1_OPLOG_FILE_OBJECT_USED_FOR_READING_2
- .toLocalizedString(
- new Object[] {readPosition + valueLength, writePosition, this.crf.raf}),
+ .toLocalizedString(offsetInOplog + valueLength, writePosition, this.crf.raf),
getParent().getName());
- } else if (readPosition < 0) {
+ } else if (offsetInOplog < 0) {
throw new DiskAccessException(
LocalizedStrings.Oplog_CANNOT_FIND_RECORD_0_WHEN_READING_FROM_1.toLocalizedString(
- new Object[] {Long.valueOf(offsetInOplog), this.diskFile.getPath()}),
+ offsetInOplog, this.diskFile.getPath()),
getParent().getName());
}
- // if (this.closed || this.deleted.get()) {
- // throw new DiskAccessException("attempting get on "
- // + (this.deleted.get() ? "destroyed" : "closed")
- // + " oplog #" + getOplogId(), this.owner);
- // }
try {
- this.crf.raf.seek(readPosition);
+ this.crf.raf.seek(offsetInOplog);
this.stats.incOplogSeeks();
byte[] valueBytes = null;
if (wrapper.getBytes().length < valueLength) {
@@ -1601,10 +1474,8 @@ class OverflowOplog implements CompactableOplog, Flushable {
} catch (IOException ex) {
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FROM_0_OPLOG_DETAILS_1_2_3_4_5_6
- .toLocalizedString(new Object[] {this.diskFile.getPath(),
- Long.valueOf(this.oplogId), Long.valueOf(offsetInOplog),
- Long.valueOf(this.crf.currSize), Long.valueOf(this.crf.bytesFlushed),
- Boolean.valueOf(/* !dr.isSync() @todo */false), Boolean.valueOf(false)}),
+ .toLocalizedString(this.diskFile.getPath(), (long) this.oplogId, offsetInOplog,
+ this.crf.currSize, this.crf.bytesFlushed, false, false),
ex, getParent().getName());
} catch (IllegalStateException ex) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
index d2f44e8..12d0a97 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
@@ -22,7 +22,6 @@ import org.apache.geode.cache.PartitionedRegionStorageException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.persistence.PartitionOfflineException;
-import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -1394,7 +1393,7 @@ public class PRHARedundancyProvider {
chosen = 0;
} else {
// Pick one (at random)
- chosen = PartitionedRegion.rand.nextInt(bestStores.size());
+ chosen = PartitionedRegion.RANDOM.nextInt(bestStores.size());
}
DataStoreBuckets aDataStore = bestStores.get(chosen);
return aDataStore.memberId;
@@ -1524,7 +1523,7 @@ public class PRHARedundancyProvider {
public void scheduleRedundancyRecovery(Object failedMemId) {
final boolean isStartup = failedMemId == null ? true : false;
- final GemFireCacheImpl cache = this.prRegion.getCache();
+ final InternalCache cache = this.prRegion.getCache();
final int redundantCopies = PRHARedundancyProvider.this.prRegion.getRedundantCopies();
final long delay;
final boolean movePrimaries;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PRQueryProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PRQueryProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PRQueryProcessor.java
index 6df3971..9c7815f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PRQueryProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PRQueryProcessor.java
@@ -14,13 +14,42 @@
*/
package org.apache.geode.internal.cache;
+import static java.lang.Integer.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.InternalGemFireException;
import org.apache.geode.cache.CacheRuntimeException;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.cache.query.QueryInvocationTargetException;
import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.internal.*;
+import org.apache.geode.cache.query.internal.CompiledSelect;
+import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.cache.query.internal.ExecutionContext;
+import org.apache.geode.cache.query.internal.IndexTrackingQueryObserver;
+import org.apache.geode.cache.query.internal.NWayMergeResults;
+import org.apache.geode.cache.query.internal.QueryExecutionContext;
+import org.apache.geode.cache.query.internal.QueryMonitor;
+import org.apache.geode.cache.query.internal.QueryObserver;
+import org.apache.geode.cache.query.internal.QueryObserverHolder;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.Assert;
@@ -30,32 +59,22 @@ import org.apache.geode.internal.cache.PartitionedRegionQueryEvaluator.PRQueryRe
import org.apache.geode.internal.cache.execute.BucketMovedException;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.*;
-
/**
* This class takes the responsibility of executing the query on a data store for the buckets
- * specified in bucketList. It contains a <code>PRQueryExecutor</code> thread-pool executor that
- * takes a <code>Callable</code> task identified by <code>PartitionedRegion</code>, queryString and
- * bucketId.
+ * specified in bucketList. It contains a {@code PRQueryExecutor} thread-pool executor that takes a
+ * {@code Callable} task identified by {@code PartitionedRegion}, queryString and bucketId.
*
* The QueryTasks add results directly to a results queue. The BucketQueryResult is used not only to
* indicate completion, and holds an exception if there one occurred while processing a query.
- *
*/
public class PRQueryProcessor {
private static final Logger logger = LogService.getLogger();
final static int BUCKET_QUERY_TIMEOUT = 60;
- public final static int NUM_THREADS = Integer
- .getInteger(DistributionConfig.GEMFIRE_PREFIX + "PRQueryProcessor.numThreads", 1).intValue();
+ public final static int NUM_THREADS =
+ getInteger(DistributionConfig.GEMFIRE_PREFIX + "PRQueryProcessor.numThreads", 1);
/* For Test purpose */
public static int TEST_NUM_THREADS = 0;
@@ -69,14 +88,13 @@ public class PRQueryProcessor {
private volatile ObjectType resultType = null;
private boolean isIndexUsedForLocalQuery = false;
- // private List _failedBuckets;
public PRQueryProcessor(PartitionedRegionDataStore prDS, DefaultQuery query, Object[] parameters,
List<Integer> buckets) {
Assert.assertTrue(!buckets.isEmpty(), "bucket list can not be empty. ");
this._prds = prDS;
this._bucketsToQuery = buckets;
- ((GemFireCacheImpl) prDS.partitionedRegion.getCache()).getLocalQueryService();
+ prDS.partitionedRegion.getCache().getLocalQueryService();
this.query = query;
this.parameters = parameters;
PRQueryExecutor.initializeExecutorService();
@@ -104,7 +122,6 @@ public class PRQueryProcessor {
* Executes a pre-compiled query on a data store. Adds result objects to resultQueue
*
* @return boolean true if the result is a struct type
- * @throws QueryException
* @throws ForceReattemptException if query should be tried again
*/
public boolean executeQuery(Collection<Collection> resultCollector)
@@ -115,7 +132,7 @@ public class PRQueryProcessor {
// ((IndexTrackingQueryObserver)observer).setIndexInfo(resultCollector.getIndexInfoMap());
// }
- if (NUM_THREADS > 1 || this.TEST_NUM_THREADS > 1) {
+ if (NUM_THREADS > 1 || TEST_NUM_THREADS > 1) {
executeWithThreadPool(resultCollector);
} else {
executeSequentially(resultCollector, this._bucketsToQuery);
@@ -139,7 +156,6 @@ public class PRQueryProcessor {
try {
futures = execService.invokeAll(callableTasks, 300, TimeUnit.SECONDS);
} catch (RejectedExecutionException rejectedExecutionEx) {
- // this._prds.partitionedRegion.checkReadiness();
throw rejectedExecutionEx;
}
@@ -166,7 +182,7 @@ public class PRQueryProcessor {
} catch (TimeoutException e) {
throw new InternalGemFireException(
LocalizedStrings.PRQueryProcessor_TIMED_OUT_WHILE_EXECUTING_QUERY_TIME_EXCEEDED_0
- .toLocalizedString(Integer.valueOf(BUCKET_QUERY_TIMEOUT)),
+ .toLocalizedString(BUCKET_QUERY_TIMEOUT),
e);
} catch (ExecutionException ee) {
Throwable cause = ee.getCause();
@@ -217,8 +233,8 @@ public class PRQueryProcessor {
if (pr.isLocallyDestroyed || pr.isClosed) {
throw new RegionDestroyedException("PR destroyed during query", pr.getFullPath());
} else {
- throw new ForceReattemptException("Bucket id " + pr.bucketStringForLogs(bId.intValue())
- + " not found on VM " + pr.getMyId());
+ throw new ForceReattemptException(
+ "Bucket id " + pr.bucketStringForLogs(bId) + " not found on VM " + pr.getMyId());
}
}
bukRegion.waitForData();
@@ -254,7 +270,7 @@ public class PRQueryProcessor {
// Avoid if query is distinct as this Integer could be a region value.
if (!query.getSimpleSelect().isDistinct() && query.getSimpleSelect().isCount()
&& r instanceof Integer) {
- if (((Integer) r).intValue() != 0) {
+ if ((Integer) r != 0) {
rq.put(r);
}
} else {
@@ -268,7 +284,7 @@ public class PRQueryProcessor {
}
}
}
- rq.put(new EndOfBucket(bId.intValue()));
+ rq.put(new EndOfBucket(bId));
this.incNumBucketsProcessed();
return; // success
}
@@ -298,8 +314,8 @@ public class PRQueryProcessor {
throw new RegionDestroyedException("PR destroyed during query", pr.getFullPath());
}
pr.checkReadiness();
- throw new ForceReattemptException("Bucket id " + pr.bucketStringForLogs(bId.intValue())
- + " not found on VM " + pr.getMyId());
+ throw new ForceReattemptException(
+ "Bucket id " + pr.bucketStringForLogs(bId) + " not found on VM " + pr.getMyId());
}
}
@@ -342,9 +358,8 @@ public class PRQueryProcessor {
}
}
- NWayMergeResults mergedResults = new NWayMergeResults(sortedResults, cs.isDistinct(), limit,
- cs.getOrderByAttrs(), context, cs.getElementTypeForOrderByQueries());
- return mergedResults;
+ return new NWayMergeResults(sortedResults, cs.isDistinct(), limit, cs.getOrderByAttrs(),
+ context, cs.getElementTypeForOrderByQueries());
}
@@ -367,15 +382,10 @@ public class PRQueryProcessor {
Object results = query.executeUsingContext(context);
synchronized (resultCollector) {
- // TODO:Asif: In what situation would the results object itself be undefined?
+ // TODO: In what situation would the results object itself be undefined?
// The elements of the results can be undefined , but not the resultset itself
- /*
- * if (results == QueryService.UNDEFINED) {
- * resultCollector.add(Collections.singleton(results)); } else {
- */
this.resultType = ((SelectResults) results).getCollectionType().getElementType();
- resultCollector.add((SelectResults) results);
- // }
+ resultCollector.add((Collection) results);
}
isIndexUsedForLocalQuery = ((QueryExecutionContext) context).isIndexUsed();
@@ -435,7 +445,7 @@ public class PRQueryProcessor {
/**
* Closes the executor service. This is called from
- * {@link PartitionedRegion#afterRegionsClosedByCacheClose(GemFireCacheImpl)}
+ * {@link PartitionedRegion#afterRegionsClosedByCacheClose(InternalCache)}
*/
static synchronized void shutdown() {
if (execService != null) {
@@ -541,8 +551,7 @@ public class PRQueryProcessor {
// ((IndexTrackingQueryObserver)observer).setIndexInfo(resultColl.getIndexInfoMap());
}
- final Integer bId = Integer.valueOf(this._bucketId);
- List<Integer> bucketList = Collections.singletonList(bId);
+ List<Integer> bucketList = Collections.singletonList(this._bucketId);
ExecutionContext context =
new QueryExecutionContext(this.parameters, pr.getCache(), this.query);
context.setBucketList(bucketList);
@@ -571,11 +580,6 @@ public class PRQueryProcessor {
private Exception _ex = null;
public boolean retry = false;
- /**
- * Constructor
- *
- * @param bukId
- */
public BucketQueryResult(int bukId) {
this._buk = bukId;
}
@@ -593,7 +597,7 @@ public class PRQueryProcessor {
}
public Integer getBucketId() {
- return Integer.valueOf(this._buk);
+ return valueOf(this._buk);
}
public boolean isReattemptNeeded() {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java
index a25d4ca..35374d7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionAttributesImpl.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -182,13 +179,15 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
}
/**
- * Constructs an instance of <code>PartitionAttributes</code> with default settings.
+ * Constructs an instance of {@code PartitionAttributes} with default settings.
*
* @see PartitionAttributesFactory
*/
- public PartitionAttributesImpl() {}
-
+ public PartitionAttributesImpl() {
+ // do nothing
+ }
+ @Override
public PartitionResolver getPartitionResolver() {
return this.partitionResolver;
}
@@ -211,31 +210,22 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
this.hasPartitionListeners = true;
}
- // public ExpirationAttributes getEntryTimeToLive()
- // {
- // return new ExpirationAttributes(this.entryTimeToLiveExpiration.getTimeout(),
- // this.entryTimeToLiveExpiration.getAction());
- // }
- //
- // public ExpirationAttributes getEntryIdleTimeout()
- // {
- // return new ExpirationAttributes(this.entryIdleTimeoutExpiration.getTimeout(),
- // this.entryIdleTimeoutExpiration.getAction());
- // }
-
+ @Override
public int getRedundantCopies() {
return this.redundancy;
}
+ @Override
public int getTotalNumBuckets() {
return this.totalNumBuckets;
}
- // deprecated method
+ @Override
public long getTotalSize() {
return this.getTotalMaxMemory();
}
+ @Override
public long getTotalMaxMemory() {
return this.totalMaxMemory;
}
@@ -253,10 +243,12 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
* DistributedSystem has not yet been created)
* @see #getLocalMaxMemoryForValidation()
*/
+ @Override
public int getLocalMaxMemory() {
if (this.offHeap && !this.localMaxMemoryExists) {
int value = computeOffHeapLocalMaxMemory();
- if (this.localMaxMemoryExists) { // real value now exists so set it and return
+ if (this.localMaxMemoryExists) {
+ // real value now exists so set it and return
this.localMaxMemory = value;
}
}
@@ -269,8 +261,8 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
* DistributedSystem has not yet been created)
*/
private void checkLocalMaxMemoryExists() {
- if (this.offHeap && !this.localMaxMemoryExists) { // real value does NOT yet exist so throw
- // IllegalStateException
+ if (this.offHeap && !this.localMaxMemoryExists) {
+ // real value does NOT yet exist so throw IllegalStateException
throw new IllegalStateException(
"Attempting to use localMaxMemory for off-heap but value is not yet known (default value is equal to off-heap-memory-size)");
}
@@ -295,32 +287,39 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
return this.localMaxMemory;
}
+ @Override
public String getColocatedWith() {
return this.colocatedRegionName;
}
+ @Override
public Properties getLocalProperties() {
return this.localProperties;
}
+ @Override
public Properties getGlobalProperties() {
return this.globalProperties;
}
+ @Override
public long getStartupRecoveryDelay() {
return startupRecoveryDelay;
}
+ @Override
public long getRecoveryDelay() {
return recoveryDelay;
}
+ @Override
public List<FixedPartitionAttributesImpl> getFixedPartitionAttributes() {
return this.fixedPAttrs;
}
private static final PartitionListener[] EMPTY_PARTITION_LISTENERS = new PartitionListener[0];
+ @Override
public PartitionListener[] getPartitionListeners() {
ArrayList<PartitionListener> listeners = this.partitionListeners;
if (listeners == null) {
@@ -352,7 +351,8 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
} catch (CloneNotSupportedException e) {
throw new InternalGemFireError(
LocalizedStrings.PartitionAttributesImpl_CLONENOTSUPPORTEDEXCEPTION_THROWN_IN_CLASS_THAT_IMPLEMENTS_CLONEABLE
- .toLocalizedString());
+ .toLocalizedString(),
+ e);
}
}
@@ -362,8 +362,8 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
@Override
public String toString() {
- StringBuffer s = new StringBuffer();
- return s.append("PartitionAttributes@").append(System.identityHashCode(this))
+ StringBuilder sb = new StringBuilder();
+ return sb.append("PartitionAttributes@").append(System.identityHashCode(this))
.append("[redundantCopies=").append(getRedundantCopies()).append(";localMaxMemory=")
.append(getLocalMaxMemory()).append(";totalMaxMemory=").append(this.totalMaxMemory)
.append(";totalNumBuckets=").append(this.totalNumBuckets).append(";partitionResolver=")
@@ -378,6 +378,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
* @throws IllegalStateException if off-heap and the actual value is not yet known (because the
* DistributedSystem has not yet been created)
*/
+ @Override
public void toData(DataOutput out) throws IOException {
checkLocalMaxMemoryExists();
out.writeInt(this.redundancy);
@@ -393,6 +394,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
DataSerializer.writeObject(this.fixedPAttrs, out);
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.redundancy = in.readInt();
this.totalMaxMemory = in.readLong();
@@ -436,8 +438,6 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
|| this.totalMaxMemory != other.getTotalMaxMemory()
|| this.startupRecoveryDelay != other.getStartupRecoveryDelay()
|| this.recoveryDelay != other.getRecoveryDelay()
- // || ! this.localProperties.equals(other.getLocalProperties())
- // || ! this.globalProperties.equals(other.getGlobalProperties())
|| ((this.partitionResolver == null) != (other.getPartitionResolver() == null))
|| (this.partitionResolver != null
&& !this.partitionResolver.equals(other.getPartitionResolver()))
@@ -447,7 +447,6 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
|| ((this.fixedPAttrs == null) != (other.getFixedPartitionAttributes() == null))
|| (this.fixedPAttrs != null
&& !this.fixedPAttrs.equals(other.getFixedPartitionAttributes()))) {
- // throw new RuntimeException("this="+this.toString() + " other=" + other.toString());
return false;
}
@@ -457,12 +456,12 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
if (otherPListeners.length != thisPListeners.length) {
return false;
}
- Set<String> otherListenerClassName = new HashSet<String>();
+ Set<String> otherListenerClassName = new HashSet<>();
for (int i = 0; i < otherPListeners.length; i++) {
PartitionListener listener = otherPListeners[i];
otherListenerClassName.add(listener.getClass().getName());
}
- Set<String> thisListenerClassName = new HashSet<String>();
+ Set<String> thisListenerClassName = new HashSet<>();
for (int i = 0; i < thisPListeners.length; i++) {
PartitionListener listener = thisPListeners[i];
thisListenerClassName.add(listener.getClass().getName());
@@ -517,7 +516,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
if (propVal != null) {
try {
setTotalMaxMemory(Integer.parseInt(propVal));
- } catch (RuntimeException e) {
+ } catch (RuntimeException ignore) {
this.totalMaxMemory = PartitionAttributesFactory.GLOBAL_MAX_MEMORY_DEFAULT;
}
}
@@ -525,7 +524,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
if (propVal != null) {
try {
this.setTotalNumBuckets(Integer.parseInt(propVal));
- } catch (RuntimeException e) {
+ } catch (RuntimeException ignore) {
this.totalNumBuckets = PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_DEFAULT;
}
}
@@ -533,7 +532,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
public void addFixedPartitionAttributes(FixedPartitionAttributes fpa) {
if (this.fixedPAttrs == null) {
- this.fixedPAttrs = new ArrayList<FixedPartitionAttributesImpl>(1);
+ this.fixedPAttrs = new ArrayList<>(1);
this.fixedPAttrs.add((FixedPartitionAttributesImpl) fpa);
this.hasFixedPAttrs = true;
} else {
@@ -562,12 +561,12 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
if ((this.totalNumBuckets <= 0)) {
throw new IllegalStateException(
LocalizedStrings.PartitionAttributesImpl_TOTALNUMBICKETS_0_IS_AN_ILLEGAL_VALUE_PLEASE_CHOOSE_A_VALUE_GREATER_THAN_0
- .toLocalizedString(Integer.valueOf(this.totalNumBuckets)));
+ .toLocalizedString(this.totalNumBuckets));
}
if ((this.redundancy < 0) || (this.redundancy >= 4)) {
throw new IllegalStateException(
LocalizedStrings.PartitionAttributesImpl_REDUNDANTCOPIES_0_IS_AN_ILLEGAL_VALUE_PLEASE_CHOOSE_A_VALUE_BETWEEN_0_AND_3
- .toLocalizedString(Integer.valueOf(this.redundancy)));
+ .toLocalizedString(this.redundancy));
}
for (Iterator it = this.getLocalProperties().keySet().iterator(); it.hasNext();) {
String propName = (String) it.next();
@@ -660,29 +659,27 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
Cache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
Region<?, ?> region = cache.getRegion(this.colocatedRegionName);
- {
- if (region == null) {
- throw new IllegalStateException(
- LocalizedStrings.PartitionAttributesImpl_REGION_SPECIFIED_IN_COLOCATEDWITH_IS_NOT_PRESENT_IT_SHOULD_BE_CREATED_BEFORE_SETTING_COLOCATED_WITH_THIS_REGION
- .toLocalizedString());
- }
- if (!(region instanceof PartitionedRegion)) {
- throw new IllegalStateException(
- LocalizedStrings.PartitionAttributesImpl_SETTING_THE_ATTRIBUTE_COLOCATEDWITH_IS_SUPPORTED_ONLY_FOR_PARTITIONEDREGIONS
- .toLocalizedString());
- }
- PartitionedRegion colocatedRegion = (PartitionedRegion) region;
- if (this.getTotalNumBuckets() != colocatedRegion.getPartitionAttributes()
- .getTotalNumBuckets()) {
- throw new IllegalStateException(
- LocalizedStrings.PartitionAttributesImpl_CURRENT_PARTITIONEDREGIONS_TOTALNUMBUCKETS_SHOULD_BE_SAME_AS_TOTALNUMBUCKETS_OF_COLOCATED_PARTITIONEDREGION
- .toLocalizedString());
- }
- if (this.getRedundancy() != colocatedRegion.getPartitionAttributes().getRedundantCopies()) {
- throw new IllegalStateException(
- LocalizedStrings.PartitionAttributesImpl_CURRENT_PARTITIONEDREGIONS_REDUNDANCY_SHOULD_BE_SAME_AS_THE_REDUNDANCY_OF_COLOCATED_PARTITIONEDREGION
- .toLocalizedString());
- }
+ if (region == null) {
+ throw new IllegalStateException(
+ LocalizedStrings.PartitionAttributesImpl_REGION_SPECIFIED_IN_COLOCATEDWITH_IS_NOT_PRESENT_IT_SHOULD_BE_CREATED_BEFORE_SETTING_COLOCATED_WITH_THIS_REGION
+ .toLocalizedString());
+ }
+ if (!(region instanceof PartitionedRegion)) {
+ throw new IllegalStateException(
+ LocalizedStrings.PartitionAttributesImpl_SETTING_THE_ATTRIBUTE_COLOCATEDWITH_IS_SUPPORTED_ONLY_FOR_PARTITIONEDREGIONS
+ .toLocalizedString());
+ }
+ PartitionedRegion colocatedRegion = (PartitionedRegion) region;
+ if (this.getTotalNumBuckets() != colocatedRegion.getPartitionAttributes()
+ .getTotalNumBuckets()) {
+ throw new IllegalStateException(
+ LocalizedStrings.PartitionAttributesImpl_CURRENT_PARTITIONEDREGIONS_TOTALNUMBUCKETS_SHOULD_BE_SAME_AS_TOTALNUMBUCKETS_OF_COLOCATED_PARTITIONEDREGION
+ .toLocalizedString());
+ }
+ if (this.getRedundancy() != colocatedRegion.getPartitionAttributes().getRedundantCopies()) {
+ throw new IllegalStateException(
+ LocalizedStrings.PartitionAttributesImpl_CURRENT_PARTITIONEDREGIONS_REDUNDANCY_SHOULD_BE_SAME_AS_THE_REDUNDANCY_OF_COLOCATED_PARTITIONEDREGION
+ .toLocalizedString());
}
}
}
@@ -732,7 +729,7 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
}
@SuppressWarnings("unchecked")
- public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) {
+ public void setAll(PartitionAttributes pa) {
setRedundantCopies(pa.getRedundantCopies());
setLocalProperties(pa.getLocalProperties());
setGlobalProperties(pa.getGlobalProperties());
@@ -767,12 +764,11 @@ public class PartitionAttributesImpl implements PartitionAttributes, Cloneable,
long availableOffHeapMemoryInMB = 0;
if (testAvailableOffHeapMemory != null) {
availableOffHeapMemoryInMB =
- OffHeapStorage.parseOffHeapMemorySize(testAvailableOffHeapMemory) / (1024 * 1024);
+ OffHeapStorage.parseOffHeapMemorySize(testAvailableOffHeapMemory) / (1024 << 10);
} else if (InternalDistributedSystem.getAnyInstance() == null) {
this.localMaxMemoryExists = false;
- return OFF_HEAP_LOCAL_MAX_MEMORY_PLACEHOLDER; // fix 52033: return non-negative, non-zero
- // temporary placeholder for
- // offHeapLocalMaxMemory
+ // fix 52033: return non-negative, non-zero temporary placeholder for offHeapLocalMaxMemory
+ return OFF_HEAP_LOCAL_MAX_MEMORY_PLACEHOLDER;
} else {
String offHeapSizeConfigValue =
InternalDistributedSystem.getAnyInstance().getOriginalConfig().getOffHeapMemorySize();
[03/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index 2b847d0..f6450f7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.management.internal.beans;
+import static org.apache.geode.internal.lang.SystemUtils.getLineSeparator;
+
import org.apache.geode.Statistics;
import org.apache.geode.StatisticsType;
import org.apache.geode.cache.CacheClosedException;
@@ -319,16 +321,9 @@ public class MemberMBeanBridge {
logger.info(LogMarker.CONFIG, "Command Service could not be initialized. {}", e.getMessage());
} catch (DependenciesNotFoundException e) {
commandServiceInitError = e.getMessage();
- if (CacheServerLauncher.isDedicatedCacheServer) {
- // log as error for dedicated cache server - launched through script
- // LOG:CONFIG:
- logger.info(LogMarker.CONFIG, "Command Service could not be initialized. {}",
- e.getMessage());
- } else {
- // LOG:CONFIG:
- logger.info(LogMarker.CONFIG, "Command Service could not be initialized. {}",
- e.getMessage());
- }
+ // log as error for dedicated cache server - launched through script
+ // LOG:CONFIG:
+ logger.info(LogMarker.CONFIG, "Command Service could not be initialized. {}", e.getMessage());
}
intitGemfireProperties();
@@ -336,7 +331,7 @@ public class MemberMBeanBridge {
try {
InetAddress addr = SocketCreator.getLocalHost();
this.hostname = addr.getHostName();
- } catch (UnknownHostException ex) {
+ } catch (UnknownHostException ignore) {
this.hostname = ManagementConstants.DEFAULT_HOST_NAME;
}
@@ -787,13 +782,13 @@ public class MemberMBeanBridge {
try {
maxFileDescriptorCount =
(Long) mbeanServer.getAttribute(osObjectName, "MaxFileDescriptorCount");
- } catch (Exception e) {
+ } catch (Exception ignore) {
maxFileDescriptorCount = -1;
}
try {
committedVirtualMemorySize =
(Long) mbeanServer.getAttribute(osObjectName, "CommittedVirtualMemorySize");
- } catch (Exception e) {
+ } catch (Exception ignore) {
committedVirtualMemorySize = -1;
}
@@ -804,23 +799,23 @@ public class MemberMBeanBridge {
try {
totalPhysicalMemorySize =
systemStat.get(StatsKey.LINUX_SYSTEM_PHYSICAL_MEMORY).longValue();
- } catch (Exception e) {
+ } catch (Exception ignore) {
totalPhysicalMemorySize = -1;
}
try {
freePhysicalMemorySize = systemStat.get(StatsKey.LINUX_SYSTEM_FREE_MEMORY).longValue();
- } catch (Exception e) {
+ } catch (Exception ignore) {
freePhysicalMemorySize = -1;
}
try {
totalSwapSpaceSize = systemStat.get(StatsKey.LINUX_SYSTEM_TOTAL_SWAP_SIZE).longValue();
- } catch (Exception e) {
+ } catch (Exception ignore) {
totalSwapSpaceSize = -1;
}
try {
freeSwapSpaceSize = systemStat.get(StatsKey.LINUX_SYSTEM_FREE_SWAP_SIZE).longValue();
- } catch (Exception e) {
+ } catch (Exception ignore) {
freeSwapSpaceSize = -1;
}
@@ -877,9 +872,9 @@ public class MemberMBeanBridge {
List<String> compactedStores = new ArrayList<String>();
if (cache != null && !cache.isClosed()) {
- for (DiskStoreImpl store : cacheImpl.listDiskStoresIncludingRegionOwned()) {
+ for (DiskStore store : cacheImpl.listDiskStoresIncludingRegionOwned()) {
if (store.forceCompaction()) {
- compactedStores.add(store.getPersistentID().getDirectory());
+ compactedStores.add(((DiskStoreImpl) store).getPersistentID().getDirectory());
}
}
@@ -897,7 +892,7 @@ public class MemberMBeanBridge {
public String[] listDiskStores(boolean includeRegionOwned) {
GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache;
String[] retStr = null;
- Collection<DiskStoreImpl> diskCollection = null;
+ Collection<DiskStore> diskCollection = null;
if (includeRegionOwned) {
diskCollection = cacheImpl.listDiskStoresIncludingRegionOwned();
} else {
@@ -905,7 +900,7 @@ public class MemberMBeanBridge {
}
if (diskCollection != null && diskCollection.size() > 0) {
retStr = new String[diskCollection.size()];
- Iterator<DiskStoreImpl> it = diskCollection.iterator();
+ Iterator<DiskStore> it = diskCollection.iterator();
int i = 0;
while (it.hasNext()) {
retStr[i] = it.next().getName();
@@ -965,13 +960,14 @@ public class MemberMBeanBridge {
return LocalizedStrings.SystemMemberImpl_NO_LOG_FILE_CONFIGURED_LOG_MESSAGES_WILL_BE_DIRECTED_TO_STDOUT
.toLocalizedString();
} else {
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
if (mainTail != null) {
result.append(mainTail);
}
if (childTail != null) {
- result.append(
- "\n" + LocalizedStrings.SystemMemberImpl_TAIL_OF_CHILD_LOG.toLocalizedString() + "\n");
+ result.append(getLineSeparator())
+ .append(LocalizedStrings.SystemMemberImpl_TAIL_OF_CHILD_LOG.toLocalizedString())
+ .append(getLineSeparator());
result.append(childTail);
}
return result.toString();
@@ -993,7 +989,7 @@ public class MemberMBeanBridge {
try {
// Allow the Function call to exit
Thread.sleep(1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
}
ConnectionTable.threadWantsSharedResources();
if (ids.isConnected()) {
@@ -1021,8 +1017,8 @@ public class MemberMBeanBridge {
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
if (cache != null) {
- Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned();
- for (DiskStoreImpl store : diskStores) {
+ Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
+ for (DiskStore store : diskStores) {
store.flush();
}
}
@@ -1201,8 +1197,7 @@ public class MemberMBeanBridge {
*/
public long getTotalBytesInUse() {
MemoryUsage memHeap = memoryMXBean.getHeapMemoryUsage();
- long bytesUsed = memHeap.getUsed();
- return bytesUsed;
+ return memHeap.getUsed();
}
/**
@@ -1334,9 +1329,8 @@ public class MemberMBeanBridge {
return false;
}
try {
- boolean isManager = service.isManager();
- return isManager;
- } catch (Exception e) {
+ return service.isManager();
+ } catch (Exception ignore) {
return false;
}
}
@@ -1354,22 +1348,18 @@ public class MemberMBeanBridge {
}
try {
return service.isManagerCreated();
- } catch (Exception e) {
+ } catch (Exception ignore) {
return false;
}
}
/**
- *
* @return true if member has a server
*/
public boolean isServer() {
return cache.isServer();
}
- /** Statistics Related Attributes **/
- /*********************************************************************************************************/
-
public int getInitialImageKeysReceived() {
return getMemberLevelStatistic(StatsKey.GET_INITIAL_IMAGE_KEYS_RECEIVED).intValue();
}
@@ -1701,7 +1691,7 @@ public class MemberMBeanBridge {
try {
maxFileDescriptorCount =
(Long) mbeanServer.getAttribute(osObjectName, "MaxFileDescriptorCount");
- } catch (Exception e) {
+ } catch (Exception ignore) {
maxFileDescriptorCount = -1;
}
return maxFileDescriptorCount;
@@ -1729,11 +1719,17 @@ public class MemberMBeanBridge {
return objects;
}
+ /**
+ * @deprecated Please use {@link #getOffHeapFreeMemory()} instead.
+ */
@Deprecated
public long getOffHeapFreeSize() {
return getOffHeapFreeMemory();
}
+ /**
+ * @deprecated Please use {@link #getOffHeapUsedMemory()} instead.
+ */
@Deprecated
public long getOffHeapUsedSize() {
return getOffHeapUsedMemory();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ConfigurationRequestHandler.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ConfigurationRequestHandler.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ConfigurationRequestHandler.java
index 6495d09..201bcd6 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ConfigurationRequestHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ConfigurationRequestHandler.java
@@ -48,7 +48,7 @@ public class ConfigurationRequestHandler implements TcpHandler {
try {
logger.info("Received request for configuration : {}", request);
ConfigurationRequest configRequest = (ConfigurationRequest) request;
- return sharedConfig.createConfigurationReponse(configRequest);
+ return sharedConfig.createConfigurationResponse(configRequest);
} catch (Exception e) {
logger.info(e.getMessage(), e);
return null;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/PdxInstanceFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/PdxInstanceFactory.java b/geode-core/src/main/java/org/apache/geode/pdx/PdxInstanceFactory.java
index d458a22..2214456 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/PdxInstanceFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/PdxInstanceFactory.java
@@ -16,7 +16,6 @@ package org.apache.geode.pdx;
import java.util.Date;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.RegionService;
/**
@@ -41,7 +40,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>char</code>.
+ * {@code char}.
* <p>
* Java char is mapped to .NET System.Char.
*
@@ -55,7 +54,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>boolean</code>.
+ * {@code boolean}.
* <p>
* Java boolean is mapped to .NET System.Boolean.
*
@@ -69,7 +68,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>byte</code>.
+ * {@code byte}.
* <p>
* Java byte is mapped to .NET System.SByte.
*
@@ -83,7 +82,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>short</code>.
+ * {@code short}.
* <p>
* Java short is mapped to .NET System.Int16.
*
@@ -97,7 +96,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>int</code>.
+ * {@code int}.
* <p>
* Java int is mapped to .NET System.Int32.
*
@@ -111,7 +110,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>long</code>.
+ * {@code long}.
* <p>
* Java long is mapped to .NET System.Int64.
*
@@ -125,7 +124,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>float</code>.
+ * {@code float}.
* <p>
* Java float is mapped to .NET System.Float.
*
@@ -139,7 +138,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>double</code>.
+ * {@code double}.
* <p>
* Java double is mapped to .NET System.Double.
*
@@ -153,7 +152,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>Date</code>.
+ * {@code Date}.
* <p>
* Java Date is mapped to .NET System.DateTime.
*
@@ -167,7 +166,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>String</code>.
+ * {@code String}.
* <p>
* Java String is mapped to .NET System.String.
*
@@ -181,7 +180,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>Object</code>.
+ * {@code Object}.
* <p>
* It is best to use one of the other writeXXX methods if your field type will always be XXX. This
* method allows the field value to be anything that is an instance of Object. This gives you more
@@ -201,16 +200,16 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>Object</code>.
+ * {@code Object}.
* <p>
* It is best to use one of the other writeXXX methods if your field type will always be XXX. This
* method allows the field value to be anything that is an instance of Object. This gives you more
* flexibility but more space is used to store the serialized field.
* <p>
* Note that some Java objects serialized with this method may not be compatible with non-java
- * languages. To ensure that only portable objects are serialized set the
- * <code>checkPortability</code> parameter to true. The following is a list of the Java classes
- * that are portable and the .NET class they are mapped to:
+ * languages. To ensure that only portable objects are serialized set the {@code checkPortability}
+ * parameter to true. The following is a list of the Java classes that are portable and the .NET
+ * class they are mapped to:
* <ul>
* <li>instances of {@link PdxSerializable}: .NET class of same name
* <li>instances of {@link PdxInstance}: .NET class of same name
@@ -235,10 +234,10 @@ public interface PdxInstanceFactory {
* <li>double[]: System.Double[]
* <li>String[]: System.String[]
* <li>byte[][]: System.Byte[][]
- * <li>Object[]: System.Collections.Generic.List<Object>
- * <li>java.util.HashMap: System.Collections.Generics.IDictionary<Object, Object>
+ * <li>Object[]: System.Collections.Generic.List<Object>
+ * <li>java.util.HashMap: System.Collections.Generics.IDictionary<Object, Object>
* <li>java.util.Hashtable: System.Collections.Hashtable
- * <li>java.util.ArrayList: System.Collections.Generic.IList<Object>
+ * <li>java.util.ArrayList: System.Collections.Generic.IList<Object>
* <li>java.util.Vector: System.Collections.ArrayList
* <li>java.util.HashSet: CacheableHashSet
* <li>java.util.LinkedHashSet: CacheableLinkedHashSet
@@ -259,7 +258,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>boolean[]</code>.
+ * {@code boolean[]}.
* <p>
* Java boolean[] is mapped to .NET System.Boolean[].
*
@@ -273,7 +272,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>char[]</code>.
+ * {@code char[]}.
* <p>
* Java char[] is mapped to .NET System.Char[].
*
@@ -287,7 +286,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>byte[]</code>.
+ * {@code byte[]}.
* <p>
* Java byte[] is mapped to .NET System.Byte[].
*
@@ -301,7 +300,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>short[]</code>.
+ * {@code short[]}.
* <p>
* Java short[] is mapped to .NET System.Int16[].
*
@@ -315,7 +314,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>int[]</code>.
+ * {@code int[]}.
* <p>
* Java int[] is mapped to .NET System.Int32[].
*
@@ -329,7 +328,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>long[]</code>.
+ * {@code long[]}.
* <p>
* Java long[] is mapped to .NET System.Int64[].
*
@@ -343,7 +342,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>float[]</code>.
+ * {@code float[]}.
* <p>
* Java float[] is mapped to .NET System.Float[].
*
@@ -357,7 +356,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>double[]</code>.
+ * {@code double[]}.
* <p>
* Java double[] is mapped to .NET System.Double[].
*
@@ -371,7 +370,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>String[]</code>.
+ * {@code String[]}.
* <p>
* Java String[] is mapped to .NET System.String[].
*
@@ -385,12 +384,12 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>Object[]</code>.
+ * {@code Object[]}.
* <p>
- * Java Object[] is mapped to .NET System.Collections.Generic.List<Object>. For how each element
- * of the array is a mapped to .NET see {@link #writeObject(String, Object, boolean) writeObject}.
- * Note that this call may serialize elements that are not compatible with non-java languages. To
- * ensure that only portable objects are serialized use
+ * Java Object[] is mapped to .NET System.Collections.Generic.List<Object>. For how each
+ * element of the array is a mapped to .NET see {@link #writeObject(String, Object, boolean)
+ * writeObject}. Note that this call may serialize elements that are not compatible with non-java
+ * languages. To ensure that only portable objects are serialized use
* {@link #writeObjectArray(String, Object[], boolean)}.
*
* @param fieldName the name of the field to write
@@ -403,13 +402,13 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>Object[]</code>.
+ * {@code Object[]}.
* <p>
- * Java Object[] is mapped to .NET System.Collections.Generic.List<Object>. For how each element
- * of the array is a mapped to .NET see {@link #writeObject(String, Object, boolean) writeObject}.
- * Note that this call may serialize elements that are not compatible with non-java languages. To
- * ensure that only portable objects are serialized use
- * {@link #writeObjectArray(String, Object[], boolean)}.
+ * Java Object[] is mapped to .NET System.Collections.Generic.List<Object>. For how each
+ * element of the array is a mapped to .NET see {@link #writeObject(String, Object, boolean)
+ * writeObject}. Note that this call may serialize elements that are not compatible with non-java
+ * languages. To ensure that only portable objects are serialized use
+ * {@code writeObjectArray(String, Object[], boolean)}.
*
* @param fieldName the name of the field to write
* @param value the value of the field to write
@@ -427,7 +426,7 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value to the serialized form. The fields type is
- * <code>byte[][]</code>.
+ * {@code byte[][]}.
* <p>
* Java byte[][] is mapped to .NET System.Byte[][].
*
@@ -441,8 +440,8 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value and type to the serialized form. This method uses
- * the <code>fieldType</code> to determine which writeXXX method it should call. If it can not
- * find a specific match to a writeXXX method it will call {@link #writeObject(String, Object)
+ * the {@code fieldType} to determine which writeXXX method it should call. If it can not find a
+ * specific match to a writeXXX method it will call {@link #writeObject(String, Object)
* writeObject}. This method may serialize objects that are not portable to non-java languages. To
* ensure that only objects that are portable to non-java languages are serialized use
* {@link #writeField(String, Object, Class, boolean)} instead.
@@ -476,7 +475,7 @@ public interface PdxInstanceFactory {
*
* @param fieldName the name of the field to write
* @param fieldValue the value of the field to write; this parameter's class must extend the
- * <code>fieldType</code>
+ * {@code fieldType}
* @param fieldType the type of the field to write
* @return this PdxInstanceFactory
* @throws PdxFieldAlreadyExistsException if the named field has already been written
@@ -487,11 +486,10 @@ public interface PdxInstanceFactory {
/**
* Writes the named field with the given value and type to the serialized form. This method uses
- * the <code>fieldType</code> to determine which writeXXX method it should call. If it can not
- * find a specific match to a writeXXX method it will call
- * {@link #writeObject(String, Object, boolean) writeObject}. To ensure that only objects that are
- * portable to non-java languages are serialized set the <code>checkPortability</code> parameter
- * to true.
+ * the {@code fieldType} to determine which writeXXX method it should call. If it can not find a
+ * specific match to a writeXXX method it will call {@link #writeObject(String, Object, boolean)
+ * writeObject}. To ensure that only objects that are portable to non-java languages are
+ * serialized set the {@code checkPortability} parameter to true.
* <p>
* The fieldTypes that map to a specific method are:
* <ul>
@@ -522,7 +520,7 @@ public interface PdxInstanceFactory {
*
* @param fieldName the name of the field to write
* @param fieldValue the value of the field to write; this parameter's class must extend the
- * <code>fieldType</code>
+ * {@code fieldType}
* @param fieldType the type of the field to write
* @param checkPortability if true then an exception is thrown if a non-portable object is
* serialized
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/internal/ClientTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/ClientTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/ClientTypeRegistration.java
index 8c48473..c10de03 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/ClientTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/ClientTypeRegistration.java
@@ -36,7 +36,7 @@ import org.apache.geode.cache.client.internal.GetPDXTypeByIdOp;
import org.apache.geode.cache.client.internal.GetPDXTypesOp;
import org.apache.geode.cache.client.internal.PoolImpl;
import org.apache.geode.cache.wan.GatewaySender;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PoolManagerImpl;
import org.apache.geode.internal.logging.LogService;
@@ -44,9 +44,9 @@ public class ClientTypeRegistration implements TypeRegistration {
private static final Logger logger = LogService.getLogger();
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
- public ClientTypeRegistration(GemFireCacheImpl cache) {
+ public ClientTypeRegistration(InternalCache cache) {
this.cache = cache;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
index 5b82611..0609dd4 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
@@ -17,22 +17,19 @@ package org.apache.geode.pdx.internal;
import java.util.Map;
import org.apache.geode.cache.wan.GatewaySender;
-import org.apache.geode.internal.cache.CacheConfig;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A type registration that is used for loners. In the loner case, we'll try to be helpful and not
* decide what type registration to give the user until they actually use it.
- *
*/
public class LonerTypeRegistration implements TypeRegistration {
private volatile TypeRegistration delegate = null;
- private final GemFireCacheImpl cache;
-
+ private final InternalCache cache;
- public LonerTypeRegistration(GemFireCacheImpl cache) {
+ public LonerTypeRegistration(InternalCache cache) {
this.cache = cache;
}
@@ -104,10 +101,9 @@ public class LonerTypeRegistration implements TypeRegistration {
* Check to see if the current member is a loner and we can't tell if the user wants a peer or a
* client type registry.
*
- * @param cache
* @return true if this member is a loner and we can't determine what type of registry they want.
*/
- public static boolean isIndeterminateLoner(GemFireCacheImpl cache) {
+ public static boolean isIndeterminateLoner(InternalCache cache) {
boolean isLoner = cache.getInternalDistributedSystem().isLoner();
boolean pdxConfigured = cache.getPdxPersistent();
return isLoner && !pdxConfigured/* && !hasGateways */;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceFactoryImpl.java
index 6d2e906..08e3364 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceFactoryImpl.java
@@ -14,15 +14,13 @@
*/
package org.apache.geode.pdx.internal;
-import java.nio.ByteBuffer;
import java.util.Date;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.tcp.ByteBufferInputStream.ByteSourceFactory;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxInstanceFactory;
-import org.apache.geode.pdx.PdxUnreadFields;
/**
* PdxInstances created with this factory can never be deserialized but you can access their fields
@@ -32,26 +30,27 @@ import org.apache.geode.pdx.PdxUnreadFields;
* PdxType is expensive since it can never figure out it is already defined without doing an
* expensive check in the type registry. We should optimize this before making this a public
* feature.
- *
*/
public class PdxInstanceFactoryImpl implements PdxInstanceFactory {
private final PdxWriterImpl writer;
+
private boolean created = false;
private PdxInstanceFactoryImpl(String name, boolean expectDomainClass) {
- PdxOutputStream os = new PdxOutputStream();
- PdxType pt = new PdxType(name, expectDomainClass);
- GemFireCacheImpl gfc = GemFireCacheImpl
+ PdxOutputStream pdxOutputStream = new PdxOutputStream();
+ PdxType pdxType = new PdxType(name, expectDomainClass);
+ InternalCache internalCache = GemFireCacheImpl
.getForPdx("PDX registry is unavailable because the Cache has been closed.");
- TypeRegistry tr = gfc.getPdxRegistry();
- this.writer = new PdxWriterImpl(pt, tr, os);
+ TypeRegistry pdxRegistry = internalCache.getPdxRegistry();
+ this.writer = new PdxWriterImpl(pdxType, pdxRegistry, pdxOutputStream);
}
public static PdxInstanceFactory newCreator(String name, boolean expectDomainClass) {
return new PdxInstanceFactoryImpl(name, expectDomainClass);
}
+ @Override
public PdxInstance create() {
if (this.created) {
throw new IllegalStateException("The create method can only be called once.");
@@ -61,135 +60,149 @@ public class PdxInstanceFactoryImpl implements PdxInstanceFactory {
return this.writer.makePdxInstance();
}
+ @Override
public PdxInstanceFactory writeChar(String fieldName, char value) {
this.writer.writeChar(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeBoolean(String fieldName, boolean value) {
this.writer.writeBoolean(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeByte(String fieldName, byte value) {
this.writer.writeByte(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeShort(String fieldName, short value) {
this.writer.writeShort(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeInt(String fieldName, int value) {
this.writer.writeInt(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeLong(String fieldName, long value) {
this.writer.writeLong(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeFloat(String fieldName, float value) {
this.writer.writeFloat(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeDouble(String fieldName, double value) {
this.writer.writeDouble(fieldName, value);
return this;
}
- public PdxInstanceFactory writeDate(String fieldName, Date date) {
- this.writer.writeDate(fieldName, date);
+ @Override
+ public PdxInstanceFactory writeDate(String fieldName, Date value) {
+ this.writer.writeDate(fieldName, value);
return this;
}
+ @Override
public PdxInstanceFactory writeString(String fieldName, String value) {
this.writer.writeString(fieldName, value);
return this;
}
- public PdxInstanceFactory writeObject(String fieldName, Object object) {
- return writeObject(fieldName, object, false);
+ @Override
+ public PdxInstanceFactory writeObject(String fieldName, Object value) {
+ return writeObject(fieldName, value, false);
}
- public PdxInstanceFactory writeBooleanArray(String fieldName, boolean[] array) {
- this.writer.writeBooleanArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeBooleanArray(String fieldName, boolean[] value) {
+ this.writer.writeBooleanArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeCharArray(String fieldName, char[] array) {
- this.writer.writeCharArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeCharArray(String fieldName, char[] value) {
+ this.writer.writeCharArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeByteArray(String fieldName, byte[] array) {
- this.writer.writeByteArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeByteArray(String fieldName, byte[] value) {
+ this.writer.writeByteArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeShortArray(String fieldName, short[] array) {
- this.writer.writeShortArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeShortArray(String fieldName, short[] value) {
+ this.writer.writeShortArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeIntArray(String fieldName, int[] array) {
- this.writer.writeIntArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeIntArray(String fieldName, int[] value) {
+ this.writer.writeIntArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeLongArray(String fieldName, long[] array) {
- this.writer.writeLongArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeLongArray(String fieldName, long[] value) {
+ this.writer.writeLongArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeFloatArray(String fieldName, float[] array) {
- this.writer.writeFloatArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeFloatArray(String fieldName, float[] value) {
+ this.writer.writeFloatArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeDoubleArray(String fieldName, double[] array) {
- this.writer.writeDoubleArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeDoubleArray(String fieldName, double[] value) {
+ this.writer.writeDoubleArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeStringArray(String fieldName, String[] array) {
- this.writer.writeStringArray(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeStringArray(String fieldName, String[] value) {
+ this.writer.writeStringArray(fieldName, value);
return this;
}
- public PdxInstanceFactory writeObjectArray(String fieldName, Object[] array) {
- return writeObjectArray(fieldName, array, false);
- }
-
- public PdxInstanceFactory writeUnreadFields(PdxUnreadFields unread) {
- this.writer.writeUnreadFields(unread);
- return this;
+ @Override
+ public PdxInstanceFactory writeObjectArray(String fieldName, Object[] value) {
+ return writeObjectArray(fieldName, value, false);
}
- public PdxInstanceFactory writeRaw(PdxField field, ByteBuffer rawData) {
- this.writer.writeRawField(field, ByteSourceFactory.create(rawData));
- return this;
- }
-
-
- public PdxInstanceFactory writeArrayOfByteArrays(String fieldName, byte[][] array) {
- this.writer.writeArrayOfByteArrays(fieldName, array);
+ @Override
+ public PdxInstanceFactory writeArrayOfByteArrays(String fieldName, byte[][] value) {
+ this.writer.writeArrayOfByteArrays(fieldName, value);
return this;
}
+ @Override
public <CT, VT extends CT> PdxInstanceFactory writeField(String fieldName, VT fieldValue,
Class<CT> fieldType) {
return writeField(fieldName, fieldValue, fieldType, false);
}
+ @Override
public PdxInstanceFactory markIdentityField(String fieldName) {
this.writer.markIdentityField(fieldName);
return this;
}
+ @Override
public PdxInstanceFactory writeObject(String fieldName, Object value, boolean checkPortability) {
if (InternalDataSerializer.is662SerializationEnabled()) {
boolean alreadyInProgress = InternalDataSerializer.isPdxSerializationInProgress();
@@ -210,6 +223,7 @@ public class PdxInstanceFactoryImpl implements PdxInstanceFactory {
return this;
}
+ @Override
public PdxInstanceFactory writeObjectArray(String fieldName, Object[] value,
boolean checkPortability) {
if (InternalDataSerializer.is662SerializationEnabled()) {
@@ -230,6 +244,7 @@ public class PdxInstanceFactoryImpl implements PdxInstanceFactory {
return this;
}
+ @Override
public <CT, VT extends CT> PdxInstanceFactory writeField(String fieldName, VT fieldValue,
Class<CT> fieldType, boolean checkPortability) {
if (InternalDataSerializer.is662SerializationEnabled()) {
@@ -251,14 +266,14 @@ public class PdxInstanceFactoryImpl implements PdxInstanceFactory {
}
public static PdxInstance createPdxEnum(String className, String enumName, int enumOrdinal,
- GemFireCacheImpl gfc) {
+ InternalCache internalCache) {
if (className == null) {
throw new IllegalArgumentException("className must not be null");
}
if (enumName == null) {
throw new IllegalArgumentException("enumName must not be null");
}
- TypeRegistry tr = gfc.getPdxRegistry();
+ TypeRegistry tr = internalCache.getPdxRegistry();
EnumInfo ei = new EnumInfo(className, enumName, enumOrdinal);
return ei.getPdxInstance(tr.defineEnum(ei));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
index b4fa33e..6b22aac 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
@@ -23,14 +23,16 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.InternalGemFireError;
import org.apache.geode.InternalGemFireException;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheWriterException;
import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.EntryEvent;
-import org.apache.geode.cache.Operation;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionExistsException;
@@ -50,12 +52,9 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.internal.CopyOnWriteHashSet;
import org.apache.geode.internal.cache.DiskStoreImpl;
-import org.apache.geode.internal.cache.EntryEventImpl;
-import org.apache.geode.internal.cache.EnumListenerEvent;
-import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
-import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.logging.LogService;
@@ -63,23 +62,19 @@ import org.apache.geode.internal.util.concurrent.CopyOnWriteHashMap;
import org.apache.geode.pdx.JSONFormatter;
import org.apache.geode.pdx.PdxInitializationException;
import org.apache.geode.pdx.PdxRegistryMismatchException;
-import org.apache.logging.log4j.Logger;
-/**
- *
- */
public class PeerTypeRegistration implements TypeRegistration {
private static final Logger logger = LogService.getLogger();
- /**
- *
- */
private static final int MAX_TRANSACTION_FAILURES = 10;
+
public static final String LOCK_SERVICE_NAME = "__PDX";
+
/**
* The region name. Public for tests only.
*/
public static final String REGION_NAME = "PdxTypes";
+
public static final String REGION_FULL_PATH = "/" + REGION_NAME;
public static final int PLACE_HOLDER_FOR_TYPE_ID = 0xFFFFFF;
public static final int PLACE_HOLDER_FOR_DS_ID = 0xFF000000;
@@ -88,7 +83,7 @@ public class PeerTypeRegistration implements TypeRegistration {
private final int maxTypeId;
private volatile DistributedLockService dls;
private final Object dlsLock = new Object();
- private GemFireCacheImpl cache;
+ private InternalCache cache;
/**
* The region where the PDX metadata is stored. Because this region is transactional for our
@@ -111,10 +106,9 @@ public class PeerTypeRegistration implements TypeRegistration {
private volatile boolean typeRegistryInUse = false;
- public PeerTypeRegistration(GemFireCacheImpl cache) {
+ public PeerTypeRegistration(InternalCache cache) {
this.cache = cache;
-
int distributedSystemId =
cache.getInternalDistributedSystem().getDistributionManager().getDistributedSystemId();
if (distributedSystemId == -1) {
@@ -378,7 +372,7 @@ public class PeerTypeRegistration implements TypeRegistration {
verifyConfiguration();
Integer existingId = typeToId.get(newType);
if (existingId != null) {
- return existingId.intValue();
+ return existingId;
}
lock();
try {
@@ -392,8 +386,7 @@ public class PeerTypeRegistration implements TypeRegistration {
updateIdToTypeRegion(newType);
- typeToId.put(newType, Integer.valueOf(id));
- // this.cache.getLogger().info("Defining: " + newType, new RuntimeException("STACK"));
+ typeToId.put(newType, id);
return newType.getTypeId();
} finally {
@@ -537,10 +530,10 @@ public class PeerTypeRegistration implements TypeRegistration {
}
public boolean hasPersistentRegions() {
- Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned();
+ Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
boolean hasPersistentRegions = false;
- for (DiskStoreImpl store : diskStores) {
- hasPersistentRegions |= store.hasPersistedData();
+ for (DiskStore store : diskStores) {
+ hasPersistentRegions |= ((DiskStoreImpl) store).hasPersistedData();
}
return hasPersistentRegions;
}
@@ -574,7 +567,7 @@ public class PeerTypeRegistration implements TypeRegistration {
} else {
PdxType foundType = (PdxType) v;
Integer id = (Integer) k;
- int tmpDsId = PLACE_HOLDER_FOR_DS_ID & id.intValue();
+ int tmpDsId = PLACE_HOLDER_FOR_DS_ID & id;
if (tmpDsId == this.dsId) {
totalPdxTypeIdInDS++;
}
@@ -635,8 +628,7 @@ public class PeerTypeRegistration implements TypeRegistration {
private TXStateProxy suspendTX() {
Cache c = (Cache) getIdToType().getRegionService();
TXManagerImpl txManager = (TXManagerImpl) c.getCacheTransactionManager();
- TXStateProxy currentState = txManager.internalSuspend();
- return currentState;
+ return txManager.internalSuspend();
}
private void resumeTX(TXStateProxy state) {
@@ -759,8 +751,6 @@ public class PeerTypeRegistration implements TypeRegistration {
/**
* adds a PdxType for a field to a {@code className => Set<PdxType>} map
- *
- * @param type
*/
private void updateClassToTypeMap(PdxType type) {
if (type != null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
index ebca878..e245b34 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
@@ -14,6 +14,13 @@
*/
package org.apache.geode.pdx.internal;
+import static java.lang.Integer.*;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.DiskStoreFactory;
@@ -21,7 +28,7 @@ import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.concurrent.CopyOnWriteHashMap;
@@ -29,11 +36,6 @@ import org.apache.geode.internal.util.concurrent.CopyOnWriteWeakHashMap;
import org.apache.geode.pdx.PdxSerializationException;
import org.apache.geode.pdx.PdxSerializer;
import org.apache.geode.pdx.ReflectionBasedAutoSerializer;
-import org.apache.logging.log4j.Logger;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
public class TypeRegistry {
private static final Logger logger = LogService.getLogger();
@@ -41,31 +43,39 @@ public class TypeRegistry {
private static final boolean DISABLE_TYPE_REGISTRY =
Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "TypeRegistry.DISABLE_PDX_REGISTRY");
- private final Map<Integer, PdxType> idToType = new CopyOnWriteHashMap<Integer, PdxType>();
- private final Map<PdxType, Integer> typeToId = new CopyOnWriteHashMap<PdxType, Integer>();
- private final Map<Class<?>, PdxType> localTypeIds =
- new CopyOnWriteWeakHashMap<Class<?>, PdxType>();
+ private final Map<Integer, PdxType> idToType = new CopyOnWriteHashMap<>();
+
+ private final Map<PdxType, Integer> typeToId = new CopyOnWriteHashMap<>();
+
+ private final Map<Class<?>, PdxType> localTypeIds = new CopyOnWriteWeakHashMap<>();
+
private final Map<Class<?>, Map<Integer, UnreadPdxType>> localTypeIdMaps =
- new CopyOnWriteWeakHashMap<Class<?>, Map<Integer, UnreadPdxType>>();
+ new CopyOnWriteWeakHashMap<>();
+
private final WeakConcurrentIdentityHashMap<Object, PdxUnreadData> unreadDataMap =
WeakConcurrentIdentityHashMap.make();
- private final Map<Integer, EnumInfo> idToEnum = new CopyOnWriteHashMap<Integer, EnumInfo>();
- private final Map<EnumInfo, Integer> enumInfoToId = new CopyOnWriteHashMap<EnumInfo, Integer>();
- private final Map<Enum<?>, Integer> localEnumIds = new CopyOnWriteWeakHashMap<Enum<?>, Integer>();
+
+ private final Map<Integer, EnumInfo> idToEnum = new CopyOnWriteHashMap<>();
+
+ private final Map<EnumInfo, Integer> enumInfoToId = new CopyOnWriteHashMap<>();
+
+ private final Map<Enum<?>, Integer> localEnumIds = new CopyOnWriteWeakHashMap<>();
+
private final TypeRegistration distributedTypeRegistry;
- private final GemFireCacheImpl cache;
- public TypeRegistry(GemFireCacheImpl cache, boolean disableTypeRegistry) {
+ private final InternalCache cache;
+
+ public TypeRegistry(InternalCache cache, boolean disableTypeRegistry) {
this.cache = cache;
if (DISABLE_TYPE_REGISTRY || disableTypeRegistry) {
- distributedTypeRegistry = new NullTypeRegistration();
+ this.distributedTypeRegistry = new NullTypeRegistration();
} else if (cache.hasPool()) {
- distributedTypeRegistry = new ClientTypeRegistration(cache);
+ this.distributedTypeRegistry = new ClientTypeRegistration(cache);
} else if (LonerTypeRegistration.isIndeterminateLoner(cache)) {
- distributedTypeRegistry = new LonerTypeRegistration(cache);
+ this.distributedTypeRegistry = new LonerTypeRegistration(cache);
} else {
- distributedTypeRegistry = new PeerTypeRegistration(cache);
+ this.distributedTypeRegistry = new PeerTypeRegistration(cache);
}
}
@@ -77,7 +87,7 @@ public class TypeRegistry {
this.idToType.clear();
this.idToEnum.clear();
this.enumInfoToId.clear();
- distributedTypeRegistry.testClearRegistry();
+ this.distributedTypeRegistry.testClearRegistry();
}
public void testClearLocalTypeRegistry() {
@@ -86,17 +96,11 @@ public class TypeRegistry {
this.localEnumIds.clear();
}
- public static boolean mayNeedDiskStore(GemFireCacheImpl cache) {
- if (DISABLE_TYPE_REGISTRY) {
- return false;
- } else if (cache.hasPool()) {
- return false;
- } else {
- return cache.getPdxPersistent();
- }
+ public static boolean mayNeedDiskStore(InternalCache cache) {
+ return !DISABLE_TYPE_REGISTRY && !cache.hasPool() && cache.getPdxPersistent();
}
- public static String getPdxDiskStoreName(GemFireCacheImpl cache) {
+ public static String getPdxDiskStoreName(InternalCache cache) {
if (!mayNeedDiskStore(cache)) {
return null;
} else {
@@ -109,9 +113,9 @@ public class TypeRegistry {
}
public void initialize() {
- if (!cache.getPdxPersistent() || cache.getPdxDiskStore() == null
- || cache.findDiskStore(cache.getPdxDiskStore()) != null) {
- distributedTypeRegistry.initialize();
+ if (!this.cache.getPdxPersistent() || this.cache.getPdxDiskStore() == null
+ || this.cache.findDiskStore(this.cache.getPdxDiskStore()) != null) {
+ this.distributedTypeRegistry.initialize();
}
}
@@ -146,40 +150,39 @@ public class TypeRegistry {
return null;
}
-
- public PdxType getExistingType(Object o) {
+ PdxType getExistingType(Object o) {
return getExistingTypeForClass(o.getClass());
}
- public PdxType getExistingTypeForClass(Class<?> c) {
- return this.localTypeIds.get(c);
+ public PdxType getExistingTypeForClass(Class<?> aClass) {
+ return this.localTypeIds.get(aClass);
}
/**
* Returns the local type that should be used for deserializing blobs of the given typeId for the
* given local class. Returns null if no such local type exists.
*/
- public UnreadPdxType getExistingTypeForClass(Class<?> c, int typeId) {
- Map<Integer, UnreadPdxType> m = this.localTypeIdMaps.get(c);
- if (m != null) {
- return m.get(typeId);
+ UnreadPdxType getExistingTypeForClass(Class<?> aClass, int typeId) {
+ Map<Integer, UnreadPdxType> map = this.localTypeIdMaps.get(aClass);
+ if (map != null) {
+ return map.get(typeId);
} else {
return null;
}
}
- public void defineUnreadType(Class<?> c, UnreadPdxType unreadPdxType) {
+ void defineUnreadType(Class<?> aClass, UnreadPdxType unreadPdxType) {
int typeId = unreadPdxType.getTypeId();
// even though localTypeIdMaps is copy on write we need to sync it
// during write to safely update the nested map.
// We make the nested map copy-on-write so that readers don't need to sync.
synchronized (this.localTypeIdMaps) {
- Map<Integer, UnreadPdxType> m = this.localTypeIdMaps.get(c);
- if (m == null) {
- m = new CopyOnWriteHashMap<Integer, UnreadPdxType>();
- this.localTypeIdMaps.put(c, m);
+ Map<Integer, UnreadPdxType> map = this.localTypeIdMaps.get(aClass);
+ if (map == null) {
+ map = new CopyOnWriteHashMap<Integer, UnreadPdxType>();
+ this.localTypeIdMaps.put(aClass, map);
}
- m.put(typeId, unreadPdxType);
+ map.put(typeId, unreadPdxType);
}
}
@@ -189,11 +192,12 @@ public class TypeRegistry {
public int defineType(PdxType newType) {
Integer existingId = this.typeToId.get(newType);
if (existingId != null) {
- int eid = existingId.intValue();
+ int eid = existingId;
newType.setTypeId(eid);
return eid;
}
- int id = distributedTypeRegistry.defineType(newType);
+
+ int id = this.distributedTypeRegistry.defineType(newType);
newType.setTypeId(id);
PdxType oldType = this.idToType.get(id);
if (oldType == null) {
@@ -228,7 +232,7 @@ public class TypeRegistry {
/**
* Create a type id for a type that was generated locally.
*/
- public PdxType defineLocalType(Object o, PdxType newType) {
+ PdxType defineLocalType(Object o, PdxType newType) {
if (o != null) {
PdxType t = getExistingType(o);
if (t != null) {
@@ -244,7 +248,6 @@ public class TypeRegistry {
return newType;
}
-
/**
* Test hook that returns the most recently allocated type id
*
@@ -253,31 +256,32 @@ public class TypeRegistry {
* @return the most recently allocated type id
*/
public int getLastAllocatedTypeId() {
- return distributedTypeRegistry.getLastAllocatedTypeId();
+ return this.distributedTypeRegistry.getLastAllocatedTypeId();
}
public TypeRegistration getTypeRegistration() {
- return distributedTypeRegistry;
+ return this.distributedTypeRegistry;
}
public void gatewaySenderStarted(GatewaySender gatewaySender) {
- if (distributedTypeRegistry != null) {
- distributedTypeRegistry.gatewaySenderStarted(gatewaySender);
+ if (this.distributedTypeRegistry != null) {
+ this.distributedTypeRegistry.gatewaySenderStarted(gatewaySender);
}
}
public void creatingDiskStore(DiskStore dsi) {
- if (cache.getPdxDiskStore() != null && dsi.getName().equals(cache.getPdxDiskStore())) {
- distributedTypeRegistry.initialize();
+ if (this.cache.getPdxDiskStore() != null
+ && dsi.getName().equals(this.cache.getPdxDiskStore())) {
+ this.distributedTypeRegistry.initialize();
}
}
public void creatingPersistentRegion() {
- distributedTypeRegistry.creatingPersistentRegion();
+ this.distributedTypeRegistry.creatingPersistentRegion();
}
public void creatingPool() {
- distributedTypeRegistry.creatingPool();
+ this.distributedTypeRegistry.creatingPool();
}
// test hook
@@ -285,23 +289,24 @@ public class TypeRegistry {
this.localTypeIds.remove(o.getClass());
}
- public PdxUnreadData getUnreadData(Object o) {
+ PdxUnreadData getUnreadData(Object o) {
return this.unreadDataMap.get(o);
}
- public void putUnreadData(Object o, PdxUnreadData ud) {
+ void putUnreadData(Object o, PdxUnreadData ud) {
this.unreadDataMap.put(o, ud);
}
- private static final AtomicReference<PdxSerializer> pdxSerializer =
- new AtomicReference<PdxSerializer>(null);
- private static final AtomicReference<AutoSerializableManager> asm =
- new AtomicReference<AutoSerializableManager>(null);
+ private static final AtomicReference<PdxSerializer> pdxSerializer = new AtomicReference<>(null);
+
+ private static final AtomicReference<AutoSerializableManager> asm = new AtomicReference<>(null);
+
/**
* To fix bug 45116 we want any attempt to get the PdxSerializer after it has been closed to fail
* with an exception.
*/
private static volatile boolean open = false;
+
/**
* If the pdxSerializer is ever set to a non-null value then set this to true. It gets reset to
* false when init() is called. This was added to fix bug 45116.
@@ -357,10 +362,10 @@ public class TypeRegistry {
if (v != null) {
Integer id = this.localEnumIds.get(v);
if (id != null) {
- result = id.intValue();
+ result = id;
} else {
- result = distributedTypeRegistry.getEnumId(v);
- id = Integer.valueOf(result);
+ result = this.distributedTypeRegistry.getEnumId(v);
+ id = valueOf(result);
this.localEnumIds.put(v, id);
EnumInfo ei = new EnumInfo(v);
this.idToEnum.put(id, ei);
@@ -385,9 +390,9 @@ public class TypeRegistry {
public int defineEnum(EnumInfo newInfo) {
Integer existingId = this.enumInfoToId.get(newInfo);
if (existingId != null) {
- return existingId.intValue();
+ return existingId;
}
- int id = distributedTypeRegistry.defineEnum(newInfo);
+ int id = this.distributedTypeRegistry.defineEnum(newInfo);
EnumInfo oldInfo = this.idToEnum.get(id);
if (oldInfo == null) {
this.idToEnum.put(id, newInfo);
@@ -444,21 +449,20 @@ public class TypeRegistry {
* server side distributed system is cycled
*/
public void clear() {
- if (distributedTypeRegistry.isClient()) {
- idToType.clear();
- typeToId.clear();
- localTypeIds.clear();
- localTypeIdMaps.clear();
- unreadDataMap.clear();
- idToEnum.clear();
- enumInfoToId.clear();
- localEnumIds.clear();
+ if (this.distributedTypeRegistry.isClient()) {
+ this.idToType.clear();
+ this.typeToId.clear();
+ this.localTypeIds.clear();
+ this.localTypeIdMaps.clear();
+ this.unreadDataMap.clear();
+ this.idToEnum.clear();
+ this.enumInfoToId.clear();
+ this.localEnumIds.clear();
AutoSerializableManager autoSerializer = getAutoSerializableManager();
if (autoSerializer != null) {
autoSerializer.resetCachedTypes();
}
}
-
}
/**
@@ -467,7 +471,7 @@ public class TypeRegistry {
* @return the types
*/
public Map<Integer, PdxType> typeMap() {
- return distributedTypeRegistry.types();
+ return this.distributedTypeRegistry.types();
}
/**
@@ -476,7 +480,7 @@ public class TypeRegistry {
* @return the enums
*/
public Map<Integer, EnumInfo> enumMap() {
- return distributedTypeRegistry.enums();
+ return this.distributedTypeRegistry.enums();
}
/**
@@ -487,8 +491,8 @@ public class TypeRegistry {
* @return PdxType having the field or null if not found
*
*/
- public PdxType getPdxTypeForField(String fieldName, String className) {
- return distributedTypeRegistry.getPdxTypeForField(fieldName, className);
+ PdxType getPdxTypeForField(String fieldName, String className) {
+ return this.distributedTypeRegistry.getPdxTypeForField(fieldName, className);
}
public void addImportedType(int typeId, PdxType importedType) {
@@ -522,10 +526,10 @@ public class TypeRegistry {
* Get the size of the the type registry in this local member
*/
public int getLocalSize() {
- int result = distributedTypeRegistry.getLocalSize();
+ int result = this.distributedTypeRegistry.getLocalSize();
if (result == 0) {
// If this is the client, go ahead and return the number of cached types we have
- return idToType.size();
+ return this.idToType.size();
}
return result;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/CacheUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/CacheUtils.java b/geode-core/src/test/java/org/apache/geode/cache/query/CacheUtils.java
index da79ae0..e5fa846 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/CacheUtils.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/CacheUtils.java
@@ -12,49 +12,52 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * Utils.java
- *
- * Created on March 8, 2005, 4:16 PM
- */
package org.apache.geode.cache.query;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.LogWriter;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.query.types.CollectionType;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
+import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.GatewayException;
+import org.apache.geode.cache.RegionExistsException;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- *
- */
public class CacheUtils {
+ private static final Logger logger = LogService.getLogger();
- static Properties props = new Properties();
- static DistributedSystem ds;
- static volatile Cache cache;
+ private static Properties props = new Properties();
+ private static DistributedSystem ds;
+ static volatile InternalCache cache;
static QueryService qs;
static {
- try {
- init();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ init();
}
- static void init() throws Exception {
+ private static void init()
+ throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
if (GemFireCacheImpl.getInstance() == null) {
props.setProperty(MCAST_PORT, "0");
- cache = new CacheFactory(props).create();
+ cache = (InternalCache) new CacheFactory(props).create();
} else {
cache = GemFireCacheImpl.getInstance();
}
@@ -62,19 +65,19 @@ public class CacheUtils {
qs = cache.getQueryService();
}
- public static Cache getCache() {
+ public static InternalCache getCache() {
return cache;
}
public static void startCache() {
try {
if (cache.isClosed()) {
- cache = new CacheFactory(props).create();
+ cache = (InternalCache) new CacheFactory(props).create();
ds = cache.getDistributedSystem();
qs = cache.getQueryService();
}
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
}
@@ -84,7 +87,7 @@ public class CacheUtils {
cache.close();
}
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
}
@@ -93,11 +96,11 @@ public class CacheUtils {
if (!cache.isClosed()) {
cache.close();
}
- cache = new CacheFactory(props).create();
+ cache = (InternalCache) new CacheFactory(props).create();
ds = cache.getDistributedSystem();
qs = cache.getQueryService();
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
}
@@ -109,23 +112,20 @@ public class CacheUtils {
attributesFactory.setScope(scope);
}
RegionAttributes regionAttributes = attributesFactory.create();
- Region region = cache.createRegion(regionName, regionAttributes);
- return region;
+ return cache.createRegion(regionName, regionAttributes);
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
- return null;
}
+ // TODO: paramter flag is unused
public static Region createRegion(String regionName, RegionAttributes regionAttributes,
boolean flag) {
try {
- Region region = cache.createRegion(regionName, regionAttributes);
- return region;
+ return cache.createRegion(regionName, regionAttributes);
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
- return null;
}
public static Region createRegion(String regionName, Class valueConstraint) {
@@ -139,12 +139,10 @@ public class CacheUtils {
attributesFactory.setValueConstraint(valueConstraint);
attributesFactory.setIndexMaintenanceSynchronous(indexMaintenanceSynchronous);
RegionAttributes regionAttributes = attributesFactory.create();
- Region region = cache.createRegion(regionName, regionAttributes);
- return region;
+ return cache.createRegion(regionName, regionAttributes);
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
- return null;
}
public static Region createRegion(Region parentRegion, String regionName, Class valueConstraint) {
@@ -153,12 +151,10 @@ public class CacheUtils {
if (valueConstraint != null)
attributesFactory.setValueConstraint(valueConstraint);
RegionAttributes regionAttributes = attributesFactory.create();
- Region region = parentRegion.createSubregion(regionName, regionAttributes);
- return region;
+ return parentRegion.createSubregion(regionName, regionAttributes);
} catch (Exception e) {
- e.printStackTrace();
+ throw new AssertionError(e);
}
- return null;
}
public static Region getRegion(String regionPath) {
@@ -179,10 +175,7 @@ public class CacheUtils {
}
public static void log(Object message) {
- Cache cache = GemFireCacheImpl.getInstance();
- if (cache != null) {
- cache.getLogger().fine(message.toString());
- }
+ logger.debug(message);
}
public static CacheTransactionManager getCacheTranxnMgr() {
@@ -190,16 +183,19 @@ public class CacheUtils {
}
public static void compareResultsOfWithAndWithoutIndex(SelectResults[][] r, Object test) {
- Set set1 = null;
- Set set2 = null;
- Iterator itert1 = null;
- Iterator itert2 = null;
- ObjectType type1, type2;
- for (int j = 0; j < r.length; j++) {
- CollectionType collType1 = r[j][0].getCollectionType();
- CollectionType collType2 = r[j][1].getCollectionType();
+ Set set1;
+ Set set2;
+ Iterator itert1;
+ Iterator itert2;
+ ObjectType type1;
+ ObjectType type2;
+
+ for (final SelectResults[] selectResults : r) {
+ CollectionType collType1 = selectResults[0].getCollectionType();
+ CollectionType collType2 = selectResults[1].getCollectionType();
type1 = collType1.getElementType();
type2 = collType2.getElementType();
+
if (collType1.getSimpleClassName().equals(collType2.getSimpleClassName())) {
log("Both SelectResults are of the same Type i.e.--> " + collType1);
} else {
@@ -208,6 +204,7 @@ public class CacheUtils {
"FAILED:Select results Collection Type is different in both the cases. CollectionType1="
+ collType1 + " CollectionType2=" + collType2);
}
+
if (type1.equals(type2)) {
log("Both SelectResults have same element Type i.e.--> " + type1);
} else {
@@ -224,15 +221,17 @@ public class CacheUtils {
fail("FAILED:SelectResults Collection Type is different in both the cases. CollType1="
+ collType1 + " CollType2=" + collType2);
}
- if (r[j][0].size() == r[j][1].size()) {
- log("Both SelectResults are of Same Size i.e. Size= " + r[j][1].size());
+
+ if (selectResults[0].size() == selectResults[1].size()) {
+ log("Both SelectResults are of Same Size i.e. Size= " + selectResults[1].size());
} else {
- fail("FAILED:SelectResults size is different in both the cases. Size1=" + r[j][0].size()
- + " Size2 = " + r[j][1].size());
+ fail("FAILED:SelectResults size is different in both the cases. Size1="
+ + selectResults[0].size() + " Size2 = " + selectResults[1].size());
}
- set2 = ((r[j][1]).asSet());
- set1 = ((r[j][0]).asSet());
- // boolean pass = true;
+
+ set2 = selectResults[1].asSet();
+ set1 = selectResults[0].asSet();
+
itert1 = set1.iterator();
while (itert1.hasNext()) {
Object p1 = itert1.next();
@@ -241,6 +240,7 @@ public class CacheUtils {
boolean exactMatch = false;
while (itert2.hasNext()) {
Object p2 = itert2.next();
+
if (p1 instanceof Struct) {
Object[] values1 = ((Struct) p1).getFieldValues();
Object[] values2 = ((Struct) p2).getFieldValues();
@@ -248,11 +248,11 @@ public class CacheUtils {
boolean elementEqual = true;
for (int i = 0; i < values1.length; ++i) {
elementEqual =
- elementEqual && ((values1[i] == values2[i]) || values1[i].equals(values2[i]));
+ elementEqual && (values1[i] == values2[i] || values1[i].equals(values2[i]));
}
exactMatch = elementEqual;
} else {
- exactMatch = (p2 == p1) || p2.equals(p1);
+ exactMatch = p2 == p1 || p2.equals(p1);
}
if (exactMatch) {
break;
@@ -260,7 +260,7 @@ public class CacheUtils {
}
if (!exactMatch) {
fail(
- "Atleast one element in the pair of SelectResults supposedly identical, is not equal ");
+ "At least one element in the pair of SelectResults supposedly identical, is not equal");
}
}
}
@@ -268,14 +268,17 @@ public class CacheUtils {
public static boolean compareResultsOfWithAndWithoutIndex(SelectResults[][] r) {
boolean ok = true;
- Set set1 = null;
- Set set2 = null;
- Iterator itert1 = null;
- Iterator itert2 = null;
- ObjectType type1, type2;
- outer: for (int j = 0; j < r.length; j++) {
- CollectionType collType1 = r[j][0].getCollectionType();
- CollectionType collType2 = r[j][1].getCollectionType();
+ Set set1;
+ Set set2;
+ Iterator itert1;
+ Iterator itert2;
+ ObjectType type1;
+ ObjectType type2;
+
+ // TODO: eliminate loop labels
+ outer: for (final SelectResults[] aR : r) {
+ CollectionType collType1 = aR[0].getCollectionType();
+ CollectionType collType2 = aR[1].getCollectionType();
type1 = collType1.getElementType();
type2 = collType2.getElementType();
@@ -288,6 +291,7 @@ public class CacheUtils {
ok = false;
break;
}
+
if (type1.equals(type2)) {
log("Both SelectResults have same element Type i.e.--> " + type1);
} else {
@@ -308,18 +312,20 @@ public class CacheUtils {
ok = false;
break;
}
- if (r[j][0].size() == r[j][1].size()) {
- log("Both SelectResults are of Same Size i.e. Size= " + r[j][1].size());
+
+ if (aR[0].size() == aR[1].size()) {
+ log("Both SelectResults are of Same Size i.e. Size= " + aR[1].size());
} else {
// test.fail("FAILED:SelectResults size is different in both the cases. Size1=" +
// r[j][0].size() + " Size2 = " + r[j][1].size());
ok = false;
break;
}
- set2 = (((SelectResults) r[j][1]).asSet());
- set1 = (((SelectResults) r[j][0]).asSet());
- boolean pass = true;
+
+ set2 = aR[1].asSet();
+ set1 = aR[0].asSet();
itert1 = set1.iterator();
+
while (itert1.hasNext()) {
Object p1 = itert1.next();
itert2 = set2.iterator();
@@ -330,7 +336,6 @@ public class CacheUtils {
if (p1 instanceof Struct) {
Object[] values1 = ((Struct) p1).getFieldValues();
Object[] values2 = ((Struct) p2).getFieldValues();
- // test.assertIndexDetailsEquals(values1.length, values2.length);
if (values1.length != values2.length) {
ok = false;
break outer;
@@ -339,22 +344,20 @@ public class CacheUtils {
for (int i = 0; i < values1.length; ++i) {
if (values1[i] != null) {
elementEqual =
- elementEqual && ((values1[i] == values2[i]) || values1[i].equals(values2[i]));
+ elementEqual && (values1[i] == values2[i] || values1[i].equals(values2[i]));
} else {
- elementEqual = elementEqual && ((values1[i] == values2[i]));
+ elementEqual = elementEqual && values1[i] == values2[i];
}
}
exactMatch = elementEqual;
} else {
- exactMatch = (p2 == p1) || p2.equals(p1);
+ exactMatch = p2 == p1 || p2.equals(p1);
}
if (exactMatch) {
break;
}
}
if (!exactMatch) {
- // test.fail("Atleast one element in the pair of SelectResults supposedly identical, is
- // not equal ");
ok = false;
break outer;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/functional/FunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/functional/FunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/functional/FunctionJUnitTest.java
index 8bb2610..b8451bd 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/functional/FunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/functional/FunctionJUnitTest.java
@@ -80,14 +80,14 @@ public class FunctionJUnitTest {
ExecutionContext context = null;
for (int i = 0; i < 6; i++) {
CompiledValue cf = new CompiledFunction(cvArr[i], OQLLexerTokenTypes.LITERAL_nvl);
- StringBuffer clauseBuffer = new StringBuffer();
+ StringBuilder clauseBuffer = new StringBuilder();
cf.generateCanonicalizedExpression(clauseBuffer, context);
if (!clauseBuffer.toString().equals("NVL" + canonicalizedArgs[i])) {
fail("Canonicalization not done properly");
}
cf = new CompiledFunction(cvArr[i], OQLLexerTokenTypes.LITERAL_element);
- clauseBuffer = new StringBuffer();
+ clauseBuffer = new StringBuilder();
cf.generateCanonicalizedExpression(clauseBuffer, context);
if (!clauseBuffer.toString().equals("ELEMENT" + canonicalizedArgs[i])) {
fail("Canonicalization not done properly");
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledAggregateFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
index f3bcc02..38d3f6f 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
@@ -42,19 +42,20 @@ import org.apache.geode.cache.query.internal.aggregate.MaxMin;
import org.apache.geode.cache.query.internal.aggregate.Sum;
import org.apache.geode.cache.query.internal.aggregate.SumDistinct;
import org.apache.geode.cache.query.internal.aggregate.SumDistinctPRQueryNode;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class CompiledAggregateFunctionJUnitTest {
private Mockery context;
- private Cache cache;
+ private InternalCache cache;
private List bucketList;
@Before
public void setUp() throws Exception {
context = new Mockery();
- cache = context.mock(Cache.class);
+ cache = context.mock(InternalCache.class);
bucketList = new ArrayList();
bucketList.add(Integer.valueOf(1));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java
index 21745d5..504d1fe 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java
@@ -84,7 +84,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
try {
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -144,7 +144,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
try {
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -242,7 +242,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
// qs.createIndex("statusIndex",
// IndexType.FUNCTIONAL,"status","/portfolio");
@@ -331,7 +331,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio p");
Iterator iter = list.iterator();
while (iter.hasNext()) {
@@ -395,7 +395,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
// qs.createIndex("statusIndex",
// IndexType.FUNCTIONAL,"status","/portfolio");
@@ -466,7 +466,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
try {
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -512,7 +512,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
try {
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -580,7 +580,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -636,7 +636,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
// qs.createIndex("statusIndex",
// IndexType.FUNCTIONAL,"status","/portfolio");
@@ -705,7 +705,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -774,7 +774,7 @@ public class CompiledJunctionInternalsJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions,/employees e");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -844,7 +844,7 @@ public class CompiledJunctionInternalsJUnitTest {
List list =
compiler.compileFromClause("/portfolio p, p.positions,/employees e, /portfolio1 p1");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolio");
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
@@ -945,7 +945,7 @@ public class CompiledJunctionInternalsJUnitTest {
List list = compiler.compileFromClause(
"/portfolio p, p.positions,/employees e, /employees1 e1, /portfolio p1");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
// qs.createIndex("statusIndex",
// IndexType.FUNCTIONAL,"status","/portfolio");
@@ -2861,7 +2861,7 @@ public class CompiledJunctionInternalsJUnitTest {
private void bindIteratorsAndCreateIndex(ExecutionContext context) throws Exception {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID", "/portfolio");
Iterator iter = list.iterator();
while (iter.hasNext()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/test/java/org/apache/geode/cache/query/internal/ExecutionContextJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/ExecutionContextJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/ExecutionContextJUnitTest.java
index a15bae0..1112ee2 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/ExecutionContextJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/ExecutionContextJUnitTest.java
@@ -72,7 +72,7 @@ public class ExecutionContextJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
try {
Iterator iter = list.iterator();
while (iter.hasNext()) {
@@ -100,7 +100,7 @@ public class ExecutionContextJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
Iterator iter = list.iterator();
int i = 0;
while (iter.hasNext()) {
@@ -128,7 +128,7 @@ public class ExecutionContextJUnitTest {
QCompiler compiler = new QCompiler();
List list = compiler.compileFromClause("/portfolio p, p.positions");
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
Iterator iter = list.iterator();
int i = 0;
CompiledIteratorDef iterDef = null;
@@ -143,7 +143,7 @@ public class ExecutionContextJUnitTest {
rIter.getIndexInternalID().equals("index_iter" + i));
}
Set temp = new HashSet();
- context.computeUtlimateDependencies(iterDef, temp);
+ context.computeUltimateDependencies(iterDef, temp);
String regionPath = context
.getRegionPathForIndependentRuntimeIterator((RuntimeIterator) temp.iterator().next());
if (!(regionPath != null && regionPath.equals("/portfolio"))) {
@@ -166,7 +166,7 @@ public class ExecutionContextJUnitTest {
"/portfolio p, p.positions, p.addreses addrs, addrs.collection1 coll1, /dummy d1, d1.collection2 d2");
RuntimeIterator indItr = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
- context.newScope(context.assosciateScopeID());
+ context.newScope(context.associateScopeID());
int i = 0;
List checkList = new ArrayList();
try {
[24/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index 51212c6..7dbd701 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -40,7 +40,6 @@ import java.net.InetAddress;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -76,7 +75,6 @@ import org.apache.geode.InternalGemFireError;
import org.apache.geode.SerializationException;
import org.apache.geode.SystemFailure;
import org.apache.geode.ToDataException;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.distributed.internal.DMStats;
@@ -89,6 +87,7 @@ import org.apache.geode.i18n.StringId;
import org.apache.geode.internal.cache.EnumListenerEvent;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PoolManagerImpl;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.CacheServerHelper;
@@ -127,14 +126,11 @@ import org.apache.geode.pdx.internal.TypeRegistry;
public abstract class InternalDataSerializer extends DataSerializer implements DSCODE {
private static final Logger logger = LogService.getLogger();
- private static final Set loggedClasses = new HashSet();
-
/**
* Maps Class names to their DataSerializer. This is used to find a DataSerializer during
* serialization.
*/
- private static final ConcurrentHashMap<String, DataSerializer> classesToSerializers =
- new ConcurrentHashMap<String, DataSerializer>();
+ private static final Map<String, DataSerializer> classesToSerializers = new ConcurrentHashMap<>();
private static final String serializationVersionTxt =
System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "serializationVersion");
@@ -194,12 +190,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
*
* @since GemFire 6.6.2
*/
- private static enum SERIALIZATION_VERSION {
+ private enum SERIALIZATION_VERSION {
vINVALID,
- v660, // includes 6.6.0.x and 6.6.1.x. Note that no serialization changes were made in
- // 6.6 until 6.6.2
- v662 // 6.6.2.x or later
- // NOTE if you add a new constant make sure and update "latestVersion".
+ // includes 6.6.0.x and 6.6.1.x. Note that no serialization changes were made in 6.6 until 6.6.2
+ v660,
+ // 6.6.2.x or later NOTE if you add a new constant make sure and update "latestVersion".
+ v662
}
/**
@@ -208,7 +204,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static final SERIALIZATION_VERSION latestVersion = SERIALIZATION_VERSION.v662;
private static SERIALIZATION_VERSION calculateSerializationVersion() {
- if (serializationVersionTxt == null || serializationVersionTxt.equals("")) {
+ if (serializationVersionTxt == null || serializationVersionTxt.isEmpty()) {
return latestVersion;
} else if (serializationVersionTxt.startsWith("6.6.0")
|| serializationVersionTxt.startsWith("6.6.1")) {
@@ -245,7 +241,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("java.lang.String", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
try {
writeString((String) o, out);
} catch (UTFDataFormatException ex) {
@@ -260,7 +256,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.net.InetAddress", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
InetAddress address = (InetAddress) o;
out.writeByte(INET_ADDRESS);
writeInetAddress(address, out);
@@ -269,7 +265,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.net.Inet4Address", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
InetAddress address = (InetAddress) o;
out.writeByte(INET_ADDRESS);
writeInetAddress(address, out);
@@ -278,7 +274,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.net.Inet6Address", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
InetAddress address = (InetAddress) o;
out.writeByte(INET_ADDRESS);
writeInetAddress(address, out);
@@ -287,7 +283,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Class", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Class c = (Class) o;
if (c.isPrimitive()) {
writePrimitiveClass(c, out);
@@ -300,7 +296,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Boolean", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Boolean value = (Boolean) o;
out.writeByte(BOOLEAN);
writeBoolean(value, out);
@@ -309,7 +305,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Character", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Character value = (Character) o;
out.writeByte(CHARACTER);
writeCharacter(value, out);
@@ -318,7 +314,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Byte", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Byte value = (Byte) o;
out.writeByte(BYTE);
writeByte(value, out);
@@ -327,7 +323,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Short", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Short value = (Short) o;
out.writeByte(SHORT);
writeShort(value, out);
@@ -336,7 +332,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Integer", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Integer value = (Integer) o;
out.writeByte(INTEGER);
writeInteger(value, out);
@@ -345,7 +341,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Long", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Long value = (Long) o;
out.writeByte(LONG);
writeLong(value, out);
@@ -354,7 +350,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Float", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Float value = (Float) o;
out.writeByte(FLOAT);
writeFloat(value, out);
@@ -363,7 +359,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.lang.Double", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Double value = (Double) o;
out.writeByte(DOUBLE);
writeDouble(value, out);
@@ -373,7 +369,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[Z", // boolean[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(BOOLEAN_ARRAY);
writeBooleanArray((boolean[]) o, out);
return true;
@@ -382,7 +378,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[B", // byte[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
byte[] array = (byte[]) o;
out.writeByte(BYTE_ARRAY);
writeByteArray(array, out);
@@ -392,7 +388,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[C", // char[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(CHAR_ARRAY);
writeCharArray((char[]) o, out);
return true;
@@ -401,7 +397,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[D", // double[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
double[] array = (double[]) o;
out.writeByte(DOUBLE_ARRAY);
writeDoubleArray(array, out);
@@ -411,7 +407,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[F", // float[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
float[] array = (float[]) o;
out.writeByte(FLOAT_ARRAY);
writeFloatArray(array, out);
@@ -421,7 +417,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[I", // int[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
int[] array = (int[]) o;
out.writeByte(INT_ARRAY);
writeIntArray(array, out);
@@ -431,7 +427,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[J", // long[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
long[] array = (long[]) o;
out.writeByte(LONG_ARRAY);
writeLongArray(array, out);
@@ -441,7 +437,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[S", // short[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
short[] array = (short[]) o;
out.writeByte(SHORT_ARRAY);
writeShortArray(array, out);
@@ -451,7 +447,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
classesToSerializers.put("[Ljava.lang.String;", // String[]
new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
String[] array = (String[]) o;
out.writeByte(STRING_ARRAY);
writeStringArray(array, out);
@@ -460,7 +456,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put(TimeUnit.NANOSECONDS.getClass().getName(), new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TIME_UNIT);
out.writeByte(TIME_UNIT_NANOSECONDS);
return true;
@@ -468,7 +464,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put(TimeUnit.MICROSECONDS.getClass().getName(), new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TIME_UNIT);
out.writeByte(TIME_UNIT_MICROSECONDS);
return true;
@@ -476,7 +472,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put(TimeUnit.MILLISECONDS.getClass().getName(), new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TIME_UNIT);
out.writeByte(TIME_UNIT_MILLISECONDS);
return true;
@@ -484,7 +480,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put(TimeUnit.SECONDS.getClass().getName(), new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TIME_UNIT);
out.writeByte(TIME_UNIT_SECONDS);
return true;
@@ -492,7 +488,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.Date", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Date date = (Date) o;
out.writeByte(DATE);
writeDate(date, out);
@@ -501,7 +497,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.io.File", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
File file = (File) o;
out.writeByte(FILE);
writeFile(file, out);
@@ -510,7 +506,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.ArrayList", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
ArrayList list = (ArrayList) o;
out.writeByte(ARRAY_LIST);
writeArrayList(list, out);
@@ -519,7 +515,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.LinkedList", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
LinkedList list = (LinkedList) o;
out.writeByte(LINKED_LIST);
writeLinkedList(list, out);
@@ -528,7 +524,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.Vector", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(VECTOR);
writeVector((Vector) o, out);
return true;
@@ -536,7 +532,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.Stack", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(STACK);
writeStack((Stack) o, out);
return true;
@@ -544,7 +540,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.HashSet", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
HashSet list = (HashSet) o;
out.writeByte(HASH_SET);
writeHashSet(list, out);
@@ -553,7 +549,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.LinkedHashSet", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(LINKED_HASH_SET);
writeLinkedHashSet((LinkedHashSet) o, out);
return true;
@@ -561,7 +557,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.HashMap", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
HashMap list = (HashMap) o;
out.writeByte(HASH_MAP);
writeHashMap(list, out);
@@ -570,7 +566,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.IdentityHashMap", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(IDENTITY_HASH_MAP);
writeIdentityHashMap((IdentityHashMap) o, out);
return true;
@@ -578,26 +574,15 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.Hashtable", new WellKnownPdxDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(HASH_TABLE);
writeHashtable((Hashtable) o, out);
return true;
}
});
- // We can't add this here because it would cause writeObject to not be compatible with previous
- // releases
- // classesToSerializers.put("java.util.concurrent.ConcurrentHashMap",
- // new WellKnownDS() {
- // @Override
- // public final boolean toData(Object o, DataOutput out)
- // throws IOException {
- // out.writeByte(CONCURRENT_HASH_MAP);
- // writeConcurrentHashMap((ConcurrentHashMap<?, ?>) o, out);
- // return true;
- // }});
classesToSerializers.put("java.util.Properties", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
Properties props = (Properties) o;
out.writeByte(PROPERTIES);
writeProperties(props, out);
@@ -606,7 +591,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.TreeMap", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TREE_MAP);
writeTreeMap((TreeMap) o, out);
return true;
@@ -614,7 +599,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.TreeSet", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TREE_SET);
writeTreeSet((TreeSet) o, out);
return true;
@@ -623,7 +608,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (is662SerializationEnabled()) {
classesToSerializers.put("java.math.BigInteger", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(BIG_INTEGER);
writeBigInteger((BigInteger) o, out);
return true;
@@ -631,7 +616,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.math.BigDecimal", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(BIG_DECIMAL);
writeBigDecimal((BigDecimal) o, out);
return true;
@@ -639,7 +624,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.util.UUID", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(UUID);
writeUUID((UUID) o, out);
return true;
@@ -647,7 +632,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
});
classesToSerializers.put("java.sql.Timestamp", new WellKnownDS() {
@Override
- public final boolean toData(Object o, DataOutput out) throws IOException {
+ public boolean toData(Object o, DataOutput out) throws IOException {
out.writeByte(TIMESTAMP);
writeTimestamp((Timestamp) o, out);
return true;
@@ -657,7 +642,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Maps the id of a serializer to its <code>DataSerializer</code>.
+ * Maps the id of a serializer to its {@code DataSerializer}.
*/
private static final ConcurrentMap/* <Integer, DataSerializer|Marker> */ idsToSerializers =
new ConcurrentHashMap();
@@ -667,14 +652,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* into the vm as keys and their corresponding holder instances as values.
*/
private static final ConcurrentHashMap<String, SerializerAttributesHolder> dsClassesToHolders =
- new ConcurrentHashMap<String, SerializerAttributesHolder>();
+ new ConcurrentHashMap<>();
/**
* Contains the id of the data serializers not yet loaded into the vm as keys and their
* corresponding holder instances as values.
*/
private static final ConcurrentHashMap<Integer, SerializerAttributesHolder> idsToHolders =
- new ConcurrentHashMap<Integer, SerializerAttributesHolder>();
+ new ConcurrentHashMap<>();
/**
* Contains the classnames of supported classes as keys and their corresponding
@@ -682,22 +667,21 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* have not been loaded into the vm.
*/
private static final ConcurrentHashMap<String, SerializerAttributesHolder> supportedClassesToHolders =
- new ConcurrentHashMap<String, SerializerAttributesHolder>();
+ new ConcurrentHashMap<>();
/**
- * <code>RegistrationListener</code>s that receive callbacks when <code>DataSerializer</code>s and
- * <code>Instantiator</code>s are registered. Note: copy-on-write access used for this set
+ * {@code RegistrationListener}s that receive callbacks when {@code DataSerializer}s and
+ * {@code Instantiator}s are registered. Note: copy-on-write access used for this set
*/
private static volatile Set listeners = new HashSet();
- private static final Object listenersSync = new Object();
- //////////////////// Static Methods ////////////////////
+ private static final Object listenersSync = new Object();
/**
* Convert the given unsigned byte to an int. The returned value will be in the range [0..255]
* inclusive
*/
- private static final int ubyteToInt(byte ub) {
+ private static int ubyteToInt(byte ub) {
return ub & 0xFF;
}
@@ -710,7 +694,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Instantiates an instance of <code>DataSerializer</code>
+ * Instantiates an instance of {@code DataSerializer}
*
* @throws IllegalArgumentException If the class can't be instantiated
*
@@ -727,7 +711,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
try {
init = c.getDeclaredConstructor(new Class[0]);
- } catch (NoSuchMethodException ex) {
+ } catch (NoSuchMethodException ignored) {
StringId s = LocalizedStrings.DataSerializer_CLASS_0_DOES_NOT_HAVE_A_ZEROARGUMENT_CONSTRUCTOR;
Object[] args = new Object[] {c.getName()};
if (c.getDeclaringClass() != null) {
@@ -742,24 +726,22 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
init.setAccessible(true);
s = (DataSerializer) init.newInstance(new Object[0]);
- } catch (IllegalAccessException ex) {
+ } catch (IllegalAccessException ignored) {
throw new IllegalArgumentException(
LocalizedStrings.DataSerializer_COULD_NOT_INSTANTIATE_AN_INSTANCE_OF_0
.toLocalizedString(c.getName()));
} catch (InstantiationException ex) {
- RuntimeException ex2 = new IllegalArgumentException(
+ throw new IllegalArgumentException(
LocalizedStrings.DataSerializer_COULD_NOT_INSTANTIATE_AN_INSTANCE_OF_0
- .toLocalizedString(c.getName()));
- ex2.initCause(ex);
- throw ex2;
+ .toLocalizedString(c.getName()),
+ ex);
} catch (InvocationTargetException ex) {
- RuntimeException ex2 = new IllegalArgumentException(
+ throw new IllegalArgumentException(
LocalizedStrings.DataSerializer_WHILE_INSTANTIATING_AN_INSTANCE_OF_0
- .toLocalizedString(c.getName()));
- ex2.initCause(ex);
- throw ex2;
+ .toLocalizedString(c.getName()),
+ ex);
}
return s;
@@ -768,18 +750,17 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
public static DataSerializer register(Class c, boolean distribute, EventID eventId,
ClientProxyMembershipID context) {
DataSerializer s = newInstance(c);
- // This method is only called when server connection and
- // CacheClientUpdaterThread
+ // This method is only called when server connection and CacheClientUpdaterThread
s.setEventId(eventId);
s.setContext(context);
return _register(s, distribute);
}
/**
- * Registers a <code>DataSerializer</code> instance with the data serialization framework.
+ * Registers a {@code DataSerializer} instance with the data serialization framework.
*
- * @param distribute Should the registered <code>DataSerializer</code> be distributed to other
- * members of the distributed system?
+ * @param distribute Should the registered {@code DataSerializer} be distributed to other members
+ * of the distributed system?
*
* @see DataSerializer#register(Class)
*/
@@ -802,21 +783,20 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
LocalizedStrings.InternalDataSerializer_THE_DATASERIALIZER_0_HAS_NO_SUPPORTED_CLASSES_ITS_GETSUPPORTEDCLASSES_METHOD_MUST_RETURN_AT_LEAST_ONE_CLASS;
throw new IllegalArgumentException(msg.toLocalizedString(s.getClass().getName()));
}
- {
- for (int i = 0; i < classes.length; i++) {
- if (classes[i] == null) {
- final StringId msg =
- LocalizedStrings.InternalDataSerializer_THE_DATASERIALIZER_GETSUPPORTEDCLASSES_METHOD_FOR_0_RETURNED_AN_ARRAY_THAT_CONTAINED_A_NULL_ELEMENT;
- throw new IllegalArgumentException(msg.toLocalizedString(s.getClass().getName()));
- } else if (classes[i].isArray()) {
- final StringId msg =
- LocalizedStrings.InternalDataSerializer_THE_DATASERIALIZER_GETSUPPORTEDCLASSES_METHOD_FOR_0_RETURNED_AN_ARRAY_THAT_CONTAINED_AN_ARRAY_CLASS_WHICH_IS_NOT_ALLOWED_SINCE_ARRAYS_HAVE_BUILTIN_SUPPORT;
- throw new IllegalArgumentException(msg.toLocalizedString(s.getClass().getName()));
- }
+
+ for (Class aClass : classes) {
+ if (aClass == null) {
+ final StringId msg =
+ LocalizedStrings.InternalDataSerializer_THE_DATASERIALIZER_GETSUPPORTEDCLASSES_METHOD_FOR_0_RETURNED_AN_ARRAY_THAT_CONTAINED_A_NULL_ELEMENT;
+ throw new IllegalArgumentException(msg.toLocalizedString(s.getClass().getName()));
+ } else if (aClass.isArray()) {
+ final StringId msg =
+ LocalizedStrings.InternalDataSerializer_THE_DATASERIALIZER_GETSUPPORTEDCLASSES_METHOD_FOR_0_RETURNED_AN_ARRAY_THAT_CONTAINED_AN_ARRAY_CLASS_WHICH_IS_NOT_ALLOWED_SINCE_ARRAYS_HAVE_BUILTIN_SUPPORT;
+ throw new IllegalArgumentException(msg.toLocalizedString(s.getClass().getName()));
}
}
- final Integer idx = Integer.valueOf(id);
+ final Integer idx = id;
boolean retry;
Marker oldMarker = null;
final Marker m = new InitMarker();
@@ -839,8 +819,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
DataSerializer other = (DataSerializer) oldSerializer;
throw new IllegalStateException(
LocalizedStrings.InternalDataSerializer_A_DATASERIALIZER_OF_CLASS_0_IS_ALREADY_REGISTERED_WITH_ID_1_SO_THE_DATASERIALIZER_OF_CLASS_2_COULD_NOT_BE_REGISTERED
- .toLocalizedString(
- new Object[] {other.getClass().getName(), Integer.valueOf(other.getId())}));
+ .toLocalizedString(new Object[] {other.getClass().getName(), other.getId()}));
}
}
} while (retry);
@@ -887,7 +866,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// if dataserializer is getting registered for first time
// its EventID will be null, so generate a new event id
// the the distributed system is connected
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && s.getEventId() == null) {
s.setEventId(new EventID(cache.getDistributedSystem()));
}
@@ -911,7 +890,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Marks a <code>DataSerializer</code> className for registration with the data serialization
+ * Marks a {@code DataSerializer} className for registration with the data serialization
* framework. Does not necessarily load the classes into this VM.
*
* @param className Name of the DataSerializer class.
@@ -927,10 +906,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Marks a <code>DataSerializer</code> className for registration with the data serialization
+ * Marks a {@code DataSerializer} className for registration with the data serialization
* framework. Does not necessarily load the classes into this VM.
*
- * @param className
* @param distribute If true, distribute this data serializer.
* @see DataSerializer#register(Class)
*/
@@ -940,7 +918,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static void register(String className, boolean distribute,
SerializerAttributesHolder holder) {
- if (className == null || className.trim().equals("")) {
+ if (className == null || className.trim().isEmpty()) {
throw new IllegalArgumentException("Class name cannot be null or empty.");
}
@@ -949,8 +927,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (oldValue.getId() != 0 && holder.getId() != 0 && oldValue.getId() != holder.getId()) {
throw new IllegalStateException(
LocalizedStrings.InternalDataSerializer_A_DATASERIALIZER_OF_CLASS_0_IS_ALREADY_REGISTERED_WITH_ID_1_SO_THE_DATASERIALIZER_OF_CLASS_2_COULD_NOT_BE_REGISTERED
- .toLocalizedString(new Object[] {oldValue.getClass().getName(),
- Integer.valueOf(oldValue.getId())}));
+ .toLocalizedString(new Object[] {oldValue.getClass().getName(), oldValue.getId()}));
}
}
@@ -986,10 +963,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private ClientProxyMembershipID proxyId = null;
private int id = 0;
- public SerializerAttributesHolder() {}
+ SerializerAttributesHolder() {}
- public SerializerAttributesHolder(String name, EventID event, ClientProxyMembershipID proxy,
- int id) {
+ SerializerAttributesHolder(String name, EventID event, ClientProxyMembershipID proxy, int id) {
this.className = name;
this.eventId = event;
this.proxyId = proxy;
@@ -1016,9 +992,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return this.id;
}
+ @Override
public String toString() {
return "SerializerAttributesHolder[name=" + this.className + ",id=" + this.id + ",eventId="
- + this.eventId + "]";
+ + this.eventId + ']';
}
}
@@ -1031,7 +1008,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
private static void sendRegistrationMessageToClients(DataSerializer dataSerializer) {
- Cache cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// A cache has not yet been created.
// we can't propagate it to clients
@@ -1041,12 +1018,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
try {
serializedDataSerializer[0] =
CacheServerHelper.serialize(dataSerializer.getClass().toString().substring(6));
- {
- byte[] idBytes = new byte[4];
- Part.encodeInt(dataSerializer.getId(), idBytes);
- serializedDataSerializer[1] = idBytes;
- }
- } catch (IOException e) {
+
+ byte[] idBytes = new byte[4];
+ Part.encodeInt(dataSerializer.getId(), idBytes);
+ serializedDataSerializer[1] = idBytes;
+ } catch (IOException ignored) {
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER,
"InternalDataSerializer encountered an IOException while serializing DataSerializer :{}",
@@ -1063,7 +1039,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
public static EventID generateEventId() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// A cache has not yet created
return null;
@@ -1072,11 +1048,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Unregisters a <code>Serializer</code> that was previously registered with the data
- * serialization framework.
+ * Unregisters a {@code Serializer} that was previously registered with the data serialization
+ * framework.
*/
public static void unregister(int id) {
- final Integer idx = Integer.valueOf(id);
+ final Integer idx = id;
Object o = idsToSerializers.remove(idx);
if (o != null) {
if (o instanceof InitMarker) {
@@ -1106,12 +1082,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Returns the <code>DataSerializer</code> for the given class. If no class has been registered,
- * <code>null</code> is returned. Remember that it is okay to return <code>null</code> in this
- * case. This method is invoked when writing an object. If a serializer isn't available, then its
- * the user's fault.
+ * Returns the {@code DataSerializer} for the given class. If no class has been registered,
+ * {@code null} is returned. Remember that it is okay to return {@code null} in this case. This
+ * method is invoked when writing an object. If a serializer isn't available, then its the user's
+ * fault.
*/
- public static DataSerializer getSerializer(Class c) {
+ private static DataSerializer getSerializer(Class c) {
DataSerializer ds = classesToSerializers.get(c.getName());
if (ds == null) {
SerializerAttributesHolder sah = supportedClassesToHolders.get(c.getName());
@@ -1127,7 +1103,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
supportedClassesToHolders.remove(clazz.getName());
}
return serializer;
- } catch (ClassNotFoundException cnfe) {
+ } catch (ClassNotFoundException ignored) {
logger.info(LogMarker.SERIALIZER,
LocalizedMessage.create(
LocalizedStrings.InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0,
@@ -1139,10 +1115,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Returns the <code>DataSerializer</code> with the given id.
+ * Returns the {@code DataSerializer} with the given id.
*/
public static DataSerializer getSerializer(int id) {
- final Integer idx = Integer.valueOf(id);
+ final Integer idx = id;
final GetMarker marker = new GetMarker();
DataSerializer result = null;
boolean timedOut = false;
@@ -1163,7 +1139,6 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
if (result == null) {
- // SerializerAttributesHolder sah = idsToHolders.get(idx);
if (sah != null) {
Class dsClass = null;
try {
@@ -1176,7 +1151,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
supportedClassesToHolders.remove(clazz.getName());
}
return ds;
- } catch (ClassNotFoundException cnfe) {
+ } catch (ClassNotFoundException ignored) {
logger.info(LogMarker.SERIALIZER,
LocalizedMessage.create(
LocalizedStrings.InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0,
@@ -1193,9 +1168,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
public static DataSerializer[] getSerializers() {
final int size = idsToSerializers.size();
Collection coll = new ArrayList(size);
- Iterator it = idsToSerializers.values().iterator();
- while (it.hasNext()) {
- Object v = it.next();
+ for (Object v : idsToSerializers.values()) {
if (v instanceof InitMarker) {
v = ((Marker) v).getSerializer();
}
@@ -1224,7 +1197,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
for (Class clazz : ds.getSupportedClasses()) {
supportedClassesToHolders.remove(clazz.getName());
}
- } catch (ClassNotFoundException cnfe) {
+ } catch (ClassNotFoundException ignored) {
logger.info(LogMarker.SERIALIZER, LocalizedMessage.create(
LocalizedStrings.InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0, name));
}
@@ -1242,12 +1215,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
public static SerializerAttributesHolder[] getSerializersForDistribution() {
final int size = idsToSerializers.size() + dsClassesToHolders.size();
- Collection<SerializerAttributesHolder> coll =
- new ArrayList<InternalDataSerializer.SerializerAttributesHolder>(size);
+ Collection<SerializerAttributesHolder> coll = new ArrayList<>(size);
- Iterator it = idsToSerializers.values().iterator();
- while (it.hasNext()) {
- Object v = it.next();
+ for (Object v : idsToSerializers.values()) {
if (v instanceof InitMarker) {
v = ((Marker) v).getSerializer();
}
@@ -1258,10 +1228,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- Iterator<Entry<String, SerializerAttributesHolder>> iterator =
- dsClassesToHolders.entrySet().iterator();
- while (iterator.hasNext()) {
- SerializerAttributesHolder v = iterator.next().getValue();
+ for (final Entry<String, SerializerAttributesHolder> stringSerializerAttributesHolderEntry : dsClassesToHolders
+ .entrySet()) {
+ SerializerAttributesHolder v = stringSerializerAttributesHolderEntry.getValue();
coll.add(v);
}
@@ -1269,12 +1238,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Persist this class's map to out
+ * Persist this class's map to out TODO: saveRegistrations is unused
*/
public static void saveRegistrations(DataOutput out) throws IOException {
- Iterator it = idsToSerializers.values().iterator();
- while (it.hasNext()) {
- Object v = it.next();
+ for (Object v : idsToSerializers.values()) {
if (v instanceof InitMarker) {
v = ((Marker) v).getSerializer();
}
@@ -1291,7 +1258,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
while (iterator.hasNext()) {
try {
dsClass = getCachedClass(iterator.next().getKey());
- } catch (ClassNotFoundException cnfe) {
+ } catch (ClassNotFoundException ignored) {
logger.info(LogMarker.SERIALIZER,
LocalizedMessage.create(
LocalizedStrings.InternalDataSerializer_COULD_NOT_LOAD_DATASERIALIZER_CLASS_0,
@@ -1315,7 +1282,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Read the data from in and register it with this class.
+ * Read the data from in and register it with this class. TODO: loadRegistrations is unused
*
* @throws IllegalArgumentException if a registration fails
*/
@@ -1325,7 +1292,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
boolean skip = false;
try {
dsClass = DataSerializer.readClass(in);
- } catch (ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ignored) {
skip = true;
}
if (skip) {
@@ -1336,8 +1303,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Adds a <code>RegistrationListener</code> that will receive callbacks when
- * <code>DataSerializer</code>s and <code>Instantiator</code>s are registered.
+ * Adds a {@code RegistrationListener} that will receive callbacks when {@code DataSerializer}s
+ * and {@code Instantiator}s are registered.
*/
public static void addRegistrationListener(RegistrationListener l) {
synchronized (listenersSync) {
@@ -1348,7 +1315,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Removes a <code>RegistrationListener</code> so that it no longer receives callbacks.
+ * Removes a {@code RegistrationListener} so that it no longer receives callbacks.
*/
public static void removeRegistrationListener(RegistrationListener l) {
synchronized (listenersSync) {
@@ -1359,29 +1326,25 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Alerts all <code>RegistrationListener</code>s that a new <code>DataSerializer</code> has been
- * registered
+ * Alerts all {@code RegistrationListener}s that a new {@code DataSerializer} has been registered
*
* @see InternalDataSerializer.RegistrationListener#newDataSerializer
*/
private static void fireNewDataSerializer(DataSerializer ds) {
- Iterator iter = listeners.iterator();
- while (iter.hasNext()) {
- RegistrationListener listener = (RegistrationListener) iter.next();
+ for (Object listener1 : listeners) {
+ RegistrationListener listener = (RegistrationListener) listener1;
listener.newDataSerializer(ds);
}
}
/**
- * Alerts all <code>RegistrationListener</code>s that a new <code>Instantiator</code> has been
- * registered
+ * Alerts all {@code RegistrationListener}s that a new {@code Instantiator} has been registered
*
* @see InternalDataSerializer.RegistrationListener#newInstantiator
*/
static void fireNewInstantiator(Instantiator instantiator) {
- Iterator iter = listeners.iterator();
- while (iter.hasNext()) {
- RegistrationListener listener = (RegistrationListener) iter.next();
+ for (Object listener1 : listeners) {
+ RegistrationListener listener = (RegistrationListener) listener1;
listener.newInstantiator(instantiator);
}
}
@@ -1398,10 +1361,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- ///////////////// START DataSerializer Implementation Methods ///////////
-
// Writes just the header of a DataSerializableFixedID to out.
- public static final void writeDSFIDHeader(int dsfid, DataOutput out) throws IOException {
+ public static void writeDSFIDHeader(int dsfid, DataOutput out) throws IOException {
if (dsfid == DataSerializableFixedID.ILLEGAL) {
throw new IllegalStateException(
LocalizedStrings.InternalDataSerializer_ATTEMPTED_TO_SERIALIZE_ILLEGAL_DSFID
@@ -1419,8 +1380,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static final void writeDSFID(DataSerializableFixedID o, DataOutput out)
- throws IOException {
+ public static void writeDSFID(DataSerializableFixedID o, DataOutput out) throws IOException {
int dsfid = o.getDSFID();
if (dsfidToClassMap != null && logger.isTraceEnabled(LogMarker.DEBUG_DSFID)) {
logger.trace(LogMarker.DEBUG_DSFID, "writeDSFID {} class={}", dsfid, o.getClass());
@@ -1429,8 +1389,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// consistency check to make sure that the same DSFID is not used
// for two different classes
String newClassName = o.getClass().getName();
- String existingClassName =
- (String) dsfidToClassMap.putIfAbsent(Integer.valueOf(dsfid), newClassName);
+ String existingClassName = (String) dsfidToClassMap.putIfAbsent(dsfid, newClassName);
if (existingClassName != null && !existingClassName.equals(newClassName)) {
logger.trace(LogMarker.DEBUG_DSFID, "dsfid={} is used for class {} and class {}", dsfid,
existingClassName, newClassName);
@@ -1449,13 +1408,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// Note: this is not a user code toData but one from our
// internal code since only GemFire product code implements DSFID
throw io;
- } catch (CancelException ex) {
+ } catch (CancelException | ToDataException | GemFireRethrowable ex) {
// Serializing a PDX can result in a cache closed exception. Just rethrow
throw ex;
- } catch (ToDataException ex) {
- throw ex;
- } catch (GemFireRethrowable ex) {
- throw ex;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -1473,20 +1428,20 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Data serializes an instance of a well-known class to the given <code>DataOutput</code>.
+ * Data serializes an instance of a well-known class to the given {@code DataOutput}.
*
- * @return <code>true</code> if <code>o</code> was actually written to <code>out</code>
+ * @return {@code true} if {@code o} was actually written to {@code out}
*/
- public static boolean writeWellKnownObject(Object o, DataOutput out,
+ private static boolean writeWellKnownObject(Object o, DataOutput out,
boolean ensurePdxCompatibility) throws IOException {
return writeUserObject(o, out, ensurePdxCompatibility);
}
/**
* Data serializes an instance of a "user class" (that is, a class that can be handled by a
- * registered <code>DataSerializer</code>) to the given <code>DataOutput</code>.
+ * registered {@code DataSerializer}) to the given {@code DataOutput}.
*
- * @return <code>true</code> if <code>o</code> was written to <code>out</code>.
+ * @return {@code true} if {@code o} was written to {@code out}.
*/
private static boolean writeUserObject(Object o, DataOutput out, boolean ensurePdxCompatibility)
throws IOException {
@@ -1515,7 +1470,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
}
- boolean toDataResult = false;
+ boolean toDataResult;
try {
toDataResult = serializer.toData(o, out);
} catch (IOException io) {
@@ -1530,13 +1485,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
throw new ToDataException(
"toData failed on DataSerializer with id=" + id + " for class " + c, io);
}
- } catch (ToDataException ex) {
- throw ex;
- } catch (CancelException ex) {
+ } catch (CancelException | ToDataException | GemFireRethrowable ex) {
// Serializing a PDX can result in a cache closed exception. Just rethrow
throw ex;
- } catch (GemFireRethrowable ex) {
- throw ex;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -1557,8 +1508,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
} else {
throw new ToDataException(
LocalizedStrings.DataSerializer_SERIALIZER_0_A_1_SAID_THAT_IT_COULD_SERIALIZE_AN_INSTANCE_OF_2_BUT_ITS_TODATA_METHOD_RETURNED_FALSE
- .toLocalizedString(new Object[] {Integer.valueOf(serializer.getId()),
- serializer.getClass().getName(), o.getClass().getName()}));
+ .toLocalizedString(serializer.getId(), serializer.getClass().getName(),
+ o.getClass().getName()));
}
// Do byte[][] and Object[] here to fix bug 44060
} else if (o instanceof byte[][]) {
@@ -1583,10 +1534,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return true;
} else {
PdxSerializer pdxSerializer = TypeRegistry.getPdxSerializer();
- if (pdxSerializer != null) {
- return writePdx(out, null, o, pdxSerializer);
- }
- return false;
+ return pdxSerializer != null && writePdx(out, null, o, pdxSerializer);
}
}
@@ -1596,20 +1544,18 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (asm != null) {
AutoClassInfo aci = asm.getExistingClassInfo(o.getClass());
if (aci != null) {
- GemFireCacheImpl gfc = GemFireCacheImpl
+ InternalCache internalCache = GemFireCacheImpl
.getForPdx("PDX registry is unavailable because the Cache has been closed.");
- TypeRegistry tr = gfc.getPdxRegistry();
+ TypeRegistry tr = internalCache.getPdxRegistry();
- PdxWriterImpl writer;
- {
- PdxOutputStream os;
- if (out instanceof HeapDataOutputStream) {
- os = new PdxOutputStream((HeapDataOutputStream) out);
- } else {
- os = new PdxOutputStream();
- }
- writer = new PdxWriterImpl(tr, o, aci, os);
+ PdxOutputStream os;
+ if (out instanceof HeapDataOutputStream) {
+ os = new PdxOutputStream((HeapDataOutputStream) out);
+ } else {
+ os = new PdxOutputStream();
}
+ PdxWriterImpl writer = new PdxWriterImpl(tr, o, aci, os);
+
try {
if (is662SerializationEnabled()) {
boolean alreadyInProgress = isPdxSerializationInProgress();
@@ -1626,14 +1572,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
} else {
asm.writeData(writer, o, aci);
}
- } catch (ToDataException ex) {
- throw ex;
- } catch (CancelException ex) {
- // Serializing a PDX can result in a cache closed exception. Just rethrow
- throw ex;
- } catch (NonPortableClassException ex) {
- throw ex;
- } catch (GemFireRethrowable ex) {
+ } catch (ToDataException | CancelException | NonPortableClassException
+ | GemFireRethrowable ex) {
throw ex;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
@@ -1651,7 +1591,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
t);
}
int bytesWritten = writer.completeByteStreamGeneration();
- getDMStats(gfc).incPdxSerialization(bytesWritten);
+ getDMStats(internalCache).incPdxSerialization(bytesWritten);
if (!(out instanceof HeapDataOutputStream)) {
writer.sendTo(out);
}
@@ -1661,7 +1601,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return false;
}
- public static void checkPdxCompatible(Object o, boolean ensurePdxCompatibility) {
+ private static void checkPdxCompatible(Object o, boolean ensurePdxCompatibility) {
if (ensurePdxCompatibility) {
throw new NonPortableClassException(
"Instances of " + o.getClass() + " are not compatible with non-java PDX.");
@@ -1673,15 +1613,15 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* custom serializater.
*/
private static boolean isGemfireObject(Object o) {
- return ((o instanceof Function) // fixes 43691
+ return (o instanceof Function // fixes 43691
|| o.getClass().getName().startsWith("org.apache.")
|| o.getClass().getName().startsWith("org.apache.geode"))
&& !(o instanceof PdxSerializerObject);
}
/**
- * Reads an object that was serialized by a customer ("user") <code>DataSerializer</code> from the
- * given <code>DataInput</code>.
+ * Reads an object that was serialized by a customer ("user") {@code DataSerializer} from the
+ * given {@code DataInput}.
*
* @throws IOException If the serializer that can deserialize the object is not registered.
*/
@@ -1691,16 +1631,16 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (serializer == null) {
throw new IOException(LocalizedStrings.DataSerializer_SERIALIZER_0_IS_NOT_REGISTERED
- .toLocalizedString(new Object[] {Integer.valueOf(serializerId)}));
+ .toLocalizedString(new Object[] {serializerId}));
}
return serializer.fromData(in);
}
/**
- * Checks to make sure a <code>DataOutput</code> is not <code>null</code>.
+ * Checks to make sure a {@code DataOutput} is not {@code null}.
*
- * @throws NullPointerException If <code>out</code> is <code>null</code>
+ * @throws NullPointerException If {@code out} is {@code null}
*/
public static void checkOut(DataOutput out) {
if (out == null) {
@@ -1710,9 +1650,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Checks to make sure a <code>DataInput</code> is not <code>null</code>.
+ * Checks to make sure a {@code DataInput} is not {@code null}.
*
- * @throws NullPointerException If <code>in</code> is <code>null</code>
+ * @throws NullPointerException If {@code in} is {@code null}
*/
public static void checkIn(DataInput in) {
if (in == null) {
@@ -1721,29 +1661,23 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
-
-
/**
- * Writes a <code>Set</code> to a <code>DataOutput</code>.
- *
+ * Writes a {@code Set} to a {@code DataOutput}.
* <P>
- *
* This method is internal because its semantics (that is, its ability to write any kind of
- * <code>Set</code>) are different from the <code>write</code>XXX methods of the external
- * <code>DataSerializer</code>.
+ * {@code Set}) are different from the {@code write}XXX methods of the external
+ * {@code DataSerializer}.
*
- * @throws IOException A problem occurs while writing to <code>out</code>
+ * @throws IOException A problem occurs while writing to {@code out}
*
* @see #readSet
*
* @since GemFire 4.0
*/
public static void writeSet(Collection<?> set, DataOutput out) throws IOException {
-
checkOut(out);
int size;
-
if (set == null) {
size = -1;
} else {
@@ -1761,11 +1695,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Reads a <code>Set</code> from a <code>DataInput</code>.
+ * Reads a {@code Set} from a {@code DataInput}.
*
- * @throws IOException A problem occurs while writing to <code>out</code>
- * @throws ClassNotFoundException The class of one of the <Code>HashSet</code>'s elements cannot
- * be found.
+ * @throws IOException A problem occurs while writing to {@code out}
+ * @throws ClassNotFoundException The class of one of the {@code HashSet}'s elements cannot be
+ * found.
*
* @see #writeSet
*
@@ -1776,12 +1710,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Reads a <code>Set</code> from a <code>DataInput</code> into the given non-null collection.
- * Returns true if collection read is non-null else returns false.
+ * Reads a {@code Set} from a {@code DataInput} into the given non-null collection. Returns true
+ * if collection read is non-null else returns false. TODO: readCollection is unused
*
- * @throws IOException A problem occurs while reading from <code>in</code>
- * @throws ClassNotFoundException The class of one of the <Code>Set</code>'s elements cannot be
- * found.
+ * @throws IOException A problem occurs while reading from {@code in}
+ * @throws ClassNotFoundException The class of one of the {@code Set}'s elements cannot be found.
*
* @see #writeSet
*/
@@ -1792,9 +1725,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
final int size = readArrayLength(in);
if (size >= 0) {
- E element;
for (int index = 0; index < size; ++index) {
- element = DataSerializer.<E>readObject(in);
+ E element = DataSerializer.<E>readObject(in);
c.add(element);
}
@@ -1820,10 +1752,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
} else {
out.writeInt(set.size());
out.writeBoolean(hasLongIDs);
- for (Iterator it = set.iterator(); it.hasNext();) {
- Long l = (Long) it.next();
+ for (Object aSet : set) {
+ Long l = (Long) aSet;
if (hasLongIDs) {
- out.writeLong(l.longValue());
+ out.writeLong(l);
} else {
out.writeInt((int) l.longValue());
}
@@ -1841,14 +1773,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
boolean longIDs = in.readBoolean();
for (int i = 0; i < size; i++) {
long l = longIDs ? in.readLong() : in.readInt();
- result.add(Long.valueOf(l));
+ result.add(l);
}
return result;
}
}
/**
- * write a set of Long objects
+ * write a set of Long objects TODO: writeListOfLongs is unused
*
* @param list the set of Long objects
* @param hasLongIDs if false, write only ints, not longs
@@ -1861,10 +1793,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
} else {
out.writeInt(list.size());
out.writeBoolean(hasLongIDs);
- for (Iterator it = list.iterator(); it.hasNext();) {
- Long l = (Long) it.next();
+ for (Object aList : list) {
+ Long l = (Long) aList;
if (hasLongIDs) {
- out.writeLong(l.longValue());
+ out.writeLong(l);
} else {
out.writeInt((int) l.longValue());
}
@@ -1882,7 +1814,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
boolean longIDs = in.readBoolean();
for (int i = 0; i < size; i++) {
long l = longIDs ? in.readLong() : in.readInt();
- result.add(Long.valueOf(l));
+ result.add(l);
}
return result;
}
@@ -1891,9 +1823,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
/**
- * Writes the type code for a primitive type Class to <code>DataOutput</code>.
+ * Writes the type code for a primitive type Class to {@code DataOutput}.
*/
- public static final void writePrimitiveClass(Class c, DataOutput out) throws IOException {
+ public static void writePrimitiveClass(Class c, DataOutput out) throws IOException {
if (c == Boolean.TYPE) {
out.writeByte(BOOLEAN_TYPE);
} else if (c == Character.TYPE) {
@@ -1921,7 +1853,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static final Class decodePrimitiveClass(byte typeCode) {
+ public static Class decodePrimitiveClass(byte typeCode) {
switch (typeCode) {
case BOOLEAN_TYPE:
return Boolean.TYPE;
@@ -1945,7 +1877,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return null;
default:
throw new InternalGemFireError(LocalizedStrings.InternalDataSerializer_UNEXPECTED_TYPECODE_0
- .toLocalizedString(Byte.valueOf(typeCode)));
+ .toLocalizedString(typeCode));
}
}
@@ -1955,12 +1887,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static final byte TIME_UNIT_SECONDS = -4;
/**
- * Reads a <code>TimeUnit</code> from a <code>DataInput</code>.
+ * Reads a {@code TimeUnit} from a {@code DataInput}.
*
- * @throws IOException A problem occurs while writing to <code>out</code>
+ * @throws IOException A problem occurs while writing to {@code out}
*/
- public static TimeUnit readTimeUnit(DataInput in) throws IOException {
-
+ private static TimeUnit readTimeUnit(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
byte type = in.readByte();
@@ -1980,8 +1911,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
unit = TimeUnit.SECONDS;
break;
default:
- throw new IOException(LocalizedStrings.DataSerializer_UNKNOWN_TIMEUNIT_TYPE_0
- .toLocalizedString(Byte.valueOf(type)));
+ throw new IOException(
+ LocalizedStrings.DataSerializer_UNKNOWN_TIMEUNIT_TYPE_0.toLocalizedString(type));
}
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -1991,7 +1922,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return unit;
}
- public static void writeTimestamp(Timestamp o, DataOutput out) throws IOException {
+ private static void writeTimestamp(Timestamp o, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2000,7 +1931,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
DataSerializer.writePrimitiveLong(o.getTime(), out);
}
- public static Timestamp readTimestamp(DataInput in) throws IOException {
+ private static Timestamp readTimestamp(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
Timestamp result = new Timestamp(DataSerializer.readPrimitiveLong(in));
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2009,7 +1940,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return result;
}
- public static void writeUUID(java.util.UUID o, DataOutput out) throws IOException {
+ private static void writeUUID(java.util.UUID o, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2019,7 +1950,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
DataSerializer.writePrimitiveLong(o.getLeastSignificantBits(), out);
}
- public static UUID readUUID(DataInput in) throws IOException {
+ private static UUID readUUID(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
long mb = DataSerializer.readPrimitiveLong(in);
long lb = DataSerializer.readPrimitiveLong(in);
@@ -2030,7 +1961,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return result;
}
- public static void writeBigDecimal(BigDecimal o, DataOutput out) throws IOException {
+ private static void writeBigDecimal(BigDecimal o, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2039,7 +1970,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
DataSerializer.writeString(o.toString(), out);
}
- public static BigDecimal readBigDecimal(DataInput in) throws IOException {
+ private static BigDecimal readBigDecimal(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
BigDecimal result = new BigDecimal(DataSerializer.readString(in));
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2048,7 +1979,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return result;
}
- public static void writeBigInteger(BigInteger o, DataOutput out) throws IOException {
+ private static void writeBigInteger(BigInteger o, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2057,7 +1988,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
DataSerializer.writeByteArray(o.toByteArray(), out);
}
- public static BigInteger readBigInteger(DataInput in) throws IOException {
+ private static BigInteger readBigInteger(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
BigInteger result = new BigInteger(DataSerializer.readByteArray(in));
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2066,12 +1997,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return result;
}
-
- // private static final HashSet seenClassNames = DEBUG_DSFID ? new HashSet(): null;
private static final ConcurrentMap dsfidToClassMap =
logger.isTraceEnabled(LogMarker.DEBUG_DSFID) ? new ConcurrentHashMap() : null;
- public static final void writeUserDataSerializableHeader(int classId, DataOutput out)
+ public static void writeUserDataSerializableHeader(int classId, DataOutput out)
throws IOException {
if (classId <= Byte.MAX_VALUE && classId >= Byte.MIN_VALUE) {
out.writeByte(USER_DATA_SERIALIZABLE);
@@ -2086,16 +2015,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * Writes given number of characters from array of <code>char</code>s to a
- * <code>DataOutput</code>.
+ * Writes given number of characters from array of {@code char}s to a {@code DataOutput}.
*
- * @throws IOException A problem occurs while writing to <code>out</code>
+ * @throws IOException A problem occurs while writing to {@code out}
*
* @see DataSerializer#readCharArray
* @since GemFire 6.6
*/
public static void writeCharArray(char[] array, int length, DataOutput out) throws IOException {
-
checkOut(out);
if (array == null) {
@@ -2117,13 +2044,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
*
* @param serializedForm the serialized byte array
*/
- public static final boolean isSerializedNull(byte[] serializedForm) {
+ public static boolean isSerializedNull(byte[] serializedForm) {
return serializedForm.length == 1 && serializedForm[0] == NULL;
}
- public static final void basicWriteObject(Object o, DataOutput out,
- boolean ensurePdxCompatibility) throws IOException {
-
+ public static void basicWriteObject(Object o, DataOutput out, boolean ensurePdxCompatibility)
+ throws IOException {
checkOut(out);
final boolean isDebugEnabled_SERIALIZER = logger.isTraceEnabled(LogMarker.SERIALIZER);
@@ -2163,18 +2089,6 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
writeUserDataSerializableHeader(classId, out);
} else {
out.writeByte(DATA_SERIALIZABLE);
- // if (DEBUG_DSFID) {
- // if (logger.infoEnabled()) {
- // boolean alreadySeen;
- // synchronized (seenClassNames) {
- // alreadySeen = seenClassNames.add(c.getName());
- // }
- // if (alreadySeen) {
- // // this class should be made a DSFID if it is a product class
- // logger.info("DataSerialized class " + c.getName(), new RuntimeException("CALLSTACK"));
- // }
- // }
- // }
DataSerializer.writeClass(c, out);
}
DataSerializable ds = (DataSerializable) o;
@@ -2200,18 +2114,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* used to catch Java serialization early for the case where the data is being sent to a
* non-Java client
*/
- if (disallowJavaSerialization() && (o instanceof Serializable)) {
+ if (disallowJavaSerialization() && o instanceof Serializable) {
throw new NotSerializableException(
LocalizedStrings.DataSerializer_0_IS_NOT_DATASERIALIZABLE_AND_JAVA_SERIALIZATION_IS_DISALLOWED
.toLocalizedString(o.getClass().getName()));
}
- // if (out instanceof DSDataOutput) {
- // // Unwrap the DSDataOutput to avoid one layer of
- // // delegation. This also prevents us from having to flush
- // // the ObjectOutputStream.
- // out = ((DSDataOutput) out).out;
- // }
writeSerializableObject(o, out);
}
}
@@ -2222,7 +2130,6 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
/**
- * @throws IOException
* @since GemFire 6.6.2
*/
private static void writePdxEnum(Enum<?> e, DataOutput out) throws IOException {
@@ -2248,17 +2155,17 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static Object readPdxEnum(DataInput in) throws IOException {
int dsId = in.readByte();
int tmp = readArrayLength(in);
- int enumId = (dsId << 24) | (tmp & 0xFFFFFF);
+ int enumId = dsId << 24 | tmp & 0xFFFFFF;
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "read PdxEnum id={}", enumId);
}
- GemFireCacheImpl gfc = GemFireCacheImpl
+ InternalCache internalCache = GemFireCacheImpl
.getForPdx("PDX registry is unavailable because the Cache has been closed.");
- TypeRegistry tr = gfc.getPdxRegistry();
+ TypeRegistry tr = internalCache.getPdxRegistry();
Object result = tr.getEnumById(enumId);
if (result instanceof PdxInstance) {
- getDMStats(gfc).incPdxInstanceCreations();
+ getDMStats(internalCache).incPdxInstanceCreations();
}
return result;
}
@@ -2283,12 +2190,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
private static Object readPdxInlineEnum(DataInput in) throws IOException, ClassNotFoundException {
- GemFireCacheImpl gfc = GemFireCacheImpl.getInstance();
- if (gfc != null && gfc.getPdxReadSerializedByAnyGemFireServices()) {
+ InternalCache internalCache = GemFireCacheImpl.getInstance();
+ if (internalCache != null && internalCache.getPdxReadSerializedByAnyGemFireServices()) {
String className = DataSerializer.readString(in);
String enumName = DataSerializer.readString(in);
int enumOrdinal = InternalDataSerializer.readArrayLength(in);
- getDMStats(gfc).incPdxInstanceCreations();
+ getDMStats(internalCache).incPdxInstanceCreations();
return new PdxInstanceEnum(className, enumName, enumOrdinal);
} else {
Enum<?> e = readGemFireEnum(in);
@@ -2297,16 +2204,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
-
/**
* write an object in java Serializable form with a SERIALIZABLE DSCODE so that it can be
* deserialized with DataSerializer.readObject()
*
* @param o the object to serialize
* @param out the data output to serialize to
- * @throws IOException
*/
- public static final void writeSerializableObject(Object o, DataOutput out) throws IOException {
+ public static void writeSerializableObject(Object o, DataOutput out) throws IOException {
out.writeByte(SERIALIZABLE);
if (out instanceof ObjectOutputStream) {
((ObjectOutputStream) out).writeObject(o);
@@ -2322,15 +2227,6 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
public void write(int b) throws IOException {
out2.write(b);
}
-
- // public void write(byte[] b) throws IOException {
- // out.write(b);
- // }
-
- // public void write(byte[] b, int off, int len)
- // throws IOException {
- // out.write(b, off, len);
- // }
};
}
boolean wasDoNotCopy = false;
@@ -2370,15 +2266,15 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* @param ds the object to write
* @param out the output stream.
*/
- public static final void invokeToData(Object ds, DataOutput out) throws IOException {
- boolean isDSFID = (ds instanceof DataSerializableFixedID);
+ public static void invokeToData(Object ds, DataOutput out) throws IOException {
+ boolean isDSFID = ds instanceof DataSerializableFixedID;
try {
boolean invoked = false;
Version v = InternalDataSerializer.getVersionForDataStreamOrNull(out);
- Version[] versions = null;
if (v != null && v != Version.CURRENT) {
// get versions where DataOutput was upgraded
+ Version[] versions = null;
if (ds instanceof SerializationVersions) {
SerializationVersions sv = (SerializationVersions) ds;
versions = sv.getSerializationVersions();
@@ -2386,10 +2282,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// check if the version of the peer or diskstore is different and
// there has been a change in the message
if (versions != null && versions.length > 0) {
- for (int i = 0; i < versions.length; i++) {
+ for (Version version : versions) {
// if peer version is less than the greatest upgraded version
- if (v.compareTo(versions[i]) < 0) {
- ds.getClass().getMethod("toDataPre_" + versions[i].getMethodSuffix(),
+ if (v.compareTo(version) < 0) {
+ ds.getClass().getMethod("toDataPre_" + version.getMethodSuffix(),
new Class[] {DataOutput.class}).invoke(ds, out);
invoked = true;
break;
@@ -2415,13 +2311,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
} else {
throw new ToDataException("toData failed on DataSerializable " + ds.getClass(), io);
}
- } catch (ToDataException ex) {
- throw ex;
- } catch (CancelException ex) {
+ } catch (CancelException | ToDataException | GemFireRethrowable ex) {
// Serializing a PDX can result in a cache closed exception. Just rethrow
throw ex;
- } catch (GemFireRethrowable ex) {
- throw ex;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -2447,14 +2339,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* @param ds the object to write
* @param in the input stream.
*/
- public static final void invokeFromData(Object ds, DataInput in)
+ public static void invokeFromData(Object ds, DataInput in)
throws IOException, ClassNotFoundException {
try {
boolean invoked = false;
Version v = InternalDataSerializer.getVersionForDataStreamOrNull(in);
- Version[] versions = null;
if (v != null && v != Version.CURRENT) {
// get versions where DataOutput was upgraded
+ Version[] versions = null;
if (ds instanceof SerializationVersions) {
SerializationVersions vds = (SerializationVersions) ds;
versions = vds.getSerializationVersions();
@@ -2462,10 +2354,10 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// check if the version of the peer or diskstore is different and
// there has been a change in the message
if (versions != null && versions.length > 0) {
- for (int i = 0; i < versions.length; i++) {
+ for (Version version : versions) {
// if peer version is less than the greatest upgraded version
- if (v.compareTo(versions[i]) < 0) {
- ds.getClass().getMethod("fromDataPre" + "_" + versions[i].getMethodSuffix(),
+ if (v.compareTo(version) < 0) {
+ ds.getClass().getMethod("fromDataPre" + '_' + version.getMethodSuffix(),
new Class[] {DataInput.class}).invoke(ds, in);
invoked = true;
break;
@@ -2480,24 +2372,19 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
((DataSerializable) ds).fromData(in);
}
}
- } catch (EOFException ex) {
+ } catch (EOFException | ClassNotFoundException | CacheClosedException ex) {
// client went away - ignore
throw ex;
- } catch (ClassNotFoundException ex) {
- throw ex;
- } catch (CacheClosedException cce) {
- throw cce;
} catch (Exception ex) {
- SerializationException ex2 = new SerializationException(
+ throw new SerializationException(
LocalizedStrings.DataSerializer_COULD_NOT_CREATE_AN_INSTANCE_OF_0
.toLocalizedString(ds.getClass().getName()),
ex);
- throw ex2;
}
}
- private static final Object readDataSerializable(final DataInput in)
+ private static Object readDataSerializable(final DataInput in)
throws IOException, ClassNotFoundException {
Class c = readClass(in);
try {
@@ -2517,15 +2404,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// client went away - ignore
throw ex;
} catch (Exception ex) {
- SerializationException ex2 = new SerializationException(
+ throw new SerializationException(
LocalizedStrings.DataSerializer_COULD_NOT_CREATE_AN_INSTANCE_OF_0
.toLocalizedString(c.getName()),
ex);
- throw ex2;
}
}
- private static final Object readDataSerializableFixedID(final DataInput in)
+ private static Object readDataSerializableFixedID(final DataInput in)
throws IOException, ClassNotFoundException {
Class c = readClass(in);
try {
@@ -2542,18 +2428,17 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
return o;
} catch (Exception ex) {
- SerializationException ex2 = new SerializationException(
+ throw new SerializationException(
LocalizedStrings.DataSerializer_COULD_NOT_CREATE_AN_INSTANCE_OF_0
.toLocalizedString(c.getName()),
ex);
- throw ex2;
}
}
/**
* Get the {@link Version} of the peer or disk store that created this {@link DataInput}.
*/
- public static final Version getVersionForDataStream(DataInput in) {
+ public static Version getVersionForDataStream(DataInput in) {
// check if this is a versioned data input
if (in instanceof VersionedDataStream) {
final Version v = ((VersionedDataStream) in).getVersion();
@@ -2568,7 +2453,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* Get the {@link Version} of the peer or disk store that created this {@link DataInput}. Returns
* null if the version is same as this member's.
*/
- public static final Version getVersionForDataStreamOrNull(DataInput in) {
+ public static Version getVersionForDataStreamOrNull(DataInput in) {
// check if this is a versioned data input
if (in instanceof VersionedDataStream) {
return ((VersionedDataStream) in).getVersion();
@@ -2581,7 +2466,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
/**
* Get the {@link Version} of the peer or disk store that created this {@link DataOutput}.
*/
- public static final Version getVersionForDataStream(DataOutput out) {
+ public static Version getVersionForDataStream(DataOutput out) {
// check if this is a versioned data output
if (out instanceof VersionedDataStream) {
final Version v = ((VersionedDataStream) out).getVersion();
@@ -2596,7 +2481,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
* Get the {@link Version} of the peer or disk store that created this {@link DataOutput}. Returns
* null if the version is same as this member's.
*/
- public static final Version getVersionForDataStreamOrNull(DataOutput out) {
+ public static Version getVersionForDataStreamOrNull(DataOutput out) {
// check if this is a versioned data output
if (out instanceof VersionedDataStream) {
return ((VersionedDataStream) out).getVersion();
@@ -2606,17 +2491,24 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static final byte NULL_ARRAY = -1; // array is null
+ // array is null
+ public static final byte NULL_ARRAY = -1;
+
/**
+ * array len encoded as unsigned short in next 2 bytes
+ *
* @since GemFire 5.7
*/
- private static final byte SHORT_ARRAY_LEN = -2; // array len encoded as unsigned short in next 2
- // bytes
+ private static final byte SHORT_ARRAY_LEN = -2;
+
/**
+ * array len encoded as int in next 4 bytes
+ *
* @since GemFire 5.7
*/
- public static final byte INT_ARRAY_LEN = -3; // array len encoded as int in next 4 bytes
- private static final int MAX_BYTE_ARRAY_LEN = ((byte) -4) & 0xFF;
+ public static final byte INT_ARRAY_LEN = -3;
+
+ private static final int MAX_BYTE_ARRAY_LEN = (byte) -4 & 0xFF;
public static void writeArrayLength(int len, DataOutput out) throws IOException {
if (len == -1) {
@@ -2653,6 +2545,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
/**
* Serializes a list of Integers. The argument may be null. Deserialize with readListOfIntegers().
+ *
+ * TODO: writeListOfIntegers is unused
*/
public void writeListOfIntegers(List<Integer> list, DataOutput out) throws IOException {
int size;
@@ -2664,52 +2558,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
InternalDataSerializer.writeArrayLength(size, out);
if (size > 0) {
for (int i = 0; i < size; i++) {
- out.writeInt(list.get(i).intValue());
+ out.writeInt(list.get(i));
}
}
}
- /**
- * Reads a list of integers serialized by writeListOfIntegers. This will return null if the object
- * serialized by writeListOfIntegers was null.
- */
- public List<Integer> readListOfIntegers(DataInput in) throws IOException {
- int size = InternalDataSerializer.readArrayLength(in);
- if (size > 0) {
- List<Integer> list = new ArrayList<Integer>(size);
- for (int i = 0; i < size; i++) {
- list.add(Integer.valueOf(in.readInt()));
- }
- return list;
- } else if (size == 0) {
- return Collections.<Integer>emptyList();
- } else {
- return null;
- }
- }
-
- /**
- * Reads and discards an array of <code>byte</code>s from a <code>DataInput</code>.
- *
- * @throws IOException A problem occurs while writing to <code>out</code>
- *
- * @see #writeByteArray(byte[], DataOutput)
- */
- public static void skipByteArray(DataInput in) throws IOException {
-
- InternalDataSerializer.checkIn(in);
-
- int length = InternalDataSerializer.readArrayLength(in);
- if (length != -1) {
- in.skipBytes(length);
- if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
- logger.trace(LogMarker.SERIALIZER, "Skipped byte array of length {}", length);
- }
- }
- }
-
- public static final Object readDSFID(final DataInput in)
- throws IOException, ClassNotFoundException {
+ public static Object readDSFID(final DataInput in) throws IOException, ClassNotFoundException {
checkIn(in);
byte header = in.readByte();
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
@@ -2728,8 +2582,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static final int readDSFIDHeader(final DataInput in)
- throws IOException,
<TRUNCATED>
[07/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey1.java
index f09495f..77fc21e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey1.java
@@ -147,7 +147,7 @@ public class VersionedThinLRURegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey2.java
index 6c3940d..25caf89 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapStringKey2.java
@@ -159,7 +159,7 @@ public class VersionedThinLRURegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapUUIDKey.java
index ab6ecba..dc3e2ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapUUIDKey.java
@@ -131,7 +131,7 @@ public class VersionedThinLRURegionEntryOffHeapUUIDKey extends VersionedThinLRUR
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapIntKey.java
index f3330ac..b2181d0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapIntKey.java
@@ -67,7 +67,7 @@ public class VersionedThinRegionEntryHeapIntKey extends VersionedThinRegionEntry
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapLongKey.java
index 20dd863..901e64d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapLongKey.java
@@ -67,7 +67,7 @@ public class VersionedThinRegionEntryHeapLongKey extends VersionedThinRegionEntr
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapObjectKey.java
index 665fa49..27fb4bd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapObjectKey.java
@@ -69,7 +69,7 @@ public class VersionedThinRegionEntryHeapObjectKey extends VersionedThinRegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey1.java
index 6b5783e..05d32cb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey1.java
@@ -86,7 +86,7 @@ public class VersionedThinRegionEntryHeapStringKey1 extends VersionedThinRegionE
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey2.java
index 5cdf57d..68e9a61 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapStringKey2.java
@@ -98,7 +98,7 @@ public class VersionedThinRegionEntryHeapStringKey2 extends VersionedThinRegionE
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapUUIDKey.java
index 1900435..fcc2a68 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeapUUIDKey.java
@@ -69,7 +69,7 @@ public class VersionedThinRegionEntryHeapUUIDKey extends VersionedThinRegionEntr
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapIntKey.java
index e920222..22baf55 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapIntKey.java
@@ -126,7 +126,7 @@ public class VersionedThinRegionEntryOffHeapIntKey extends VersionedThinRegionEn
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapLongKey.java
index 8b3de9d..931faef 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapLongKey.java
@@ -126,7 +126,7 @@ public class VersionedThinRegionEntryOffHeapLongKey extends VersionedThinRegionE
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapObjectKey.java
index 90ac91a..1f0554e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapObjectKey.java
@@ -127,7 +127,7 @@ public class VersionedThinRegionEntryOffHeapObjectKey extends VersionedThinRegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey1.java
index 80b4237..0a2ee2a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey1.java
@@ -144,7 +144,7 @@ public class VersionedThinRegionEntryOffHeapStringKey1 extends VersionedThinRegi
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey2.java
index f1dd95e..c834c4a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapStringKey2.java
@@ -156,7 +156,7 @@ public class VersionedThinRegionEntryOffHeapStringKey2 extends VersionedThinRegi
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapUUIDKey.java
index cd9c4c3..9401e7e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeapUUIDKey.java
@@ -128,7 +128,7 @@ public class VersionedThinRegionEntryOffHeapUUIDKey extends VersionedThinRegionE
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
index 7578f15..d5e39a9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
@@ -14,17 +14,33 @@
*/
package org.apache.geode.internal.cache.control;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryType;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationListener;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.query.internal.QueryMonitor;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.statistics.GemFireStatSampler;
-import org.apache.geode.internal.statistics.LocalStatListener;
import org.apache.geode.internal.SetUtils;
-import org.apache.geode.internal.statistics.StatisticsImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryThresholds.MemoryState;
import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceManagerProfile;
@@ -32,19 +48,9 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import javax.management.ListenerNotFoundException;
-import javax.management.Notification;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationListener;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryType;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.*;
+import org.apache.geode.internal.statistics.GemFireStatSampler;
+import org.apache.geode.internal.statistics.LocalStatListener;
+import org.apache.geode.internal.statistics.StatisticsImpl;
/**
* Allows for the setting of eviction and critical thresholds. These thresholds are compared against
@@ -67,8 +73,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
DistributionConfig.GEMFIRE_PREFIX + "heapPollerInterval";
// Internal for polling the JVM for changes in heap memory usage.
- private static final int POLLER_INTERVAL =
- Integer.getInteger(POLLER_INTERVAL_PROP, 500).intValue();
+ private static final int POLLER_INTERVAL = Integer.getInteger(POLLER_INTERVAL_PROP, 500);
// This holds a new event as it transitions from updateStateAndSendEvent(...) to fillInProfile()
private ThreadLocal<MemoryEvent> upcomingEvent = new ThreadLocal<MemoryEvent>();
@@ -153,14 +158,12 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
private final InternalResourceManager resourceManager;
private final ResourceAdvisor resourceAdvisor;
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
private final ResourceManagerStats stats;
private static boolean testDisableMemoryUpdates = false;
private static long testBytesUsedForThresholdSet = -1;
-
-
/**
* Determines if the name of the memory pool MXBean provided matches a list of known tenured pool
* names.
@@ -189,7 +192,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
|| (HEAP_POOL != null && name.equals(HEAP_POOL));
}
- HeapMemoryMonitor(final InternalResourceManager resourceManager, final GemFireCacheImpl cache,
+ HeapMemoryMonitor(final InternalResourceManager resourceManager, final InternalCache cache,
final ResourceManagerStats stats) {
this.resourceManager = resourceManager;
this.resourceAdvisor = (ResourceAdvisor) cache.getDistributionAdvisor();
@@ -273,9 +276,8 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
try {
emitter.removeNotificationListener(this, null, null);
this.cache.getLoggerI18n().fine("Removed Memory MXBean notification listener" + this);
- } catch (ListenerNotFoundException e) {
- this.cache.getLoggerI18n().fine(
- "This instance '" + toString() + "' was not registered as a Memory MXBean listener");
+ } catch (ListenerNotFoundException ignore) {
+ logger.debug("This instance '{}' was not registered as a Memory MXBean listener", this);
}
// Stop the stats listener
@@ -574,7 +576,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
final long usageThreshold = memoryPoolMXBean.getUsageThreshold();
this.cache.getLoggerI18n().info(
LocalizedStrings.HeapMemoryMonitor_OVERRIDDING_MEMORYPOOLMXBEAN_HEAP_0_NAME_1,
- new Object[] {Long.valueOf(usageThreshold), memoryPoolMXBean.getName()});
+ new Object[] {usageThreshold, memoryPoolMXBean.getName()});
MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
NotificationEmitter emitter = (NotificationEmitter) mbean;
@@ -783,12 +785,12 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
HeapMemoryMonitor.this.cache.getLoggerI18n().fine(
"StatSampler scheduled a " + "handleNotification call with " + usedBytes + " bytes");
}
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignore) {
if (!HeapMemoryMonitor.this.resourceManager.isClosed()) {
- HeapMemoryMonitor.this.cache.getLoggerI18n()
- .warning(LocalizedStrings.ResourceManager_REJECTED_EXECUTION_CAUSE_NOHEAP_EVENTS);
+ logger.warn(LocalizedMessage
+ .create(LocalizedStrings.ResourceManager_REJECTED_EXECUTION_CAUSE_NOHEAP_EVENTS));
}
- } catch (CacheClosedException e) {
+ } catch (CacheClosedException ignore) {
// nothing to do
}
}
@@ -803,7 +805,6 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
/**
* Polls the heap if stat sampling is disabled.
- *
*/
class HeapPoller implements Runnable {
@SuppressWarnings("synthetic-access")
@@ -839,9 +840,9 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
this.thresholds = newThresholds;
StringBuilder builder = new StringBuilder("In testing, the following values were set");
- builder.append(" maxMemoryBytes:" + newThresholds.getMaxMemoryBytes());
- builder.append(" criticalThresholdBytes:" + newThresholds.getCriticalThresholdBytes());
- builder.append(" evictionThresholdBytes:" + newThresholds.getEvictionThresholdBytes());
+ builder.append(" maxMemoryBytes:").append(newThresholds.getMaxMemoryBytes());
+ builder.append(" criticalThresholdBytes:").append(newThresholds.getCriticalThresholdBytes());
+ builder.append(" evictionThresholdBytes:").append(newThresholds.getEvictionThresholdBytes());
this.cache.getLoggerI18n().fine(builder.toString());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
index e98b6db..48cb34e 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
@@ -14,6 +14,23 @@
*/
package org.apache.geode.internal.cache.control;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.Cache;
@@ -27,7 +44,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.OverflowQueueWithDMStats;
import org.apache.geode.distributed.internal.SerialQueuedExecutorWithDMStats;
import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceManagerProfile;
import org.apache.geode.internal.cache.partitioned.LoadProbe;
@@ -36,16 +53,11 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicInteger;
/**
- * Implementation of ResourceManager with additional internal-only methods. TODO: cleanup raw and
- * typed collections
- *
+ * Implementation of ResourceManager with additional internal-only methods.
+ * <p>
+ * TODO: cleanup raw and typed collections
*/
public class InternalResourceManager implements ResourceManager {
private static final Logger logger = LogService.getLogger();
@@ -56,12 +68,12 @@ public class InternalResourceManager implements ResourceManager {
public enum ResourceType {
HEAP_MEMORY(0x1), OFFHEAP_MEMORY(0x2), MEMORY(0x3), ALL(0xFFFFFFFF);
- int id;
+ final int id;
- private ResourceType(final int id) {
+ ResourceType(final int id) {
this.id = id;
}
- };
+ }
private Map<ResourceType, Set<ResourceListener>> listeners =
new HashMap<ResourceType, Set<ResourceListener>>();
@@ -73,7 +85,7 @@ public class InternalResourceManager implements ResourceManager {
private final Set<RebalanceOperation> inProgressOperations = new HashSet<RebalanceOperation>();
private final Object inProgressOperationsLock = new Object();
- final GemFireCacheImpl cache;
+ final InternalCache cache;
private LoadProbe loadProbe;
@@ -93,11 +105,11 @@ public class InternalResourceManager implements ResourceManager {
return (InternalResourceManager) cache.getResourceManager();
}
- public static InternalResourceManager createResourceManager(final GemFireCacheImpl cache) {
+ public static InternalResourceManager createResourceManager(final InternalCache cache) {
return new InternalResourceManager(cache);
}
- private InternalResourceManager(GemFireCacheImpl cache) {
+ private InternalResourceManager(InternalCache cache) {
this.cache = cache;
this.resourceAdvisor = (ResourceAdvisor) cache.getDistributionAdvisor();
this.stats = new ResourceManagerStats(cache.getDistributedSystem());
@@ -118,9 +130,8 @@ public class InternalResourceManager implements ResourceManager {
return thread;
}
};
- int nThreads = MAX_RESOURCE_MANAGER_EXE_THREADS;
- this.scheduledExecutor = new ScheduledThreadPoolExecutor(nThreads, tf);
+ this.scheduledExecutor = new ScheduledThreadPoolExecutor(MAX_RESOURCE_MANAGER_EXE_THREADS, tf);
// Initialize the load probe
try {
@@ -281,7 +292,7 @@ public class InternalResourceManager implements ResourceManager {
void runWithNotifyExecutor(Runnable runnable) {
try {
this.notifyExecutor.execute(runnable);
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignore) {
if (!isClosed()) {
this.cache.getLoggerI18n()
.warning(LocalizedStrings.ResourceManager_REJECTED_EXECUTION_CAUSE_NOHEAP_EVENTS);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
index c9fe6b6..151d2d5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
@@ -19,7 +19,7 @@ import java.util.Set;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryThresholds.MemoryState;
import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceManagerProfile;
@@ -56,7 +56,7 @@ public class OffHeapMemoryMonitor implements MemoryMonitor, MemoryUsageListener
private final OffHeapMemoryUsageListener offHeapMemoryUsageListener;
private final InternalResourceManager resourceManager;
private final ResourceAdvisor resourceAdvisor;
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
private final ResourceManagerStats stats;
/**
* InternalResoruceManager insists on creating a OffHeapMemoryMonitor even when it does not have
@@ -64,7 +64,7 @@ public class OffHeapMemoryMonitor implements MemoryMonitor, MemoryUsageListener
*/
private final MemoryAllocator memoryAllocator;
- OffHeapMemoryMonitor(final InternalResourceManager resourceManager, final GemFireCacheImpl cache,
+ OffHeapMemoryMonitor(final InternalResourceManager resourceManager, final InternalCache cache,
final MemoryAllocator memoryAllocator, final ResourceManagerStats stats) {
this.resourceManager = resourceManager;
this.resourceAdvisor = (ResourceAdvisor) cache.getDistributionAdvisor();
@@ -131,7 +131,7 @@ public class OffHeapMemoryMonitor implements MemoryMonitor, MemoryUsageListener
if (threadToWaitFor != null) {
try {
threadToWaitFor.join();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -548,7 +548,7 @@ public class OffHeapMemoryMonitor implements MemoryMonitor, MemoryUsageListener
try {
this.wait(MS_TIMEOUT);
this.deliverEvent = false;
- } catch (InterruptedException iex) {
+ } catch (InterruptedException ignore) {
logger.warn("OffHeapMemoryUsageListener was interrupted {}", this);
this.stopRequested = true;
exitRunLoop = true;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
index cd9eab3..4a04bfe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
@@ -12,9 +12,23 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.control;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.GemFireException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SystemFailure;
@@ -23,37 +37,28 @@ import org.apache.geode.cache.control.RebalanceOperation;
import org.apache.geode.cache.control.RebalanceResults;
import org.apache.geode.cache.partition.PartitionRebalanceInfo;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.partitioned.PartitionedRegionRebalanceOp;
import org.apache.geode.internal.cache.partitioned.rebalance.CompositeDirector;
import org.apache.geode.internal.logging.LogService;
-import org.apache.logging.log4j.Logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicBoolean;
/**
- * Implements <code>RebalanceOperation</code> for rebalancing Cache resources.
- *
+ * Implements {@code RebalanceOperation} for rebalancing Cache resources.
*/
@SuppressWarnings("synthetic-access")
public class RebalanceOperationImpl implements RebalanceOperation {
-
private static final Logger logger = LogService.getLogger();
private final boolean simulation;
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
private List<Future<RebalanceResults>> futureList = new ArrayList<Future<RebalanceResults>>();
private int pendingTasks;
private final AtomicBoolean cancelled = new AtomicBoolean();
private final Object futureLock = new Object();
private RegionFilter filter;
- RebalanceOperationImpl(GemFireCacheImpl cache, boolean simulation, RegionFilter filter) {
+ RebalanceOperationImpl(InternalCache cache, boolean simulation, RegionFilter filter) {
this.simulation = simulation;
this.cache = cache;
this.filter = filter;
@@ -97,7 +102,7 @@ public class RebalanceOperationImpl implements RebalanceOperation {
this.futureList.add(submitRebalanceTask(prOp, start));
}
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// ignore, go on to the next region
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
index 0151f00..da0c190 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.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.internal.cache.control;
import java.io.DataInput;
@@ -37,6 +36,7 @@ import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.UpdateAttributesProcessor;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryThresholds.MemoryState;
@@ -82,18 +82,12 @@ public class ResourceAdvisor extends DistributionAdvisor {
this.profiles = new ResourceManagerProfile[] {profile};
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.distributed.internal.DistributionMessage#process(org.apache.geode.
- * distributed.internal.DistributionManager)
- */
@Override
protected void process(DistributionManager dm) {
Throwable thr = null;
ResourceManagerProfile p = null;
try {
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
final ResourceAdvisor ra = cache.getInternalResourceManager().getResourceAdvisor();
if (this.profiles != null) {
@@ -110,7 +104,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
logger.debug("No cache: {}", this);
}
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("Cache closed: {}", this);
}
@@ -137,11 +131,6 @@ public class ResourceAdvisor extends DistributionAdvisor {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.DataSerializableFixedID#getDSFID()
- */
@Override
public int getDSFID() {
return RESOURCE_PROFILE_MESSAGE;
@@ -184,7 +173,6 @@ public class ResourceAdvisor extends DistributionAdvisor {
* @param irm The resource manager which is requesting distribution
* @param recips The recipients of the message
* @param profile Profile to send in this message
- * @throws ReplyException
*/
public static void send(final InternalResourceManager irm,
Set<InternalDistributedMember> recips, ResourceManagerProfile profile) {
@@ -235,7 +223,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
}
private InternalResourceManager getResourceManager() {
- return ((GemFireCacheImpl) getAdvisee()).getInternalResourceManager(false);
+ return ((InternalCache) getAdvisee()).getInternalResourceManager(false);
}
@SuppressWarnings("synthetic-access")
@@ -288,7 +276,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
@Override
public String toString() {
- return new StringBuilder().append("ResourceAdvisor for ResourceManager " + getAdvisee())
+ return new StringBuilder().append("ResourceAdvisor for ResourceManager ").append(getAdvisee())
.toString();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
index dcadab0..fe7b3d3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
@@ -27,7 +27,7 @@ import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.DistributedRegion;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.control.MemoryThresholds;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -404,7 +404,7 @@ public class DistributedRegionFunctionExecutor extends AbstractExecution {
*/
@Override
public void validateExecution(Function function, Set targetMembers) {
- GemFireCacheImpl cache = region.getGemFireCache();
+ InternalCache cache = region.getGemFireCache();
if (cache != null && cache.getTxManager().getTXState() != null) {
if (targetMembers.size() > 1) {
throw new TransactionException(
@@ -419,18 +419,18 @@ public class DistributedRegionFunctionExecutor extends AbstractExecution {
} else if (!target.equals(funcTarget)) {
throw new TransactionDataNotColocatedException(
LocalizedStrings.PartitionedRegion_TX_FUNCTION_EXECUTION_NOT_COLOCATED_0_1
- .toLocalizedString(new Object[] {target, funcTarget}));
+ .toLocalizedString(target, funcTarget));
}
}
}
if (!MemoryThresholds.isLowMemoryExceptionDisabled() && function.optimizeForWrite()) {
try {
region.checkIfAboveThreshold(null);
- } catch (LowMemoryException e) {
+ } catch (LowMemoryException ignore) {
Set<DistributedMember> htrm = region.getMemoryThresholdReachedMembers();
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
- .toLocalizedString(new Object[] {function.getId(), htrm}),
+ .toLocalizedString(function.getId(), htrm),
htrm);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionResultSender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionResultSender.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionResultSender.java
index 3c5045a..c9d3fd8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionResultSender.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionResultSender.java
@@ -23,16 +23,11 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.internal.cache.DistributedRegionFunctionStreamingMessage;
import org.apache.geode.internal.cache.ForceReattemptException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-/**
- *
- *
- */
-public final class DistributedRegionFunctionResultSender implements InternalResultSender {
+public class DistributedRegionFunctionResultSender implements InternalResultSender {
private static final Logger logger = LogService.getLogger();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionExecutionNodePruner.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionExecutionNodePruner.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionExecutionNodePruner.java
index 18700a7..5b1146f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionExecutionNodePruner.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionExecutionNodePruner.java
@@ -163,7 +163,7 @@ public class FunctionExecutionNodePruner {
// return node;
return (nodesOfEqualSize.size() > 0
- ? nodesOfEqualSize.get(PartitionedRegion.rand.nextInt(nodesOfEqualSize.size())) : null);
+ ? nodesOfEqualSize.get(PartitionedRegion.RANDOM.nextInt(nodesOfEqualSize.size())) : null);
}
public static HashMap<Integer, HashSet> groupByBucket(PartitionedRegion pr, Set routingKeys,
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/LocalResultCollectorImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/LocalResultCollectorImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/LocalResultCollectorImpl.java
index 9268e55..e0fe28f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/LocalResultCollectorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/LocalResultCollectorImpl.java
@@ -24,10 +24,9 @@ import org.apache.geode.cache.execute.FunctionInvocationTargetException;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ReplyProcessor21;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
-public final class LocalResultCollectorImpl implements LocalResultCollector {
+public class LocalResultCollectorImpl implements LocalResultCollector {
private final ResultCollector userRC;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
index 74034e4..ab6794b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
@@ -36,11 +36,10 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.SetUtils;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.control.MemoryThresholds;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- */
public class MemberFunctionExecutor extends AbstractExecution {
protected InternalDistributedSystem ds;
@@ -131,7 +130,7 @@ public class MemberFunctionExecutor extends AbstractExecution {
final FunctionContext context = new FunctionContextImpl(function.getId(),
getArgumentsForMember(localVM.getId()), resultSender);
boolean isTx = false;
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
isTx = cache.getTxManager().getTXState() == null ? false : true;
}
@@ -156,13 +155,9 @@ public class MemberFunctionExecutor extends AbstractExecution {
return localRC;
}
- /**
- * @param function
- * @param dest
- */
@Override
public void validateExecution(final Function function, final Set dest) {
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && cache.getTxManager().getTXState() != null) {
if (dest.size() > 1) {
throw new TransactionException(
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
index a3ae2c0..27542f5 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.Random;
import java.util.Set;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.LowMemoryException;
import org.apache.geode.cache.Region;
@@ -38,15 +37,12 @@ import org.apache.geode.internal.Assert;
import org.apache.geode.internal.SetUtils;
import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.control.MemoryThresholds;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- *
- *
- */
public class MultiRegionFunctionExecutor extends AbstractExecution {
private final Set<Region> regions;
@@ -210,7 +206,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
LocalizedStrings.MemberFunctionExecutor_NO_MEMBER_FOUND_FOR_EXECUTING_FUNCTION_0
.toLocalizedString(function.getId()));
}
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (function.optimizeForWrite() && cache != null
&& cache.getInternalResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
&& !MemoryThresholds.isLowMemoryExceptionDisabled()) {
@@ -218,7 +214,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
Set<DistributedMember> sm = SetUtils.intersection(hcm, dest);
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
- .toLocalizedString(new Object[] {function.getId(), sm}),
+ .toLocalizedString(function.getId(), sm),
sm);
}
setExecutionNodes(dest);
@@ -243,7 +239,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
Set<String> regionPathSet = memberToRegionMap.get(localVM);
Set<Region> regions = new HashSet<Region>();
if (regionPathSet != null) {
- Cache cache1 = GemFireCacheImpl.getInstance();
+ InternalCache cache1 = GemFireCacheImpl.getInstance();
for (String regionPath : regionPathSet) {
regions.add(cache1.getRegion(regionPath));
}
@@ -263,8 +259,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
MultiRegionFunctionResultWaiter waiter = new MultiRegionFunctionResultWaiter(ds,
localResultCollector, function, dest, memberArgs, resultSender, memberToRegionMap);
- ResultCollector reply = waiter.getFunctionResultFrom(dest, function, this);
- return reply;
+ return waiter.getFunctionResultFrom(dest, function, this);
}
return localResultCollector;
}
@@ -280,7 +275,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
PartitionedRegion pr = (PartitionedRegion) region;
Set<InternalDistributedMember> prMembers = pr.getRegionAdvisor().advisePrimaryOwners();
if (pr.isDataStore()) {
- GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache();
+ InternalCache cache = (InternalCache) region.getCache();
// Add local node
InternalDistributedMember localVm = cache.getMyId();
Set<String> regions = memberToRegions.get(localVm);
@@ -334,7 +329,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
memberToRegions.put(member, regions);
}
} else if (dp.withReplication()) {
- GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache();
+ InternalCache cache = (InternalCache) region.getCache();
// Add local node
InternalDistributedMember local = cache.getMyId();
Set<String> regions = memberToRegions.get(local);
@@ -345,7 +340,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
memberToRegions.put(local, regions);
}
} else if (region instanceof LocalRegion) {
- GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache();
+ InternalCache cache = (InternalCache) region.getCache();
// Add local node
InternalDistributedMember local = cache.getMyId();
Set<String> regions = memberToRegions.get(local);
@@ -366,9 +361,9 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
@Override
public void validateExecution(Function function, Set targetMembers) {
- GemFireCacheImpl cache = null;
+ InternalCache cache = null;
for (Region r : regions) {
- cache = (GemFireCacheImpl) r.getCache();
+ cache = (InternalCache) r.getCache();
break;
}
if (cache != null && cache.getTxManager().getTXState() != null) {
@@ -385,7 +380,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
} else if (!target.equals(funcTarget)) {
throw new TransactionDataNotColocatedException(
LocalizedStrings.PartitionedRegion_TX_FUNCTION_EXECUTION_NOT_COLOCATED_0_1
- .toLocalizedString(new Object[] {target, funcTarget}));
+ .toLocalizedString(target, funcTarget));
}
}
}
@@ -396,7 +391,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
Set<DistributedMember> sm = SetUtils.intersection(hcm, targetMembers);
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
- .toLocalizedString(new Object[] {function.getId(), sm}),
+ .toLocalizedString(function.getId(), sm),
sm);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
index c7a7d36..6e13ebc 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
@@ -12,11 +12,9 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.execute;
import java.util.Iterator;
-import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.geode.cache.LowMemoryException;
@@ -30,16 +28,12 @@ import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.SetUtils;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.control.MemoryThresholds;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- *
- *
- */
public class PartitionedRegionFunctionExecutor extends AbstractExecution {
private final PartitionedRegion pr;
@@ -332,16 +326,9 @@ public class PartitionedRegionFunctionExecutor extends AbstractExecution {
return buf.toString();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.execute.AbstractExecution#validateExecution(org.apache.geode.
- * cache.execute.Function, java.util.Set)
- */
@Override
public void validateExecution(Function function, Set targetMembers) {
- GemFireCacheImpl cache = pr.getGemFireCache();
+ InternalCache cache = pr.getGemFireCache();
if (cache != null && cache.getTxManager().getTXState() != null) {
if (targetMembers.size() > 1) {
throw new TransactionException(
@@ -356,7 +343,7 @@ public class PartitionedRegionFunctionExecutor extends AbstractExecution {
} else if (!target.equals(funcTarget)) {
throw new TransactionDataRebalancedException(
LocalizedStrings.PartitionedRegion_TX_FUNCTION_EXECUTION_NOT_COLOCATED_0_1
- .toLocalizedString(new Object[] {target, funcTarget}));
+ .toLocalizedString(target, funcTarget));
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
index 3a20dc3..18ba32b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
@@ -12,9 +12,12 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.execute;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.internal.ProxyCache;
@@ -26,28 +29,23 @@ import org.apache.geode.cache.execute.FunctionException;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.TXStateProxyImpl;
import org.apache.geode.internal.cache.execute.util.SynchronizedResultCollector;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
/**
- *
* Executes Function with FunctionService#onRegion(Region region) in client server mode.
*
* @see FunctionService#onRegion(Region) *
* @since GemFire 5.8 LA
- *
*/
public class ServerRegionFunctionExecutor extends AbstractExecution {
private static final Logger logger = LogService.getLogger();
- final private LocalRegion region;
+ private final LocalRegion region;
private boolean executeOnBucketSet = false;
public ServerRegionFunctionExecutor(Region r, ProxyCache proxyCache) {
@@ -288,11 +286,12 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
}
return srp;
} else {
- StringBuffer message = new StringBuffer();
+ StringBuilder message = new StringBuilder();
message.append(srp).append(": ");
- message.append(
- "No available connection was found. Server Region Proxy is not available for this region "
- + region.getName());
+ message
+ .append(
+ "No available connection was found. Server Region Proxy is not available for this region ")
+ .append(region.getName());
throw new FunctionException(message.toString());
}
}
@@ -340,16 +339,9 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
return new ServerRegionFunctionExecutor(this, argument);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.execute.AbstractExecution#validateExecution(org.apache.geode.
- * cache.execute.Function, java.util.Set)
- */
@Override
public void validateExecution(Function function, Set targetMembers) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && cache.getTxManager().getTXState() != null) {
TXStateProxyImpl tx = (TXStateProxyImpl) cache.getTxManager().getTXState();
tx.getRealDeal(null, region);
@@ -357,7 +349,6 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
}
}
-
@Override
public ResultCollector execute(final String functionName) {
if (functionName == null) {
@@ -472,6 +463,4 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
public boolean getExecuteOnBucketSetFlag() {
return this.executeOnBucketSet;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/FindRestEnabledServersFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/FindRestEnabledServersFunction.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/FindRestEnabledServersFunction.java
index 13d8e18..f78de18 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/FindRestEnabledServersFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/FindRestEnabledServersFunction.java
@@ -21,18 +21,17 @@ import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.management.internal.RestAgent;
/**
* The FindRestEnabledServersFunction class is a gemfire function that gives details about REST
* enabled gemfire servers.
- * <p/>
*
* @since GemFire 8.1
*/
-
public class FindRestEnabledServersFunction extends FunctionAdapter implements InternalEntity {
+ private static final long serialVersionUID = 7851518767859544678L;
/**
* This property defines internal function that will get executed on each node to fetch active
@@ -40,20 +39,17 @@ public class FindRestEnabledServersFunction extends FunctionAdapter implements I
*/
public static final String FIND_REST_ENABLED_SERVERS_FUNCTION_ID =
FindRestEnabledServersFunction.class.getName();
- private static final long serialVersionUID = 7851518767859544678L;
-
public void execute(FunctionContext context) {
-
try {
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+ InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
DistributionConfig config = InternalDistributedSystem.getAnyInstance().getConfig();
String bindAddress = RestAgent.getBindAddressForHttpService(config);
final String protocolType = config.getHttpServiceSSLEnabled() ? "https" : "http";
- if (c.isRESTServiceRunning()) {
+ if (cache.isRESTServiceRunning()) {
context.getResultSender()
.lastResult(protocolType + "://" + bindAddress + ":" + config.getHttpServicePort());
@@ -62,7 +58,6 @@ public class FindRestEnabledServersFunction extends FunctionAdapter implements I
}
} catch (CacheClosedException ex) {
context.getResultSender().lastResult("");
-
}
}
[22/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteCacheInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteCacheInfo.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteCacheInfo.java
index bcce322..59be343 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteCacheInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteCacheInfo.java
@@ -14,6 +14,15 @@
*/
package org.apache.geode.internal.admin.remote;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheRuntimeException;
@@ -22,16 +31,9 @@ import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.admin.CacheInfo;
import org.apache.geode.internal.admin.StatResource;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-
-// import org.apache.geode.internal.*;
-
/**
* This class is an implementation of the {@link CacheInfo} interface.
*/
@@ -54,14 +56,14 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
/** Is this is a cache server? */
private boolean isServer;
- public RemoteCacheInfo(GemFireCacheImpl c) {
- this.name = c.getName();
- this.id = System.identityHashCode(c);
- this.closed = c.isClosed();
- this.lockTimeout = c.getLockTimeout();
- this.lockLease = c.getLockLease();
- this.searchTimeout = c.getSearchTimeout();
- this.upTime = c.getUpTime();
+ public RemoteCacheInfo(InternalCache internalCache) {
+ this.name = internalCache.getName();
+ this.id = System.identityHashCode(internalCache);
+ this.closed = internalCache.isClosed();
+ this.lockTimeout = internalCache.getLockTimeout();
+ this.lockLease = internalCache.getLockLease();
+ this.searchTimeout = internalCache.getSearchTimeout();
+ this.upTime = internalCache.getUpTime();
if (this.closed) {
this.rootRegionNames = null;
this.perfStats = null;
@@ -71,16 +73,15 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
try {
final Set roots;
if (!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "PRDebug")) {
- roots = c.rootRegions();
+ roots = internalCache.rootRegions();
} else {
- roots = c.rootRegions(true);
+ roots = internalCache.rootRegions(true);
}
String[] rootNames = new String[roots.size()];
int idx = 0;
- Iterator it = roots.iterator();
- while (it.hasNext()) {
- Region r = (Region) it.next();
+ for (Object root : roots) {
+ Region r = (Region) root;
rootNames[idx] = r.getName();
idx++;
}
@@ -88,28 +89,30 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
} catch (CacheRuntimeException ignore) {
this.rootRegionNames = null;
}
- this.perfStats = new RemoteStatResource(c.getCachePerfStats().getStats());
+ this.perfStats = new RemoteStatResource(internalCache.getCachePerfStats().getStats());
// Note that since this is only a snapshot, so no synchronization
// on allBridgeServersLock is needed.
- Collection bridges = c.getCacheServers();
+ Collection<CacheServer> bridges = internalCache.getCacheServers();
this.bridgeServerIds = new int[bridges.size()];
- Iterator iter = bridges.iterator();
+ Iterator<CacheServer> iter = bridges.iterator();
for (int i = 0; iter.hasNext(); i++) {
- CacheServer bridge = (CacheServer) iter.next();
+ CacheServer bridge = iter.next();
this.bridgeServerIds[i] = System.identityHashCode(bridge);
}
- this.isServer = c.isServer();
+ this.isServer = internalCache.isServer();
}
}
/**
* For use only by DataExternalizable mechanism
*/
- public RemoteCacheInfo() {}
-
+ public RemoteCacheInfo() {
+ // do nothing
+ }
+ @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(this.name, out);
out.writeInt(this.id);
@@ -124,6 +127,7 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
out.writeBoolean(this.isServer);
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.name = DataSerializer.readString(in);
this.id = in.readInt();
@@ -139,34 +143,42 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
}
// CacheInfo interface methods
+ @Override
public String getName() {
return this.name;
}
+ @Override
public int getId() {
return this.id;
}
+ @Override
public boolean isClosed() {
return this.closed;
}
+ @Override
public int getLockTimeout() {
return this.lockTimeout;
}
+ @Override
public int getLockLease() {
return this.lockLease;
}
+ @Override
public int getSearchTimeout() {
return this.searchTimeout;
}
+ @Override
public int getUpTime() {
return this.upTime;
}
+ @Override
public synchronized Set getRootRegionNames() {
if (this.rootRegionNames == null) {
return null;
@@ -175,19 +187,23 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
}
}
+ @Override
public StatResource getPerfStats() {
return this.perfStats;
}
+ @Override
public synchronized void setClosed() {
this.closed = true;
this.rootRegionNames = null;
}
+ @Override
public int[] getBridgeServerIds() {
return this.bridgeServerIds;
}
+ @Override
public boolean isServer() {
return this.isServer;
}
@@ -203,6 +219,6 @@ public class RemoteCacheInfo implements CacheInfo, DataSerializable {
@Override
public String toString() {
return LocalizedStrings.RemoteCacheInfo_INFORMATION_ABOUT_THE_CACHE_0_WITH_1_BRIDGE_SERVERS
- .toLocalizedString(new Object[] {this.name, Integer.valueOf(this.bridgeServerIds.length)});
+ .toLocalizedString(this.name, this.bridgeServerIds.length);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
index 14c3ac2..5a47354 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
@@ -19,27 +19,32 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.Set;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
+import org.apache.geode.internal.logging.LogService;
/**
* An instruction to all members that they should forget about the persistent member described by
* this pattern. TODO prpersist - This extends AdminRequest, but it doesn't work with most of the
* admin paradigm, which is a request response to a single member. Maybe we need to a new base
* class.
- *
*/
public class RevokePersistentIDRequest extends CliLegacyMessage {
- PersistentMemberPattern pattern;
+ private static final Logger logger = LogService.getLogger();
- public RevokePersistentIDRequest() {
+ private PersistentMemberPattern pattern;
+ public RevokePersistentIDRequest() {
+ // do nothing
}
public RevokePersistentIDRequest(PersistentMemberPattern pattern) {
@@ -63,22 +68,23 @@ public class RevokePersistentIDRequest extends CliLegacyMessage {
}
throw e;
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.warn(e);
}
request.createResponse((DistributionManager) dm);
}
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
PersistentMemberManager mm = cache.getPersistentMemberManager();
- mm.revokeMember(pattern);
+ mm.revokeMember(this.pattern);
}
return new RevokePersistentIDResponse(this.getSender());
}
+ @Override
public int getDSFID() {
return REVOKE_PERSISTENT_ID_REQUEST;
}
@@ -86,14 +92,13 @@ public class RevokePersistentIDRequest extends CliLegacyMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- pattern = new PersistentMemberPattern();
- InternalDataSerializer.invokeFromData(pattern, in);
+ this.pattern = new PersistentMemberPattern();
+ InternalDataSerializer.invokeFromData(this.pattern, in);
}
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
- InternalDataSerializer.invokeToData(pattern, out);
+ InternalDataSerializer.invokeToData(this.pattern, out);
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
index 5255292..78ac174 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
@@ -12,61 +12,53 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
-
package org.apache.geode.internal.admin.remote;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.admin.GemFireVM;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-// import org.apache.geode.internal.*;
+import org.apache.geode.internal.cache.InternalCache;
/**
* Responds to {@link RootRegionResponse}.
*/
public final class RootRegionResponse extends AdminResponse {
- // instance variables
- // private boolean hasRoot = false;
+
private String[] regions;
private String[] userAttrs;
/**
- * Returns a <code>RootRegionResponse</code> that will be returned to the specified recipient. The
+ * Returns a {@code RootRegionResponse} that will be returned to the specified recipient. The
* message will contains a copy of the local manager's system config.
*/
public static RootRegionResponse create(DistributionManager dm,
InternalDistributedMember recipient) {
RootRegionResponse m = new RootRegionResponse();
try {
- Cache cache = CacheFactory.getInstance(dm.getSystem());
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
final Collection roots;
if (!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "PRDebug")) {
roots = cache.rootRegions();
} else {
- roots = ((GemFireCacheImpl) cache).rootRegions(true);
+ roots = cache.rootRegions(true);
}
-
List regionNames = new ArrayList();
List userAttributes = new ArrayList();
- for (Iterator iter = roots.iterator(); iter.hasNext();) {
- Region r = (Region) iter.next();
+ for (Object root : roots) {
+ Region r = (Region) root;
regionNames.add(r.getName());
userAttributes.add(CacheDisplay.getCachedObjectDisplay(r.getUserAttribute(),
GemFireVM.LIGHTWEIGHT_CACHE_VALUE));
@@ -76,20 +68,19 @@ public final class RootRegionResponse extends AdminResponse {
m.regions = (String[]) regionNames.toArray(temp);
m.userAttrs = (String[]) userAttributes.toArray(temp);;
- } catch (CancelException cce) {
- /* no cache yet */ }
+ } catch (CancelException ignore) {
+ /* no cache yet */
+ }
m.setRecipient(recipient);
return m;
}
- // instance methods
-
public Region[] getRegions(RemoteGemFireVM vm) {
- if (regions.length > 0) {
- Region[] roots = new Region[regions.length];
- for (int i = 0; i < regions.length; i++) {
- roots[i] = new AdminRegion(regions[i], vm, userAttrs[i]);
+ if (this.regions.length > 0) {
+ Region[] roots = new Region[this.regions.length];
+ for (int i = 0; i < this.regions.length; i++) {
+ roots[i] = new AdminRegion(this.regions[i], vm, this.userAttrs[i]);
}
return roots;
} else {
@@ -97,6 +88,7 @@ public final class RootRegionResponse extends AdminResponse {
}
}
+ @Override
public int getDSFID() {
return ROOT_REGION_RESPONSE;
}
@@ -104,15 +96,15 @@ public final class RootRegionResponse extends AdminResponse {
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
- DataSerializer.writeObject(regions, out);
- DataSerializer.writeObject(userAttrs, out);
+ DataSerializer.writeObject(this.regions, out);
+ DataSerializer.writeObject(this.userAttrs, out);
}
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- regions = (String[]) DataSerializer.readObject(in);
- userAttrs = (String[]) DataSerializer.readObject(in);
+ this.regions = DataSerializer.readObject(in);
+ this.userAttrs = DataSerializer.readObject(in);
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
index 979207a..b12f9f2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
@@ -14,44 +14,55 @@
*/
package org.apache.geode.internal.admin.remote;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SystemFailure;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyMessage;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.tcp.ConnectionTable;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
/**
* An instruction to all members with cache that their PR should gracefully close and disconnect DS
- *
*/
public class ShutdownAllRequest extends AdminRequest {
private static final Logger logger = LogService.getLogger();
- static final long SLEEP_TIME_BEFORE_DISCONNECT_DS = Long
- .getLong(DistributionConfig.GEMFIRE_PREFIX + "sleep-before-disconnect-ds", 1000).longValue();
+ private static final long SLEEP_TIME_BEFORE_DISCONNECT_DS =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "sleep-before-disconnect-ds", 1000);
- public ShutdownAllRequest() {}
+ public ShutdownAllRequest() {
+ // do nothing
+ }
/**
* Sends a shutdownAll request to all other members and performs local shutdownAll processing in
* the waitingThreadPool.
*/
public static Set send(final DM dm, long timeout) {
-
boolean hadCache = hasCache();
- boolean interrupted = false;
- DistributionManager dism =
- (dm instanceof DistributionManager) ? (DistributionManager) dm : null;
+ DistributionManager dism = dm instanceof DistributionManager ? (DistributionManager) dm : null;
InternalDistributedMember myId = dm.getDistributionManagerId();
Set recipients = dm.getOtherNormalDistributionManagerIds();
@@ -59,7 +70,6 @@ public class ShutdownAllRequest extends AdminRequest {
recipients.remove(myId);
// now do shutdownall
- // recipients = dm.getOtherNormalDistributionManagerIds();
ShutdownAllRequest request = new ShutdownAllRequest();
request.setRecipients(recipients);
@@ -84,6 +94,7 @@ public class ShutdownAllRequest extends AdminRequest {
}
}
+ boolean interrupted = false;
try {
if (!replyProcessor.waitForReplies(timeout)) {
return null;
@@ -92,9 +103,9 @@ public class ShutdownAllRequest extends AdminRequest {
if (!(e.getCause() instanceof CancelException)) {
e.handleAsUnexpected();
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// expected
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
}
@@ -116,7 +127,7 @@ public class ShutdownAllRequest extends AdminRequest {
try {
Thread.sleep(3 * SLEEP_TIME_BEFORE_DISCONNECT_DS);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
}
return replyProcessor.getResults();
}
@@ -139,10 +150,11 @@ public class ShutdownAllRequest extends AdminRequest {
final InternalDistributedSystem ids = dm.getSystem();
if (ids.isConnected()) {
Thread t = new Thread(new Runnable() {
+ @Override
public void run() {
try {
Thread.sleep(SLEEP_TIME_BEFORE_DISCONNECT_DS);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
}
ConnectionTable.threadWantsSharedResources();
if (ids.isConnected()) {
@@ -156,19 +168,15 @@ public class ShutdownAllRequest extends AdminRequest {
}
private static boolean hasCache() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- if (cache != null && !cache.isClosed()) {
- return true;
- } else {
- return false;
- }
+ InternalCache cache = GemFireCacheImpl.getInstance();
+ return cache != null && !cache.isClosed();
}
@Override
protected AdminResponse createResponse(DistributionManager dm) {
boolean isToShutdown = hasCache();
- boolean isSuccess = false;
if (isToShutdown) {
+ boolean isSuccess = false;
try {
GemFireCacheImpl.getInstance().shutDownAll();
isSuccess = true;
@@ -207,6 +215,7 @@ public class ShutdownAllRequest extends AdminRequest {
return new ShutdownAllResponse(this.getSender(), isToShutdown);
}
+ @Override
public int getDSFID() {
return SHUTDOWN_ALL_REQUEST;
}
@@ -230,7 +239,7 @@ public class ShutdownAllRequest extends AdminRequest {
private static class ShutDownAllReplyProcessor extends AdminMultipleReplyProcessor {
Set results = Collections.synchronizedSet(new TreeSet());
- public ShutDownAllReplyProcessor(DM dm, Collection initMembers) {
+ ShutDownAllReplyProcessor(DM dm, Collection initMembers) {
super(dm, initMembers);
}
@@ -239,13 +248,9 @@ public class ShutdownAllRequest extends AdminRequest {
return false;
}
- /*
+ /**
* If response arrives, we will save into results and keep wait for member's departure. If the
* member is departed before sent response, no wait for its response
- *
- * @see
- * org.apache.geode.distributed.internal.ReplyProcessor21#process(org.apache.geode.distributed.
- * internal.DistributionMessage)
*/
@Override
public void process(DistributionMessage msg) {
@@ -254,8 +259,8 @@ public class ShutdownAllRequest extends AdminRequest {
}
if (msg instanceof ShutdownAllResponse) {
if (((ShutdownAllResponse) msg).isToShutDown()) {
- logger.debug("{} adding {} to result set {}", this, msg.getSender(), results);
- results.add(msg.getSender());
+ logger.debug("{} adding {} to result set {}", this, msg.getSender(), this.results);
+ this.results.add(msg.getSender());
} else {
// for member without cache, we will not wait for its result
// so no need to wait its DS to close either
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractBucketRegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractBucketRegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractBucketRegionQueue.java
index 60f397c..eacb8fd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractBucketRegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractBucketRegionQueue.java
@@ -60,15 +60,14 @@ public abstract class AbstractBucketRegionQueue extends BucketRegion {
* Holds keys for those events that were not found in BucketRegionQueue during processing of
* ParallelQueueRemovalMessage. This can occur due to the scenario mentioned in #49196.
*/
- private final ConcurrentHashSet<Object> failedBatchRemovalMessageKeys =
- new ConcurrentHashSet<Object>();
+ private final ConcurrentHashSet<Object> failedBatchRemovalMessageKeys = new ConcurrentHashSet<>();
- public AbstractBucketRegionQueue(String regionName, RegionAttributes attrs,
- LocalRegion parentRegion, GemFireCacheImpl cache,
- InternalRegionArguments internalRegionArgs) {
+ AbstractBucketRegionQueue(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
+ InternalCache cache, InternalRegionArguments internalRegionArgs) {
super(regionName, attrs, parentRegion, cache, internalRegionArgs);
this.stats = ((AbstractLRURegionMap) getRegionMap()).getLRUStatistics();
- gatewaySenderStats = this.getPartitionedRegion().getParallelGatewaySender().getStatistics();
+ this.gatewaySenderStats =
+ this.getPartitionedRegion().getParallelGatewaySender().getStatistics();
}
// Prevent this region from using concurrency checks
@@ -199,7 +198,7 @@ public abstract class AbstractBucketRegionQueue extends BucketRegion {
}
@Released
EntryEventImpl event = getPartitionedRegion().newDestroyEntryEvent(key, null);
- event.setEventId(new EventID(cache.getSystem()));
+ event.setEventId(new EventID(cache.getInternalDistributedSystem()));
try {
event.setRegion(this);
basicDestroy(event, true, null);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractCacheServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractCacheServer.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractCacheServer.java
index d575634..0a6c24b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractCacheServer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractCacheServer.java
@@ -14,6 +14,10 @@
*/
package org.apache.geode.internal.cache;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Set;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.server.ClientSubscriptionConfig;
@@ -28,10 +32,6 @@ import org.apache.geode.management.membership.ClientMembership;
import org.apache.geode.management.membership.ClientMembershipEvent;
import org.apache.geode.management.membership.ClientMembershipListener;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Set;
-
/**
* Abstract class that contains common code that all true implementations of {@link CacheServer} can
* use.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegionEntry.java
index b162683..ea2c148 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegionEntry.java
@@ -16,13 +16,7 @@ package org.apache.geode.internal.cache;
import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
import org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderQueue;
-import org.apache.geode.internal.offheap.annotations.Released;
-import org.apache.geode.internal.offheap.annotations.Retained;
-/**
- *
- *
- */
public abstract class AbstractDiskRegionEntry extends AbstractRegionEntry implements DiskEntry {
protected AbstractDiskRegionEntry(RegionEntryContext context, Object value) {
super(context, value);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
index 64a1fea..bdaf200 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.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.internal.cache;
import org.apache.geode.cache.EntryEvent;
@@ -26,10 +25,9 @@ import org.apache.geode.internal.offheap.annotations.Retained;
* Abstract implementation class of RegionEntry interface. This is adds Disk support behavior
*
* @since GemFire 3.5.1
- *
- *
*/
public abstract class AbstractOplogDiskRegionEntry extends AbstractDiskRegionEntry {
+
protected AbstractOplogDiskRegionEntry(RegionEntryContext context, Object value) {
super(context, value);
}
[34/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/CacheClosedException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheClosedException.java b/geode-core/src/main/java/org/apache/geode/cache/CacheClosedException.java
index b24bc2f..d149462 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheClosedException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheClosedException.java
@@ -16,12 +16,11 @@ package org.apache.geode.cache;
import org.apache.geode.CancelException;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
/**
* Indicates that the caching system has been closed. Can be thrown from almost any method related
- * to regions or the <code>Cache</code> after the cache has been closed.
- *
- *
+ * to regions or the {@code Cache} after the cache has been closed.
*
* @see Cache
* @since GemFire 3.0
@@ -30,28 +29,28 @@ public class CacheClosedException extends CancelException {
private static final long serialVersionUID = -6479561694497811262L;
/**
- * Constructs a new <code>CacheClosedException</code>.
+ * Constructs a new {@code CacheClosedException}.
*/
public CacheClosedException() {
super();
}
/**
- * Constructs a new <code>CacheClosedException</code> with a message string.
+ * Constructs a new {@code CacheClosedException} with a message string.
*
* @param msg a message string
*/
public CacheClosedException(String msg) {
super(msg);
- // bug #43108 - CacheClosedException should include cause of closure
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ // bug #43108 - CacheClosedException should include cause of closure TODO: but not this way!
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
initCause(cache.getDisconnectCause());
}
}
/**
- * Constructs a new <code>CacheClosedException</code> with a message string and a cause.
+ * Constructs a new {@code CacheClosedException} with a message string and a cause.
*
* @param msg the message string
* @param cause a causal Throwable
@@ -61,7 +60,7 @@ public class CacheClosedException extends CancelException {
}
/**
- * Constructs a new <code>CacheClosedException</code> with a cause.
+ * Constructs a new {@code CacheClosedException} with a cause.
*
* @param cause a causal Throwable
*/
@@ -69,4 +68,3 @@ public class CacheClosedException extends CancelException {
super(cause);
}
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
index 0772dcf..38fdac6 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.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.Properties;
@@ -23,15 +22,16 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.GemFireVersion;
import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.jndi.JNDIInvoker;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxSerializer;
+import org.apache.geode.security.AuthenticationFailedException;
+import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.security.PostProcessor;
import org.apache.geode.security.SecurityManager;
-
/**
* Factory class used to create the singleton {@link Cache cache} and connect to the GemFire
* singleton {@link DistributedSystem distributed system}. If the application wants to connect to
@@ -87,8 +87,6 @@ import org.apache.geode.security.SecurityManager;
* explicitly control the individual region attributes can do this declaratively in XML or using
* APIs.
*
- *
- *
* @since GemFire 3.0
*/
public class CacheFactory {
@@ -135,32 +133,29 @@ public class CacheFactory {
}
/**
- * Creates a new cache that uses the specified <code>system</code>.
- *
+ * Creates a new cache that uses the specified {@code system}.
* <p>
- *
- * The <code>system</code> can specify a
+ * The {@code system} can specify a
* <A href="../distributed/DistributedSystem.html#cache-xml-file">"cache-xml-file"</a> property
* which will cause this creation to also create the regions, objects, and attributes declared in
- * the file. The contents of the file must comply with the <code>"doc-files/cache8_0.dtd"></code>
- * file. Note that when parsing the XML file {@link Declarable} classes are loaded using the
- * current thread's {@linkplain Thread#getContextClassLoader context class loader}.
+ * the file. The contents of the file must comply with the {@code "doc-files/cache8_0.dtd">} file.
+ * Note that when parsing the XML file {@link Declarable} classes are loaded using the current
+ * thread's {@linkplain Thread#getContextClassLoader context class loader}.
*
- * @param system a <code>DistributedSystem</code> obtained by calling
+ * @param system a {@code DistributedSystem} obtained by calling
* {@link DistributedSystem#connect}.
*
- * @return a <code>Cache</code> that uses the specified <code>system</code> for distribution.
+ * @return a {@code Cache} that uses the specified {@code system} for distribution.
*
- * @throws IllegalArgumentException If <code>system</code> is not
- * {@link DistributedSystem#isConnected connected}.
+ * @throws IllegalArgumentException If {@code system} is not {@link DistributedSystem#isConnected
+ * connected}.
* @throws CacheExistsException If an open cache already exists.
* @throws CacheXmlException If a problem occurs while parsing the declarative caching XML file.
* @throws TimeoutException If a {@link Region#put(Object, Object)} times out while initializing
* the cache.
- * @throws CacheWriterException If a <code>CacheWriterException</code> is thrown while
- * initializing the cache.
- * @throws GatewayException If a <code>GatewayException</code> is thrown while initializing the
+ * @throws CacheWriterException If a {@code CacheWriterException} is thrown while initializing the
* cache.
+ * @throws GatewayException If a {@code GatewayException} is thrown while initializing the cache.
* @throws RegionExistsException If the declarative caching XML file describes a region that
* already exists (including the root region).
* @deprecated as of 6.5 use {@link #CacheFactory(Properties)} instead.
@@ -191,10 +186,9 @@ public class CacheFactory {
* @throws CacheXmlException If a problem occurs while parsing the declarative caching XML file.
* @throws TimeoutException If a {@link Region#put(Object, Object)} times out while initializing
* the cache.
- * @throws CacheWriterException If a <code>CacheWriterException</code> is thrown while
- * initializing the cache.
- * @throws GatewayException If a <code>GatewayException</code> is thrown while initializing the
+ * @throws CacheWriterException If a {@code CacheWriterException} is thrown while initializing the
* cache.
+ * @throws GatewayException If a {@code GatewayException} is thrown while initializing the cache.
* @throws RegionExistsException If the declarative caching XML file describes a region that
* already exists (including the root region).
* @throws IllegalStateException if cache already exists and is not compatible with the new
@@ -222,7 +216,7 @@ public class CacheFactory {
/**
* Gets the instance of {@link Cache} produced by an earlier call to {@link #create()}.
*
- * @param system the <code>DistributedSystem</code> the cache was created with.
+ * @param system the {@code DistributedSystem} the cache was created with.
* @return the {@link Cache} associated with the specified system.
* @throws CacheClosedException if a cache has not been created or the created one is
* {@link Cache#isClosed closed}
@@ -235,7 +229,7 @@ public class CacheFactory {
* Gets the instance of {@link Cache} produced by an earlier call to {@link #create()} even if it
* has been closed.
*
- * @param system the <code>DistributedSystem</code> the cache was created with.
+ * @param system the {@code DistributedSystem} the cache was created with.
* @return the {@link Cache} associated with the specified system.
* @throws CacheClosedException if a cache has not been created
* @since GemFire 3.5
@@ -245,7 +239,6 @@ public class CacheFactory {
}
private static Cache basicGetInstance(DistributedSystem system, boolean closeOk) {
-
// Avoid synchronization if this is an initialization thread to avoid
// deadlock when messaging returns to this VM
final int initReq = LocalRegion.threadInitLevelRequirement();
@@ -260,7 +253,7 @@ public class CacheFactory {
}
private static Cache basicGetInstancePart2(DistributedSystem system, boolean closeOk) {
- GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
+ InternalCache instance = GemFireCacheImpl.getInstance();
if (instance == null) {
throw new CacheClosedException(
LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
@@ -286,7 +279,7 @@ public class CacheFactory {
* {@link Cache#isClosed closed}
*/
public static synchronized Cache getAnyInstance() {
- GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
+ InternalCache instance = GemFireCacheImpl.getInstance();
if (instance == null) {
throw new CacheClosedException(
LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
@@ -299,7 +292,7 @@ public class CacheFactory {
/**
* Returns the version of the cache implementation.
*
- * @return the version of the cache implementation as a <code>String</code>
+ * @return the version of the cache implementation as a {@code String}
*/
public static String getVersion() {
return GemFireVersion.getGemFireVersion();
@@ -335,7 +328,6 @@ public class CacheFactory {
* object provided this way is expected to be initialized already. We are not calling the init
* method on this object
*
- * @param securityManager
* @return this CacheFactory
*/
public CacheFactory setSecurityManager(SecurityManager securityManager) {
@@ -351,7 +343,6 @@ public class CacheFactory {
* object provided this way is expected to be initialized already. We are not calling the init
* method on this object
*
- * @param postProcessor
* @return this CacheFactory
*/
public CacheFactory setPostProcessor(PostProcessor postProcessor) {
@@ -393,8 +384,8 @@ public class CacheFactory {
/**
* Control whether the type metadata for PDX objects is persisted to disk. The default for this
* setting is false. If you are using persistent regions with PDX then you must set this to true.
- * If you are using a <code>GatewaySender</code> or <code>AsyncEventQueue</code> with PDX then you
- * should set this to true.
+ * If you are using a {@code GatewaySender} or {@code AsyncEventQueue} with PDX then you should
+ * set this to true.
*
* @param isPersistent true if the metadata should be persistent
* @return this CacheFactory
@@ -410,12 +401,12 @@ public class CacheFactory {
* preserve unread fields be including their data during serialization. But if you configure the
* cache to ignore unread fields then their data will be lost during serialization.
* <P>
- * You should only set this attribute to <code>true</code> if you know this member will only be
- * reading cache data. In this use case you do not need to pay the cost of preserving the unread
- * fields since you will never be reserializing pdx data.
+ * You should only set this attribute to {@code true} if you know this member will only be reading
+ * cache data. In this use case you do not need to pay the cost of preserving the unread fields
+ * since you will never be reserializing pdx data.
*
- * @param ignore <code>true</code> if fields not read during pdx deserialization should be
- * ignored; <code>false</code>, the default, if they should be preserved.
+ * @param ignore {@code true} if fields not read during pdx deserialization should be ignored;
+ * {@code false}, the default, if they should be preserved.
* @return this CacheFactory
* @since GemFire 6.6
*/
@@ -424,4 +415,3 @@ public class CacheFactory {
return this;
}
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
index 57a1a46..5818cfc 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.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.io.File;
@@ -22,6 +21,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.geode.InternalGemFireError;
@@ -40,8 +40,8 @@ import org.apache.geode.internal.cache.DynamicRegionFactoryImpl;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.EnumListenerEvent;
import org.apache.geode.internal.cache.EvictionAttributesImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InitialImageOperation;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionEntry;
@@ -49,7 +49,6 @@ import org.apache.geode.internal.cache.RegionEventImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.security.GemFireSecurityException;
-
/**
* DynamicRegionFactory provides a distributed region creation service. Any other member of the
* GemFire DistributedSystem that has created an instance of this class will automatically
@@ -65,12 +64,18 @@ import org.apache.geode.security.GemFireSecurityException;
* <li>Before you've created a GemFire Cache in your application, add a line of code as follows:<br>
*
* <pre>
- * <code> DynamicRegionFactory factory = DynamicRegionFactory.get();
- * factory.open(config);</code>
+ * {
+ * @code
+ * DynamicRegionFactory factory = DynamicRegionFactory.get();
+ * factory.open(config);
+ * }
* </pre>
*
* <pre>
- * <code> DynamicRegionFactory myFactoryHandle = DynamicRegionFactory.get().open(config);</code>
+ * {
+ * @code
+ * DynamicRegionFactory myFactoryHandle = DynamicRegionFactory.get().open(config);
+ * }
* </pre>
*
* or just use a dynamic-region-factory element in the cache.xml.
@@ -130,26 +135,31 @@ import org.apache.geode.security.GemFireSecurityException;
* @since GemFire 4.3
* @deprecated This class is deprecated. Use {@link FunctionService} to create regions on other
* members instead.
- *
*/
@SuppressWarnings("deprecation")
@Deprecated
public abstract class DynamicRegionFactory {
public static final String dynamicRegionListName = "__DynamicRegions";
+
private Region dynamicRegionList = null;
+
/**
* This controls the delay introduced to try and avoid any race conditions between propagation of
* newly created Dynamic Regions and the Entries put into them.
*/
private static final long regionCreateSleepMillis =
- Long.getLong("DynamicRegionFactory.msDelay", 250).longValue();
- private static DynamicRegionFactory singleInstance = new DynamicRegionFactoryImpl();
- GemFireCacheImpl c = null;
- Config config = null;
+ Long.getLong("DynamicRegionFactory.msDelay", 250);
+
+ private static final DynamicRegionFactory singleInstance = new DynamicRegionFactoryImpl();
+
+ InternalCache cache = null;
+
+ private Config config = null;
/** The region listeners registered on this DynamicRegionFactory */
- private static volatile List regionListeners = Collections.EMPTY_LIST;
+ private static volatile List regionListeners = Collections.emptyList();
+
private static final Object regionListenerLock = new Object();
/**
@@ -174,9 +184,9 @@ public abstract class DynamicRegionFactory {
* Closes the dynamic region factory, disabling any further creation or destruction of dynamic
* regions in this cache.
*/
- protected void _close() {
+ protected void doClose() {
this.config = null;
- this.c = null;
+ this.cache = null;
}
/**
@@ -191,7 +201,7 @@ public abstract class DynamicRegionFactory {
* after their cache has been created.
*/
public boolean isActive() {
- return isOpen() && this.c != null;
+ return isOpen() && this.cache != null;
}
/**
@@ -217,24 +227,21 @@ public abstract class DynamicRegionFactory {
/**
* The method is for internal use only. It is called implicitly during cache creation.
+ * <p>
+ * This method is called internally during cache initialization at the correct time. Initialize
+ * the factory with a GemFire Cache. We create the metadata Region which holds all our dynamically
+ * created regions.
*
- * @param theCache The GemFire <code>Cache</code>
- * @throws CacheException
+ * @param theCache The GemFire {@code Cache}
*/
-
- protected void _internalInit(GemFireCacheImpl theCache) throws CacheException {
-
+ protected void doInternalInit(InternalCache theCache) throws CacheException {
if (isClosed()) {
// DynamicRegions are not enabled in this vm. Just return.
return;
}
- /**
- * This method is called internally during cache initialization at the correct time. Initialize
- * the factory with a GemFire Cache. We create the metadata Region which holds all our
- * dynamically created regions.
- */
+
try {
- this.c = theCache;
+ this.cache = theCache;
this.dynamicRegionList = theCache.getRegion(dynamicRegionListName);
final boolean isClient = this.config.getPoolName() != null;
if (this.dynamicRegionList == null) {
@@ -276,7 +283,7 @@ public abstract class DynamicRegionFactory {
af.setDataPolicy(DataPolicy.REPLICATE); // setMirrorType(MirrorType.KEYS_VALUES);
}
- for (GatewaySender gs : c.getGatewaySenders()) {
+ for (GatewaySender gs : this.cache.getGatewaySenders()) {
if (!gs.isParallel())
af.addGatewaySenderId(gs.getId());
}
@@ -284,36 +291,31 @@ public abstract class DynamicRegionFactory {
}
try {
- dynamicRegionList = theCache.createVMRegion(dynamicRegionListName, af.create(), ira);
+ this.dynamicRegionList = theCache.createVMRegion(dynamicRegionListName, af.create(), ira);
} catch (IOException e) {
// only if loading snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- LocalizedStrings.DynamicRegionFactory_UNEXPECTED_EXCEPTION.toLocalizedString());
- assErr.initCause(e);
- throw assErr;
+ throw new InternalGemFireError(
+ LocalizedStrings.DynamicRegionFactory_UNEXPECTED_EXCEPTION.toLocalizedString(), e);
} catch (ClassNotFoundException e) {
// only if loading snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- LocalizedStrings.DynamicRegionFactory_UNEXPECTED_EXCEPTION.toLocalizedString());
- assErr.initCause(e);
- throw assErr;
+ throw new InternalGemFireError(
+ LocalizedStrings.DynamicRegionFactory_UNEXPECTED_EXCEPTION.toLocalizedString(), e);
}
if (isClient) {
- dynamicRegionList.registerInterest("ALL_KEYS");
+ this.dynamicRegionList.registerInterest("ALL_KEYS");
}
if (theCache.getLoggerI18n().fineEnabled()) {
- theCache.getLoggerI18n().fine("Created dynamic region: " + dynamicRegionList);
+ theCache.getLoggerI18n().fine("Created dynamic region: " + this.dynamicRegionList);
}
} else {
if (theCache.getLoggerI18n().fineEnabled()) {
- theCache.getLoggerI18n().fine("Retrieved dynamic region: " + dynamicRegionList);
+ theCache.getLoggerI18n().fine("Retrieved dynamic region: " + this.dynamicRegionList);
}
}
createDefinedDynamicRegions();
} catch (CacheException e) {
- //
theCache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_ERROR_INITIALIZING_DYNAMICREGIONFACTORY, e);
throw e;
@@ -322,47 +324,44 @@ public abstract class DynamicRegionFactory {
/**
* This creates Dynamic Regions that already exist in other publishing processes
- *
*/
private void createDefinedDynamicRegions() throws CacheException {
- // TODO: perhaps add some logic here to avoid the possiblity of synchronization issues . . . .
- Set s = dynamicRegionList.entrySet(false);
+ // TODO: perhaps add some logic here to avoid the possibility of synchronization issues
+ Set set = this.dynamicRegionList.entrySet(false);
- Iterator i = s.iterator();
- TreeMap sorted = new TreeMap();
+ Iterator iterator = set.iterator();
+ SortedMap sorted = new TreeMap();
// sort by region name before creating (bug 35528)
- while (i.hasNext()) {
- Region.Entry e = (Region.Entry) i.next();
+ while (iterator.hasNext()) {
+ Region.Entry e = (Region.Entry) iterator.next();
DynamicRegionAttributes dda = (DynamicRegionAttributes) e.getValue();
- sorted.put(dda.rootRegionName + "/" + dda.name, dda);
+ sorted.put(dda.rootRegionName + '/' + dda.name, dda);
}
- i = sorted.values().iterator();
+ iterator = sorted.values().iterator();
- while (i.hasNext()) {
- DynamicRegionAttributes dda = (DynamicRegionAttributes) i.next();
+ while (iterator.hasNext()) {
+ DynamicRegionAttributes dda = (DynamicRegionAttributes) iterator.next();
- doBeforeRegionCreated(dda.rootRegionName, dda.name, null);
+ doBeforeRegionCreated(dda.rootRegionName, dda.name);
Region region = createDynamicRegionImpl(dda.rootRegionName, dda.name, false);
doAfterRegionCreated(region, false, false, null);
-
}
-
}
/**
- * Returns the <code>DynamicRegionFactory</code> singleton instance.
+ * Returns the {@code DynamicRegionFactory} singleton instance.
*
- * @return the <code>DynamicRegionFactory</code> singleton instance
+ * @return the {@code DynamicRegionFactory} singleton instance
*/
public static DynamicRegionFactory get() {
return singleInstance;
}
/**
- * Registers a <code>DynamicRegionListener</code> for callbacks.
+ * Registers a {@code DynamicRegionListener} for callbacks.
*
- * @param listener The <code>DynamicRegionListener</code> to be registered
+ * @param listener The {@code DynamicRegionListener} to be registered
*/
public void registerDynamicRegionListener(DynamicRegionListener listener) {
synchronized (regionListenerLock) {
@@ -376,9 +375,9 @@ public abstract class DynamicRegionFactory {
}
/**
- * Unregisters a <code>DynamicRegionListener</code> for callbacks.
+ * Unregisters a {@code DynamicRegionListener} for callbacks.
*
- * @param listener The <code>DynamicRegionListener</code> to be unregistered
+ * @param listener The {@code DynamicRegionListener} to be unregistered
*/
public void unregisterDynamicRegionListener(DynamicRegionListener listener) {
synchronized (regionListenerLock) {
@@ -392,10 +391,9 @@ public abstract class DynamicRegionFactory {
}
}
- private void doBeforeRegionCreated(String parentRegion, String regionName,
- DistributedMember mbr) {
- for (Iterator i = regionListeners.iterator(); i.hasNext();) {
- DynamicRegionListener listener = (DynamicRegionListener) i.next();
+ private void doBeforeRegionCreated(String parentRegion, String regionName) {
+ for (Object regionListener : regionListeners) {
+ DynamicRegionListener listener = (DynamicRegionListener) regionListener;
try {
listener.beforeRegionCreate(parentRegion, regionName);
} catch (VirtualMachineError err) {
@@ -410,7 +408,7 @@ public abstract class DynamicRegionFactory {
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- this.c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONCREATED,
listener, t);
}
@@ -421,10 +419,10 @@ public abstract class DynamicRegionFactory {
DistributedMember mbr) {
RegionEvent event =
new RegionEventImpl(region, Operation.REGION_CREATE, null, isOriginRemote, getMember(mbr));
- for (Iterator i = regionListeners.iterator(); i.hasNext();) {
- DynamicRegionListener listener = (DynamicRegionListener) i.next();
+ for (Object regionListener : regionListeners) {
+ DynamicRegionListener listener = (DynamicRegionListener) regionListener;
try {
- listener.afterRegionCreate(event /* region */ );
+ listener.afterRegionCreate(event /* region */);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -437,7 +435,7 @@ public abstract class DynamicRegionFactory {
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- this.c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED,
listener, t);
}
@@ -453,10 +451,10 @@ public abstract class DynamicRegionFactory {
op = expiration ? Operation.REGION_EXPIRE_DESTROY : Operation.REGION_DESTROY;
}
RegionEvent event = new RegionEventImpl(region, op, null, isOriginRemote, getMember(mbr));
- for (Iterator i = regionListeners.iterator(); i.hasNext();) {
- DynamicRegionListener listener = (DynamicRegionListener) i.next();
+ for (Object regionListener : regionListeners) {
+ DynamicRegionListener listener = (DynamicRegionListener) regionListener;
try {
- listener.beforeRegionDestroy(event /* fullRegionName */ );
+ listener.beforeRegionDestroy(event /* fullRegionName */);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -469,7 +467,7 @@ public abstract class DynamicRegionFactory {
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- this.c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_BEFOREREGIONDESTROYED,
listener, t);
}
@@ -485,10 +483,10 @@ public abstract class DynamicRegionFactory {
op = expiration ? Operation.REGION_EXPIRE_DESTROY : Operation.REGION_DESTROY;
}
RegionEvent event = new RegionEventImpl(region, op, null, isOriginRemote, getMember(mbr));
- for (Iterator i = regionListeners.iterator(); i.hasNext();) {
- DynamicRegionListener listener = (DynamicRegionListener) i.next();
+ for (Object regionListener : regionListeners) {
+ DynamicRegionListener listener = (DynamicRegionListener) regionListener;
try {
- listener.afterRegionDestroy(event /* fullRegionName */ );
+ listener.afterRegionDestroy(event /* fullRegionName */);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -501,7 +499,7 @@ public abstract class DynamicRegionFactory {
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- this.c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONDESTROYED,
listener, t);
}
@@ -511,27 +509,25 @@ public abstract class DynamicRegionFactory {
/** return the argument, or if null the DistributedMember id of this vm */
private DistributedMember getMember(DistributedMember mbr) {
if (mbr == null) {
- return InternalDistributedSystem.getAnyInstance().getDistributedMember();
+ return this.cache.getInternalDistributedSystem().getDistributedMember();
} else {
return null;
}
}
-
/**
* Creates the dynamic Region in the local cache and distributes the creation to other caches.
*
* @param parentRegionName the new region is created as a subregion of the region having this path
* @param regionName the name of the new subregion
- * @return the <code>Region</code> created
- * @throws CacheException
+ * @return the {@code Region} created
*/
public Region createDynamicRegion(String parentRegionName, String regionName)
throws CacheException {
if (isClosed()) {
throw new IllegalStateException("Dynamic region factory is closed");
}
- doBeforeRegionCreated(parentRegionName, regionName, null);
+ doBeforeRegionCreated(parentRegionName, regionName);
Region region = createDynamicRegionImpl(parentRegionName, regionName, true);
doAfterRegionCreated(region, false, false, null);
return region;
@@ -540,13 +536,12 @@ public abstract class DynamicRegionFactory {
/**
* Destroys the dynamic Region in the local cache and distributes the destruction to other caches.
*
- * @param fullRegionName The full path of the <code>Region</code> to be dynamically destroyed
- * @throws CacheException
+ * @param fullRegionName The full path of the {@code Region} to be dynamically destroyed
* @throws RegionDestroyedException if the dynamic region was never created or has already been
* destroyed
*/
public void destroyDynamicRegion(String fullRegionName) throws CacheException {
- if (!dynamicRegionList.containsKey(fullRegionName)) {
+ if (!this.dynamicRegionList.containsKey(fullRegionName)) {
throw new RegionDestroyedException(
LocalizedStrings.DynamicRegionFactory_DYNAMIC_REGION_0_HAS_NOT_BEEN_CREATED
.toLocalizedString(fullRegionName),
@@ -557,7 +552,7 @@ public abstract class DynamicRegionFactory {
}
// Retrieve the region to destroy
- Region region = c.getRegion(fullRegionName);
+ Region region = this.cache.getRegion(fullRegionName);
if (region != null) {
DistributedMember mbr = getMember(null);
doBeforeRegionDestroyed(region, false, false, false, mbr);
@@ -575,15 +570,14 @@ public abstract class DynamicRegionFactory {
private Region createDynamicRegionImpl(String parentRegionName, String newRegionName,
boolean addEntry) throws CacheException {
- Region parentRegion = c.getRegion(parentRegionName);
- Region newRegion = null;
+ Region parentRegion = this.cache.getRegion(parentRegionName);
if (parentRegion == null) {
String errMsg =
LocalizedStrings.DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_
.toLocalizedString(parentRegionName);
RegionDestroyedException e = new RegionDestroyedException(errMsg, parentRegionName);
- c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_ERROR__COULD_NOT_FIND_A_REGION_NAMED___0_,
parentRegionName, e);
throw e;
@@ -591,51 +585,46 @@ public abstract class DynamicRegionFactory {
// Create RegionAttributes by inheriting from the parent
RegionAttributes rra = parentRegion.getAttributes();
- RegionAttributes newRegionAttributes = null;
AttributesFactory af = new AttributesFactory(rra);
- {
- EvictionAttributes ev = rra.getEvictionAttributes();
- if (ev != null && ev.getAlgorithm().isLRU()) {
- EvictionAttributes rev = new EvictionAttributesImpl((EvictionAttributesImpl) ev);
- af.setEvictionAttributes(rev);
- }
+ EvictionAttributes ev = rra.getEvictionAttributes();
+ if (ev != null && ev.getAlgorithm().isLRU()) {
+ EvictionAttributes rev = new EvictionAttributesImpl((EvictionAttributesImpl) ev);
+ af.setEvictionAttributes(rev);
}
// for internal testing, until partitioned regions support subclasses or
// DynamicRegion implementation is redone to not inherit attrs from parent
- // regions [bruce]
+ // regions
if (newRegionName.endsWith("_PRTEST_")) {
- af.setPartitionAttributes((new PartitionAttributesFactory()).create());
+ af.setPartitionAttributes(new PartitionAttributesFactory().create());
}
- newRegionAttributes = af.create();
+ RegionAttributes newRegionAttributes = af.create();
+ Region newRegion;
try {
newRegion = parentRegion.createSubregion(newRegionName, newRegionAttributes);
- c.getLoggerI18n().fine("Created dynamic region " + newRegion);
+ this.cache.getLoggerI18n().fine("Created dynamic region " + newRegion);
} catch (RegionExistsException ex) {
// a race condition exists that can cause this so just fine log it
- c.getLoggerI18n().fine(
+ this.cache.getLoggerI18n().fine(
"DynamicRegion " + newRegionName + " in parent " + parentRegionName + " already existed");
newRegion = ex.getRegion();
- // } catch ( CacheException e ) {
- // c.getLoggerI18n().warning ( "Error creating new Dynamic Region '" + newRegionName, e );
- // throw e;
}
if (addEntry) {
DynamicRegionAttributes dra = new DynamicRegionAttributes();
dra.name = newRegionName;
dra.rootRegionName = parentRegion.getFullPath();
- if (c.getLoggerI18n().fineEnabled()) {
- c.getLoggerI18n()
+ if (this.cache.getLoggerI18n().fineEnabled()) {
+ this.cache.getLoggerI18n()
.fine("Putting entry into dynamic region list at key: " + newRegion.getFullPath());
}
- dynamicRegionList.put(newRegion.getFullPath(), dra);
+ this.dynamicRegionList.put(newRegion.getFullPath(), dra);
}
- if (config.getRegisterInterest()) {
+ if (this.config.getRegisterInterest()) {
ServerRegionProxy proxy = ((LocalRegion) newRegion).getServerProxy();
if (proxy != null) {
if (((Pool) proxy.getPool()).getSubscriptionEnabled()) {
@@ -643,7 +632,7 @@ public abstract class DynamicRegionFactory {
newRegion.registerInterest("ALL_KEYS");
} catch (GemFireSecurityException ex) {
// Ignore security exceptions here
- c.getSecurityLoggerI18n().warning(
+ this.cache.getSecurityLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_EXCEPTION_WHEN_REGISTERING_INTEREST_FOR_ALL_KEYS_IN_DYNAMIC_REGION_0_1,
new Object[] {newRegion.getFullPath(), ex});
}
@@ -654,13 +643,13 @@ public abstract class DynamicRegionFactory {
if (regionCreateSleepMillis > 0) {
try {
Thread.sleep(regionCreateSleepMillis);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
- if (c.getLoggerI18n().fineEnabled()) {
- c.getLoggerI18n().fine("Created Dynamic Region " + newRegion.getFullPath());
+ if (this.cache.getLoggerI18n().fineEnabled()) {
+ this.cache.getLoggerI18n().fine("Created Dynamic Region " + newRegion.getFullPath());
}
return newRegion;
}
@@ -668,30 +657,30 @@ public abstract class DynamicRegionFactory {
private void destroyDynamicRegionImpl(String fullRegionName) throws CacheException {
// Destroy the entry in the dynamicRegionList
try {
- if (c.getLoggerI18n().fineEnabled()) {
- c.getLoggerI18n()
+ if (this.cache.getLoggerI18n().fineEnabled()) {
+ this.cache.getLoggerI18n()
.fine("Destroying entry from dynamic region list at key: " + fullRegionName);
}
- dynamicRegionList.destroy(fullRegionName);
+ this.dynamicRegionList.destroy(fullRegionName);
} catch (CacheException e) {
- c.getLoggerI18n().warning(
+ this.cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_ERROR_DESTROYING_DYNAMIC_REGION__0, fullRegionName,
e);
throw e;
}
- if (c.getLoggerI18n().fineEnabled()) {
- c.getLoggerI18n().fine("Destroyed Dynamic Region " + fullRegionName);
+ if (this.cache.getLoggerI18n().fineEnabled()) {
+ this.cache.getLoggerI18n().fine("Destroyed Dynamic Region " + fullRegionName);
}
}
/**
* Configuration for dynamic region factory. The default attributes are:
* <ul>
- * <li>diskDir: <code>null</code>
- * <li>poolName: <code>null</code>
- * <li>persistBackup: <code>true</code>
- * <li>registerInterest: <code>true</code>
+ * <li>diskDir: {@code null}
+ * <li>poolName: {@code null}
+ * <li>persistBackup: {@code true}
+ * <li>registerInterest: {@code true}
* </ul>
*
* @since GemFire 4.3
@@ -795,8 +784,8 @@ public abstract class DynamicRegionFactory {
/**
* Returns the disk directory that the dynamic region factory data will be written to. Returns
- * null if no directory has been specified. The diskDir is only used if
- * <code>persistBackup</code> is true.
+ * null if no directory has been specified. The diskDir is only used if {@code persistBackup} is
+ * true.
*/
public File getDiskDir() {
return this.diskDir;
@@ -834,11 +823,11 @@ public abstract class DynamicRegionFactory {
String newRegionName = dra.name;
try {
- doBeforeRegionCreated(parentRegionName, newRegionName, event.getDistributedMember());
+ doBeforeRegionCreated(parentRegionName, newRegionName);
Region region = createDynamicRegionImpl(parentRegionName, newRegionName, false);
doAfterRegionCreated(region, true, true, event.getDistributedMember());
} catch (Exception e) {
- c.getLoggerI18n().warning(
+ cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_CREATE_DYNAMIC_REGION__0,
newRegionName, e);
}
@@ -852,12 +841,12 @@ public abstract class DynamicRegionFactory {
// "local" events. If this is a true local then c.getRegion will return
// null and this code will do nothing.
// When bug 35644 fixed the following "if" can be uncommented.
- // // Ignore the callback if it originated in this process (because the region
- // // will already have been destroyed)
- // if ( !event.isOriginRemote() && !(event instanceof BridgeEntryEventImpl)) return;
+
+ // Ignore the callback if it originated in this process (because the region
+ // will already have been destroyed)
String fullRegionName = (String) event.getKey();
- Region drRegion = c.getRegion(fullRegionName);
+ Region drRegion = cache.getRegion(fullRegionName);
if (drRegion != null) {
try {
doBeforeRegionDestroyed(drRegion, true, event.getOperation().isDistributed(),
@@ -866,49 +855,19 @@ public abstract class DynamicRegionFactory {
doAfterRegionDestroyed(drRegion, true, event.getOperation().isDistributed(),
event.getOperation().isExpiration(), event.getDistributedMember());
} catch (Exception e) {
- c.getLoggerI18n().warning(
+ cache.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_ERROR_ATTEMPTING_TO_LOCALLY_DESTROY_DYNAMIC_REGION__0,
fullRegionName, e);
}
}
}
- // private class DRListener implements CacheListener {
- // public void afterCreate(EntryEvent arg0) {
- // buildDynamicRegion(arg0);
- // }
- //
- // public void afterDestroy(EntryEvent arg0) {
- // razeDynamicRegion(arg0);
- // }
- //
- // public void afterInvalidate(EntryEvent arg0) {
- // // Stub, nothing to do.
- // }
- //
- // public void afterRegionDestroy(RegionEvent arg0) {
- // // Stub, nothing to do.
- // }
- //
- // public void afterRegionInvalidate(RegionEvent arg0) {
- // // Stub, nothing to do.
- // }
- //
- // public void afterUpdate(EntryEvent arg0) {
- // // Stub, nothing to do.
- // }
- //
- // public void close() {
- // // Stub, nothing to do.
- // }
- // }
-
// Introduced to keep symmetry with DistributedMetaRegion and potentially provide improved control
// of
// the meta data
private class LocalMetaRegion extends LocalRegion {
protected LocalMetaRegion(RegionAttributes attrs, InternalRegionArguments ira) {
- super(dynamicRegionListName, attrs, null, DynamicRegionFactory.this.c, ira);
+ super(dynamicRegionListName, attrs, null, DynamicRegionFactory.this.cache, ira);
Assert.assertTrue(attrs.getScope().isLocal());
}
@@ -1003,9 +962,9 @@ public abstract class DynamicRegionFactory {
if (!event.isBulkOpInProgress()) {
try {
entry.dispatchListenerEvents(event);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
- stopper.checkCancelInProgress(null);
+ this.stopper.checkCancelInProgress(null);
}
}
}
@@ -1017,7 +976,7 @@ public abstract class DynamicRegionFactory {
// distribution and notification order on the BridgeServer
private class DistributedMetaRegion extends DistributedRegion {
protected DistributedMetaRegion(RegionAttributes attrs) {
- super(dynamicRegionListName, attrs, null, DynamicRegionFactory.this.c,
+ super(dynamicRegionListName, attrs, null, DynamicRegionFactory.this.cache,
new InternalRegionArguments());
}
@@ -1115,9 +1074,9 @@ public abstract class DynamicRegionFactory {
if (!event.isBulkOpInProgress()) {
try {
entry.dispatchListenerEvents(event);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
- stopper.checkCancelInProgress(null);
+ this.stopper.checkCancelInProgress(null);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/GemFireCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/GemFireCache.java b/geode-core/src/main/java/org/apache/geode/cache/GemFireCache.java
index e60bc59..f2a75db 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/GemFireCache.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/GemFireCache.java
@@ -43,8 +43,8 @@ import org.apache.geode.pdx.PdxSerializer;
*/
public interface GemFireCache extends RegionService {
/**
- * Returns the name of this cache. This method does not throw <code>CacheClosedException</code> if
- * the cache is closed.
+ * Returns the name of this cache. This method does not throw {@code CacheClosedException} if the
+ * cache is closed.
*
* @return the String name of this cache
*/
@@ -52,14 +52,14 @@ public interface GemFireCache extends RegionService {
/**
* Returns the distributed system used by this cache. This method does not throw
- * <code>CacheClosedException</code> if the cache is closed.
+ * {@code CacheClosedException} if the cache is closed.
*/
public DistributedSystem getDistributedSystem();
/**
- * Returns the <code>ResourceManager</code> for managing this cache's resources.
+ * Returns the {@code ResourceManager} for managing this cache's resources.
*
- * @return <code>ResourceManager</code> for managing this cache's resources
+ * @return {@code ResourceManager} for managing this cache's resources
* @since GemFire 6.0
*/
public ResourceManager getResourceManager();
@@ -81,8 +81,8 @@ public interface GemFireCache extends RegionService {
public boolean getCopyOnRead();
/**
- * Returns the <code>RegionAttributes</code> with the given <code>id</code> or <code>null</code>
- * if no <code>RegionAttributes</code> with that id exists.
+ * Returns the {@code RegionAttributes} with the given {@code id} or {@code null} if no
+ * {@code RegionAttributes} with that id exists.
*
* @see #setRegionAttributes
*
@@ -91,14 +91,13 @@ public interface GemFireCache extends RegionService {
public <K, V> RegionAttributes<K, V> getRegionAttributes(String id);
/**
- * Sets the <code>id</code> of the given <code>RegionAttributes</code>. If a region attributes
- * named <code>name</code> already exists, the mapping will be overwritten with
- * <code>attrs</code>. However, changing the mapping will not effect existing regions.
+ * Sets the {@code id} of the given {@code RegionAttributes}. If a region attributes named
+ * {@code name} already exists, the mapping will be overwritten with {@code attrs}. However,
+ * changing the mapping will not effect existing regions.
*
* @param id The id of the region attributes
- * @param attrs The attributes to associate with <code>id</code>. If <code>attrs</code> is
- * <code>null</code>, any existing <code>RegionAttributes</code> associated with
- * <code>id</code> will be removed.
+ * @param attrs The attributes to associate with {@code id}. If {@code attrs} is {@code null}, any
+ * existing {@code RegionAttributes} associated with {@code id} will be removed.
*
* @see #getRegionAttributes
*
@@ -122,13 +121,12 @@ public interface GemFireCache extends RegionService {
*
* <P>
*
- * Because this method may perform a {@link Region#put(Object, Object) put} on a
- * <code>Region</code>, it declares that it throws a <code>TimeoutException</code>,
- * <code>CacheWriterException</code>, <code>GatewayException</code>, or
- * <code>RegionExistsException</code>.
+ * Because this method may perform a {@link Region#put(Object, Object) put} on a {@code Region},
+ * it declares that it throws a {@code TimeoutException}, {@code CacheWriterException},
+ * {@code GatewayException}, or {@code RegionExistsException}.
*
- * @throws CacheXmlException If the XML read from <code>is</code> does not conform to the dtd or
- * if an <code>IOException</code> occurs while reading the XML.
+ * @throws CacheXmlException If the XML read from {@code is} does not conform to the dtd or if an
+ * {@code IOException} occurs while reading the XML.
*
* @since GemFire 4.1
*/
@@ -136,8 +134,8 @@ public interface GemFireCache extends RegionService {
throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException;
/**
- * Gets the logging object for GemFire. This method does not throw
- * <code>CacheClosedException</code> if the cache is closed.
+ * Gets the logging object for GemFire. This method does not throw {@code CacheClosedException} if
+ * the cache is closed.
*
* @return the logging object
*/
@@ -145,17 +143,17 @@ public interface GemFireCache extends RegionService {
/**
* Gets the security logging object for GemFire. This method does not throw
- * <code>CacheClosedException</code> if the cache is closed.
+ * {@code CacheClosedException} if the cache is closed.
*
* @return the security logging object
*/
public LogWriter getSecurityLogger();
/**
- * Returns the DiskStore by name or <code>null</code> if no disk store is found.
+ * Returns the DiskStore by name or {@code null} if no disk store is found.
*
- * @param name the name of the disk store to find. If <code>null</code> then the default disk
- * store, if it exists, is returned.
+ * @param name the name of the disk store to find. If {@code null} then the default disk store, if
+ * it exists, is returned.
* @since GemFire 6.5
*/
public DiskStore findDiskStore(String name);
@@ -237,15 +235,15 @@ public interface GemFireCache extends RegionService {
public Context getJNDIContext();
/**
- * Returns the Declarable used to initialize this cache or <code>null</code> if it does not have
- * an initializer.
+ * Returns the Declarable used to initialize this cache or {@code null} if it does not have an
+ * initializer.
*
* @since GemFire 6.6
*/
public Declarable getInitializer();
/**
- * Returns the Properties used to initialize the cache initializer or <code>null</code> if no
+ * Returns the Properties used to initialize the cache initializer or {@code null} if no
* initializer properties exist.
*
* @since GemFire 6.6
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/Region.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/Region.java b/geode-core/src/main/java/org/apache/geode/cache/Region.java
index 3eef543..08b7cf2 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/Region.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/Region.java
@@ -1071,6 +1071,7 @@ public interface Region<K, V> extends ConcurrentMap<K, V> {
* @return the Cache
* @deprecated as of 6.5 use {@link #getRegionService()} instead.
*/
+ @Deprecated
public Cache getCache();
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/RegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/RegionFactory.java b/geode-core/src/main/java/org/apache/geode/cache/RegionFactory.java
index 3a2e9f6..90e182f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/RegionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/RegionFactory.java
@@ -20,12 +20,12 @@ import java.util.Properties;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.compression.Compressor;
import org.apache.geode.distributed.LeaseExpiredException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
/**
- * <code>RegionFactory</code> is used to create {@link Region regions} in a {@link Cache cache}.
+ * {@code RegionFactory} is used to create {@link Region regions} in a {@link Cache cache}.
* Instances of this interface can be created:
* <ul>
* <li>using a {@link RegionShortcut shortcut} by calling
@@ -63,17 +63,16 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
*
* @since GemFire 5.0
*/
-
public class RegionFactory<K, V> {
private final AttributesFactory<K, V> attrsFactory;
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
/**
* For internal use only.
*
* @since GemFire 6.5
*/
- protected RegionFactory(GemFireCacheImpl cache) {
+ protected RegionFactory(InternalCache cache) {
this.cache = cache;
this.attrsFactory = new AttributesFactory<K, V>();
}
@@ -83,7 +82,7 @@ public class RegionFactory<K, V> {
*
* @since GemFire 6.5
*/
- protected RegionFactory(GemFireCacheImpl cache, RegionShortcut pra) {
+ protected RegionFactory(InternalCache cache, RegionShortcut pra) {
this.cache = cache;
RegionAttributes ra = cache.getRegionAttributes(pra.toString());
if (ra == null) {
@@ -97,7 +96,7 @@ public class RegionFactory<K, V> {
*
* @since GemFire 6.5
*/
- protected RegionFactory(GemFireCacheImpl cache, RegionAttributes ra) {
+ protected RegionFactory(InternalCache cache, RegionAttributes ra) {
this.cache = cache;
this.attrsFactory = new AttributesFactory<K, V>(ra);
}
@@ -107,7 +106,7 @@ public class RegionFactory<K, V> {
*
* @since GemFire 6.5
*/
- protected RegionFactory(GemFireCacheImpl cache, String regionAttributesId) {
+ protected RegionFactory(InternalCache cache, String regionAttributesId) {
this.cache = cache;
RegionAttributes<K, V> ra = getCache().getRegionAttributes(regionAttributesId);
if (ra == null) {
@@ -127,7 +126,7 @@ public class RegionFactory<K, V> {
*/
@Deprecated
public RegionFactory() throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory().create());
+ this((InternalCache) new CacheFactory().create());
}
/**
@@ -142,7 +141,7 @@ public class RegionFactory<K, V> {
@Deprecated
public RegionFactory(RegionAttributes<K, V> regionAttributes)
throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory().create(), regionAttributes);
+ this((InternalCache) new CacheFactory().create(), regionAttributes);
}
/**
@@ -160,7 +159,7 @@ public class RegionFactory<K, V> {
@Deprecated
public RegionFactory(String regionAttributesId)
throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory().create(), regionAttributesId);
+ this((InternalCache) new CacheFactory().create(), regionAttributesId);
}
/**
@@ -170,7 +169,7 @@ public class RegionFactory<K, V> {
* used.
*
* @param distributedSystemProperties an instance of Properties containing
- * <code>DistributedSystem</code configuration
+ * {@code DistributedSystem} configuration
* @throws CacheException if unable to connect the DistributedSystem or create a Cache
* @deprecated as of 6.5 use {@link CacheFactory#CacheFactory(Properties)} and
* {@link Cache#createRegionFactory()} instead.
@@ -178,7 +177,7 @@ public class RegionFactory<K, V> {
@Deprecated
public RegionFactory(Properties distributedSystemProperties)
throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory(distributedSystemProperties).create());
+ this((InternalCache) new CacheFactory(distributedSystemProperties).create());
}
/**
@@ -198,8 +197,7 @@ public class RegionFactory<K, V> {
public RegionFactory(Properties distributedSystemProperties,
RegionAttributes<K, V> regionAttributes)
throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory(distributedSystemProperties).create(),
- regionAttributes);
+ this((InternalCache) new CacheFactory(distributedSystemProperties).create(), regionAttributes);
}
/**
@@ -222,19 +220,19 @@ public class RegionFactory<K, V> {
@Deprecated
public RegionFactory(Properties distributedSystemProperties, String regionAttributesId)
throws CacheWriterException, RegionExistsException, TimeoutException {
- this((GemFireCacheImpl) new CacheFactory(distributedSystemProperties).create(),
+ this((InternalCache) new CacheFactory(distributedSystemProperties).create(),
regionAttributesId);
}
/**
* Returns the cache used by this factory.
*/
- private synchronized GemFireCacheImpl getCache() {
+ private synchronized InternalCache getCache() {
return this.cache;
}
/**
- * Sets the cache loader for the next <code>RegionAttributes</code> created.
+ * Sets the cache loader for the next {@code RegionAttributes} created.
*
* @param cacheLoader the cache loader or null if no loader
* @return a reference to this RegionFactory object
@@ -247,7 +245,7 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the cache writer for the next <code>RegionAttributes</code> created.
+ * Sets the cache writer for the next {@code RegionAttributes} created.
*
* @param cacheWriter the cache writer or null if no cache writer
* @return a reference to this RegionFactory object
@@ -263,7 +261,7 @@ public class RegionFactory<K, V> {
*
* @param aListener the cache listener to add
* @return a reference to this RegionFactory object
- * @throws IllegalArgumentException if <code>aListener</code> is null
+ * @throws IllegalArgumentException if {@code aListener} is null
* @see AttributesFactory#addCacheListener
*/
public RegionFactory<K, V> addCacheListener(CacheListener<K, V> aListener) {
@@ -273,11 +271,11 @@ public class RegionFactory<K, V> {
/**
* Removes all cache listeners and then adds each listener in the specified array. for the next
- * <code>RegionAttributes</code> created.
+ * {@code RegionAttributes} created.
*
* @param newListeners a possibly null or empty array of listeners to add to this factory.
* @return a reference to this RegionFactory object
- * @throws IllegalArgumentException if the <code>newListeners</code> array has a null element
+ * @throws IllegalArgumentException if the {@code newListeners} array has a null element
* @see AttributesFactory#initCacheListeners
*/
public RegionFactory<K, V> initCacheListeners(CacheListener<K, V>[] newListeners) {
@@ -298,8 +296,8 @@ public class RegionFactory<K, V> {
/**
* Sets the idleTimeout expiration attributes for region entries for the next
- * <code>RegionAttributes</code> created. Note that the XML element that corresponds to this
- * method "entry-idle-time", does not include "out" in its name.
+ * {@code RegionAttributes} created. Note that the XML element that corresponds to this method
+ * "entry-idle-time", does not include "out" in its name.
*
* @param idleTimeout the idleTimeout ExpirationAttributes for entries in this region
* @return a reference to this RegionFactory object
@@ -312,7 +310,7 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the custom idleTimeout for the next <code>RegionAttributes</code> created.
+ * Sets the custom idleTimeout for the next {@code RegionAttributes} created.
*
* @param custom the custom method
* @return the receiver
@@ -325,7 +323,7 @@ public class RegionFactory<K, V> {
/**
* Sets the timeToLive expiration attributes for region entries for the next
- * <code>RegionAttributes</code> created.
+ * {@code RegionAttributes} created.
*
* @param timeToLive the timeToLive ExpirationAttributes for entries in this region
* @return a reference to this RegionFactory object
@@ -338,8 +336,7 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the custom timeToLive expiration method for the next <code>RegionAttributes</code>
- * created.
+ * Sets the custom timeToLive expiration method for the next {@code RegionAttributes} created.
*
* @param custom the custom method
* @return the receiver
@@ -352,8 +349,8 @@ public class RegionFactory<K, V> {
/**
* Sets the idleTimeout expiration attributes for the region itself for the next
- * <code>RegionAttributes</code> created. Note that the XML element that corresponds to this
- * method "region-idle-time", does not include "out" in its name.
+ * {@code RegionAttributes} created. Note that the XML element that corresponds to this method
+ * "region-idle-time", does not include "out" in its name.
*
* @param idleTimeout the ExpirationAttributes for this region idleTimeout
* @return a reference to this RegionFactory object
@@ -367,7 +364,7 @@ public class RegionFactory<K, V> {
/**
* Sets the timeToLive expiration attributes for the region itself for the next
- * <code>RegionAttributes</code> created.
+ * {@code RegionAttributes} created.
*
* @param timeToLive the ExpirationAttributes for this region timeToLive
* @return a reference to this RegionFactory object
@@ -380,7 +377,7 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the scope for the next <code>RegionAttributes</code> created.
+ * Sets the scope for the next {@code RegionAttributes} created.
*
* @param scopeType the type of Scope to use for the region
* @return a reference to this RegionFactory object
@@ -393,7 +390,7 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the data policy for the next <code>RegionAttributes</code> created.
+ * Sets the data policy for the next {@code RegionAttributes} created.
*
* @param dataPolicy The type of mirroring to use for the region
* @return a reference to this RegionFactory object
@@ -436,15 +433,14 @@ public class RegionFactory<K, V> {
* Sets the pool name attribute. This causes regions that use these attributes to be a client
* region which communicates with the servers that the connection pool communicates with.
* <p>
- * If this attribute is set to <code>null</code> or <code>""</code> then the connection pool is
- * disabled causing regions that use these attributes to be communicate with peers instead of
- * servers.
+ * If this attribute is set to {@code null} or {@code ""} then the connection pool is disabled
+ * causing regions that use these attributes to be communicate with peers instead of servers.
* <p>
* The named connection pool must exist on the cache at the time these attributes are used to
* create a region. See {@link PoolManager#createFactory} for how to create a connection pool.
*
- * @param poolName the name of the connection pool to use; if <code>null</code> or <code>""</code>
- * then the connection pool attribute is disabled for regions using these attributes.
+ * @param poolName the name of the connection pool to use; if {@code null} or {@code ""} then the
+ * connection pool attribute is disabled for regions using these attributes.
* @return a reference to this RegionFactory object
* @throws IllegalStateException if a cache loader or cache writer has already been set.
* @since GemFire 5.7
@@ -491,14 +487,13 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the key constraint for the next <code>RegionAttributes</code> created. Keys in the region
- * will be constrained to this class (or subclass). Any attempt to store a key of an incompatible
- * type in the region will cause a <code>ClassCastException</code> to be thrown.
+ * Sets the key constraint for the next {@code RegionAttributes} created. Keys in the region will
+ * be constrained to this class (or subclass). Any attempt to store a key of an incompatible type
+ * in the region will cause a {@code ClassCastException} to be thrown.
*
* @param keyConstraint The Class to constrain the keys to, or null if no constraint
* @return a reference to this RegionFactory object
- * @throws IllegalArgumentException if <code>keyConstraint</code> is a class denoting a primitive
- * type
+ * @throws IllegalArgumentException if {@code keyConstraint} is a class denoting a primitive type
* @see AttributesFactory#setKeyConstraint
*/
public RegionFactory<K, V> setKeyConstraint(Class<K> keyConstraint) {
@@ -507,14 +502,14 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the value constraint for the next <code>RegionAttributes</code> created. Values in the
- * region will be constrained to this class (or subclass). Any attempt to store a value of an
- * incompatible type in the region will cause a <code>ClassCastException</code> to be thrown.
+ * Sets the value constraint for the next {@code RegionAttributes} created. Values in the region
+ * will be constrained to this class (or subclass). Any attempt to store a value of an
+ * incompatible type in the region will cause a {@code ClassCastException} to be thrown.
*
* @param valueConstraint The Class to constrain the values to, or null if no constraint
* @return a reference to this RegionFactory object
- * @throws IllegalArgumentException if <code>valueConstraint</code> is a class denoting a
- * primitive type
+ * @throws IllegalArgumentException if {@code valueConstraint} is a class denoting a primitive
+ * type
* @see AttributesFactory#setValueConstraint
*/
public RegionFactory<K, V> setValueConstraint(Class<V> valueConstraint) {
@@ -523,8 +518,8 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the entry initial capacity for the next <code>RegionAttributes</code> created. This value
- * is used in initializing the map that holds the entries.
+ * Sets the entry initial capacity for the next {@code RegionAttributes} created. This value is
+ * used in initializing the map that holds the entries.
*
* @param initialCapacity the initial capacity of the entry map
* @return a reference to this RegionFactory object
@@ -538,8 +533,8 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the entry load factor for the next <code>RegionAttributes</code> created. This value is
- * used in initializing the map that holds the entries.
+ * Sets the entry load factor for the next {@code RegionAttributes} created. This value is used in
+ * initializing the map that holds the entries.
*
* @param loadFactor the load factor of the entry map
* @return a reference to this RegionFactory object
@@ -553,8 +548,8 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the concurrency level tof the next <code>RegionAttributes</code> created. This value is
- * used in initializing the map that holds the entries.
+ * Sets the concurrency level tof the next {@code RegionAttributes} created. This value is used in
+ * initializing the map that holds the entries.
*
* @param concurrencyLevel the concurrency level of the entry map
* @return a reference to this RegionFactory object
@@ -655,8 +650,8 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the <code>PartitionAttributes</code> that describe how the region is partitioned among
- * members of the distributed system.
+ * Sets the {@code PartitionAttributes} that describe how the region is partitioned among members
+ * of the distributed system.
*
* @return a reference to this RegionFactory object
* @see AttributesFactory#setPartitionAttributes
@@ -667,14 +662,15 @@ public class RegionFactory<K, V> {
}
/**
- * Sets the <code>MembershipAttributes</code> that describe the membership roles required for
- * reliable access to the region.
+ * Sets the {@code MembershipAttributes} that describe the membership roles required for reliable
+ * access to the region.
*
* @param ra the MembershipAttributes to use
* @return a reference to this RegionFactory object
* @see AttributesFactory#setMembershipAttributes
* @deprecated this API is scheduled to be removed
*/
+ @Deprecated
public RegionFactory<K, V> setMembershipAttributes(MembershipAttributes ra) {
this.attrsFactory.setMembershipAttributes(ra);
return this;
@@ -787,7 +783,6 @@ public class RegionFactory<K, V> {
/**
* Sets cloning on region Note: off-heap regions always behave as if cloning is enabled.
*
- * @param cloningEnable
* @return a reference to this RegionFactory object
* @since GemFire 6.1
* @see AttributesFactory#setCloningEnabled
@@ -800,7 +795,6 @@ public class RegionFactory<K, V> {
/**
* Adds a gatewaySenderId to the RegionAttributes
*
- * @param gatewaySenderId
* @return a reference to this RegionFactory object
* @since GemFire 7.0
* @see AttributesFactory#addGatewaySenderId(String)
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/TransactionDataRebalancedException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/TransactionDataRebalancedException.java b/geode-core/src/main/java/org/apache/geode/cache/TransactionDataRebalancedException.java
index fded49f..5119628 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/TransactionDataRebalancedException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/TransactionDataRebalancedException.java
@@ -32,4 +32,12 @@ public class TransactionDataRebalancedException extends TransactionException {
public TransactionDataRebalancedException(String s) {
super(s);
}
+
+ public TransactionDataRebalancedException(Throwable cause) {
+ super(cause);
+ }
+
+ public TransactionDataRebalancedException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
index 1a4052b..042d0f7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
@@ -189,7 +189,7 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
create(AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncQueueId));
AsyncEventQueueImpl queue = new AsyncEventQueueImpl(sender, listener);
asyncEventQueue = queue;
- ((GemFireCacheImpl) cache).addAsyncEventQueue(queue);
+ this.cache.addAsyncEventQueue(queue);
} else if (this.cache instanceof CacheCreation) {
asyncEventQueue = new AsyncEventQueueCreation(asyncQueueId, attrs, listener);
((CacheCreation) cache).addAsyncEventQueue(asyncEventQueue);
@@ -220,7 +220,7 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
if (this.cache instanceof GemFireCacheImpl) {
sender = new ParallelAsyncEventQueueImpl(this.cache, this.attrs);
- ((GemFireCacheImpl) this.cache).addGatewaySender(sender);
+ this.cache.addGatewaySender(sender);
if (!this.attrs.isManualStart()) {
sender.start();
}
@@ -229,19 +229,12 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
((CacheCreation) this.cache).addGatewaySender(sender);
}
} else {
- // if (this.attrs.getOrderPolicy() != null) {
- // if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
- // throw new AsyncEventQueueConfigurationException(
- // LocalizedStrings.AsyncEventQueue_INVALID_ORDER_POLICY_CONCURRENCY_0
- // .toLocalizedString(id));
- // }
- // }
if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
}
if (this.cache instanceof GemFireCacheImpl) {
sender = new SerialAsyncEventQueueImpl(this.cache, this.attrs);
- ((GemFireCacheImpl) this.cache).addGatewaySender(sender);
+ this.cache.addGatewaySender(sender);
if (!this.attrs.isManualStart()) {
sender.start();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
index 0def5d2..bf7e874 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
@@ -25,7 +25,7 @@ import org.apache.geode.cache.wan.GatewayEventFilter;
import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.RegionQueue;
import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
import org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor;
@@ -150,7 +150,7 @@ public class AsyncEventQueueImpl implements AsyncEventQueue {
if (this == obj) {
return true;
}
- if (!(obj instanceof AsyncEventQueue)) {
+ if (!(obj instanceof AsyncEventQueueImpl)) {
return false;
}
AsyncEventQueueImpl asyncEventQueue = (AsyncEventQueueImpl) obj;
@@ -203,9 +203,9 @@ public class AsyncEventQueueImpl implements AsyncEventQueue {
}
public void destroy(boolean initiator) {
- GemFireCacheImpl gfci = (GemFireCacheImpl) ((AbstractGatewaySender) this.sender).getCache();
+ InternalCache cache = ((AbstractGatewaySender) this.sender).getCache();
((AbstractGatewaySender) this.sender).destroy(initiator);
- gfci.removeAsyncEventQueue(this);
+ cache.removeAsyncEventQueue(this);
}
public boolean isBucketSorted() {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
index e799880..9fa15f7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
@@ -19,23 +19,22 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.EntryOperation;
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
import org.apache.geode.cache.wan.GatewayTransportFilter;
+import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ResourceEvent;
-import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.EventID;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegionHelper;
import org.apache.geode.internal.cache.UpdateAttributesProcessor;
import org.apache.geode.internal.cache.ha.ThreadIdentifier;
import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
import org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor;
+import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
import org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor;
import org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue;
-import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
import org.apache.geode.internal.cache.xmlcache.CacheCreation;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -86,7 +85,7 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
// Only notify the type registry if this is a WAN gateway queue
if (!isAsyncEventQueue()) {
- ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
+ getCache().getPdxRegistry().gatewaySenderStarted(this);
}
new UpdateAttributesProcessor(this).distribute(false);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
index 9252dc7..a1d933f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
@@ -25,7 +25,6 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ResourceEvent;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.EventID;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.RegionQueue;
import org.apache.geode.internal.cache.UpdateAttributesProcessor;
@@ -99,7 +98,7 @@ public class SerialAsyncEventQueueImpl extends AbstractGatewaySender {
// Only notify the type registry if this is a WAN gateway queue
if (!isAsyncEventQueue()) {
- ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
+ getCache().getPdxRegistry().gatewaySenderStarted(this);
}
new UpdateAttributesProcessor(this).distribute(false);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
index e72cbff..0d678ca 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
@@ -12,11 +12,19 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.client;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import java.util.Properties;
+
import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.CacheXmlException;
import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionExistsException;
+import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.internal.GemFireVersion;
@@ -25,11 +33,8 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxSerializer;
-
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import org.apache.geode.security.AuthenticationFailedException;
+import org.apache.geode.security.AuthenticationRequiredException;
/**
* Factory class used to create the singleton {@link ClientCache client cache} and connect to one or
@@ -209,7 +214,7 @@ public class ClientCacheFactory {
private ClientCache basicCreate() {
synchronized (ClientCacheFactory.class) {
- GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
+ InternalClientCache instance = GemFireCacheImpl.getInstance();
{
String propValue = this.dsProps.getProperty(MCAST_PORT);
@@ -224,7 +229,7 @@ public class ClientCacheFactory {
}
{
String propValue = this.dsProps.getProperty(LOCATORS);
- if (propValue != null && !propValue.equals("")) {
+ if (propValue != null && !propValue.isEmpty()) {
throw new IllegalStateException(
"On a client cache the locators property must be set to an empty string or not set. It was set to \""
+ propValue + "\".");
@@ -254,8 +259,7 @@ public class ClientCacheFactory {
return instance;
} else {
- GemFireCacheImpl gfc = GemFireCacheImpl.createClient(system, this.pf, cacheConfig);
- return gfc;
+ return GemFireCacheImpl.createClient(system, this.pf, cacheConfig);
}
}
}
@@ -606,7 +610,7 @@ public class ClientCacheFactory {
* ClientCacheFactory
*/
public static synchronized ClientCache getAnyInstance() {
- GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
+ InternalClientCache instance = GemFireCacheImpl.getInstance();
if (instance == null) {
throw new CacheClosedException(
LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ClientRegionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ClientRegionFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ClientRegionFactoryImpl.java
index ef67667..f1e2d7c 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ClientRegionFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ClientRegionFactoryImpl.java
@@ -29,7 +29,6 @@ import org.apache.geode.cache.client.ClientRegionFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.compression.Compressor;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.UserSpecifiedRegionAttributes;
@@ -41,7 +40,7 @@ import org.apache.geode.internal.cache.UserSpecifiedRegionAttributes;
public class ClientRegionFactoryImpl<K, V> implements ClientRegionFactory<K, V> {
private final AttributesFactory<K, V> attrsFactory;
- private final GemFireCacheImpl cache;
+ private final InternalClientCache cache;
/**
* Constructs a ClientRegionFactory by creating a DistributedSystem and a Cache. If no
@@ -51,7 +50,7 @@ public class ClientRegionFactoryImpl<K, V> implements ClientRegionFactory<K, V>
*
* @param pra the region shortcut to use
*/
- public ClientRegionFactoryImpl(GemFireCacheImpl cache, ClientRegionShortcut pra) {
+ public ClientRegionFactoryImpl(InternalClientCache cache, ClientRegionShortcut pra) {
this.cache = cache;
RegionAttributes ra = cache.getRegionAttributes(pra.toString());
if (ra == null) {
@@ -70,7 +69,7 @@ public class ClientRegionFactoryImpl<K, V> implements ClientRegionFactory<K, V>
*
* @param refid the name of the region attributes to use
*/
- public ClientRegionFactoryImpl(GemFireCacheImpl cache, String refid) {
+ public ClientRegionFactoryImpl(InternalClientCache cache, String refid) {
this.cache = cache;
RegionAttributes ra = cache.getRegionAttributes(refid);
if (ra == null) {
@@ -90,7 +89,7 @@ public class ClientRegionFactoryImpl<K, V> implements ClientRegionFactory<K, V>
/**
* Returns the cache used by this factory.
*/
- private GemFireCacheImpl getCache() {
+ private InternalClientCache getCache() {
return this.cache;
}
@@ -219,7 +218,7 @@ public class ClientRegionFactoryImpl<K, V> implements ClientRegionFactory<K, V>
@SuppressWarnings("deprecation")
private RegionAttributes<K, V> createRegionAttributes() {
RegionAttributes<K, V> ra = this.attrsFactory.create();
- if (ra.getPoolName() == null || "".equals(ra.getPoolName())) {
+ if (ra.getPoolName() == null || ra.getPoolName().isEmpty()) {
UserSpecifiedRegionAttributes<K, V> ura = (UserSpecifiedRegionAttributes<K, V>) ra;
if (ura.requiresPoolName) {
Pool dp = getDefaultPool();
[25/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index 4ac2c9c..6a230e3 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -35,7 +35,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.GemFireCache;
import org.apache.geode.cache.client.internal.locator.ClientConnectionRequest;
@@ -60,6 +59,7 @@ import org.apache.geode.distributed.internal.tcpserver.TcpHandler;
import org.apache.geode.distributed.internal.tcpserver.TcpServer;
import org.apache.geode.internal.admin.remote.DistributionLocatorId;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.wan.WANServiceProvider;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.InternalLogWriter;
@@ -74,7 +74,6 @@ import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.management.internal.JmxManagerLocator;
import org.apache.geode.management.internal.JmxManagerLocatorRequest;
-import org.apache.geode.management.internal.JmxManagerLocatorResponse;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
import org.apache.geode.management.internal.configuration.handlers.ConfigurationRequestHandler;
@@ -84,7 +83,7 @@ import org.apache.geode.management.internal.configuration.messages.SharedConfigu
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
/**
- * Provides the implementation of a distribution <code>Locator</code> as well as internal-only
+ * Provides the implementation of a distribution {@code Locator} as well as internal-only
* functionality.
* <p>
* This class has APIs that perform essentially three layers of services. At the bottom layer is the
@@ -94,24 +93,15 @@ import org.apache.geode.management.internal.configuration.messages.SharedConfigu
* Server Location Service DistributedSystem Peer Location Service
* <p>
* The startLocator() methods provide a way to start all three services in one call. Otherwise, the
- * services can be started independently <code> locator = createLocator()
+ * services can be started independently {@code locator = createLocator()
* locator.startPeerLocation(); locator.startDistributeSystem();
*
* @since GemFire 4.0
*/
public class InternalLocator extends Locator implements ConnectListener {
-
private static final Logger logger = LogService.getLogger();
/**
- * How long (in milliseconds) a member that we haven't heard from in a while should live before we
- * call it dead?
- */
- private static final long EXPIRY_MS = 60000; // one minute
-
- private static final int SHARED_CONFIG_STATUS_TIMEOUT = 10000; // 10 seconds
-
- /**
* system property name for forcing an locator distribution manager type
*/
public static final String FORCE_LOCATOR_DM_TYPE = "Locator.forceLocatorDMType";
@@ -127,8 +117,6 @@ public class InternalLocator extends Locator implements ConnectListener {
public static final String LOCATORS_PREFERRED_AS_COORDINATORS =
DistributionConfig.GEMFIRE_PREFIX + "disable-floating-coordinator";
- ///////////////////// Instance Fields //////////////////////
-
/**
* The tcp server responding to locator requests
*/
@@ -148,7 +136,7 @@ public class InternalLocator extends Locator implements ConnectListener {
* The cache owned by this locator, if any. Note that if a cache already exists because the
* locator is being colocated in a normal member this field will be null.
*/
- private Cache myCache;
+ private InternalCache myCache;
/**
* locator state file
@@ -175,7 +163,7 @@ public class InternalLocator extends Locator implements ConnectListener {
private DistributionConfigImpl config;
- private LocatorMembershipListener locatorListener;
+ private final LocatorMembershipListener locatorListener;
private WanLocatorDiscoverer locatorDiscoverer;
@@ -197,30 +185,29 @@ public class InternalLocator extends Locator implements ConnectListener {
private volatile Thread restartThread;
- public boolean isSharedConfigurationEnabled() {
+ boolean isSharedConfigurationEnabled() {
return this.config.getEnableClusterConfiguration();
}
- public boolean loadFromSharedConfigDir() {
+ private boolean loadFromSharedConfigDir() {
return this.config.getLoadClusterConfigFromDir();
}
public boolean isSharedConfigurationRunning() {
- if (this.sharedConfig != null) {
- return this.sharedConfig.getStatus() == SharedConfigurationStatus.RUNNING;
- } else {
- return false;
- }
+ return this.sharedConfig != null
+ && this.sharedConfig.getStatus() == SharedConfigurationStatus.RUNNING;
}
- ////////////////////// Static Methods /////////////////////
-
/**
* the locator hosted by this JVM. As of 7.0 it is a singleton.
+ *
+ * GuardedBy must synchronize on locatorLock
*/
- private static InternalLocator locator; // must synchronize on locatorLock
+ private static InternalLocator locator;
+
private static final Object locatorLock = new Object();
+ // TODO: getLocator() overrides static method of a superclass
public static InternalLocator getLocator() {
// synchronize in order to fix #46336 (race condition in createLocator)
synchronized (locatorLock) {
@@ -228,20 +215,22 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
+ // TODO: hasLocator() overrides static method of a superclass
public static boolean hasLocator() {
synchronized (locatorLock) {
return locator != null;
}
}
- private static boolean removeLocator(InternalLocator l) {
- if (l == null) {
+ // TODO: return value of removeLocator is never used
+ private static boolean removeLocator(InternalLocator locator) {
+ if (locator == null) {
return false;
}
synchronized (locatorLock) {
if (hasLocator()) {
- if (l.equals(locator)) {
- locator = null;
+ if (locator.equals(InternalLocator.locator)) {
+ InternalLocator.locator = null;
return true;
}
}
@@ -269,32 +258,31 @@ public class InternalLocator extends Locator implements ConnectListener {
*/
public static InternalLocator createLocator(int port, File logFile, File stateFile,
InternalLogWriter logger, InternalLogWriter securityLogger, InetAddress bindAddress,
- String hostnameForClients, java.util.Properties distributedSystemProperties,
- boolean startDistributedSystem) throws IOException {
+ String hostnameForClients, Properties distributedSystemProperties,
+ boolean startDistributedSystem) {
synchronized (locatorLock) {
if (hasLocator()) {
throw new IllegalStateException(
"A locator can not be created because one already exists in this JVM.");
}
- InternalLocator l =
+ InternalLocator locator =
new InternalLocator(port, logFile, stateFile, logger, securityLogger, bindAddress,
hostnameForClients, distributedSystemProperties, null, startDistributedSystem);
- locator = l;
- return l;
+ InternalLocator.locator = locator;
+ return locator;
}
}
- private static void setLocator(InternalLocator l) {
+ private static void setLocator(InternalLocator locator) {
synchronized (locatorLock) {
- if (locator != null && locator != l) {
+ if (InternalLocator.locator != null && InternalLocator.locator != locator) {
throw new IllegalStateException(
"A locator can not be created because one already exists in this JVM.");
}
- locator = l;
+ InternalLocator.locator = locator;
}
}
-
/**
* Creates a distribution locator that runs in this VM on the given port and bind address and
* creates a distributed system.
@@ -306,7 +294,6 @@ public class InternalLocator extends Locator implements ConnectListener {
* @param dsProperties optional properties to configure the distributed system (e.g., mcast
* addr/port, other locators)
* @param hostnameForClients the name to give to clients for connecting to this locator
- * @throws IOException
* @since GemFire 7.0
*/
public static InternalLocator startLocator(int port, File logFile, File stateFile,
@@ -316,7 +303,6 @@ public class InternalLocator extends Locator implements ConnectListener {
dsProperties, hostnameForClients);
}
-
/**
* Creates a distribution locator that runs in this VM on the given port and bind address.
* <p>
@@ -330,8 +316,6 @@ public class InternalLocator extends Locator implements ConnectListener {
* @param dsProperties optional properties to configure the distributed system (e.g., mcast
* addr/port, other locators)
* @param hostnameForClients the name to give to clients for connecting to this locator
- *
- * @throws IOException
*/
public static InternalLocator startLocator(int port, File logFile, File stateFile,
InternalLogWriter logger, InternalLogWriter securityLogger, InetAddress bindAddress,
@@ -339,58 +323,57 @@ public class InternalLocator extends Locator implements ConnectListener {
throws IOException {
System.setProperty(FORCE_LOCATOR_DM_TYPE, "true");
- InternalLocator slocator = null;
+ InternalLocator newLocator = null;
boolean startedLocator = false;
try {
- slocator = createLocator(port, logFile, stateFile, logger, securityLogger, bindAddress,
+ newLocator = createLocator(port, logFile, stateFile, logger, securityLogger, bindAddress,
hostnameForClients, dsProperties, startDistributedSystem);
// TODO:GEODE-1243: this.server is now a TcpServer and it should store or return its non-zero
// port in a variable to use here
try {
- slocator.startPeerLocation(startDistributedSystem);
+ newLocator.startPeerLocation(startDistributedSystem);
if (startDistributedSystem) {
try {
- slocator.startDistributedSystem(); // TODO:GEODE-1243: throws Exception if TcpServer
- // still has zero for its locator port
+ // TODO:GEODE-1243: throws Exception if TcpServer still has zero for its locator port
+ newLocator.startDistributedSystem();
} catch (RuntimeException e) {
- slocator.stop();
+ newLocator.stop();
throw e;
}
// fix bug #46324
- final InternalDistributedSystem ids = (InternalDistributedSystem) slocator.myDs;
+ final InternalDistributedSystem ids = newLocator.myDs;
if (ids != null) {
ids.getDistributionManager().addHostedLocators(ids.getDistributedMember(),
- getLocatorStrings(), slocator.isSharedConfigurationEnabled());
+ getLocatorStrings(), newLocator.isSharedConfigurationEnabled());
}
}
- } catch (LocatorCancelException e) {
- slocator.stop();
+ } catch (final LocatorCancelException ignored) {
+ newLocator.stop();
}
-
InternalDistributedSystem sys = InternalDistributedSystem.getConnectedInstance();
if (sys != null) {
try {
- slocator.startServerLocation(sys);
+ newLocator.startServerLocation(sys);
} catch (RuntimeException e) {
- slocator.stop();
+ newLocator.stop();
throw e;
}
}
- slocator.endStartLocator(null);
+ newLocator.endStartLocator(null);
startedLocator = true;
- return slocator;
+ return newLocator;
} finally {
System.getProperties().remove(FORCE_LOCATOR_DM_TYPE);
if (!startedLocator) {
// fix for bug 46314
- removeLocator(slocator);
+ removeLocator(newLocator);
}
}
}
@@ -407,7 +390,7 @@ public class InternalLocator extends Locator implements ConnectListener {
return false;
}
- InternalDistributedSystem ids = (InternalDistributedSystem) internalLocator.myDs;
+ InternalDistributedSystem ids = internalLocator.myDs;
if (ids == null) {
return false;
}
@@ -419,10 +402,8 @@ public class InternalLocator extends Locator implements ConnectListener {
return distMgr.getDMType() == DistributionManager.LOCATOR_DM_TYPE;
}
- /////////////////////// Constructors //////////////////////
-
/**
- * Creates a new <code>Locator</code> with the given port, log file, logger, and bind address.
+ * Creates a new {@code Locator} with the given port, log file, logger, and bind address.
*
* @param port the tcp/ip port to listen on
* @param logF the file that log messages should be written to
@@ -441,12 +422,14 @@ public class InternalLocator extends Locator implements ConnectListener {
InternalLogWriter securityLogWriter,
// LOG: 1 non-null source: GemFireDistributionLocator(same instance as logWriter),
// InternalDistributedSystem
- InetAddress bindAddress, String hostnameForClients,
- java.util.Properties distributedSystemProperties, DistributionConfigImpl cfg,
- boolean startDistributedSystem) {
+ InetAddress bindAddress, String hostnameForClients, Properties distributedSystemProperties,
+ DistributionConfigImpl cfg, boolean startDistributedSystem) {
+
+ // TODO: the following three assignments are already done in superclass
this.logFile = logF;
this.bindAddress = bindAddress;
this.hostnameForClients = hostnameForClients;
+
if (stateF == null) {
this.stateFile = new File("locator" + port + "view.dat");
} else {
@@ -456,23 +439,23 @@ public class InternalLocator extends Locator implements ConnectListener {
this.productUseLog = new ProductUseLog(productUseFile);
this.config = cfg;
- env = new Properties();
+ this.env = new Properties();
// set bind-address explicitly only if not wildcard and let any explicit
// value in distributedSystemProperties take precedence (#46870)
if (bindAddress != null && !bindAddress.isAnyLocalAddress()) {
- env.setProperty(BIND_ADDRESS, bindAddress.getHostAddress());
+ this.env.setProperty(BIND_ADDRESS, bindAddress.getHostAddress());
}
if (distributedSystemProperties != null) {
- env.putAll(distributedSystemProperties);
+ this.env.putAll(distributedSystemProperties);
}
- env.setProperty(CACHE_XML_FILE, "");
+ this.env.setProperty(CACHE_XML_FILE, "");
// create a DC so that all of the lookup rules, gemfire.properties, etc,
// are considered and we have a config object we can trust
if (this.config == null) {
- this.config = new DistributionConfigImpl(env);
+ this.config = new DistributionConfigImpl(this.env);
this.env.clear();
this.env.putAll(this.config.getProps());
}
@@ -480,9 +463,9 @@ public class InternalLocator extends Locator implements ConnectListener {
final boolean hasLogFileButConfigDoesNot = this.logFile != null && this.config.getLogFile()
.toString().equals(DistributionConfig.DEFAULT_LOG_FILE.toString());
if (logWriter == null && hasLogFileButConfigDoesNot) {
- this.config.unsafeSetLogFile(this.logFile); // LOG: this is(was) a hack for when logFile and
- // config don't match -- if config specifies a
- // different log-file things will break!
+ // LOG: this is(was) a hack for when logFile and config don't match -- if config specifies a
+ // different log-file things will break!
+ this.config.unsafeSetLogFile(this.logFile);
}
// LOG: create LogWriterAppenders (these are closed at shutdown)
@@ -520,26 +503,24 @@ public class InternalLocator extends Locator implements ConnectListener {
if (securityLogWriter == null) {
securityLogWriter = LogWriterFactory.createLogWriterLogger(false, true, this.config, false);
- ((LogWriterLogger) logWriter).setLogWriterLevel(this.config.getSecurityLogLevel());
+ logWriter.setLogWriterLevel(this.config.getSecurityLogLevel());
securityLogWriter.fine("SecurityLogWriter for locator is created.");
}
SocketCreatorFactory.setDistributionConfig(this.config);
this.locatorListener = WANServiceProvider.createLocatorMembershipListener();
- if (locatorListener != null) {
+ if (this.locatorListener != null) {
// We defer setting the port until the handler is init'd - that way we'll have an actual port
- // in the
- // case where we're starting with port = 0.
- this.locatorListener.setConfig(this.getConfig());
+ // in the case where we're starting with port = 0.
+ this.locatorListener.setConfig(getConfig());
}
this.handler = new PrimaryHandler(this, locatorListener);
ThreadGroup group = LoggingThreadGroup.createThreadGroup("Distribution locators", logger);
- stats = new LocatorStats();
+ this.stats = new LocatorStats();
-
- server = new TcpServer(port, this.bindAddress, null, this.config, this.handler,
+ this.server = new TcpServer(port, this.bindAddress, null, this.config, this.handler,
new DelayedPoolStatHelper(), group, this.toString());
}
@@ -551,10 +532,9 @@ public class InternalLocator extends Locator implements ConnectListener {
this.productUseLog = new ProductUseLog(productUseFile);
}
-
private void startTcpServer() throws IOException {
logger.info(LocalizedMessage.create(LocalizedStrings.InternalLocator_STARTING_0, this));
- server.start();
+ this.server.start();
}
public ClusterConfigurationService getSharedConfiguration() {
@@ -562,19 +542,20 @@ public class InternalLocator extends Locator implements ConnectListener {
}
public DistributionConfigImpl getConfig() {
- return config;
+ return this.config;
}
/**
* Start peer location in this locator. If you plan on starting a distributed system later, this
* method should be called first so that the distributed system can use this locator.
- *
+ * <p>
+ * TODO: parameter withDS is never used
+ *
* @param withDS true if a distributed system has been or will be started
*
- * @throws IOException
* @since GemFire 5.7
*/
- public void startPeerLocation(boolean withDS) throws IOException {
+ void startPeerLocation(boolean withDS) throws IOException {
if (isPeerLocator()) {
throw new IllegalStateException(
LocalizedStrings.InternalLocator_PEER_LOCATION_IS_ALREADY_RUNNING_FOR_0
@@ -595,18 +576,18 @@ public class InternalLocator extends Locator implements ConnectListener {
} else {
// check if security is enabled
String prop = this.config.getSecurityPeerAuthInit();
- locatorsAreCoordinators = (prop != null && prop.length() > 0);
+ locatorsAreCoordinators = prop != null && !prop.isEmpty();
if (!locatorsAreCoordinators) {
locatorsAreCoordinators = Boolean.getBoolean(LOCATORS_PREFERRED_AS_COORDINATORS);
}
}
- this.locatorImpl =
- MemberFactory.newLocatorHandler(this.bindAddress, this.stateFile, locatorsProp,
- locatorsAreCoordinators, networkPartitionDetectionEnabled, stats, securityUDPDHAlgo);
+ this.locatorImpl = MemberFactory.newLocatorHandler(this.bindAddress, this.stateFile,
+ locatorsProp, locatorsAreCoordinators, networkPartitionDetectionEnabled, this.stats,
+ securityUDPDHAlgo);
this.handler.addHandler(PeerLocatorRequest.class, this.locatorImpl);
- peerLocator = true;
- if (!server.isAlive()) {
+ this.peerLocator = true;
+ if (!this.server.isAlive()) {
startTcpServer();
}
}
@@ -624,15 +605,17 @@ public class InternalLocator extends Locator implements ConnectListener {
/**
* For backward-compatibility we retain this method
+ * <p>
+ * TODO: parameters peerLocator and serverLocator and b1 are never used
*
* @deprecated use a form of the method that does not have peerLocator/serverLocator parameters
*/
+ @Deprecated
public static InternalLocator startLocator(int locatorPort, File logFile, File stateFile,
InternalLogWriter logger, InternalLogWriter logger1, InetAddress addr,
Properties dsProperties, boolean peerLocator, boolean serverLocator, String s, boolean b1)
throws IOException {
return startLocator(locatorPort, logFile, stateFile, logger, logger1, addr, dsProperties, s);
-
}
class SharedConfigurationRunnable implements Runnable {
@@ -642,23 +625,19 @@ public class InternalLocator extends Locator implements ConnectListener {
@Override
public void run() {
try {
- if (locator.sharedConfig == null) {
+ if (this.locator.sharedConfig == null) {
// locator.sharedConfig will already be created in case of auto-reconnect
- locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
+ this.locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
}
- locator.sharedConfig.initSharedConfiguration(locator.loadFromSharedConfigDir());
- locator.installSharedConfigDistribution();
+ this.locator.sharedConfig.initSharedConfiguration(this.locator.loadFromSharedConfigDir());
+ this.locator.installSharedConfigDistribution();
logger.info(
"Cluster configuration service start up completed successfully and is now running ....");
- } catch (CancelException e) {
+ } catch (CancelException | LockServiceDestroyedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Cluster configuration start up was cancelled", e);
}
- } catch (LockServiceDestroyedException e) {
- if (logger.isDebugEnabled()) {
- logger.debug("Cluster configuration start up was cancelled", e);
- }
- } catch (Throwable e) {
+ } catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
@@ -669,10 +648,9 @@ public class InternalLocator extends Locator implements ConnectListener {
* stopped, this distributed system will be disconnected. If a distributed system already exists,
* this method will have no affect.
*
- * @throws UnknownHostException
* @since GemFire 5.7
*/
- public void startDistributedSystem() throws UnknownHostException {
+ private void startDistributedSystem() throws UnknownHostException {
InternalDistributedSystem existing = InternalDistributedSystem.getConnectedInstance();
if (existing != null) {
@@ -681,27 +659,25 @@ public class InternalLocator extends Locator implements ConnectListener {
.create(LocalizedStrings.InternalLocator_USING_EXISTING_DISTRIBUTED_SYSTEM__0, existing));
startCache(existing);
} else {
- String thisLocator;
- {
- StringBuilder sb = new StringBuilder(100);
- if (bindAddress != null) {
- sb.append(bindAddress.getHostAddress());
- } else {
- sb.append(SocketCreator.getLocalHost().getHostAddress());
- }
- sb.append('[').append(getPort()).append(']');
- thisLocator = sb.toString();
+
+ StringBuilder sb = new StringBuilder(100);
+ if (this.bindAddress != null) {
+ sb.append(this.bindAddress.getHostAddress());
+ } else {
+ sb.append(SocketCreator.getLocalHost().getHostAddress());
}
+ sb.append('[').append(getPort()).append(']');
+ String thisLocator = sb.toString();
- if (peerLocator) {
+ if (this.peerLocator) {
// append this locator to the locators list from the config properties
// this.logger.config("ensuring that this locator is in the locators list");
boolean setLocatorsProp = false;
String locatorsProp = this.config.getLocators();
- if (locatorsProp != null && locatorsProp.trim().length() > 0) {
+ if (locatorsProp != null && !locatorsProp.trim().isEmpty()) {
if (!locatorsProp.contains(thisLocator)) {
- locatorsProp = locatorsProp + "," + thisLocator;
+ locatorsProp = locatorsProp + ',' + thisLocator;
setLocatorsProp = true;
}
} else {
@@ -722,7 +698,6 @@ public class InternalLocator extends Locator implements ConnectListener {
// No longer default mcast-port to zero. See 46277.
}
-
Properties connectEnv = new Properties();
// LogWriterAppender is now shared via that class
// using a DistributionConfig earlier in this method
@@ -736,13 +711,13 @@ public class InternalLocator extends Locator implements ConnectListener {
LocalizedStrings.InternalDistributedSystem_STARTUP_CONFIGURATIONN_0,
this.config.toLoggerString()));
- myDs = (InternalDistributedSystem) DistributedSystem.connect(connectEnv);
+ this.myDs = (InternalDistributedSystem) DistributedSystem.connect(connectEnv);
- if (peerLocator) {
- this.locatorImpl.setMembershipManager(myDs.getDM().getMembershipManager());
+ if (this.peerLocator) {
+ this.locatorImpl.setMembershipManager(this.myDs.getDM().getMembershipManager());
}
- myDs.addDisconnectListener(new DisconnectListener() {
+ this.myDs.addDisconnectListener(new DisconnectListener() {
@Override
public void onDisconnect(InternalDistributedSystem sys) {
stop(false, false, false);
@@ -754,25 +729,23 @@ public class InternalLocator extends Locator implements ConnectListener {
logger.info(LocalizedMessage.create(LocalizedStrings.InternalLocator_LOCATOR_STARTED_ON__0,
thisLocator));
- ((InternalDistributedSystem) myDs).setDependentLocator(this);
+ myDs.setDependentLocator(this);
}
}
-
private void startCache(DistributedSystem ds) {
-
- GemFireCacheImpl gfc = GemFireCacheImpl.getInstance();
- if (gfc == null) {
+ InternalCache internalCache = GemFireCacheImpl.getInstance();
+ if (internalCache == null) {
logger.info("Creating cache for locator.");
- this.myCache = new CacheFactory(ds.getProperties()).create();
- gfc = (GemFireCacheImpl) this.myCache;
+ this.myCache = (InternalCache) new CacheFactory(ds.getProperties()).create();
+ internalCache = this.myCache;
} else {
logger.info("Using existing cache for locator.");
((InternalDistributedSystem) ds).handleResourceEvent(ResourceEvent.LOCATOR_START, this);
}
- startJmxManagerLocationService(gfc);
+ startJmxManagerLocationService(internalCache);
- startSharedConfigurationService(gfc);
+ startSharedConfigurationService(internalCache);
}
/**
@@ -781,12 +754,10 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @param distributedSystem The distributed system to use for the statistics.
*
- * @throws UnknownHostException
* @since GemFire 5.7
*/
- public void endStartLocator(InternalDistributedSystem distributedSystem)
- throws UnknownHostException {
- env = null;
+ void endStartLocator(InternalDistributedSystem distributedSystem) throws UnknownHostException {
+ this.env = null;
if (distributedSystem == null) {
distributedSystem = InternalDistributedSystem.getConnectedInstance();
}
@@ -798,7 +769,8 @@ public class InternalLocator extends Locator implements ConnectListener {
this.locatorDiscoverer = WANServiceProvider.createLocatorDiscoverer();
if (this.locatorDiscoverer != null) {
- this.locatorDiscoverer.discover(getPort(), config, locatorListener, hostnameForClients);
+ this.locatorDiscoverer.discover(getPort(), this.config, this.locatorListener,
+ this.hostnameForClients);
}
}
@@ -811,7 +783,7 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @since GemFire 5.7
*/
- public void startServerLocation(InternalDistributedSystem distributedSystem) throws IOException {
+ void startServerLocation(InternalDistributedSystem distributedSystem) throws IOException {
if (isServerLocator()) {
throw new IllegalStateException(
LocalizedStrings.InternalLocator_SERVER_LOCATION_IS_ALREADY_RUNNING_FOR_0
@@ -831,16 +803,17 @@ public class InternalLocator extends Locator implements ConnectListener {
this.productUseLog.monitorUse(distributedSystem);
- ServerLocator sl = new ServerLocator(getPort(), this.bindAddress, this.hostnameForClients,
- this.logFile, this.productUseLog, getConfig().getName(), distributedSystem, stats);
- this.handler.addHandler(LocatorListRequest.class, sl);
- this.handler.addHandler(ClientConnectionRequest.class, sl);
- this.handler.addHandler(QueueConnectionRequest.class, sl);
- this.handler.addHandler(ClientReplacementRequest.class, sl);
- this.handler.addHandler(GetAllServersRequest.class, sl);
- this.handler.addHandler(LocatorStatusRequest.class, sl);
- this.serverLocator = sl;
- if (!server.isAlive()) {
+ ServerLocator serverLocator =
+ new ServerLocator(getPort(), this.bindAddress, this.hostnameForClients, this.logFile,
+ this.productUseLog, getConfig().getName(), distributedSystem, this.stats);
+ this.handler.addHandler(LocatorListRequest.class, serverLocator);
+ this.handler.addHandler(ClientConnectionRequest.class, serverLocator);
+ this.handler.addHandler(QueueConnectionRequest.class, serverLocator);
+ this.handler.addHandler(ClientReplacementRequest.class, serverLocator);
+ this.handler.addHandler(GetAllServersRequest.class, serverLocator);
+ this.handler.addHandler(LocatorStatusRequest.class, serverLocator);
+ this.serverLocator = serverLocator;
+ if (!this.server.isAlive()) {
startTcpServer();
}
}
@@ -851,14 +824,6 @@ public class InternalLocator extends Locator implements ConnectListener {
@Override
public void stop() {
stop(false, false, true);
- // SocketCreatorFactory.close();
- }
-
- /**
- * Was this locator stopped during forced-disconnect processing but should reconnect?
- */
- public boolean getStoppedForReconnect() {
- return this.stoppedForReconnect;
}
/**
@@ -886,7 +851,7 @@ public class InternalLocator extends Locator implements ConnectListener {
while (this.server.isAlive() && System.currentTimeMillis() < endOfWait) {
try {
Thread.sleep(500);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
return;
}
@@ -943,14 +908,13 @@ public class InternalLocator extends Locator implements ConnectListener {
logger.info(LocalizedMessage.create(LocalizedStrings.InternalLocator_0__IS_STOPPED, this));
- if (stoppedForReconnect) {
+ if (this.stoppedForReconnect) {
if (this.myDs != null) {
launchRestartThread();
}
}
}
-
/**
* answers whether this locator is currently stopped
*/
@@ -962,21 +926,21 @@ public class InternalLocator extends Locator implements ConnectListener {
if (!this.shutdownHandled.compareAndSet(false, true)) {
return; // already shutdown
}
- productUseLog.close();
- if (myDs != null) {
- ((InternalDistributedSystem) myDs).setDependentLocator(null);
+ this.productUseLog.close();
+ if (this.myDs != null) {
+ this.myDs.setDependentLocator(null);
}
if (this.myCache != null && !this.stoppedForReconnect && !this.forcedDisconnect) {
logger.info("Closing locator's cache");
try {
this.myCache.close();
} catch (RuntimeException ex) {
- logger.info("Could not close locator's cache because: {}", ex);
+ logger.info("Could not close locator's cache because: {}", ex.getMessage(), ex);
}
}
- if (stats != null) {
- stats.close();
+ if (this.stats != null) {
+ this.stats.close();
}
if (this.locatorListener != null) {
@@ -984,11 +948,11 @@ public class InternalLocator extends Locator implements ConnectListener {
}
this.isSharedConfigurationStarted = false;
- if (myDs != null && !this.forcedDisconnect) {
- if (myDs.isConnected()) {
+ if (this.myDs != null && !this.forcedDisconnect) {
+ if (this.myDs.isConnected()) {
logger.info(LocalizedMessage
.create(LocalizedStrings.InternalLocator_DISCONNECTING_DISTRIBUTED_SYSTEM_FOR_0, this));
- myDs.disconnect();
+ this.myDs.disconnect();
}
}
}
@@ -1016,10 +980,10 @@ public class InternalLocator extends Locator implements ConnectListener {
} else {
logger.info("system was not restarted");
}
- Thread rs = this.restartThread;
- if (rs != null) {
+ Thread restartThread = this.restartThread;
+ if (restartThread != null) {
logger.info("waiting for services to restart...");
- rs.join();
+ restartThread.join();
this.restartThread = null;
logger.info("done waiting for services to restart");
}
@@ -1033,7 +997,9 @@ public class InternalLocator extends Locator implements ConnectListener {
private void launchRestartThread() {
// create a thread group having a last-chance exception-handler
ThreadGroup group = LoggingThreadGroup.createThreadGroup("Locator restart thread group");
+ // TODO: non-atomic operation on volatile field restartThread
this.restartThread = new Thread(group, "Location services restart thread") {
+ @Override
public void run() {
boolean restarted = false;
try {
@@ -1064,7 +1030,7 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @return true if able to reconnect the locator to the new distributed system
*/
- public boolean attemptReconnect() throws InterruptedException, IOException {
+ private boolean attemptReconnect() throws InterruptedException, IOException {
boolean restarted = false;
if (this.stoppedForReconnect) {
logger.info("attempting to restart locator");
@@ -1099,9 +1065,7 @@ public class InternalLocator extends Locator implements ConnectListener {
ds.waitUntilReconnected(waitTime, TimeUnit.MILLISECONDS);
}
InternalDistributedSystem newSystem = (InternalDistributedSystem) ds.getReconnectedSystem();
- // LogWriter log = new ManagerLogWriter(LogWriterImpl.FINE_LEVEL, System.out);
if (newSystem != null) {
- // log.fine("reconnecting locator: starting location services");
if (!tcpServerStarted) {
if (this.locatorListener != null) {
this.locatorListener.clearLocatorInfo();
@@ -1113,11 +1077,10 @@ public class InternalLocator extends Locator implements ConnectListener {
restarted = true;
}
}
- logger.info("restart thread exiting. Service was " + (restarted ? "" : "not ") + "restarted");
+ logger.info("restart thread exiting. Service was {}restarted", restarted ? "" : "not ");
return restarted;
}
-
private void restartWithoutDS() throws IOException {
synchronized (locatorLock) {
if (locator != this && hasLocator()) {
@@ -1138,7 +1101,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
- private void restartWithDS(InternalDistributedSystem newSystem, GemFireCacheImpl newCache)
+ private void restartWithDS(InternalDistributedSystem newSystem, InternalCache newCache)
throws IOException {
synchronized (locatorLock) {
if (locator != this && hasLocator()) {
@@ -1147,7 +1110,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
this.myDs = newSystem;
this.myCache = newCache;
- ((InternalDistributedSystem) myDs).setDependentLocator(this);
+ this.myDs.setDependentLocator(this);
logger.info("Locator restart: initializing TcpServer");
if (isSharedConfigurationEnabled()) {
this.sharedConfig = new ClusterConfigurationService(newCache);
@@ -1168,21 +1131,19 @@ public class InternalLocator extends Locator implements ConnectListener {
}
logger.info("Locator restart: initializing JMX manager");
startJmxManagerLocationService(newCache);
- endStartLocator((InternalDistributedSystem) myDs);
+ endStartLocator(this.myDs);
logger.info("Locator restart completed");
}
}
-
- // implementation of abstract method in Locator
@Override
public DistributedSystem getDistributedSystem() {
- return myDs;
+ return this.myDs;
}
@Override
public boolean isPeerLocator() {
- return peerLocator;
+ return this.peerLocator;
}
@Override
@@ -1204,25 +1165,21 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @return the port the locator is listening on or null if it has not yet been started
*/
+ @Override
public Integer getPort() {
- if (server != null) {
- return server.getPort();
+ if (this.server != null) {
+ return this.server.getPort();
}
return null;
}
- /******
- *
- *
- */
class FetchSharedConfigStatus implements Callable<SharedConfigurationStatusResponse> {
static final int SLEEPTIME = 1000;
static final byte MAX_RETRIES = 5;
- public SharedConfigurationStatusResponse call() throws Exception {
- SharedConfigurationStatusResponse response;
-
+ @Override
+ public SharedConfigurationStatusResponse call() throws InterruptedException {
final InternalLocator locator = InternalLocator.this;
for (int i = 0; i < MAX_RETRIES; i++) {
if (locator.sharedConfig != null) {
@@ -1234,6 +1191,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
Thread.sleep(SLEEPTIME);
}
+ SharedConfigurationStatusResponse response;
if (locator.sharedConfig != null) {
response = locator.sharedConfig.createStatusResponse();
} else {
@@ -1244,57 +1202,52 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
-
public SharedConfigurationStatusResponse getSharedConfigurationStatus() {
- ExecutorService es =
- ((GemFireCacheImpl) myCache).getDistributionManager().getWaitingThreadPool();
+ ExecutorService es = this.myCache.getDistributionManager().getWaitingThreadPool();
Future<SharedConfigurationStatusResponse> statusFuture =
es.submit(new FetchSharedConfigStatus());
- SharedConfigurationStatusResponse response = null;
+ SharedConfigurationStatusResponse response;
try {
response = statusFuture.get(5, TimeUnit.SECONDS);
} catch (Exception e) {
- logger.info("Exception occured while fetching the status {}", CliUtil.stackTraceAsString(e));
+ logger.info("Exception occurred while fetching the status {}", CliUtil.stackTraceAsString(e));
response = new SharedConfigurationStatusResponse();
response.setStatus(SharedConfigurationStatus.UNDETERMINED);
}
return response;
}
-
public static class PrimaryHandler implements TcpHandler {
- private volatile HashMap<Class, TcpHandler> handlerMapping = new HashMap<Class, TcpHandler>();
- private volatile HashSet<TcpHandler> allHandlers = new HashSet<TcpHandler>();
+ private volatile HashMap<Class, TcpHandler> handlerMapping = new HashMap<>();
+ private volatile HashSet<TcpHandler> allHandlers = new HashSet<>();
private TcpServer tcpServer;
private final LocatorMembershipListener locatorListener;
- // private final List<LocatorJoinMessage> locatorJoinMessages;
- private Object locatorJoinObject = new Object();
- private InternalLocator internalLocator;
+ private final InternalLocator internalLocator;
// GEODE-2253 test condition
private boolean hasWaitedForHandlerInitialization = false;
- public PrimaryHandler(InternalLocator locator, LocatorMembershipListener listener) {
+ PrimaryHandler(InternalLocator locator, LocatorMembershipListener listener) {
this.locatorListener = listener;
- internalLocator = locator;
- // this.locatorJoinMessages = new ArrayList<LocatorJoinMessage>();
+ this.internalLocator = locator;
}
// this method is synchronized to make sure that no new handlers are added while
// initialization is taking place.
+ @Override
public synchronized void init(TcpServer tcpServer) {
if (this.locatorListener != null) {
// This is deferred until now as the initial requested port could have been 0
- this.locatorListener.setPort(internalLocator.getPort());
+ this.locatorListener.setPort(this.internalLocator.getPort());
}
this.tcpServer = tcpServer;
- for (Iterator itr = allHandlers.iterator(); itr.hasNext();) {
- TcpHandler handler = (TcpHandler) itr.next();
+ for (TcpHandler handler : this.allHandlers) {
handler.init(tcpServer);
}
}
+ @Override
public void restarting(DistributedSystem ds, GemFireCache cache,
ClusterConfigurationService sharedConfig) {
if (ds != null) {
@@ -1304,33 +1257,35 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
+ @Override
public Object processRequest(Object request) throws IOException {
long giveup = 0;
while (giveup == 0 || System.currentTimeMillis() < giveup) {
TcpHandler handler = null;
if (request instanceof PeerLocatorRequest) {
- handler = (TcpHandler) handlerMapping.get(PeerLocatorRequest.class);
+ handler = this.handlerMapping.get(PeerLocatorRequest.class);
} else {
- handler = (TcpHandler) handlerMapping.get(request.getClass());
+ handler = this.handlerMapping.get(request.getClass());
}
if (handler != null) {
return handler.processRequest(request);
} else {
- if (locatorListener != null) {
- return locatorListener.handleRequest(request);
+ if (this.locatorListener != null) {
+ return this.locatorListener.handleRequest(request);
} else {
// either there is a configuration problem or the locator is still starting up
if (giveup == 0) {
- int locatorWaitTime = internalLocator.getConfig().getLocatorWaitTime();
+ int locatorWaitTime = this.internalLocator.getConfig().getLocatorWaitTime();
if (locatorWaitTime <= 0) {
- locatorWaitTime = 30; // always retry some number of times
+ // always retry some number of times
+ locatorWaitTime = 30;
}
- hasWaitedForHandlerInitialization = true;
- giveup = System.currentTimeMillis() + (locatorWaitTime * 1000);
+ this.hasWaitedForHandlerInitialization = true;
+ giveup = System.currentTimeMillis() + locatorWaitTime * 1000;
try {
Thread.sleep(1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignored) {
// running in an executor - no need to set the interrupted flag on the thread
return null;
}
@@ -1350,19 +1305,13 @@ public class InternalLocator extends Locator implements ConnectListener {
* installed?
*/
public boolean hasWaitedForHandlerInitialization() {
- return hasWaitedForHandlerInitialization;
- }
-
- private JmxManagerLocatorResponse findJmxManager(JmxManagerLocatorRequest request) {
- JmxManagerLocatorResponse result = null;
- // NYI
- return result;
+ return this.hasWaitedForHandlerInitialization;
}
+ @Override
public void shutDown() {
try {
- for (Iterator itr = allHandlers.iterator(); itr.hasNext();) {
- TcpHandler handler = (TcpHandler) itr.next();
+ for (TcpHandler handler : this.allHandlers) {
handler.shutDown();
}
} finally {
@@ -1370,42 +1319,45 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
- public synchronized boolean isHandled(Class clazz) {
+ synchronized boolean isHandled(Class clazz) {
return this.handlerMapping.containsKey(clazz);
}
public synchronized void addHandler(Class clazz, TcpHandler handler) {
- HashMap tmpHandlerMapping = new HashMap(handlerMapping);
- HashSet tmpAllHandlers = new HashSet(allHandlers);
+ HashMap<Class, TcpHandler> tmpHandlerMapping = new HashMap<>(this.handlerMapping);
+ HashSet<TcpHandler> tmpAllHandlers = new HashSet<>(this.allHandlers);
tmpHandlerMapping.put(clazz, handler);
- if (tmpAllHandlers.add(handler) && tcpServer != null) {
- handler.init(tcpServer);
+ if (tmpAllHandlers.add(handler) && this.tcpServer != null) {
+ handler.init(this.tcpServer);
}
- handlerMapping = tmpHandlerMapping;
- allHandlers = tmpAllHandlers;
+ this.handlerMapping = tmpHandlerMapping;
+ this.allHandlers = tmpAllHandlers;
}
+ @Override
public void endRequest(Object request, long startTime) {
- TcpHandler handler = (TcpHandler) handlerMapping.get(request.getClass());
+ TcpHandler handler = this.handlerMapping.get(request.getClass());
if (handler != null) {
handler.endRequest(request, startTime);
}
}
+ @Override
public void endResponse(Object request, long startTime) {
- TcpHandler handler = (TcpHandler) handlerMapping.get(request.getClass());
+ TcpHandler handler = this.handlerMapping.get(request.getClass());
if (handler != null) {
handler.endResponse(request, startTime);
}
}
}
+ @Override
public void onConnect(InternalDistributedSystem sys) {
try {
- stats.hookupStats(sys, SocketCreator.getLocalHost().getCanonicalHostName() + "-"
- + server.getBindAddress().toString());
- } catch (UnknownHostException uhe) {
- uhe.printStackTrace();
+ this.stats.hookupStats(sys,
+ SocketCreator.getLocalHost().getCanonicalHostName() + '-' + this.server.getBindAddress());
+ } catch (UnknownHostException e) {
+ logger.warn(e);
}
}
@@ -1416,12 +1368,12 @@ public class InternalLocator extends Locator implements ConnectListener {
* @see #getLocators()
*/
public static Collection<String> getLocatorStrings() {
- Collection<String> locatorStrings = null;
+ Collection<String> locatorStrings;
try {
Collection<DistributionLocatorId> locatorIds =
DistributionLocatorId.asDistributionLocatorIds(getLocators());
locatorStrings = DistributionLocatorId.asStrings(locatorIds);
- } catch (UnknownHostException e) {
+ } catch (UnknownHostException ignored) {
locatorStrings = null;
}
if (locatorStrings == null || locatorStrings.isEmpty()) {
@@ -1436,19 +1388,19 @@ public class InternalLocator extends Locator implements ConnectListener {
* recorded if a distributed system is started.
*/
protected class DelayedPoolStatHelper implements PoolStatHelper {
-
+ @Override
public void startJob() {
stats.incRequestInProgress(1);
}
+ @Override
public void endJob() {
stats.incRequestInProgress(-1);
}
}
- public void startSharedConfigurationService(GemFireCacheImpl gfc) {
-
+ private void startSharedConfigurationService(InternalCache internalCache) {
installSharedConfigHandler();
if (this.config.getEnableClusterConfiguration() && !this.isSharedConfigurationStarted) {
@@ -1458,25 +1410,26 @@ public class InternalLocator extends Locator implements ConnectListener {
return;
}
- ExecutorService es = gfc.getDistributionManager().getThreadPool();
+ ExecutorService es = internalCache.getDistributionManager().getThreadPool();
es.execute(new SharedConfigurationRunnable());
} else {
logger.info("Cluster configuration service is disabled");
}
}
- public void startJmxManagerLocationService(GemFireCacheImpl gfc) {
- if (gfc.getJmxManagerAdvisor() != null) {
+ public void startJmxManagerLocationService(InternalCache internalCache) {
+ if (internalCache.getJmxManagerAdvisor() != null) {
if (!this.handler.isHandled(JmxManagerLocatorRequest.class)) {
- this.handler.addHandler(JmxManagerLocatorRequest.class, new JmxManagerLocator(gfc));
+ this.handler.addHandler(JmxManagerLocatorRequest.class,
+ new JmxManagerLocator(internalCache));
}
}
}
- /***
+ /**
* Creates and installs the handler {@link ConfigurationRequestHandler}
*/
- public void installSharedConfigDistribution() {
+ private void installSharedConfigDistribution() {
if (!this.handler.isHandled(ConfigurationRequest.class)) {
this.handler.addHandler(ConfigurationRequest.class,
new ConfigurationRequestHandler(this.sharedConfig));
@@ -1484,7 +1437,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
- public void installSharedConfigHandler() {
+ private void installSharedConfigHandler() {
if (!this.handler.isHandled(SharedConfigurationStatusRequest.class)) {
this.handler.addHandler(SharedConfigurationStatusRequest.class,
new SharedConfigurationStatusRequestHandler());
@@ -1493,7 +1446,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
public boolean hasHandlerForClass(Class messageClass) {
- return (handler.isHandled(messageClass));
+ return this.handler.isHandled(messageClass);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index 8ae66d0..b45a8be 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -27,7 +27,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Map.*;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
@@ -77,13 +77,13 @@ import org.apache.geode.distributed.internal.membership.gms.SuspectMember;
import org.apache.geode.distributed.internal.membership.gms.fd.GMSHealthMonitor;
import org.apache.geode.distributed.internal.membership.gms.interfaces.Manager;
import org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave;
-import org.apache.geode.distributed.internal.membership.gms.messenger.GMSQuorumChecker;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.SystemTimer;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
import org.apache.geode.internal.cache.CacheServerImpl;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.partitioned.PartitionMessageWithDirectReply;
import org.apache.geode.internal.cache.xmlcache.CacheServerCreation;
import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
@@ -1550,7 +1550,7 @@ public class GMSMembershipManager implements MembershipManager, Manager {
/** generate XML from the cache before shutting down due to forced disconnect */
public void saveCacheXmlForReconnect(boolean sharedConfigEnabled) {
// first save the current cache description so reconnect can rebuild the cache
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
if (!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "autoReconnect-useCacheXMLFile")
&& !sharedConfigEnabled) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
index 9845bf1..86fe532 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
@@ -14,30 +14,6 @@
*/
package org.apache.geode.distributed.internal.tcpserver;
-import org.apache.geode.CancelException;
-import org.apache.geode.DataSerializer;
-import org.apache.geode.SystemFailure;
-import org.apache.geode.distributed.internal.ClusterConfigurationService;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionConfigImpl;
-import org.apache.geode.distributed.internal.DistributionStats;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.PoolStatHelper;
-import org.apache.geode.distributed.internal.PooledExecutorWithDMStats;
-import org.apache.geode.internal.DSFIDFactory;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataInputStream;
-import org.apache.geode.internal.VersionedDataOutputStream;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.tier.Acceptor;
-import org.apache.geode.internal.cache.tier.sockets.HandShake;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.internal.net.SocketCreatorFactory;
-import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.logging.log4j.Logger;
-
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
@@ -59,8 +35,34 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+
import javax.net.ssl.SSLException;
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionStats;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.PoolStatHelper;
+import org.apache.geode.distributed.internal.PooledExecutorWithDMStats;
+import org.apache.geode.internal.DSFIDFactory;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataInputStream;
+import org.apache.geode.internal.VersionedDataOutputStream;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.tier.Acceptor;
+import org.apache.geode.internal.cache.tier.sockets.HandShake;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.net.SocketCreatorFactory;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
+
/**
* TCP server which listens on a port and delegates requests to a request handler. The server uses
* expects messages containing a global version number, followed by a DataSerializable object
@@ -99,20 +101,19 @@ public class TcpServer {
public static int OLDTESTVERSION = OLDGOSSIPVERSION;
public static final long SHUTDOWN_WAIT_TIME = 60 * 1000;
- private static int MAX_POOL_SIZE = Integer
- .getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.MAX_POOL_SIZE", 100).intValue();
+ private static int MAX_POOL_SIZE =
+ Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.MAX_POOL_SIZE", 100);
private static int POOL_IDLE_TIMEOUT = 60 * 1000;
private static final Logger log = LogService.getLogger();
protected/* GemStoneAddition */ final/* GemStoneAddition */ static int READ_TIMEOUT =
- Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.READ_TIMEOUT", 60 * 1000)
- .intValue();
+ Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.READ_TIMEOUT", 60 * 1000);
// This is for backwards compatibility. The p2p.backlog flag used to be the only way to configure
// the locator backlog.
- private static final int P2P_BACKLOG = Integer.getInteger("p2p.backlog", 1000).intValue();
- private static final int BACKLOG = Integer
- .getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.BACKLOG", P2P_BACKLOG).intValue();
+ private static final int P2P_BACKLOG = Integer.getInteger("p2p.backlog", 1000);
+ private static final int BACKLOG =
+ Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "TcpServer.BACKLOG", P2P_BACKLOG);
private final int port;
private int serverSocketPortAtClose;
@@ -129,7 +130,7 @@ public class TcpServer {
private SocketCreator socketCreator;
- /**
+ /*
* GemStoneAddition - Initialize versions map. Warning: This map must be compatible with all
* GemFire versions being handled by this member "With different GOSSIPVERION". If GOSSIPVERIONS
* are same for then current GOSSIPVERSION should be used.
@@ -189,15 +190,15 @@ public class TcpServer {
POOL_IDLE_TIMEOUT, new ThreadPoolExecutor.CallerRunsPolicy());
}
- public void restarting(InternalDistributedSystem ds, GemFireCacheImpl cache,
+ public void restarting(InternalDistributedSystem ds, InternalCache cache,
ClusterConfigurationService sharedConfig) throws IOException {
this.shuttingDown = false;
this.handler.restarting(ds, cache, sharedConfig);
startServerThread();
this.executor = createExecutor(this.poolHelper, this.threadGroup);
- this.log.info("TcpServer@" + System.identityHashCode(this)
- + " restarting: completed. Server thread=" + serverThread + "@"
- + System.identityHashCode(serverThread) + ";alive=" + serverThread.isAlive());
+ log.info("TcpServer@" + System.identityHashCode(this)
+ + " restarting: completed. Server thread=" + this.serverThread + '@'
+ + System.identityHashCode(this.serverThread) + ";alive=" + this.serverThread.isAlive());
}
public void start() throws IOException {
@@ -280,7 +281,7 @@ public class TcpServer {
// Allocate no objects here!
try {
srv_sock.close();
- } catch (IOException e) {
+ } catch (IOException ignore) {
// ignore
}
SystemFailure.checkFailure(); // throws
@@ -318,7 +319,7 @@ public class TcpServer {
executor.shutdown();
try {
executor.awaitTermination(SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
handler.shutDown();
@@ -414,9 +415,9 @@ public class TcpServer {
handler.endResponse(request, startTime);
- } catch (EOFException ex) {
+ } catch (EOFException ignore) {
// client went away - ignore
- } catch (CancelException ex) {
+ } catch (CancelException ignore) {
// ignore
} catch (ClassNotFoundException ex) {
String sender = null;
@@ -460,7 +461,7 @@ public class TcpServer {
} finally {
try {
sock.close();
- } catch (IOException e) {
+ } catch (IOException ignore) {
// ignore
}
}
@@ -511,8 +512,6 @@ public class TcpServer {
/**
* Returns GossipVersion for older Gemfire versions.
*
- * @param ordinal
- *
* @return gossip version
*/
public static int getGossipVersionForOrdinal(short ordinal) {
@@ -525,12 +524,12 @@ public class TcpServer {
Iterator<Map.Entry> itr = TcpServer.GOSSIP_TO_GEMFIRE_VERSION_MAP.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry entry = itr.next();
- short o = ((Short) entry.getValue()).shortValue();
+ short o = (Short) entry.getValue();
if (o == ordinal) {
- return ((Integer) entry.getKey()).intValue();
+ return (Integer) entry.getKey();
} else if (o < ordinal && o > closest) {
closest = o;
- closestGV = ((Integer) entry.getKey()).intValue();
+ closestGV = (Integer) entry.getKey();
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
index c02dc47..7aeec03 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
@@ -203,6 +203,7 @@ import org.apache.geode.internal.cache.DestroyPartitionedRegionMessage;
import org.apache.geode.internal.cache.DestroyRegionOperation;
import org.apache.geode.internal.cache.DistTXPrecommitMessage;
import org.apache.geode.internal.cache.DistTXCommitMessage;
+import org.apache.geode.internal.cache.DistTXPrecommitMessage.DistTxPreCommitResponse;
import org.apache.geode.internal.cache.DistTXRollbackMessage;
import org.apache.geode.internal.cache.DistributedClearOperation.ClearRegionMessage;
import org.apache.geode.internal.cache.DistributedClearOperation.ClearRegionWithContextMessage;
@@ -390,7 +391,6 @@ import org.apache.geode.internal.cache.versions.VMVersionTag;
import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor;
import org.apache.geode.internal.cache.wan.GatewaySenderEventCallbackArgument;
import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
-import org.apache.geode.internal.cache.wan.parallel.WaitUntilParallelGatewaySenderFlushedCoordinator;
import org.apache.geode.internal.cache.wan.parallel.ParallelQueueBatchRemovalMessage;
import org.apache.geode.internal.cache.wan.parallel.ParallelQueueBatchRemovalMessage.BatchRemovalReplyMessage;
import org.apache.geode.internal.cache.wan.parallel.ParallelQueueRemovalMessage;
@@ -913,8 +913,7 @@ public final class DSFIDFactory implements DataSerializableFixedID {
registerDSFID(PR_QUERY_TRACE_INFO, PRQueryTraceInfo.class);
registerDSFID(INDEX_CREATION_DATA, IndexCreationData.class);
registerDSFID(DIST_TX_OP, DistTxEntryEvent.class);
- registerDSFID(DIST_TX_PRE_COMMIT_RESPONSE,
- DistTXPrecommitMessage.DistTxPrecommitResponse.class);
+ registerDSFID(DIST_TX_PRE_COMMIT_RESPONSE, DistTxPreCommitResponse.class);
registerDSFID(DIST_TX_THIN_ENTRY_STATE, TXEntryState.DistTxThinEntryState.class);
registerDSFID(SERVER_PING_MESSAGE, ServerPingMessage.class);
registerDSFID(PR_DESTROY_ON_DATA_STORE_MESSAGE, DestroyRegionOnDataStoreMessage.class);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
index f96863f..fa39ec7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
@@ -14,9 +14,6 @@
*/
package org.apache.geode.internal;
-import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
-import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -25,8 +22,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
@@ -39,7 +36,10 @@ import java.util.List;
import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
+import java.util.regex.Pattern;
+import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
+import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.CacheClosedException;
@@ -47,7 +47,7 @@ import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Declarable;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.pdx.internal.TypeRegistry;
@@ -57,18 +57,21 @@ import org.apache.geode.pdx.internal.TypeRegistry;
* @since GemFire 7.0
*/
public class DeployedJar {
- private final static Logger logger = LogService.getLogger();
- private final static MessageDigest messageDigest = getMessageDigest();
+
+ private static final Logger logger = LogService.getLogger();
+ private static final MessageDigest messageDigest = getMessageDigest();
+ private static final byte[] ZERO_BYTES = new byte[0];
+ private static final Pattern PATTERN_SLASH = Pattern.compile("/");
private final String jarName;
private final File file;
private final byte[] md5hash;
- private final Collection<Function> registeredFunctions = new ArrayList<Function>();
+ private final Collection<Function> registeredFunctions = new ArrayList<>();
private static MessageDigest getMessageDigest() {
try {
return MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException nsaex) {
+ } catch (NoSuchAlgorithmException ignored) {
// Failure just means we can't do a simple compare for content equality
}
return null;
@@ -79,7 +82,7 @@ public class DeployedJar {
}
public int getVersion() {
- return JarDeployer.extractVersionFromFilename(file.getName());
+ return JarDeployer.extractVersionFromFilename(this.file.getName());
}
public DeployedJar(File versionedJarFile, String jarName) throws IOException {
@@ -90,7 +93,7 @@ public class DeployedJar {
* Writes the given jarBytes to versionedJarFile
*/
public DeployedJar(File versionedJarFile, final String jarName, byte[] jarBytes)
- throws IOException {
+ throws FileNotFoundException {
Assert.assertTrue(jarBytes != null, "jarBytes cannot be null");
Assert.assertTrue(jarName != null, "jarName cannot be null");
Assert.assertTrue(versionedJarFile != null, "versionedJarFile cannot be null");
@@ -128,13 +131,13 @@ public class DeployedJar {
try {
jarInputStream = new JarInputStream(inputStream);
- valid = (jarInputStream.getNextJarEntry() != null);
+ valid = jarInputStream.getNextJarEntry() != null;
} catch (IOException ignore) {
// Ignore this exception and just return false
} finally {
try {
jarInputStream.close();
- } catch (IOException ioex) {
+ } catch (IOException ignored) {
// Ignore this exception and just return result
}
}
@@ -148,11 +151,10 @@ public class DeployedJar {
* @param jarBytes Bytes of data to be validated.
* @return True if the data has JAR content, false otherwise
*/
- public static boolean hasValidJarContent(final byte[] jarBytes) {
+ static boolean hasValidJarContent(final byte[] jarBytes) {
return hasValidJarContent(new ByteArrayInputStream(jarBytes));
}
-
/**
* Scan the JAR file and attempt to load all classes and register any function classes found.
*/
@@ -162,7 +164,7 @@ public class DeployedJar {
// in the constructor. Once this method is finished, all classes will have been loaded and
// there will no longer be a need to hang on to the original contents so they will be
// discarded.
- public synchronized void loadClassesAndRegisterFunctions() throws ClassNotFoundException {
+ synchronized void loadClassesAndRegisterFunctions() throws ClassNotFoundException {
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
logger.debug("Registering functions with DeployedJar: {}", this);
@@ -179,8 +181,8 @@ public class DeployedJar {
while (jarEntry != null) {
if (jarEntry.getName().endsWith(".class")) {
- final String className = jarEntry.getName().replaceAll("/", "\\.").substring(0,
- (jarEntry.getName().length() - 6));
+ final String className = PATTERN_SLASH.matcher(jarEntry.getName()).replaceAll("\\.")
+ .substring(0, jarEntry.getName().length() - 6);
if (functionClasses.contains(className)) {
if (isDebugEnabled) {
@@ -232,12 +234,11 @@ public class DeployedJar {
this.registeredFunctions.clear();
try {
- TypeRegistry typeRegistry =
- ((GemFireCacheImpl) CacheFactory.getAnyInstance()).getPdxRegistry();
+ TypeRegistry typeRegistry = ((InternalCache) CacheFactory.getAnyInstance()).getPdxRegistry();
if (typeRegistry != null) {
typeRegistry.flushCache();
}
- } catch (CacheClosedException ccex) {
+ } catch (CacheClosedException ignored) {
// That's okay, it just means there was nothing to flush to begin with
}
}
@@ -249,7 +250,7 @@ public class DeployedJar {
* @param compareToBytes Bytes to compare the original content to
* @return True of the MD5 hash is the same o
*/
- public boolean hasSameContentAs(final byte[] compareToBytes) {
+ boolean hasSameContentAs(final byte[] compareToBytes) {
// If the MD5 hash can't be calculated then silently return no match
if (messageDigest == null || this.md5hash == null) {
return Arrays.equals(compareToBytes, getJarContent());
@@ -272,16 +273,15 @@ public class DeployedJar {
* @return A collection of Objects that implement the Function interface.
*/
private Collection<Function> getRegisterableFunctionsFromClass(Class<?> clazz) {
- final List<Function> registerableFunctions = new ArrayList<Function>();
+ final List<Function> registerableFunctions = new ArrayList<>();
try {
if (Function.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
boolean registerUninitializedFunction = true;
if (Declarable.class.isAssignableFrom(clazz)) {
try {
- final List<Properties> propertiesList =
- ((GemFireCacheImpl) CacheFactory.getAnyInstance())
- .getDeclarableProperties(clazz.getName());
+ final List<Properties> propertiesList = ((InternalCache) CacheFactory.getAnyInstance())
+ .getDeclarableProperties(clazz.getName());
if (!propertiesList.isEmpty()) {
registerUninitializedFunction = false;
@@ -299,7 +299,7 @@ public class DeployedJar {
}
}
}
- } catch (CacheClosedException ccex) {
+ } catch (CacheClosedException ignored) {
// That's okay, it just means there were no properties to init the function with
}
}
@@ -313,7 +313,7 @@ public class DeployedJar {
}
}
} catch (Exception ex) {
- logger.error("Attempting to register function from JAR file: " + this.file.getAbsolutePath(),
+ logger.error("Attempting to register function from JAR file: {}", this.file.getAbsolutePath(),
ex);
}
@@ -353,15 +353,14 @@ public class DeployedJar {
}
private byte[] getJarContent() {
- InputStream channelInputStream = null;
try {
- channelInputStream = new FileInputStream(this.file);
+ InputStream channelInputStream = new FileInputStream(this.file);
final ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
final byte[] bytes = new byte[4096];
int bytesRead;
- while (((bytesRead = channelInputStream.read(bytes)) != -1)) {
+ while ((bytesRead = channelInputStream.read(bytes)) != -1) {
byteOutStream.write(bytes, 0, bytesRead);
}
channelInputStream.close();
@@ -370,7 +369,7 @@ public class DeployedJar {
logger.error("Error when attempting to read jar contents: ", e);
}
- return new byte[0];
+ return ZERO_BYTES;
}
/**
@@ -391,8 +390,8 @@ public class DeployedJar {
public URL getFileURL() {
try {
return this.file.toURL();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (MalformedURLException e) {
+ logger.warn(e);
}
return null;
}
@@ -401,7 +400,7 @@ public class DeployedJar {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((this.jarName == null) ? 0 : this.jarName.hashCode());
+ result = prime * result + (this.jarName == null ? 0 : this.jarName.hashCode());
return result;
}
@@ -430,12 +429,12 @@ public class DeployedJar {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(getClass().getName());
- sb.append("@").append(System.identityHashCode(this)).append("{");
+ sb.append('@').append(System.identityHashCode(this)).append('{');
sb.append("jarName=").append(this.jarName);
sb.append(",file=").append(this.file.getAbsolutePath());
sb.append(",md5hash=").append(Arrays.toString(this.md5hash));
sb.append(",version=").append(this.getVersion());
- sb.append("}");
+ sb.append('}');
return sb.toString();
}
}
[10/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
index 7c2a3e3..1113c82 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
@@ -12,14 +12,12 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -65,6 +63,7 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.locks.TXLockId;
import org.apache.geode.internal.cache.locks.TXLockIdImpl;
import org.apache.geode.internal.cache.locks.TXLockService;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.versions.VersionSource;
@@ -80,7 +79,6 @@ import org.apache.geode.internal.offheap.annotations.Released;
* commit, to other cache members.
*
* @since GemFire 4.0
- *
*/
public class TXCommitMessage extends PooledDistributionMessage
implements MembershipListener, MessageWithReply {
@@ -98,12 +96,10 @@ public class TXCommitMessage extends PooledDistributionMessage
protected transient DM dm; // Used on the sending side of this message
private transient int sequenceNum = 0;
- private transient HashMap<InternalDistributedMember, RegionCommitList> msgMap = null; // Maps
- // receiver
- // Serializables
- // to
- // RegionCommitList
- // instances
+
+ // Maps receiver Serializables to RegionCommitList instances
+ private transient HashMap<InternalDistributedMember, RegionCommitList> msgMap = null;
+
private transient RegionCommit currentRegion;
protected transient TXState txState = null;
private transient boolean wasProcessed;
@@ -124,7 +120,7 @@ public class TXCommitMessage extends PooledDistributionMessage
private transient boolean hasReliableRegions = false;
/** Set of all caching exceptions produced hile processing this tx */
- private transient Set processingExceptions = Collections.EMPTY_SET;
+ private transient Set processingExceptions = Collections.emptySet();
private transient ClientProxyMembershipID bridgeContext = null;
@@ -149,15 +145,6 @@ public class TXCommitMessage extends PooledDistributionMessage
* transaction
*/
public static final TXCommitMessage EXCEPTION_MSG = new TXCommitMessage();
- /*
- * /** this is set if this message should deserialize the WAN shadowKey sent by the sender. Sender
- * will not send shadowKeys when there is a mix of 7.0 and 7.0.1 members
- *
- * private transient boolean shouldReadShadowKey; /** this is set if the sender has decided to
- * send WAN shadowKey for 7.0.1 members
- *
- * private transient boolean shouldWriteShadowKey;
- */
public TXCommitMessage(TXId txIdent, DM dm, TXState txState) {
this.dm = dm;
@@ -176,7 +163,7 @@ public class TXCommitMessage extends PooledDistributionMessage
// zero arg constructor for DataSerializer
}
- static public TXFarSideCMTracker getTracker() {
+ public static TXFarSideCMTracker getTracker() {
return TXCommitMessage.txTracker;
}
@@ -194,7 +181,7 @@ public class TXCommitMessage extends PooledDistributionMessage
* Return the TXCommitMessage we have already received that is associated with id. Note because of
* bug 37657 we may need to wait for it to show up.
*/
- static public TXCommitMessage waitForMessage(Object id, DM dm) {
+ public static TXCommitMessage waitForMessage(Object id, DM dm) {
TXFarSideCMTracker map = getTracker();
return map.waitForMessage(id, dm);
}
@@ -210,12 +197,10 @@ public class TXCommitMessage extends PooledDistributionMessage
// make sure we have some changes and someone to send them to
if (!this.currentRegion.isEmpty() && s != null && !s.isEmpty()) {
// Get the persistent ids for the current region and save them
- Map<InternalDistributedMember, PersistentMemberID> persistentIds =
- getPersistentIds(this.currentRegion.r);
- this.currentRegion.persistentIds = persistentIds;
+ this.currentRegion.persistentIds = getPersistentIds(this.currentRegion.r);
if (this.msgMap == null) {
- this.msgMap = new HashMap<InternalDistributedMember, RegionCommitList>();
+ this.msgMap = new HashMap<>();
}
{
RegionCommitList newRCL = null;
@@ -245,18 +230,18 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
}
- { // Now deal with each existing recipient that does not care
- // about this region
- Iterator<Map.Entry<InternalDistributedMember, RegionCommitList>> it =
- this.msgMap.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry<InternalDistributedMember, RegionCommitList> me = it.next();
- if (!s.contains(me.getKey())) {
- RegionCommitList rcl = me.getValue();
- RegionCommitList trimmedRcl = rcl.trim(this.currentRegion);
- if (trimmedRcl != rcl) {
- me.setValue(trimmedRcl);
- }
+
+ // Now deal with each existing recipient that does not care
+ // about this region
+ Iterator<Map.Entry<InternalDistributedMember, RegionCommitList>> it =
+ this.msgMap.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<InternalDistributedMember, RegionCommitList> me = it.next();
+ if (!s.contains(me.getKey())) {
+ RegionCommitList rcl = me.getValue();
+ RegionCommitList trimmedRcl = rcl.trim(this.currentRegion);
+ if (trimmedRcl != rcl) {
+ me.setValue(trimmedRcl);
}
}
}
@@ -264,13 +249,11 @@ public class TXCommitMessage extends PooledDistributionMessage
this.currentRegion = null;
}
-
-
private Map<InternalDistributedMember, PersistentMemberID> getPersistentIds(LocalRegion r) {
if (r instanceof DistributedRegion) {
- return ((DistributedRegion) r).getCacheDistributionAdvisor().advisePersistentMembers();
+ return ((CacheDistributionAdvisee) r).getCacheDistributionAdvisor().advisePersistentMembers();
} else {
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -287,17 +270,15 @@ public class TXCommitMessage extends PooledDistributionMessage
this.currentRegion = null;
}
-
Map viewVersions = new HashMap();
private Boolean needsLargeModCount;
private transient boolean disableListeners = false;
-
/** record CacheDistributionAdvisor.startOperation versions for later cleanup */
protected void addViewVersion(DistributedRegion dr, long version) {
- viewVersions.put(dr, Long.valueOf(version));
+ viewVersions.put(dr, version);
}
protected void releaseViewVersions() {
@@ -309,7 +290,7 @@ public class TXCommitMessage extends PooledDistributionMessage
// need to continue the iteration if one of the regions is destroyed
// since others may still be okay
try {
- long newv = dr.getDistributionAdvisor().endOperation(viewVersion.longValue());
+ long newv = dr.getDistributionAdvisor().endOperation(viewVersion);
} catch (RuntimeException ex) {
rte = ex;
}
@@ -504,13 +485,13 @@ public class TXCommitMessage extends PooledDistributionMessage
}
Set cacheClosedMembers =
- (processor == null) ? Collections.EMPTY_SET : processor.getCacheClosedMembers();
+ (processor == null) ? Collections.emptySet() : processor.getCacheClosedMembers();
Set departedMembers =
- (processor == null) ? Collections.EMPTY_SET : processor.getDepartedMembers();
+ (processor == null) ? Collections.emptySet() : processor.getDepartedMembers();
// check reliability on each region
- Set regionDistributionExceptions = Collections.EMPTY_SET;
- Set failedRegionNames = Collections.EMPTY_SET;
+ Set regionDistributionExceptions = Collections.emptySet();
+ Set failedRegionNames = Collections.emptySet();
for (Iterator iter = regionToRecipients.entrySet().iterator(); iter.hasNext();) {
Map.Entry me = (Map.Entry) iter.next();
final RegionCommit rc = (RegionCommit) me.getKey();
@@ -519,7 +500,7 @@ public class TXCommitMessage extends PooledDistributionMessage
successfulRecipients.removeAll(departedMembers);
// remove members who destroyed that region or closed their cache
- Set regionDestroyedMembers = (processor == null) ? Collections.EMPTY_SET
+ Set regionDestroyedMembers = (processor == null) ? Collections.emptySet()
: processor.getRegionDestroyedMembers(rc.r.getFullPath());
successfulRecipients.removeAll(cacheClosedMembers);
@@ -528,7 +509,7 @@ public class TXCommitMessage extends PooledDistributionMessage
try {
rc.r.handleReliableDistribution(successfulRecipients);
} catch (RegionDistributionException e) {
- if (regionDistributionExceptions == Collections.EMPTY_SET) {
+ if (regionDistributionExceptions == Collections.emptySet()) {
regionDistributionExceptions = new HashSet();
failedRegionNames = new HashSet();
}
@@ -545,11 +526,10 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
-
/**
* Helper method for send
*/
- private final void setRecipientsSendData(Set recipients, ReplyProcessor21 processor,
+ private void setRecipientsSendData(Set recipients, ReplyProcessor21 processor,
RegionCommitList rcl) {
setRecipients(recipients);
this.regions = rcl;
@@ -601,22 +581,21 @@ public class TXCommitMessage extends PooledDistributionMessage
this.farSideEntryOps.add(entryOp);
}
- protected final void addProcessingException(Exception e) {
+ protected void addProcessingException(Exception e) {
// clear all previous exceptions if e is a CacheClosedException
- if (this.processingExceptions == Collections.EMPTY_SET || e instanceof CancelException) {
+ if (this.processingExceptions == Collections.emptySet() || e instanceof CancelException) {
this.processingExceptions = new HashSet();
}
this.processingExceptions.add(e);
}
-
public void setDM(DM dm) {
this.dm = dm;
}
public DM getDM() {
if (this.dm == null) {
- GemFireCacheImpl cache = GemFireCacheImpl.getExisting("Applying TXCommit");
+ InternalCache cache = GemFireCacheImpl.getExisting("Applying TXCommit");
this.dm = cache.getDistributionManager();
}
return this.dm;
@@ -639,12 +618,9 @@ public class TXCommitMessage extends PooledDistributionMessage
if (logger.isDebugEnabled()) {
logger.debug("begin processing TXCommitMessage for {}", this.txIdent);
}
+ // do this before CacheFactory.getInstance for bug 33471
final int oldLevel =
- LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE); // do this
- // before
- // CacheFactory.getInstance
- // for bug
- // 33471
+ LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
boolean forceListener = false; // this gets flipped if we need to fire tx listener
// it needs to default to false because we don't want to fire listeners on pr replicates
try {
@@ -662,20 +638,18 @@ public class TXCommitMessage extends PooledDistributionMessage
try {
// Pre-process each Region in the tx
try {
- {
- Iterator it = this.regions.iterator();
- while (it.hasNext()) {
- boolean failedBeginProcess = true;
- RegionCommit rc = (RegionCommit) it.next();
- try {
- failedBeginProcess = !rc.beginProcess(dm, this.txIdent, txEvent);
- } catch (CacheRuntimeException problem) {
- processCacheRuntimeException(problem);
- } finally {
- if (failedBeginProcess) {
- rc.r = null; // Cause related FarSideEntryOps to skip processing
- it.remove(); // Skip endProcessing as well
- }
+ Iterator it = this.regions.iterator();
+ while (it.hasNext()) {
+ boolean failedBeginProcess = true;
+ RegionCommit rc = (RegionCommit) it.next();
+ try {
+ failedBeginProcess = !rc.beginProcess(dm, this.txIdent, txEvent);
+ } catch (CacheRuntimeException problem) {
+ processCacheRuntimeException(problem);
+ } finally {
+ if (failedBeginProcess) {
+ rc.r = null; // Cause related FarSideEntryOps to skip processing
+ it.remove(); // Skip endProcessing as well
}
}
}
@@ -746,22 +720,20 @@ public class TXCommitMessage extends PooledDistributionMessage
}
public void basicProcessOps() {
- {
- List<EntryEventImpl> pendingCallbacks = new ArrayList<>(this.farSideEntryOps.size());
- Collections.sort(this.farSideEntryOps);
- Iterator it = this.farSideEntryOps.iterator();
- while (it.hasNext()) {
- try {
- RegionCommit.FarSideEntryOp entryOp = (RegionCommit.FarSideEntryOp) it.next();
- entryOp.process(pendingCallbacks);
- } catch (CacheRuntimeException problem) {
- processCacheRuntimeException(problem);
- } catch (Exception e) {
- addProcessingException(e);
- }
+ List<EntryEventImpl> pendingCallbacks = new ArrayList<>(this.farSideEntryOps.size());
+ Collections.sort(this.farSideEntryOps);
+ Iterator it = this.farSideEntryOps.iterator();
+ while (it.hasNext()) {
+ try {
+ RegionCommit.FarSideEntryOp entryOp = (RegionCommit.FarSideEntryOp) it.next();
+ entryOp.process(pendingCallbacks);
+ } catch (CacheRuntimeException problem) {
+ processCacheRuntimeException(problem);
+ } catch (Exception e) {
+ addProcessingException(e);
}
- firePendingCallbacks(pendingCallbacks);
}
+ firePendingCallbacks(pendingCallbacks);
}
private void firePendingCallbacks(List<EntryEventImpl> callbacks) {
@@ -963,7 +935,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(256);
+ StringBuilder result = new StringBuilder(256);
result.append("TXCommitMessage@").append(System.identityHashCode(this)).append("#")
.append(this.sequenceNum).append(" processorId=").append(this.processorId).append(" txId=")
.append(this.txIdent);
@@ -994,7 +966,6 @@ public class TXCommitMessage extends PooledDistributionMessage
* that represents an entire transaction. At commit time the txCommitMessage sent to each node can
* be a subset of the transaction, this method will combine those subsets into a complete message.
*
- * @param msgSet
* @return the complete txCommitMessage
*/
public static TXCommitMessage combine(Set<TXCommitMessage> msgSet) {
@@ -1014,8 +985,6 @@ public class TXCommitMessage extends PooledDistributionMessage
/**
* Combines the other TXCommitMessage into this message. Used to compute complete TXCommitMessage
* from parts.
- *
- * @param other
*/
public void combine(TXCommitMessage other) {
assert other != null;
@@ -1032,7 +1001,7 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
- public final static class RegionCommitList extends ArrayList<RegionCommit> {
+ public static class RegionCommitList extends ArrayList<RegionCommit> {
private static final long serialVersionUID = -8910813949027683641L;
private transient boolean needsAck = false;
private transient RegionCommit trimRC = null;
@@ -1091,7 +1060,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(256);
+ StringBuilder result = new StringBuilder(256);
result.append('@').append(System.identityHashCode(this)).append(' ').append(super.toString());
return result.toString();
}
@@ -1390,8 +1359,6 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
-
-
boolean isEmpty() {
return this.opKeys == null;
}
@@ -1444,7 +1411,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(64);
+ StringBuilder result = new StringBuilder(64);
if (this.regionPath != null) {
result.append(this.regionPath);
} else {
@@ -1460,8 +1427,7 @@ public class TXCommitMessage extends PooledDistributionMessage
if (this.r != null) {
DataSerializer.writeString(this.r.getFullPath(), out);
if (this.r instanceof BucketRegion) {
- DataSerializer.writeString(((BucketRegion) this.r).getPartitionedRegion().getFullPath(),
- out);
+ DataSerializer.writeString(((Bucket) this.r).getPartitionedRegion().getFullPath(), out);
} else {
DataSerializer.writeString(null, out);
}
@@ -1557,7 +1523,6 @@ public class TXCommitMessage extends PooledDistributionMessage
* @param in the data input that is used to read the data for this entry op
* @param largeModCount true if the mod count is a int instead of a byte.
* @param readShadowKey true if a long shadowKey should be read
- * @throws ClassNotFoundException
*/
public void fromData(DataInput in, boolean largeModCount, boolean readShadowKey)
throws IOException, ClassNotFoundException {
@@ -1665,7 +1630,7 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
- final Object getTrackerKey() {
+ Object getTrackerKey() {
if (this.lockId != null) {
return this.lockId;
} else {
@@ -1677,41 +1642,39 @@ public class TXCommitMessage extends PooledDistributionMessage
* Used to prevent processing of the message if we have reported to other FarSiders that we did
* not received the CommitProcessMessage
*/
- final boolean dontProcess() {
+ boolean dontProcess() {
return this.dontProcess;
}
/**
* Indicate that this message should not be processed if we receive CommitProcessMessage (late)
*/
- final void setDontProcess() {
+ void setDontProcess() {
this.dontProcess = true;
}
- final boolean isProcessing() {
+ boolean isProcessing() {
return this.isProcessing;
}
- private final void setIsProcessing(boolean isProcessing) {
+ private void setIsProcessing(boolean isProcessing) {
this.isProcessing = isProcessing;
}
- final boolean wasProcessed() {
+ boolean wasProcessed() {
return this.wasProcessed;
}
- final void setProcessed(boolean wasProcessed) {
+ void setProcessed(boolean wasProcessed) {
this.wasProcessed = wasProcessed;
}
- /********************* Region Commit Process Messages ***************************************/
-
/**
* The CommitProcessForLockIDMessaage is sent by the Distributed ACK TX origin to the recipients
* (aka FarSiders) to indicate that a previously received RegionCommit that contained a lockId
* should commence processing.
*/
- static final public class CommitProcessForLockIdMessage extends CommitProcessMessage {
+ public static class CommitProcessForLockIdMessage extends CommitProcessMessage {
private TXLockId lockId;
public CommitProcessForLockIdMessage() {
@@ -1749,7 +1712,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
result.append("CommitProcessForLockIdMessage@").append(System.identityHashCode(this))
.append(" lockId=").append(this.lockId);
return result.toString();
@@ -1763,7 +1726,7 @@ public class TXCommitMessage extends PooledDistributionMessage
* typically sent if all the TX changes are a result of load/netsearch/netload values (thus no
* lockid)
*/
- static final public class CommitProcessForTXIdMessage extends CommitProcessMessage {
+ public static class CommitProcessForTXIdMessage extends CommitProcessMessage {
private TXId txId;
public CommitProcessForTXIdMessage() {
@@ -1801,14 +1764,15 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
result.append("CommitProcessForTXIdMessage@").append(System.identityHashCode(this))
.append(" txId=").append(this.txId);
return result.toString();
}
}
- static abstract public class CommitProcessMessage extends PooledDistributionMessage {
- protected final void basicProcess(final TXCommitMessage mess, final DistributionManager dm) {
+
+ public abstract static class CommitProcessMessage extends PooledDistributionMessage {
+ protected void basicProcess(final TXCommitMessage mess, final DistributionManager dm) {
dm.removeMembershipListener(mess);
synchronized (mess) {
if (mess.dontProcess()) {
@@ -1823,8 +1787,6 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
- /********************* Commit Process Query Message ***************************************/
-
/**
* The CommitProcessQueryMessage is used to attempt to recover - in the Distributed ACK TXs - when
* the origin of the CommitProcess messages departed from the distributed system. The sender of
@@ -1835,9 +1797,8 @@ public class TXCommitMessage extends PooledDistributionMessage
* about the the tracker key - opting not to have specific messages for each type like
* CommitProcessFor<Lock/TX>Id - and take the performance penalty of an extra call to
* DataSerializer
- *
*/
- static final public class CommitProcessQueryMessage extends PooledDistributionMessage {
+ public static class CommitProcessQueryMessage extends PooledDistributionMessage {
private Object trackerKey; // Either a TXLockId or a TXId
private int processorId;
@@ -1885,7 +1846,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
result.append("CommitProcessQueryMessage@").append(System.identityHashCode(this))
.append(" trackerKeyClass=").append(this.trackerKey.getClass().getName())
.append(" trackerKey=").append(this.trackerKey).append(" processorId=")
@@ -1895,7 +1856,7 @@ public class TXCommitMessage extends PooledDistributionMessage
}
/********************* Commit Process Query Response Message **********************************/
- static final public class CommitProcessQueryReplyMessage extends ReplyMessage {
+ public static class CommitProcessQueryReplyMessage extends ReplyMessage {
private boolean wasReceived;
public CommitProcessQueryReplyMessage(boolean wasReceived) {
@@ -1929,7 +1890,7 @@ public class TXCommitMessage extends PooledDistributionMessage
@Override
public String toString() {
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
result.append("CommitProcessQueryReplyMessage@").append(System.identityHashCode(this))
.append(" wasReceived=").append(this.wasReceived).append(" processorId=")
.append(this.processorId).append(" from ").append(this.getSender());
@@ -1938,7 +1899,7 @@ public class TXCommitMessage extends PooledDistributionMessage
}
/********************* Commit Process Query Response Processor *********************************/
- static final public class CommitProcessQueryReplyProcessor extends ReplyProcessor21 {
+ public static class CommitProcessQueryReplyProcessor extends ReplyProcessor21 {
public boolean receivedOnePositive;
CommitProcessQueryReplyProcessor(DM dm, Set members) {
@@ -1956,17 +1917,19 @@ public class TXCommitMessage extends PooledDistributionMessage
}
@Override
- final protected boolean canStopWaiting() {
+ protected boolean canStopWaiting() {
return this.receivedOnePositive;
}
- final public boolean receivedACommitProcessMessage() {
+ public boolean receivedACommitProcessMessage() {
return this.receivedOnePositive;
}
}
/********************* MembershipListener Implementation ***************************************/
- public void memberJoined(InternalDistributedMember id) {}
+ public void memberJoined(InternalDistributedMember id) {
+ // do nothing
+ }
public void memberSuspect(InternalDistributedMember id, InternalDistributedMember whoSuspected,
String reason) {}
@@ -2118,58 +2081,6 @@ public class TXCommitMessage extends PooledDistributionMessage
}
}
- // /** Custom subclass that keeps all ReplyExceptions */
- // private class ReliableCommitReplyProcessor extends ReliableReplyProcessor21 {
- //
- // /** Set of members that threw CacheClosedExceptions */
- // private Set cacheExceptions = new HashSet();
- // /** key=region path, value=Set of members */
- // private Map regionExceptions = new HashMap();
- //
- // public ReliableCommitReplyProcessor(DM dm,
- // Set initMembers) {
- // super(dm, initMembers);
- // }
- // protected synchronized void processException(DistributionMessage msg,
- // ReplyException re) {
- // // only interested in CommitReplyException
- // if (re instanceof CommitReplyException) {
- // CommitReplyException cre = (CommitReplyException) re;
- // Set exceptions = cre.getExceptions();
- // for (Iterator iter = exceptions.iterator(); iter.hasNext();) {
- // Exception ex = (Exception) iter.next();
- // if (ex instanceof CacheClosedException) {
- // cacheExceptions.add(msg.getSender());
- // }
- // else if (ex instanceof RegionDestroyedException) {
- // String r = ((RegionDestroyedException)ex).getRegionFullPath();
- // Set members = (Set) regionExceptions.get(r);
- // if (members == null) {
- // members = new HashSet();
- // regionExceptions.put(r, members);
- // }
- // members.add(msg.getSender());
- // }
- // }
- // }
- // else {
- // // allow superclass to handle all other exceptions
- // super.processException(msg, re);
- // }
- // }
- // // these two accessors should be called after wait for replies completes
- // protected Set getCacheClosedMembers() {
- // return this.cacheExceptions;
- // }
- // protected Set getRegionDestroyedMembers(String regionFullPath) {
- // Set members = (Set) this.regionExceptions.get(regionFullPath);
- // if (members == null) {
- // members = Collections.EMPTY_SET;
- // }
- // return members;
- // }
- // }
-
/**
* Reply processor which collects all CommitReplyExceptions and emits a detailed failure exception
* if problems occur
@@ -2223,7 +2134,7 @@ public class TXCommitMessage extends PooledDistributionMessage
(CommitExceptionCollectingException) this.exception;
return cce.getCacheClosedMembers();
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -2233,7 +2144,7 @@ public class TXCommitMessage extends PooledDistributionMessage
(CommitExceptionCollectingException) this.exception;
return cce.getRegionDestroyedMembers(regionFullPath);
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
}
@@ -2264,14 +2175,12 @@ public class TXCommitMessage extends PooledDistributionMessage
/**
* Determine if the commit processing was incomplete, if so throw a detailed exception
* indicating the source of the problem
- *
- * @param msgMap
*/
public void handlePotentialCommitFailure(
HashMap<InternalDistributedMember, RegionCommitList> msgMap) {
if (fatalExceptions.size() > 0) {
- StringBuffer errorMessage = new StringBuffer("Incomplete commit of transaction ").append(id)
- .append(". Caused by the following exceptions: ");
+ StringBuilder errorMessage = new StringBuilder("Incomplete commit of transaction ")
+ .append(id).append(". Caused by the following exceptions: ");
for (Iterator i = fatalExceptions.entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry) i.next();
DistributedMember mem = (DistributedMember) me.getKey();
@@ -2366,16 +2275,13 @@ public class TXCommitMessage extends PooledDistributionMessage
public Set getRegionDestroyedMembers(String regionFullPath) {
Set members = (Set) this.regionExceptions.get(regionFullPath);
if (members == null) {
- members = Collections.EMPTY_SET;
+ members = Collections.emptySet();
}
return members;
}
/**
* Protected by (this)
- *
- * @param member
- * @param exceptions
*/
public void addExceptionsFromMember(InternalDistributedMember member, Set exceptions) {
for (Iterator iter = exceptions.iterator(); iter.hasNext();) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java
index 2948a48..a0a4d7c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXManagerImpl.java
@@ -12,16 +12,52 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import java.util.concurrent.locks.LockSupport;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.DataSerializer;
import org.apache.geode.GemFireException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.CommitConflictException;
+import org.apache.geode.cache.TransactionDataRebalancedException;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.cache.TransactionInDoubtException;
+import org.apache.geode.cache.TransactionListener;
+import org.apache.geode.cache.TransactionWriter;
+import org.apache.geode.cache.UnsupportedOperationInTransactionException;
import org.apache.geode.distributed.TXManagerCancelledException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.MembershipListener;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.SystemTimer.SystemTimerTask;
import org.apache.geode.internal.cache.tier.sockets.Message;
@@ -32,30 +68,14 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.MapCallback;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import java.util.concurrent.locks.LockSupport;
/**
- * <p>
* The internal implementation of the {@link CacheTransactionManager} interface returned by
- * {@link GemFireCacheImpl#getCacheTransactionManager}. Internal operations
+ * {@link InternalCache#getCacheTransactionManager}. Internal operations
*
- * </code>TransactionListener</code> invocation, Region synchronization, transaction statistics and
+ * {@code TransactionListener} invocation, Region synchronization, transaction statistics and
*
* transaction logging are handled here
- *
*
* @since GemFire 4.0
*
@@ -67,12 +87,14 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
// Thread specific context container
private final ThreadLocal<TXStateProxy> txContext;
+
private static TXManagerImpl currentInstance = null;
+
// The unique transaction ID for this Manager
private final AtomicInteger uniqId;
private final DM dm;
- private final Cache cache;
+ private final InternalCache cache;
// The DistributionMemberID used to construct TXId's
private final InternalDistributedMember distributionMgrId;
@@ -86,8 +108,10 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
*/
public static final int NOTX = -1;
- private final ArrayList<TransactionListener> txListeners = new ArrayList<TransactionListener>(8);
+ private final List<TransactionListener> txListeners = new ArrayList<>(8);
+
public TransactionWriter writer = null;
+
private volatile boolean closed = false;
private final Map<TXId, TXStateProxy> hostedTXStates;
@@ -95,7 +119,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* the number of client initiated transactions to store for client failover
*/
- public final static int FAILOVER_TX_MAP_SIZE =
+ public static final int FAILOVER_TX_MAP_SIZE =
Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "transactionFailoverMapSize", 1000);
/**
@@ -106,6 +130,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
@SuppressWarnings("unchecked")
private Map<TXId, TXCommitMessage> failoverMap =
Collections.synchronizedMap(new LinkedHashMap<TXId, TXCommitMessage>() {
+ // TODO: inner class is serializable but outer class is not
private static final long serialVersionUID = -4156018226167594134L;
protected boolean removeEldestEntry(Entry eldest) {
@@ -114,7 +139,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
eldest.getKey(), (size() > FAILOVER_TX_MAP_SIZE));
}
return size() > FAILOVER_TX_MAP_SIZE;
- };
+ }
});
/**
@@ -126,8 +151,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* this keeps track of all the transactions that were initiated locally.
*/
- private ConcurrentMap<TXId, TXStateProxy> localTxMap =
- new ConcurrentHashMap<TXId, TXStateProxy>();
+ private ConcurrentMap<TXId, TXStateProxy> localTxMap = new ConcurrentHashMap<>();
/**
* the time in minutes after which any suspended transaction are rolled back. default is 30
@@ -152,49 +176,44 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Constructor that implements the {@link CacheTransactionManager} interface. Only only one
* instance per {@link org.apache.geode.cache.Cache}
- *
- * @param cachePerfStats
*/
- public TXManagerImpl(CachePerfStats cachePerfStats, Cache cache) {
+ public TXManagerImpl(CachePerfStats cachePerfStats, InternalCache cache) {
this.cache = cache;
this.dm = ((InternalDistributedSystem) cache.getDistributedSystem()).getDistributionManager();
this.distributionMgrId = this.dm.getDistributionManagerId();
this.uniqId = new AtomicInteger(0);
this.cachePerfStats = cachePerfStats;
- this.hostedTXStates = new HashMap<TXId, TXStateProxy>();
- this.txContext = new ThreadLocal<TXStateProxy>();
- this.isTXDistributed = new ThreadLocal<Boolean>();
+ this.hostedTXStates = new HashMap<>();
+ this.txContext = new ThreadLocal<>();
+ this.isTXDistributed = new ThreadLocal<>();
this.transactionTimeToLive = Integer
.getInteger(DistributionConfig.GEMFIRE_PREFIX + "cacheServer.transactionTimeToLive", 180);
currentInstance = this;
}
- final Cache getCache() {
+ InternalCache getCache() {
return this.cache;
}
-
/**
* Get the TransactionWriter for the cache
*
* @return the current TransactionWriter
* @see TransactionWriter
*/
- public final TransactionWriter getWriter() {
+ public TransactionWriter getWriter() {
return writer;
}
-
- public final void setWriter(TransactionWriter writer) {
- if (((GemFireCacheImpl) this.cache).isClient()) {
+ public void setWriter(TransactionWriter writer) {
+ if (this.cache.isClient()) {
throw new IllegalStateException(
LocalizedStrings.TXManager_NO_WRITER_ON_CLIENT.toLocalizedString());
}
this.writer = writer;
}
-
- public final TransactionListener getListener() {
+ public TransactionListener getListener() {
synchronized (this.txListeners) {
if (this.txListeners.isEmpty()) {
return null;
@@ -280,7 +299,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
}
- final CachePerfStats getCachePerfStats() {
+ CachePerfStats getCachePerfStats() {
return this.cachePerfStats;
}
@@ -396,7 +415,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
noteCommitSuccess(opStart, lifeTime, tx);
}
- final void noteCommitFailure(long opStart, long lifeTime, TXStateInterface tx) {
+ void noteCommitFailure(long opStart, long lifeTime, TXStateInterface tx) {
long opEnd = CachePerfStats.getStatTime();
this.cachePerfStats.txFailure(opEnd - opStart, lifeTime, tx.getChanges());
TransactionListener[] listeners = getListeners();
@@ -428,7 +447,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
}
- final void noteCommitSuccess(long opStart, long lifeTime, TXStateInterface tx) {
+ void noteCommitSuccess(long opStart, long lifeTime, TXStateInterface tx) {
long opEnd = CachePerfStats.getStatTime();
this.cachePerfStats.txSuccess(opEnd - opStart, lifeTime, tx.getChanges());
TransactionListener[] listeners = getListeners();
@@ -497,7 +516,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
noteRollbackSuccess(opStart, lifeTime, tx);
}
- final void noteRollbackSuccess(long opStart, long lifeTime, TXStateInterface tx) {
+ void noteRollbackSuccess(long opStart, long lifeTime, TXStateInterface tx) {
long opEnd = CachePerfStats.getStatTime();
this.cachePerfStats.txRollback(opEnd - opStart, lifeTime, tx.getChanges());
TransactionListener[] listeners = getListeners();
@@ -597,7 +616,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
return retVal;
}
- public final void setTXState(TXStateProxy val) {
+ public void setTXState(TXStateProxy val) {
txContext.set(val);
}
@@ -625,11 +644,9 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
for (TXStateProxy proxy : this.localTxMap.values()) {
proxy.close();
}
- {
- TransactionListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- closeListener(listeners[i]);
- }
+ TransactionListener[] listeners = getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ closeListener(listeners[i]);
}
}
@@ -660,7 +677,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* @return the state of the transaction or null. Pass this value to {@link TXManagerImpl#resume}
* to reactivate the suspended transaction.
*/
- public final TXStateProxy internalSuspend() {
+ public TXStateProxy internalSuspend() {
TXStateProxy result = getTXState();
if (result != null) {
result.suspend();
@@ -691,26 +708,26 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* @deprecated use internalResume instead
*/
- public final void resume(TXStateProxy tx) {
+ @Deprecated
+ public void resume(TXStateProxy tx) {
internalResume(tx);
}
- public final boolean isClosed() {
+ public boolean isClosed() {
return this.closed;
}
- private final void checkClosed() {
+ private void checkClosed() {
cache.getCancelCriterion().checkCancelInProgress(null);
if (this.closed) {
throw new TXManagerCancelledException("This transaction manager is closed.");
}
}
- final DM getDM() {
+ DM getDM() {
return this.dm;
}
-
public static int getCurrentTXUniqueId() {
if (currentInstance == null) {
return NOTX;
@@ -718,9 +735,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
return currentInstance.getMyTXUniqueId();
}
-
-
- public final static TXStateProxy getCurrentTXState() {
+ public static TXStateProxy getCurrentTXState() {
if (currentInstance == null) {
return null;
}
@@ -747,9 +762,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* on the txState, on which this thread operates. Some messages like SizeMessage should not create
* a new txState.
*
- * @param msg
* @return {@link TXStateProxy} the txProxy for the transactional message
- * @throws InterruptedException
*/
public TXStateProxy masqueradeAs(TransactionMessage msg) throws InterruptedException {
if (msg.getTXUniqId() == NOTX || !msg.canParticipateInTransaction()) {
@@ -828,11 +841,8 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* on the txState, on which this thread operates. Some messages like SizeMessage should not create
* a new txState.
*
- * @param msg
- * @param memberId
* @param probeOnly - do not masquerade; just look up the TX state
* @return {@link TXStateProxy} the txProxy for the transactional message
- * @throws InterruptedException
*/
public TXStateProxy masqueradeAs(Message msg, InternalDistributedMember memberId,
boolean probeOnly) throws InterruptedException {
@@ -846,8 +856,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
synchronized (this.hostedTXStates) {
val = this.hostedTXStates.get(key);
if (val == null) {
- // [sjigyasu] TODO: Conditionally create object based on distributed or non-distributed tx
- // mode
+ // TODO: Conditionally create object based on distributed or non-distributed tx mode
if (msg instanceof TransactionMessage
&& ((TransactionMessage) msg).isTransactionDistributed()) {
val = new DistTXStateProxyImplOnDatanode(this, key, memberId);
@@ -894,8 +903,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Remove the association created by {@link #masqueradeAs(TransactionMessage)}
- *
- * @param tx
*/
public void unmasquerade(TXStateProxy tx) {
if (tx != null) {
@@ -907,7 +914,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Cleanup the remote txState after commit and rollback
*
- * @param txId
* @return the TXStateProxy
*/
public TXStateProxy removeHostedTXState(TXId txId) {
@@ -942,7 +948,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Used to verify if a transaction with a given id is hosted by this txManager.
*
- * @param txId
* @return true if the transaction is in progress, false otherwise
*/
public boolean isHostedTxInProgress(TXId txId) {
@@ -1104,7 +1109,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* If the given transaction is already being completed by another thread this will wait for that
* completion to finish and will ensure that the result is saved in the client failover map.
*
- * @param txId
* @return true if a wait was performed
*/
public boolean waitForCompletingTransaction(TXId txId) {
@@ -1132,7 +1136,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Returns the TXCommitMessage for a transaction that has been successfully completed.
*
- * @param txId
* @return the commit message or an exception token e.g {@link TXCommitMessage#CMT_CONFLICT_MSG}
* if the transaction threw an exception
* @see #isExceptionToken(TXCommitMessage)
@@ -1142,7 +1145,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
/**
- * @param msg
* @return true if msg is an exception token, false otherwise
*/
public boolean isExceptionToken(TXCommitMessage msg) {
@@ -1158,7 +1160,6 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* during transaction execution.
*
* @param msg the token that represents the exception
- * @param txId
* @return the exception
*/
public RuntimeException getExceptionForToken(TXCommitMessage msg, TXId txId) {
@@ -1209,13 +1210,12 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
@Override
protected void process(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
TXManagerImpl mgr = cache.getTXMgr();
mgr.removeTransactions(this.txIds, false);
}
}
-
}
private ConcurrentMap<TransactionId, TXStateProxy> suspendedTXs =
@@ -1290,8 +1290,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
SystemTimerTask task = this.expiryTasks.remove(txProxy.getTransactionId());
if (task != null) {
if (task.cancel()) {
- GemFireCacheImpl cache = (GemFireCacheImpl) this.cache;
- cache.purgeCCPTimer();
+ this.cache.purgeCCPTimer();
}
}
}
@@ -1300,8 +1299,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* this map keeps track of all the threads that are waiting in
* {@link #tryResume(TransactionId, long, TimeUnit)} for a particular transactionId
*/
- private ConcurrentMap<TransactionId, Queue<Thread>> waitMap =
- new ConcurrentHashMap<TransactionId, Queue<Thread>>();
+ private ConcurrentMap<TransactionId, Queue<Thread>> waitMap = new ConcurrentHashMap<>();
public boolean tryResume(TransactionId transactionId, long time, TimeUnit unit) {
if (transactionId == null || getTXState() != null || !exists(transactionId)) {
@@ -1383,11 +1381,9 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* schedules the transaction to expire after {@link #suspendedTXTimeout}
*
- * @param txId
* @param expiryTimeUnit the time unit to use when scheduling the expiration
*/
private void scheduleExpiry(TransactionId txId, TimeUnit expiryTimeUnit) {
- final GemFireCacheImpl cache = (GemFireCacheImpl) this.cache;
if (suspendedTXTimeout < 0) {
if (logger.isDebugEnabled()) {
logger.debug("TX: transaction: {} not scheduled to expire", txId);
@@ -1452,9 +1448,13 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
private static class RefCountMapEntry
implements HashEntry<AbstractRegionEntry, RefCountMapEntry> {
+
private final AbstractRegionEntry key;
+
private HashEntry<AbstractRegionEntry, RefCountMapEntry> next;
+
private volatile int refCount;
+
private static final AtomicIntegerFieldUpdater<RefCountMapEntry> refCountUpdater =
AtomicIntegerFieldUpdater.newUpdater(RefCountMapEntry.class, "refCount");
@@ -1561,7 +1561,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
};
- public static final void incRefCount(AbstractRegionEntry re) {
+ public static void incRefCount(AbstractRegionEntry re) {
TXManagerImpl mgr = currentInstance;
if (mgr != null) {
mgr.refCountMap.create(re, incCallback, null, null, true);
@@ -1571,7 +1571,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
/**
* Return true if refCount went to zero.
*/
- public static final boolean decRefCount(AbstractRegionEntry re) {
+ public static boolean decRefCount(AbstractRegionEntry re) {
TXManagerImpl mgr = currentInstance;
if (mgr != null) {
return mgr.refCountMap.removeConditionally(re, decCallback, null, null) != null;
@@ -1628,9 +1628,9 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
}
};
try {
- ((GemFireCacheImpl) this.cache).getCCPTimer().schedule(task, timeout);
+ this.cache.getCCPTimer().schedule(task, timeout);
} catch (IllegalStateException ise) {
- if (!((GemFireCacheImpl) this.cache).isClosed()) {
+ if (!this.cache.isClosed()) {
throw ise;
}
// task not able to be scheduled due to cache is closing,
@@ -1716,7 +1716,7 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
LocalizedStrings.TXManagerImpl_CANNOT_CHANGE_TRANSACTION_MODE_WHILE_TRANSACTIONS_ARE_IN_PROGRESS
.toLocalizedString());
} else {
- isTXDistributed.set(new Boolean(flag));
+ isTXDistributed.set(flag);
}
}
@@ -1726,14 +1726,13 @@ public class TXManagerImpl implements CacheTransactionManager, MembershipListene
* default value of this property.
*/
public boolean isDistributed() {
-
Boolean value = isTXDistributed.get();
// This can be null if not set in setDistributed().
if (value == null) {
InternalDistributedSystem ids = (InternalDistributedSystem) cache.getDistributedSystem();
return ids.getOriginalConfig().getDistributedTransactions();
} else {
- return value.booleanValue();
+ return value;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
index fd53fb1..24cbaa2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
@@ -39,20 +39,20 @@ import org.apache.geode.internal.cache.partitioned.PartitionMessage;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- *
- */
public abstract class TXMessage extends SerialDistributionMessage
implements MessageWithReply, TransactionMessage {
private static final Logger logger = LogService.getLogger();
private int processorId;
+
private int txUniqId;
+
private InternalDistributedMember txMemberId = null;
- public TXMessage() {}
+ public TXMessage() {
+ // nothing
+ }
public TXMessage(int txUniqueId, InternalDistributedMember onBehalfOfMember,
ReplyProcessor21 processor) {
@@ -73,7 +73,7 @@ public abstract class TXMessage extends SerialDistributionMessage
if (logger.isDebugEnabled()) {
logger.debug("processing {}", this);
}
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (checkCacheClosing(cache) || checkDSClosing(cache.getInternalDistributedSystem())) {
thr = new CacheClosedException(LocalizedStrings.PartitionMessage_REMOTE_CACHE_IS_CLOSED_0
.toLocalizedString(dm.getId()));
@@ -130,7 +130,7 @@ public abstract class TXMessage extends SerialDistributionMessage
return distributedSystem == null || distributedSystem.isDisconnecting();
}
- private boolean checkCacheClosing(GemFireCacheImpl cache) {
+ private boolean checkCacheClosing(InternalCache cache) {
return cache == null || cache.isClosed();
}
@@ -160,7 +160,7 @@ public abstract class TXMessage extends SerialDistributionMessage
* Transaction operations override this method to do actual work
*
* @param txId The transaction Id to operate on
- * @return true if {@link TXMessage} should send a reply false otherwise
+ * @return true if TXMessage should send a reply false otherwise
*/
protected abstract boolean operateOnTx(TXId txId, DistributionManager dm)
throws RemoteOperationException;
@@ -192,7 +192,6 @@ public abstract class TXMessage extends SerialDistributionMessage
return txMemberId;
}
-
@Override
public int getProcessorId() {
return this.processorId;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionLockRequestImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionLockRequestImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionLockRequestImpl.java
index eefa27c..1e586aa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionLockRequestImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionLockRequestImpl.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.internal.cache;
import java.io.DataInput;
@@ -26,23 +25,23 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.cache.locks.TXRegionLockRequest;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
/**
* TXRegionLockRequest represents all the locks that need to be made for a single region.
*
- *
* @since GemFire 4.0
- *
*/
-public class TXRegionLockRequestImpl
- implements org.apache.geode.internal.cache.locks.TXRegionLockRequest {
+public class TXRegionLockRequestImpl implements TXRegionLockRequest {
private static final long serialVersionUID = 5840033961584078082L;
private static final Logger logger = LogService.getLogger();
private transient LocalRegion r;
+
private String regionPath;
+
private Set<Object> entryKeys;
public TXRegionLockRequestImpl() {
@@ -93,26 +92,26 @@ public class TXRegionLockRequestImpl
this.entryKeys.add(key);
}
- public final void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.regionPath = DataSerializer.readString(in);
- final GemFireCacheImpl cache = getCache(false);
+ final InternalCache cache = getCache(false);
try {
final int size = InternalDataSerializer.readArrayLength(in);
if (cache != null && size > 0) {
this.r = (LocalRegion) cache.getRegion(this.regionPath);
}
this.entryKeys = readEntryKeySet(size, in);
- } catch (CacheClosedException cce) {
+ } catch (CacheClosedException ignore) {
// don't throw in deserialization
this.entryKeys = null;
}
}
- private final Set<Object> readEntryKeySet(final int size, final DataInput in)
+ private Set<Object> readEntryKeySet(final int size, final DataInput in)
throws IOException, ClassNotFoundException {
- if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
logger.trace(LogMarker.SERIALIZER, "Reading HashSet with size {}", size);
}
@@ -135,21 +134,21 @@ public class TXRegionLockRequestImpl
InternalDataSerializer.writeSet(this.entryKeys, out);
}
- public static final TXRegionLockRequestImpl createFromData(DataInput in)
+ public static TXRegionLockRequestImpl createFromData(DataInput in)
throws IOException, ClassNotFoundException {
TXRegionLockRequestImpl result = new TXRegionLockRequestImpl();
InternalDataSerializer.invokeFromData(result, in);
return result;
}
- public final String getRegionFullPath() {
+ public String getRegionFullPath() {
if (this.regionPath == null) {
this.regionPath = this.r.getFullPath();
}
return this.regionPath;
}
- public final Set<Object> getKeys() {
+ public Set<Object> getKeys() {
if (this.entryKeys == null) {
// check for cache closed/closing
getCache(true);
@@ -157,8 +156,8 @@ public class TXRegionLockRequestImpl
return this.entryKeys;
}
- private final GemFireCacheImpl getCache(boolean throwIfClosing) {
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ private InternalCache getCache(boolean throwIfClosing) {
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
if (throwIfClosing) {
cache.getCancelCriterion().checkCancelInProgress(null);
@@ -175,7 +174,7 @@ public class TXRegionLockRequestImpl
* Only safe to call in the vm that creates this request. Once it is serialized this method will
* return null.
*/
- public final LocalRegion getLocalRegion() {
+ public LocalRegion getLocalRegion() {
return this.r;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionState.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionState.java
index 167f1c1..496a812 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRegionState.java
@@ -97,7 +97,7 @@ public class TXRegionState {
public TXEntryState createReadEntry(LocalRegion r, Object entryKey, RegionEntry re, Object vId,
Object pendingValue) {
- GemFireCacheImpl cache = r.getCache();
+ InternalCache cache = r.getCache();
boolean isDistributed = false;
if (cache.getTxManager().getTXState() != null) {
isDistributed = cache.getTxManager().getTXState().isDistTx();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
index 725ad64..6a1eeed 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
@@ -40,16 +40,13 @@ import org.apache.geode.internal.cache.RemoteOperationMessage.RemoteOperationRes
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
-/**
- *
- *
- */
public class TXRemoteCommitMessage extends TXMessage {
-
private static final Logger logger = LogService.getLogger();
/** for deserialization */
- public TXRemoteCommitMessage() {}
+ public TXRemoteCommitMessage() {
+ // nothing
+ }
public TXRemoteCommitMessage(int txUniqId, InternalDistributedMember onBehalfOfClientMember,
ReplyProcessor21 processor) {
@@ -76,7 +73,7 @@ public class TXRemoteCommitMessage extends TXMessage {
@Override
protected boolean operateOnTx(TXId txId, DistributionManager dm) throws RemoteOperationException {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
TXManagerImpl txMgr = cache.getTXMgr();
if (logger.isDebugEnabled()) {
@@ -124,8 +121,6 @@ public class TXRemoteCommitMessage extends TXMessage {
return true;
}
-
-
/**
* This message is used for the reply to a remote commit operation: a commit from a stub to the tx
* host. This is the reply to a {@link TXRemoteCommitMessage}.
@@ -133,7 +128,9 @@ public class TXRemoteCommitMessage extends TXMessage {
* @since GemFire 6.5
*/
public static final class TXRemoteCommitReplyMessage extends ReplyMessage {
+
private transient TXCommitMessage commitMessage;
+
/*
* Used on the fromData side to transfer the value bytes to the requesting thread
*/
@@ -142,7 +139,9 @@ public class TXRemoteCommitMessage extends TXMessage {
/**
* Empty constructor to conform to DataSerializable interface
*/
- public TXRemoteCommitReplyMessage() {}
+ public TXRemoteCommitReplyMessage() {
+ // nothing
+ }
public TXRemoteCommitReplyMessage(DataInput in) throws IOException, ClassNotFoundException {
fromData(in);
@@ -219,7 +218,7 @@ public class TXRemoteCommitMessage extends TXMessage {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("TXRemoteCommitReplyMessage ").append("processorid=").append(this.processorId)
.append(" reply to sender ").append(this.getSender());
return sb.toString();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteRollbackMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteRollbackMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteRollbackMessage.java
index e416e11..13b783f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteRollbackMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteRollbackMessage.java
@@ -30,15 +30,12 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- *
- */
public class TXRemoteRollbackMessage extends TXMessage {
-
private static final Logger logger = LogService.getLogger();
- public TXRemoteRollbackMessage() {}
+ public TXRemoteRollbackMessage() {
+ // nothing
+ }
public TXRemoteRollbackMessage(int txUniqId, InternalDistributedMember onBehalfOfClientMember,
ReplyProcessor21 processor) {
@@ -60,7 +57,7 @@ public class TXRemoteRollbackMessage extends TXMessage {
@Override
protected boolean operateOnTx(TXId txId, DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
throw new CacheClosedException(
LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateProxyImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateProxyImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateProxyImpl.java
index 49922a0..22b95f3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateProxyImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateProxyImpl.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- * File comment
- */
package org.apache.geode.internal.cache;
import java.util.Collection;
@@ -48,11 +45,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-/**
- *
- */
public class TXStateProxyImpl implements TXStateProxy {
-
private static final Logger logger = LogService.getLogger();
protected static final AtomicBoolean txDistributedClientWarningIssued = new AtomicBoolean();
@@ -63,6 +56,7 @@ public class TXStateProxyImpl implements TXStateProxy {
protected DistributedMember target;
private boolean commitRequestedByOwner;
private boolean isJCATransaction;
+
/**
* for client/server JTA transactions we need to have a single thread handle both beforeCompletion
* and afterCompletion so that beforeC can obtain locks for the afterC step. This is that thread
@@ -88,39 +82,26 @@ public class TXStateProxyImpl implements TXStateProxy {
return this.synchRunnable;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getSemaphore()
- */
public ReentrantLock getLock() {
return this.lock;
}
-
- /**
- * @return the isJTA
- */
final boolean isJTA() {
return isJTA;
}
- /**
- * @return the txId
- */
final public TXId getTxId() {
return txId;
}
- /**
- * @return the txMgr
- */
public final TXManagerImpl getTxMgr() {
return txMgr;
}
protected volatile TXStateInterface realDeal;
+
protected boolean inProgress = true;
+
protected InternalDistributedMember onBehalfOfClientMember = null;
/**
@@ -184,10 +165,6 @@ public class TXStateProxyImpl implements TXStateProxy {
return this.realDeal;
}
- /**
- * @param managerImpl
- * @param id
- */
public TXStateProxyImpl(TXManagerImpl managerImpl, TXId id,
InternalDistributedMember clientMember) {
this.txMgr = managerImpl;
@@ -196,11 +173,6 @@ public class TXStateProxyImpl implements TXStateProxy {
this.onBehalfOfClientMember = clientMember;
}
- /**
- * @param managerImpl
- * @param id
- * @param isjta
- */
public TXStateProxyImpl(TXManagerImpl managerImpl, TXId id, boolean isjta) {
this.txMgr = managerImpl;
this.txId = id;
@@ -219,16 +191,6 @@ public class TXStateProxyImpl implements TXStateProxy {
this.isJTA = isJTA;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#checkJTA(java.lang.String)
- */
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateProxyInterface#checkJTA(java.lang.String)
- */
public void checkJTA(String errmsg) throws IllegalStateException {
if (isJTA()) {
throw new IllegalStateException(errmsg);
@@ -243,11 +205,6 @@ public class TXStateProxyImpl implements TXStateProxy {
.toLocalizedString("precommit"));
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#commit()
- */
public void commit() throws CommitConflictException {
boolean preserveTx = false;
try {
@@ -284,12 +241,6 @@ public class TXStateProxyImpl implements TXStateProxy {
return (TransactionException) e;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#containsValueForKey(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion)
- */
public boolean containsValueForKey(KeyInfo keyInfo, LocalRegion region) {
try {
this.operationCount++;
@@ -302,7 +253,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
private void trackBucketForTx(KeyInfo keyInfo) {
- GemFireCacheImpl cache = (GemFireCacheImpl) txMgr.getCache();
if (keyInfo.getBucketId() >= 0) {
if (logger.isDebugEnabled()) {
logger.debug("adding bucket:{} for tx:{}", keyInfo.getBucketId(), getTransactionId());
@@ -313,13 +263,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#destroyExistingEntry(org.apache.geode.internal
- * .cache.EntryEventImpl, boolean, java.lang.Object)
- */
public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite,
Object expectedOldValue) throws EntryNotFoundException {
try {
@@ -332,40 +275,19 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getBeginTime()
- */
public long getBeginTime() {
return getRealDeal(null, null).getBeginTime();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getCache()
- */
public Cache getCache() {
return txMgr.getCache();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getChanges()
- */
public int getChanges() {
assertBootstrapped();
return getRealDeal(null, null).getChanges();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getDeserializedValue(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion, boolean)
- */
public Object getDeserializedValue(KeyInfo keyInfo, LocalRegion localRegion, boolean updateStats,
boolean disableCopyOnRead, boolean preferCD, EntryEventImpl clientEvent,
boolean returnTombstones, boolean retainResult) {
@@ -379,12 +301,6 @@ public class TXStateProxyImpl implements TXStateProxy {
return val;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getEntry(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion)
- */
public Entry getEntry(KeyInfo keyInfo, LocalRegion region, boolean allowTombstones) {
try {
this.operationCount++;
@@ -396,51 +312,25 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getEvent()
- */
public TXEvent getEvent() {
assertBootstrapped();
return getRealDeal(null, null).getEvent();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getEvents()
- */
public List getEvents() {
assertBootstrapped();
return getRealDeal(null, null).getEvents();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getRegions()
- */
public Collection<LocalRegion> getRegions() {
assertBootstrapped();
return getRealDeal(null, null).getRegions();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#getTransactionId()
- */
public TransactionId getTransactionId() {
return txId;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#invalidateExistingEntry(org.apache.geode.
- * internal.cache.EntryEventImpl, boolean, boolean)
- */
public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks,
boolean forceNewEntry) {
try {
@@ -453,11 +343,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#isInProgress()
- */
public boolean isInProgress() {
return inProgress;
}
@@ -467,54 +352,26 @@ public class TXStateProxyImpl implements TXStateProxy {
this.inProgress = progress;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#needsLargeModCount()
- */
public boolean needsLargeModCount() {
assertBootstrapped();
return getRealDeal(null, null).needsLargeModCount();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#nextModSerialNum()
- */
public int nextModSerialNum() {
assertBootstrapped();
return getRealDeal(null, null).nextModSerialNum();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#readRegion(org.apache.geode.internal.cache.
- * LocalRegion)
- */
public TXRegionState readRegion(LocalRegion r) {
assertBootstrapped();
return getRealDeal(null, r).readRegion(r);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#rmRegion(org.apache.geode.internal.cache.
- * LocalRegion)
- */
public void rmRegion(LocalRegion r) {
assertBootstrapped();
getRealDeal(null, r).rmRegion(r);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#rollback()
- */
public void rollback() {
try {
getRealDeal(null, null).rollback();
@@ -526,13 +383,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#txPutEntry(org.apache.geode.internal.cache.
- * EntryEventImpl, boolean, boolean, boolean)
- */
public boolean txPutEntry(EntryEventImpl event, boolean ifNew, boolean requireOldValue,
boolean checkResources, Object expectedOldValue) {
try {
@@ -546,12 +396,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#txReadEntry(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion, boolean)
- */
public TXEntryState txReadEntry(KeyInfo keyInfo, LocalRegion localRegion, boolean rememberRead,
boolean createTxEntryIfAbsent) {
try {
@@ -565,36 +409,15 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#txReadRegion(org.apache.geode.internal.cache.
- * LocalRegion)
- */
public TXRegionState txReadRegion(LocalRegion localRegion) {
assertBootstrapped();
return getRealDeal(null, localRegion).txReadRegion(localRegion);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#txWriteRegion(org.apache.geode.internal.cache.
- * LocalRegion, java.lang.Object)
- */
public TXRegionState txWriteRegion(LocalRegion localRegion, KeyInfo entryKey) {
return getRealDeal(entryKey, localRegion).txWriteRegion(localRegion, entryKey);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateInterface#writeRegion(org.apache.geode.internal.cache.
- * LocalRegion)
- */
public TXRegionState writeRegion(LocalRegion r) {
assertBootstrapped();
return getRealDeal(null, r).writeRegion(r);
@@ -604,11 +427,6 @@ public class TXStateProxyImpl implements TXStateProxy {
assert realDeal != null;
}
- /*
- * (non-Javadoc)
- *
- * @see javax.transaction.Synchronization#afterCompletion(int)
- */
public void afterCompletion(int status) {
assertBootstrapped();
try {
@@ -621,22 +439,11 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see javax.transaction.Synchronization#beforeCompletion()
- */
public void beforeCompletion() {
assertBootstrapped();
getRealDeal(null, null).beforeCompletion();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#containsKey(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion)
- */
public boolean containsKey(KeyInfo keyInfo, LocalRegion localRegion) {
try {
this.operationCount++;
@@ -648,13 +455,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#entryCount(org.apache.geode.internal.cache.
- * LocalRegion)
- */
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "UL_UNRELEASED_LOCK",
justification = "This method unlocks and then conditionally undoes the unlock in the finally-block. Review again at later time.")
public int entryCount(LocalRegion localRegion) {
@@ -684,13 +484,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#findObject(org.apache.geode.internal.cache.
- * LocalRegion, java.lang.Object, java.lang.Object, boolean, boolean, java.lang.Object)
- */
public Object findObject(KeyInfo key, LocalRegion r, boolean isCreate, boolean generateCallbacks,
Object value, boolean disableCopyOnRead, boolean preferCD,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
@@ -706,13 +499,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#getAdditionalKeysForIterator(org.apache.geode.
- * internal.cache.LocalRegion)
- */
public Set getAdditionalKeysForIterator(LocalRegion currRgn) {
if (this.realDeal == null) {
return null;
@@ -720,13 +506,6 @@ public class TXStateProxyImpl implements TXStateProxy {
return getRealDeal(null, currRgn).getAdditionalKeysForIterator(currRgn);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#getEntryForIterator(org.apache.geode.internal.
- * cache.LocalRegion, java.lang.Object, boolean)
- */
public Object getEntryForIterator(KeyInfo key, LocalRegion currRgn, boolean rememberReads,
boolean allowTombstones) {
boolean resetTxState = this.realDeal == null;
@@ -745,15 +524,8 @@ public class TXStateProxyImpl implements TXStateProxy {
getTxMgr().internalResume(txp);
}
}
-
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#getKeyForIterator(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion, boolean)
- */
public Object getKeyForIterator(KeyInfo keyInfo, LocalRegion currRgn, boolean rememberReads,
boolean allowTombstones) {
boolean resetTxState = this.realDeal == null;
@@ -775,33 +547,16 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#getValueInVM(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion, boolean)
- */
public Object getValueInVM(KeyInfo keyInfo, LocalRegion localRegion, boolean rememberRead) {
this.operationCount++;
return getRealDeal(keyInfo, localRegion).getValueInVM(keyInfo, localRegion, rememberRead);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#isDeferredStats()
- */
public boolean isDeferredStats() {
assertBootstrapped();
return getRealDeal(null, null).isDeferredStats();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#putEntry(org.apache.geode.internal.cache.
- * EntryEventImpl, boolean, boolean, java.lang.Object, boolean, long, boolean)
- */
public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld,
Object expectedOldValue, boolean requireOldValue, long lastModified,
boolean overwriteDestroyed) {
@@ -816,34 +571,14 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateInterface#isInProgressAndSameAs(org.apache.geode.
- * internal.cache.TXStateInterface)
- */
public boolean isInProgressAndSameAs(TXStateInterface otherState) {
return isInProgress() && otherState == this;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXStateProxy#setLocalTXState(org.apache.geode.internal.cache.
- * TXState)
- */
public void setLocalTXState(TXStateInterface state) {
this.realDeal = state;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#getSerializedValue(org.apache.geode.internal.
- * cache.LocalRegion, java.lang.Object, java.lang.Object)
- */
public Object getSerializedValue(LocalRegion localRegion, KeyInfo key, boolean doNotLockEntry,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
boolean returnTombstones) throws DataLocationException {
@@ -852,13 +587,6 @@ public class TXStateProxyImpl implements TXStateProxy {
requestingClient, clientEvent, returnTombstones);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#putEntryOnRemote(org.apache.geode.internal.
- * cache.EntryEventImpl, boolean, boolean, java.lang.Object, boolean, long, boolean)
- */
public boolean putEntryOnRemote(EntryEventImpl event, boolean ifNew, boolean ifOld,
Object expectedOldValue, boolean requireOldValue, long lastModified,
boolean overwriteDestroyed) throws DataLocationException {
@@ -873,12 +601,6 @@ public class TXStateProxyImpl implements TXStateProxy {
return getRealDeal(null, null).isFireCallbacks();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#destroyOnRemote(java.lang.Integer,
- * org.apache.geode.internal.cache.EntryEventImpl, java.lang.Object)
- */
public void destroyOnRemote(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue)
throws DataLocationException {
this.operationCount++;
@@ -887,13 +609,6 @@ public class TXStateProxyImpl implements TXStateProxy {
tx.destroyOnRemote(event, cacheWrite, expectedOldValue);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#invalidateOnRemote(org.apache.geode.internal.
- * cache.EntryEventImpl, boolean, boolean)
- */
public void invalidateOnRemote(EntryEventImpl event, boolean invokeCallbacks,
boolean forceNewEntry) throws DataLocationException {
this.operationCount++;
@@ -919,13 +634,6 @@ public class TXStateProxyImpl implements TXStateProxy {
LocalizedStrings.TXState_REGION_CLEAR_NOT_SUPPORTED_IN_A_TRANSACTION.toLocalizedString());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#getBucketKeys(org.apache.geode.internal.cache.
- * LocalRegion, int)
- */
public Set getBucketKeys(LocalRegion localRegion, int bucketId, boolean allowTombstones) {
// if this the first operation in a transaction, reset txState
boolean resetTxState = this.realDeal == null;
@@ -945,12 +653,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.InternalDataView#getEntryOnRemote(java.lang.Object,
- * org.apache.geode.internal.cache.LocalRegion)
- */
public Entry getEntryOnRemote(KeyInfo keyInfo, LocalRegion localRegion, boolean allowTombstones)
throws DataLocationException {
this.operationCount++;
@@ -963,33 +665,15 @@ public class TXStateProxyImpl implements TXStateProxy {
getRealDeal(null, null);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateProxy#getTarget()
- */
public DistributedMember getTarget() {
return this.target;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateProxy#setTarget(org.apache.geode.distributed.
- * DistributedMember)
- */
public void setTarget(DistributedMember target) {
assert this.target == null;
getRealDeal(target);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.InternalDataView#getRegionKeysForIteration(org.apache.geode.
- * internal.cache.LocalRegion)
- */
public Collection<?> getRegionKeysForIteration(LocalRegion currRegion) {
if (currRegion.isUsedForPartitionedRegionBucket()) {
return currRegion.getRegionKeysForIteration();
@@ -998,20 +682,10 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateProxy#isCommitRequestedByOwner()
- */
public boolean isCommitOnBehalfOfRemoteStub() {
return this.commitRequestedByOwner;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXStateProxy#setCommitRequestedByOwner()
- */
public boolean setCommitOnBehalfOfRemoteStub(boolean requestedByOwner) {
return this.commitRequestedByOwner = requestedByOwner;
}
@@ -1039,7 +713,8 @@ public class TXStateProxyImpl implements TXStateProxy {
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TXStateProxyImpl@").append(System.identityHashCode(this)).append(" txId:")
- .append(this.txId).append(" realDeal:" + this.realDeal).append(" isJTA:").append(isJTA);
+ .append(this.txId).append(" realDeal:").append(this.realDeal).append(" isJTA:")
+ .append(isJTA);
return builder.toString();
}
@@ -1051,7 +726,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
-
public boolean isMemberIdForwardingRequired() {
if (this.realDeal == null) {
return false;
@@ -1060,7 +734,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
-
public TXCommitMessage getCommitMessage() {
if (this.realDeal == null) {
return null;
@@ -1069,7 +742,6 @@ public class TXStateProxyImpl implements TXStateProxy {
}
}
-
public void postPutAll(DistributedPutAllOperation putallOp, VersionedObjectList successfulPuts,
LocalRegion region) {
if (putallOp.putAllData.length == 0) {
@@ -1159,7 +831,6 @@ public class TXStateProxyImpl implements TXStateProxy {
// Do nothing. Not applicable for transactions.
}
-
public void close() {
if (this.realDeal != null) {
this.realDeal.close();
[23/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/InternalInstantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalInstantiator.java b/geode-core/src/main/java/org/apache/geode/internal/InternalInstantiator.java
index d292ca9..1c1a73e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalInstantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalInstantiator.java
@@ -33,9 +33,11 @@ import org.apache.geode.cache.Cache;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.SerialDistributionMessage;
+import org.apache.geode.i18n.StringId;
import org.apache.geode.internal.cache.EnumListenerEvent;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PoolManagerImpl;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.CacheClientUpdater;
@@ -46,7 +48,6 @@ import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.geode.i18n.StringId;
/**
* Contains the implementation of {@link org.apache.geode.Instantiator} registration and
@@ -84,7 +85,7 @@ public class InternalInstantiator {
/////////////////////// Static Methods ///////////////////////
/**
- * Registers an <code>Instantiator</code> with the data serialization framework.
+ * Registers an {@code Instantiator} with the data serialization framework.
*/
public static void register(Instantiator instantiator, boolean distribute) {
// [sumedh] Skip the checkForThread() check if the instantiation has not
@@ -99,7 +100,7 @@ public class InternalInstantiator {
}
/**
- * Actually registers an <code>Instantiator</code> with the data serialization framework.
+ * Actually registers an {@code Instantiator} with the data serialization framework.
*
* @param instantiator
* @param distribute
@@ -161,7 +162,7 @@ public class InternalInstantiator {
// if instantiator is getting registered for first time
// its EventID will be null, so generate a new event id
// the the distributed system is connected
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && instantiator.getEventId() == null) {
instantiator.setEventId(new EventID(cache.getDistributedSystem()));
}
@@ -204,7 +205,7 @@ public class InternalInstantiator {
* Sets the EventID to the instantiator if distributed system is created
*/
public static EventID generateEventId() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// A cache has not yet created
return null;
@@ -232,8 +233,6 @@ public class InternalInstantiator {
/**
* Sends Instantiator registration message to all cache clients
- *
- * @param instantiator
*/
private static void sendRegistrationMessageToClients(Instantiator instantiator) {
Cache cache = GemFireCacheImpl.getInstance();
@@ -267,7 +266,7 @@ public class InternalInstantiator {
}
/**
- * Creates a new <code>Instantiator</code> with the given class and id and
+ * Creates a new {@code Instantiator} with the given class and id and
* {@linkplain #register(Instantiator, boolean) registers} it with the data serialization
* framework.
*
@@ -284,7 +283,7 @@ public class InternalInstantiator {
}
/**
- * Creates a new <code>Instantiator</code> with the given class and id and
+ * Creates a new {@code Instantiator} with the given class and id and
* {@linkplain #register(Instantiator, boolean) registers} it with the data serialization
* framework.
*
@@ -303,7 +302,7 @@ public class InternalInstantiator {
}
/**
- * Lazily creates a new <code>Instantiator</code> with the given class and id.
+ * Lazily creates a new {@code Instantiator} with the given class and id.
*
* @throws IllegalArgumentException The instantiator cannot be created
* @throws IllegalStateException The instantiator cannot be registered
@@ -318,7 +317,7 @@ public class InternalInstantiator {
}
/**
- * Lazily creates a new <code>Instantiator</code> with the given class and id.
+ * Lazily creates a new {@code Instantiator} with the given class and id.
*
* This method is only called when server connection and CacheClientUpdaterThread
*
@@ -377,7 +376,7 @@ public class InternalInstantiator {
instantiatedClass =
InternalDataSerializer.getCachedClass(holder.getInstantiatedClassName());
} catch (ClassNotFoundException cnfe) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && cache.getLoggerI18n() != null && cache.getLoggerI18n().infoEnabled()) {
cache.getLoggerI18n().info(
LocalizedStrings.InternalInstantiator_COULD_NOT_LOAD_INSTANTIATOR_CLASS_0,
@@ -454,11 +453,11 @@ public class InternalInstantiator {
}
/**
- * Unregisters the given class with the given class id with the <code>Instantiator</code>.
+ * Unregisters the given class with the given class id with the {@code Instantiator}.
*
- * @throws IllegalArgumentException If <code>c</code> was not previously registered with id
- * <code>classId</code>.
- * @throws NullPointerException If <code>c</code> is <code>null</code>
+ * @throws IllegalArgumentException If {@code c} was not previously registered with id
+ * {@code classId}.
+ * @throws NullPointerException If {@code c} is {@code null}
*/
public static synchronized void unregister(Class c, int classId) {
if (c == null) {
@@ -489,7 +488,7 @@ public class InternalInstantiator {
/**
* Returns the class id for the given class.
*
- * @return <code>0</code> if the class has not be registered
+ * @return {@code 0} if the class has not be registered
*
* @see DataSerializer#writeObject(Object, DataOutput)
*/
@@ -554,7 +553,7 @@ public class InternalInstantiator {
instantiator = (Instantiator) idsToInstantiators.get(classId);
}
} catch (ClassNotFoundException cnfe) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && cache.getLoggerI18n() != null
&& cache.getLoggerI18n().infoEnabled()) {
cache.getLoggerI18n().info(
@@ -585,11 +584,11 @@ public class InternalInstantiator {
}
/**
- * Reflectively instantiates an instance of <code>Instantiator</code>.
+ * Reflectively instantiates an instance of {@code Instantiator}.
*
- * @param instantiatorClass The implementation of <code>Instantiator</code> to instantiate
- * @param instantiatedClass The implementation of <code>DataSerialization</code> that will be
- * produced by the <code>Instantiator</code>
+ * @param instantiatorClass The implementation of {@code Instantiator} to instantiate
+ * @param instantiatedClass The implementation of {@code DataSerialization} that will be produced
+ * by the {@code Instantiator}
*
* @throws IllegalArgumentException If the class can't be instantiated
*/
@@ -680,7 +679,7 @@ public class InternalInstantiator {
idsToHolders.remove(holder.getId());
}
} catch (ClassNotFoundException cnfe) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && cache.getLoggerI18n() != null
&& cache.getLoggerI18n().infoEnabled()) {
cache.getLoggerI18n().info(
@@ -716,8 +715,8 @@ public class InternalInstantiator {
/////////////////////// Inner Classes ///////////////////////
/**
- * A marker object for <Code>Instantiator</code>s that have not been registered. Using this marker
- * object allows us to asynchronously send <Code>Instantiator</code> registration updates. If the
+ * A marker object for {@code Instantiator}s that have not been registered. Using this marker
+ * object allows us to asynchronously send {@code Instantiator} registration updates. If the
* serialized bytes arrive at a VM before the registration message does, the deserializer will
* wait an amount of time for the registration message to arrive.
*/
@@ -727,7 +726,7 @@ public class InternalInstantiator {
private volatile Instantiator instantiator = null;
/**
- * Creates a new <code>Marker</code> whose {@link #getInstantiator} method will wait for the
+ * Creates a new {@code Marker} whose {@link #getInstantiator} method will wait for the
* instantiator to be registered.
*/
Marker() {
@@ -737,7 +736,7 @@ public class InternalInstantiator {
/**
* Returns the instantiator associated with this marker. If the instantiator has not been
* registered yet, then this method will wait until the instantiator is registered. If this
- * method has to wait for too long, then <code>null</code> is returned.
+ * method has to wait for too long, then {@code null} is returned.
*/
Instantiator getInstantiator() {
synchronized (this) {
@@ -811,11 +810,11 @@ public class InternalInstantiator {
/**
* A distribution message that alerts other members of the distributed cache of a new
- * <code>Instantiator</code> being registered.
+ * {@code Instantiator} being registered.
*/
public static class RegistrationMessage extends SerialDistributionMessage {
/**
- * The <code>Instantiator</code> class that was registered
+ * The {@code Instantiator} class that was registered
*/
protected Class instantiatorClass;
@@ -823,12 +822,12 @@ public class InternalInstantiator {
protected Class instantiatedClass;
/**
- * The id of the <codE>Instantiator</code> that was registered
+ * The id of the {@code Instantiator} that was registered
*/
protected int id;
/**
- * The eventId of the <codE>Instantiator</code> that was registered
+ * The eventId of the {@code Instantiator} that was registered
*/
protected EventID eventId;
@@ -838,7 +837,7 @@ public class InternalInstantiator {
protected transient StringBuffer fromDataProblems;
/**
- * The name of the <code>Instantiator</code> class that was registered
+ * The name of the {@code Instantiator} class that was registered
*/
protected String instantiatorClassName;
@@ -846,15 +845,15 @@ public class InternalInstantiator {
protected String instantiatedClassName;
/**
- * Constructor for <code>DataSerializable</code>
+ * Constructor for {@code DataSerializable}
*/
public RegistrationMessage() {
}
/**
- * Creates a new <code>RegistrationMessage</code> that broadcasts that the given
- * <code>Instantiator</code> was registered.
+ * Creates a new {@code RegistrationMessage} that broadcasts that the given {@code Instantiator}
+ * was registered.
*/
public RegistrationMessage(Instantiator s) {
this.instantiatorClass = s.getClass();
@@ -951,7 +950,7 @@ public class InternalInstantiator {
}
/**
* A distribution message that alerts other members of the distributed cache of a new
- * <code>Instantiator</code> being registered.
+ * {@code Instantiator} being registered.
*
*
* @since GemFire 5.0
@@ -961,15 +960,15 @@ public class InternalInstantiator {
private transient ClientProxyMembershipID context;
/**
- * Constructor for <code>RegistrationConetxtMessage</code>
+ * Constructor for {@code RegistrationConetxtMessage}
*/
public RegistrationContextMessage() {
}
/**
- * Creates a new <code>RegistrationContextMessage</code> that broadcasts that the given
- * <code>Instantiator</code> was registered.
+ * Creates a new {@code RegistrationContextMessage} that broadcasts that the given
+ * {@code Instantiator} was registered.
*/
public RegistrationContextMessage(Instantiator s) {
this.instantiatorClass = s.getClass();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/MigrationClient.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/MigrationClient.java b/geode-core/src/main/java/org/apache/geode/internal/MigrationClient.java
index 4cc99d9..1f3ef2a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/MigrationClient.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/MigrationClient.java
@@ -16,6 +16,18 @@ package org.apache.geode.internal;
import static org.apache.geode.distributed.ConfigurationProperties.*;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.util.Properties;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
@@ -25,16 +37,6 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.net.SocketCreator;
-import java.io.*;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-
/**
* MigrationClient is used to retrieve all of the data for a region from a MigrationServer. First
* start a MigrationServer using one version of GemFire, then connect to it using a MigrationClient
@@ -49,30 +51,29 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
* The region should be defined in the cache-xml file, and must also be defined in the server's
* cache-xml file.
* <p>
- * <p>
* Typically, the cache-xml file will be exactly the same as the one used by the MigrationServer
- * with different disk-dirs settings. When Region entries are transfered from the server to the
+ * with different disk-dirs settings. When Region entries are transferred from the server to the
* client, they are then stored in new files in these directories.
*
* @since GemFire 6.0.1
- *
*/
public class MigrationClient {
- final static boolean VERBOSE = MigrationServer.VERBOSE;
+ private static final boolean VERBOSE = MigrationServer.VERBOSE;
+
+ // version for backward communications compatibility
+ private static final int VERSION = 551;
- final static int VERSION = 551; // version for backward communications compatibility
+ private static final int CODE_ERROR = MigrationServer.CODE_ERROR;
- protected static final int CODE_ERROR = MigrationServer.CODE_ERROR;
- protected static final int CODE_ENTRY =
- MigrationServer.CODE_ENTRY; /* serialized key, serialized value */
- protected static final int CODE_COMPLETED = MigrationServer.CODE_COMPLETED;
+ /* serialized key, serialized value */
+ private static final int CODE_ENTRY = MigrationServer.CODE_ENTRY;
+
+ private static final int CODE_COMPLETED = MigrationServer.CODE_COMPLETED;
public static void main(String[] args) throws Exception {
int argIdx = 0;
- String cacheXmlFileName = null;
- String regionName = null;
- String bindAddressName = null;
- int serverPort = 10533;
+ String cacheXmlFileName;
+ String regionName;
if (args.length > argIdx + 1) {
regionName = args[argIdx++];
@@ -82,9 +83,11 @@ public class MigrationClient {
.println("MigrationClient regionName [cache-xml-file] [server-port] [server-address]");
return;
}
+ int serverPort = 10533;
if (args.length > argIdx) {
serverPort = Integer.parseInt(args[argIdx++]);
}
+ String bindAddressName = null;
if (args.length > argIdx) {
bindAddressName = args[argIdx++];
}
@@ -101,19 +104,16 @@ public class MigrationClient {
instance.getRegion(regionName);
}
-
- private InetAddress serverAddress;
- private int port;
+ private final InetAddress serverAddress;
+ private final int port;
private DistributedSystem distributedSystem;
private File cacheXmlFile;
private Cache cache;
-
private Socket server;
private int serverVersion;
private DataInputStream dis;
private DataOutputStream dos;
-
/**
* Create a MigrationClient to be used with a DistributedSystem and Cache that are created using
* GemFire APIs
@@ -121,13 +121,13 @@ public class MigrationClient {
* @param bindAddressName the server's address
* @param serverPort the server's port
*/
- public MigrationClient(String bindAddressName, int serverPort) {
+ private MigrationClient(String bindAddressName, int serverPort) {
this.port = serverPort;
try {
this.serverAddress = InetAddress.getByName(bindAddressName);
- } catch (IOException e) {
+ } catch (IOException ignore) {
throw new IllegalArgumentException(
- "Error - bind address cannot be resolved: '" + bindAddressName + "'");
+ "Error - bind address cannot be resolved: '" + bindAddressName + '\'');
}
}
@@ -143,7 +143,8 @@ public class MigrationClient {
this.cacheXmlFile = new File(cacheXmlFileName);
if (!this.cacheXmlFile.exists()) {
// in 6.x this should be localizable
- System.err.println("Warning - file not found in local directory: '" + cacheXmlFileName + "'");
+ System.err
+ .println("Warning - file not found in local directory: '" + cacheXmlFileName + '\'');
}
}
@@ -167,7 +168,6 @@ public class MigrationClient {
this.distributedSystem = DistributedSystem.connect(dsProps);
}
-
/**
* create the cache to be used by this migration server
*
@@ -191,8 +191,7 @@ public class MigrationClient {
public Region getRegion(String regionName) throws IOException, ClassNotFoundException {
initDSAndCache();
- Region region = null;
- region = this.cache.getRegion(regionName);
+ Region region = this.cache.getRegion(regionName);
try {
connectToServer();
if (this.serverVersion != VERSION) {
@@ -209,7 +208,7 @@ public class MigrationClient {
int responseCode = -1;
try {
responseCode = this.dis.readShort();
- } catch (EOFException e) {
+ } catch (EOFException ignore) {
}
switch (responseCode) {
case -1:
@@ -219,11 +218,11 @@ public class MigrationClient {
break;
case CODE_ERROR:
String errorString = this.dis.readUTF();
- System.err.println("Server responded with error: '" + errorString + "'");
+ System.err.println("Server responded with error: '" + errorString + '\'');
throw new IOException(errorString);
case CODE_ENTRY:
- Object key = (new ObjectInputStream(server.getInputStream())).readObject();
- Object value = (new ObjectInputStream(server.getInputStream())).readObject();
+ Object key = new ObjectInputStream(this.server.getInputStream()).readObject();
+ Object value = new ObjectInputStream(this.server.getInputStream()).readObject();
if (VERBOSE) {
System.out.println("received " + key);
}
@@ -232,14 +231,13 @@ public class MigrationClient {
}
}
} finally {
- if (server != null && !server.isClosed()) {
- server.close();
+ if (this.server != null && !this.server.isClosed()) {
+ this.server.close();
}
}
return region;
}
-
private void connectToServer() throws IOException {
this.server = new Socket();
SocketAddress addr;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/MigrationServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/MigrationServer.java b/geode-core/src/main/java/org/apache/geode/internal/MigrationServer.java
index 3cb3e61..1252eb0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/MigrationServer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/MigrationServer.java
@@ -16,24 +16,36 @@ package org.apache.geode.internal;
import static org.apache.geode.distributed.ConfigurationProperties.*;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.admin.internal.InetAddressUtil;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
+import org.apache.geode.cache.Region.Entry;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
-
-import java.io.*;
-import java.net.*;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import org.apache.geode.internal.logging.LogService;
/**
* MigrationServer creates a cache using a supplied cache.xml and then opens a server socket that a
@@ -98,28 +110,34 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
* @since GemFire 6.0.1
*/
public class MigrationServer {
- final static boolean VERBOSE = Boolean.getBoolean("Migration.VERBOSE");
+ private static final Logger logger = LogService.getLogger();
+
+ static final boolean VERBOSE = Boolean.getBoolean("Migration.VERBOSE");
+
+ // version for backward communications compatibility
+ private static final int VERSION = 551;
- final static int VERSION = 551; // version for backward communications compatibility
+ static final int CODE_ERROR = 0;
- protected static final int CODE_ERROR = 0;
- protected static final int CODE_ENTRY = 1; /* serialized key, serialized value */
- protected static final int CODE_COMPLETED = 2;
+ /* serialized key, serialized value */
+ static final int CODE_ENTRY = 1;
+
+ static final int CODE_COMPLETED = 2;
public static void main(String[] args) throws Exception {
int argIdx = 0;
String cacheXmlFileName = "cache.xml";
- String bindAddressName = null;
- int listenPort = 10533;
if (args.length > 0) {
cacheXmlFileName = args[argIdx++];
} else {
System.err.println("MigrationServer cache-xml-file [server-address] [server-port]");
}
+ int listenPort = 10533;
if (args.length > argIdx) {
listenPort = Integer.parseInt(args[argIdx++]);
}
+ String bindAddressName = null;
if (args.length > argIdx) {
bindAddressName = args[argIdx++];
}
@@ -136,15 +154,13 @@ public class MigrationServer {
instance.serve();
}
-
private InetAddress bindAddress;
- private int listenPort;
+ private final int listenPort;
private ServerSocket serverSocket;
private DistributedSystem distributedSystem;
private File cacheXmlFile;
private Cache cache;
-
/**
* Create a MigrationServer to be used with a DistributedSystem and Cache that are created using
* GemFire APIs
@@ -152,18 +168,18 @@ public class MigrationServer {
* @param bindAddressName the NIC to bind to, or null to use all interfaces
* @param listenPort the port to listen on
*/
- public MigrationServer(String bindAddressName, int listenPort) {
+ private MigrationServer(String bindAddressName, int listenPort) {
this.listenPort = listenPort;
if (bindAddressName != null) {
if (!isLocalHost(bindAddressName)) {
throw new IllegalArgumentException(
- "Error - bind address is not an address of this machine: '" + bindAddressName + "'");
+ "Error - bind address is not an address of this machine: '" + bindAddressName + '\'');
}
try {
this.bindAddress = InetAddress.getByName(bindAddressName);
- } catch (IOException e) {
+ } catch (IOException ignore) {
throw new IllegalArgumentException(
- "Error - bind address cannot be resolved: '" + bindAddressName + "'");
+ "Error - bind address cannot be resolved: '" + bindAddressName + '\'');
}
}
try {
@@ -175,7 +191,7 @@ public class MigrationServer {
this.serverSocket = new ServerSocket(listenPort);
}
if (VERBOSE) {
- System.out.println("created server socket " + serverSocket);
+ System.out.println("created server socket " + this.serverSocket);
}
} catch (IOException e) {
throw new IllegalArgumentException("Port is already in use", e);
@@ -194,7 +210,8 @@ public class MigrationServer {
this.cacheXmlFile = new File(cacheXmlFileName);
if (!this.cacheXmlFile.exists()) {
// in 6.x this should be localizable
- System.err.println("Warning - file not found in local directory: '" + cacheXmlFileName + "'");
+ System.err
+ .println("Warning - file not found in local directory: '" + cacheXmlFileName + '\'');
}
}
@@ -221,7 +238,6 @@ public class MigrationServer {
}
}
-
/**
* create the cache to be used by this migration server
*
@@ -237,7 +253,6 @@ public class MigrationServer {
}
}
-
/**
* This locates the distributed system and cache, if they have not been created by this server,
* and then listens for requests from MigrationClient processes.
@@ -269,16 +284,16 @@ public class MigrationServer {
Socket clientSocket;
try {
clientSocket = this.serverSocket.accept();
- } catch (java.net.SocketException e) {
+ } catch (SocketException ignored) {
return;
}
- (new RequestHandler(clientSocket)).serveClientRequest();
+ new RequestHandler(clientSocket).serveClientRequest();
}
} finally {
System.out.println("Closing migration server");
try {
this.serverSocket.close();
- } catch (Exception e) {
+ } catch (Exception ignore) {
this.serverSocket = null;
}
}
@@ -315,8 +330,6 @@ public class MigrationServer {
return this.distributedSystem;
}
-
-
// copied from 6.0 SocketCreator
public static boolean isLocalHost(Object host) {
if (host instanceof InetAddress) {
@@ -324,11 +337,11 @@ public class MigrationServer {
return true;
} else {
try {
- Enumeration en = NetworkInterface.getNetworkInterfaces();
+ Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
- NetworkInterface i = (NetworkInterface) en.nextElement();
- for (Enumeration en2 = i.getInetAddresses(); en2.hasMoreElements();) {
- InetAddress addr = (InetAddress) en2.nextElement();
+ NetworkInterface i = en.nextElement();
+ for (Enumeration<InetAddress> en2 = i.getInetAddresses(); en2.hasMoreElements();) {
+ InetAddress addr = en2.nextElement();
if (host.equals(addr)) {
return true;
}
@@ -353,21 +366,16 @@ public class MigrationServer {
return null;
}
try {
- if (host.indexOf("/") > -1) {
- return InetAddress.getByName(host.substring(host.indexOf("/") + 1));
+ if (host.contains("/")) {
+ return InetAddress.getByName(host.substring(host.indexOf('/') + 1));
} else {
return InetAddress.getByName(host);
}
- } catch (java.net.UnknownHostException e) {
+ } catch (UnknownHostException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
-
-
- // R E Q U E S T H A N D L E R
-
-
class RequestHandler implements Runnable {
Socket clientSocket;
DataInputStream dis;
@@ -375,11 +383,10 @@ public class MigrationServer {
RequestHandler(Socket clientSocket) throws IOException {
this.clientSocket = clientSocket;
- dos = new DataOutputStream(this.clientSocket.getOutputStream());
- dis = new DataInputStream(this.clientSocket.getInputStream());
+ this.dos = new DataOutputStream(this.clientSocket.getOutputStream());
+ this.dis = new DataInputStream(this.clientSocket.getInputStream());
}
-
// for now this is a blocking operation - multithread later if necessary
void serveClientRequest() {
try {
@@ -389,65 +396,57 @@ public class MigrationServer {
try {
this.clientSocket.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.debug(e);
}
}
}
}
+ @Override
public void run() {
try {
// first exchange version information so we can communicate correctly
- dos.writeShort(VERSION);
- int version = dis.readShort();
+ this.dos.writeShort(VERSION);
+ int version = this.dis.readShort();
handleRequest(version);
} catch (IOException e) {
System.err.println("Trouble dispatching request: " + e.getMessage());
- return;
} finally {
try {
this.clientSocket.close();
} catch (IOException e) {
- System.err.println("Trouble closing client socket: " + e.getMessage());
+ logger.debug("Trouble closing client socket", e);
}
}
}
/**
* read and dispatch a single request on client socket
- *
- * @param clientVersion
*/
private void handleRequest(int clientVersion) {
// for now we ignore the client version in the server. The client
// is typically of a later release than the server, and this information
// is given to the server in case a situation arises where it's needed
try {
- ClientRequest req = ClientRequest.readRequest(this.clientSocket, dis, dos);
+ ClientRequest req = ClientRequest.readRequest(this.clientSocket, this.dis, this.dos);
if (req != null) {
System.out.println(
"Processing " + req + " from " + this.clientSocket.getInetAddress().getHostAddress());
req.process(MigrationServer.this);
- dos.flush();
+ this.dos.flush();
}
} catch (IOException e) {
- e.printStackTrace();
+ logger.debug(e);
}
}
-
}
-
- // R E Q U E S T C L A S S E S
-
-
-
- static abstract class ClientRequest {
+ abstract static class ClientRequest {
Socket clientSocket;
DataInputStream dsi;
DataOutputStream dso;
- final static int REGION_REQUEST = 1;
+ static final int REGION_REQUEST = 1;
/**
* Use readRequest to create a new request object, not this constructor. Subclasses may refine
@@ -467,11 +466,9 @@ public class MigrationServer {
/**
* Read and return a request from a client
*
- * @param clientSocket
* @param dsi socket input stream
* @param dso socket output stream
* @return the new request
- * @throws IOException
*/
static ClientRequest readRequest(Socket clientSocket, DataInputStream dsi, DataOutputStream dso)
throws IOException {
@@ -480,8 +477,8 @@ public class MigrationServer {
case REGION_REQUEST:
return new RegionRequest(clientSocket, dsi, dso);
}
- String errorMessage = "Type of request is not implemented in this server";
dso.writeShort(CODE_ERROR);
+ String errorMessage = "Type of request is not implemented in this server";
dso.writeUTF(errorMessage);
System.err.println("Migration server received unknown type of request (" + requestType
+ ") from " + clientSocket.getInetAddress().getHostAddress());
@@ -494,7 +491,6 @@ public class MigrationServer {
}
abstract void process(MigrationServer server) throws IOException;
-
}
/**
@@ -506,12 +502,12 @@ public class MigrationServer {
RegionRequest(Socket clientSocket, DataInputStream dsi, DataOutputStream dso)
throws IOException {
super(clientSocket, dsi, dso);
- regionName = dsi.readUTF();
+ this.regionName = dsi.readUTF();
}
@Override
public String toString() {
- return "request for contents of region '" + this.regionName + "'";
+ return "request for contents of region '" + this.regionName + '\'';
}
@Override
@@ -519,7 +515,7 @@ public class MigrationServer {
Cache cache = server.getCache();
Region region = null;
try {
- region = cache.getRegion(regionName);
+ region = cache.getRegion(this.regionName);
if (region == null) {
String errorMessage = "Error: region " + this.regionName + " not found in cache";
System.err.println(errorMessage);
@@ -527,12 +523,12 @@ public class MigrationServer {
}
} catch (IllegalArgumentException e) {
String errorMessage = "Error: malformed region name";
- System.err.println(errorMessage);
+ logger.warn(errorMessage, e);
writeErrorResponse(errorMessage);
}
try {
- for (Iterator it = region.entrySet().iterator(); it.hasNext();) {
- sendEntry((Region.Entry) it.next());
+ for (Object o : region.entrySet()) {
+ sendEntry((Entry) o);
}
this.dso.writeShort(CODE_COMPLETED);
} catch (Exception e) {
@@ -540,22 +536,21 @@ public class MigrationServer {
}
}
- private void sendEntry(Region.Entry entry) throws Exception {
+ private void sendEntry(Region.Entry entry) throws IOException {
Object key = entry.getKey();
Object value = entry.getValue();
if (!(key instanceof Serializable)) {
- throw new IOException("Could not serialize entry for '" + key + "'");
+ throw new IOException("Could not serialize entry for '" + key + '\'');
}
if (!(value instanceof Serializable)) {
- throw new IOException("Could not serialize entry for '" + key + "'");
+ throw new IOException("Could not serialize entry for '" + key + '\'');
}
if (VERBOSE) {
System.out.println("Sending " + key);
}
- dso.writeShort(CODE_ENTRY);
- (new ObjectOutputStream(clientSocket.getOutputStream())).writeObject(key);
- (new ObjectOutputStream(clientSocket.getOutputStream())).writeObject(value);
+ this.dso.writeShort(CODE_ENTRY);
+ new ObjectOutputStream(clientSocket.getOutputStream()).writeObject(key);
+ new ObjectOutputStream(clientSocket.getOutputStream()).writeObject(value);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/PdxSerializerObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/PdxSerializerObject.java b/geode-core/src/main/java/org/apache/geode/internal/PdxSerializerObject.java
index bbb3d4c..e299fbc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/PdxSerializerObject.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/PdxSerializerObject.java
@@ -20,7 +20,7 @@ package org.apache.geode.internal;
* org.apache package.
*
* This is necessary because we exclude all other objects from the org.apache package. See
- * {@link InternalDataSerializer#writePdx(java.io.DataOutput, org.apache.geode.internal.cache.GemFireCacheImpl, Object, org.apache.geode.pdx.PdxSerializer)}
+ * {@link InternalDataSerializer#writePdx(java.io.DataOutput, org.apache.geode.internal.cache.InternalCache, Object, org.apache.geode.pdx.PdxSerializer)}
*
*
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientHealthMonitoringRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientHealthMonitoringRegion.java b/geode-core/src/main/java/org/apache/geode/internal/admin/ClientHealthMonitoringRegion.java
index ad33588..b1ae54d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientHealthMonitoringRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/ClientHealthMonitoringRegion.java
@@ -22,53 +22,53 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.Scope;
import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* This is an admin (meta) region used by the client health monitoring service to publish the client
* health details to the cache-server.
- *
*/
-
public class ClientHealthMonitoringRegion {
- public final static String ADMIN_REGION_NAME = "__ADMIN_CLIENT_HEALTH_MONITORING__";
- public final static int ADMIN_REGION_EXPIRY_INTERVAL = 20;
+ static final String ADMIN_REGION_NAME = "__ADMIN_CLIENT_HEALTH_MONITORING__";
+
+ static final int ADMIN_REGION_EXPIRY_INTERVAL = 20;
/**
* Instance for current cache
- *
- * @guarded.By ClientHealthMonitoringRegion.class
+ * <p>
+ * GuardedBy ClientHealthMonitoringRegion.class
*/
- static Region currentInstance;
+ private static Region currentInstance;
/**
* This is an accessor method used to get the reference of this region. If this region is not yet
* initialized, then it attempts to create it.
*
- * @param c the Cache we are currently using
+ * @param cache the Cache we are currently using
* @return ClientHealthMonitoringRegion reference.
*/
- public static synchronized Region getInstance(GemFireCacheImpl c) {
- if (currentInstance != null && currentInstance.getCache() == c && !c.isClosed()) {
+ public static synchronized Region getInstance(InternalCache cache) {
+ if (currentInstance != null && currentInstance.getCache() == cache && !cache.isClosed()) {
return currentInstance;
}
- if (c == null || c.isClosed()) {
+ if (cache == null || cache.isClosed()) {
return null; // give up
}
- initialize(c);
+ initialize(cache);
return currentInstance;
}
/**
* This method creates the client health monitoring region.
- *
+ * <p>
+ * GuardedBy ClientHealthMonitoringRegion.class
+ *
* @param cache The current GemFire Cache
- * @guarded.By ClientHealthMonitoringRegion.class
*/
- private static void initialize(GemFireCacheImpl cache) {
+ private static void initialize(InternalCache cache) {
try {
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientStatsManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientStatsManager.java b/geode-core/src/main/java/org/apache/geode/internal/admin/ClientStatsManager.java
index de6a43a..4276500 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/ClientStatsManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/ClientStatsManager.java
@@ -15,7 +15,6 @@
package org.apache.geode.internal.admin;
import java.util.Date;
-import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -25,7 +24,6 @@ import org.apache.geode.cache.CacheWriterException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.internal.PoolImpl;
import org.apache.geode.cache.client.internal.ServerRegionProxy;
-import org.apache.geode.cache.query.CqQuery;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.i18n.LogWriterI18n;
@@ -33,30 +31,30 @@ import org.apache.geode.internal.admin.remote.ClientHealthStats;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.management.internal.cli.CliUtil;
/**
* This class publishes the client statistics using the admin region.
- *
*/
public class ClientStatsManager {
/**
* Last cache that was initialized
*
- * @guarded.By ClientStatsManager.class
+ * GuardedBy ClientStatsManager.class
*/
- static GemFireCacheImpl lastInitializedCache = null;
+ private static InternalCache lastInitializedCache = null;
/**
- * @guarded.By ClientStatsManager.class
+ * GuardedBy ClientStatsManager.class
*/
private static Statistics cachePerfStats = null;
/**
- * @guarded.By ClientStatsManager.class
+ * GuardedBy ClientStatsManager.class
*/
private static Statistics vmStats = null;
@@ -66,7 +64,7 @@ public class ClientStatsManager {
* @param pool Connection pool which may be used for admin region.
*/
public static synchronized void publishClientStats(PoolImpl pool) {
- GemFireCacheImpl currentCache = GemFireCacheImpl.getInstance();
+ InternalCache currentCache = GemFireCacheImpl.getInstance();
if (!initializeStatistics(currentCache)) {
return; // handles null case too
}
@@ -106,9 +104,9 @@ public class ClientStatsManager {
logger.info(LocalizedStrings.ClientStatsManager_FAILED_TO_PUBLISH_CLIENT_STATISTICS, e);
}
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine("Exiting ClientStatsManager#publishClientStats.");
-
+ }
}
public static void cleanupForTests() {
@@ -117,12 +115,12 @@ public class ClientStatsManager {
/**
* This method initializes the client statistics to be queried.
- *
+ *
+ * GuardedBy ClientStatsManager.class
+ *
* @return true if statistics correctly initialized
- * @guarded.By ClientStatsManager.class
*/
- private static boolean initializeStatistics(GemFireCacheImpl currentCache) {
-
+ private static boolean initializeStatistics(InternalCache currentCache) {
if (currentCache == null) {
return false;
}
@@ -176,7 +174,6 @@ public class ClientStatsManager {
"VMStats");
}
-
return true;
}
@@ -186,86 +183,81 @@ public class ClientStatsManager {
*
* @return the client health stats object to be published to the server.
*/
- private static ClientHealthStats getClientHealthStats(GemFireCacheImpl currentCache,
- PoolImpl pool) {
+ private static ClientHealthStats getClientHealthStats(InternalCache currentCache, PoolImpl pool) {
if (currentCache == null) {
return null;
}
ClientHealthStats stats = new ClientHealthStats();
LogWriterI18n logger = currentCache.getLoggerI18n();
- {
- int gets = -1;
- int puts = -1;
- int misses = -1;
- long processCpuTime = -1;
- int threads = -1;
- int cacheListenerCalls = -1;
- int cpus = -1;
- String poolName = "";
-
- if (cachePerfStats != null) {
- gets = cachePerfStats.getInt("gets");
- puts = cachePerfStats.getInt("puts");
- misses = cachePerfStats.getInt("misses");
- cacheListenerCalls = cachePerfStats.getInt("cacheListenerCallsCompleted");
- }
-
- if (vmStats != null) {
- processCpuTime = vmStats.getLong("processCpuTime");
- threads = vmStats.getInt("threads");
- cpus = vmStats.getInt("cpus");
- }
- stats.setNumOfGets(gets);
- stats.setNumOfPuts(puts);
- stats.setNumOfMisses(misses);
- stats.setNumOfCacheListenerCalls(cacheListenerCalls);
- stats.setProcessCpuTime(processCpuTime);
- stats.setNumOfThreads(threads);
- stats.setCpus(cpus);
+ int gets = -1;
+ int puts = -1;
+ int misses = -1;
+ int cacheListenerCalls = -1;
- poolName = pool.getName();
- try {
- Map<String, String> newPoolStats = stats.getPoolStats();
- String poolStatsStr = "MinConnections=" + pool.getMinConnections() + ";MaxConnections="
- + pool.getMaxConnections() + ";Redudancy=" + pool.getSubscriptionRedundancy() + ";CQS="
- + pool.getQueryService().getCqs().length;
- logger.info(LocalizedStrings.DEBUG,
- "ClientHealthStats for poolname " + poolName + " poolStatsStr=" + poolStatsStr);
+ if (cachePerfStats != null) {
+ gets = cachePerfStats.getInt("gets");
+ puts = cachePerfStats.getInt("puts");
+ misses = cachePerfStats.getInt("misses");
+ cacheListenerCalls = cachePerfStats.getInt("cacheListenerCallsCompleted");
+ }
- newPoolStats.put(poolName, poolStatsStr);
+ long processCpuTime = -1;
+ int threads = -1;
+ int cpus = -1;
+ if (vmStats != null) {
+ processCpuTime = vmStats.getLong("processCpuTime");
+ threads = vmStats.getInt("threads");
+ cpus = vmStats.getInt("cpus");
+ }
- // consider old stats
- Region clientHealthMonitoringRegion =
- ClientHealthMonitoringRegion.getInstance(currentCache);
+ stats.setNumOfGets(gets);
+ stats.setNumOfPuts(puts);
+ stats.setNumOfMisses(misses);
+ stats.setNumOfCacheListenerCalls(cacheListenerCalls);
+ stats.setProcessCpuTime(processCpuTime);
+ stats.setNumOfThreads(threads);
+ stats.setCpus(cpus);
- if (clientHealthMonitoringRegion != null) {
- InternalDistributedSystem ds =
- (InternalDistributedSystem) currentCache.getDistributedSystem();
- ClientHealthStats oldStats =
- (ClientHealthStats) clientHealthMonitoringRegion.get(ds.getMemberId());
- logger.info(LocalizedStrings.DEBUG, "getClientHealthStats got oldStats " + oldStats);
- if (oldStats != null) {
- Map<String, String> oldPoolStats = oldStats.getPoolStats();
- logger.info(LocalizedStrings.DEBUG,
- "getClientHealthStats got oldPoolStats " + oldPoolStats);
- if (oldPoolStats != null) {
- Iterator<Entry<String, String>> it = oldPoolStats.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, String> entry = it.next();
- if (!poolName.equals(entry.getKey())) {
- stats.getPoolStats().put(entry.getKey(), entry.getValue());
- }
+ String poolName = pool.getName();
+ try {
+ Map<String, String> newPoolStats = stats.getPoolStats();
+ String poolStatsStr = "MinConnections=" + pool.getMinConnections() + ";MaxConnections="
+ + pool.getMaxConnections() + ";Redundancy=" + pool.getSubscriptionRedundancy() + ";CQS="
+ + pool.getQueryService().getCqs().length;
+ logger.info(LocalizedStrings.DEBUG,
+ "ClientHealthStats for poolName " + poolName + " poolStatsStr=" + poolStatsStr);
+
+ newPoolStats.put(poolName, poolStatsStr);
+
+ // consider old stats
+ Region clientHealthMonitoringRegion = ClientHealthMonitoringRegion.getInstance(currentCache);
+
+ if (clientHealthMonitoringRegion != null) {
+ InternalDistributedSystem ds =
+ (InternalDistributedSystem) currentCache.getDistributedSystem();
+ ClientHealthStats oldStats =
+ (ClientHealthStats) clientHealthMonitoringRegion.get(ds.getMemberId());
+ logger.info(LocalizedStrings.DEBUG, "getClientHealthStats got oldStats " + oldStats);
+ if (oldStats != null) {
+ Map<String, String> oldPoolStats = oldStats.getPoolStats();
+ logger.info(LocalizedStrings.DEBUG,
+ "getClientHealthStats got oldPoolStats " + oldPoolStats);
+ if (oldPoolStats != null) {
+ for (Entry<String, String> entry : oldPoolStats.entrySet()) {
+ if (!poolName.equals(entry.getKey())) {
+ stats.getPoolStats().put(entry.getKey(), entry.getValue());
}
}
}
}
-
- } catch (Exception e) {
- logger.fine("Exception in getting pool stats in getClientHealthStats "
- + CliUtil.stackTraceAsString(e));
}
+
+ } catch (Exception e) {
+ logger.fine("Exception in getting pool stats in getClientHealthStats "
+ + CliUtil.stackTraceAsString(e));
}
+
stats.setUpdateTime(new Date());
return stats;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
index aeb5e95..4e915d6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
@@ -14,15 +14,18 @@
*/
package org.apache.geode.internal.admin.remote;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.CacheServerImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import java.io.*;
-import java.util.*;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A message that is sent in response to a {@link BridgeServerResponse}. It perform an operation on
@@ -38,17 +41,15 @@ public final class BridgeServerResponse extends AdminResponse {
/** An exception thrown while performing the operation */
private Exception exception;
- ////////////////////// Static Methods //////////////////////
-
/**
- * Creates a <code>BridgeServerResponse</code> in response to the given request.
+ * Creates a {@code BridgeServerResponse} in response to the given request.
*/
static BridgeServerResponse create(DistributionManager dm, BridgeServerRequest request) {
BridgeServerResponse m = new BridgeServerResponse();
m.setRecipient(request.getSender());
try {
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getInstanceCloseOk(dm.getSystem());
+ InternalCache cache = (InternalCache) CacheFactory.getInstanceCloseOk(dm.getSystem());
if (request.getCacheId() != System.identityHashCode(cache)) {
m.bridgeInfo = null;
@@ -66,8 +67,8 @@ public final class BridgeServerResponse extends AdminResponse {
int id = request.getBridgeId();
// Note that since this is only an informational request
// it is not necessary to synchronize on allBridgeServersLock
- for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext();) {
- CacheServerImpl bridge = (CacheServerImpl) iter.next();
+ for (CacheServer cacheServer : cache.getCacheServers()) {
+ CacheServerImpl bridge = (CacheServerImpl) cacheServer;
if (System.identityHashCode(bridge) == id) {
m.bridgeInfo = new RemoteBridgeServer(bridge);
break;
@@ -81,8 +82,8 @@ public final class BridgeServerResponse extends AdminResponse {
case BridgeServerRequest.START_OPERATION: {
RemoteBridgeServer config = request.getBridgeInfo();
- for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext();) {
- CacheServerImpl bridge = (CacheServerImpl) iter.next();
+ for (CacheServer cacheServer : cache.getCacheServers()) {
+ CacheServerImpl bridge = (CacheServerImpl) cacheServer;
if (System.identityHashCode(bridge) == config.getId()) {
bridge.configureFrom(config);
bridge.start();
@@ -98,8 +99,8 @@ public final class BridgeServerResponse extends AdminResponse {
case BridgeServerRequest.STOP_OPERATION: {
RemoteBridgeServer config = request.getBridgeInfo();
- for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext();) {
- CacheServerImpl bridge = (CacheServerImpl) iter.next();
+ for (CacheServer cacheServer : cache.getCacheServers()) {
+ CacheServerImpl bridge = (CacheServerImpl) cacheServer;
if (System.identityHashCode(bridge) == config.getId()) {
bridge.stop();
m.bridgeInfo = new RemoteBridgeServer(bridge);
@@ -115,10 +116,9 @@ public final class BridgeServerResponse extends AdminResponse {
default:
Assert.assertTrue(false, "Unknown bridge server operation: " + operation);
}
-
}
- } catch (CancelException ex) {
+ } catch (CancelException ignore) {
m.bridgeInfo = null;
} catch (Exception ex) {
@@ -128,12 +128,10 @@ public final class BridgeServerResponse extends AdminResponse {
return m;
}
- ////////////////////// Instance Methods //////////////////////
-
/**
* Returns information about the bridge operated on
*/
- public RemoteBridgeServer getBridgeInfo() {
+ RemoteBridgeServer getBridgeInfo() {
return this.bridgeInfo;
}
@@ -144,6 +142,7 @@ public final class BridgeServerResponse extends AdminResponse {
return this.exception;
}
+ @Override
public int getDSFID() {
return BRIDGE_SERVER_RESPONSE;
}
@@ -158,8 +157,7 @@ public final class BridgeServerResponse extends AdminResponse {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.bridgeInfo = (RemoteBridgeServer) DataSerializer.readObject(in);
- this.exception = (Exception) DataSerializer.readObject(in);
+ this.bridgeInfo = DataSerializer.readObject(in);
+ this.exception = DataSerializer.readObject(in);
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
index b806405..aedf67e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
@@ -12,20 +12,19 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
-
package org.apache.geode.internal.admin.remote;
-// import org.apache.geode.internal.admin.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.*;
-import org.apache.geode.cache.*;
-import org.apache.geode.internal.*;
-import org.apache.geode.internal.cache.*;
-import java.io.*;
-// import java.net.*;
-// import java.util.*;
-import org.apache.geode.distributed.internal.membership.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A message that is sent in response to a {@link CacheConfigRequest}.
@@ -33,7 +32,7 @@ import org.apache.geode.distributed.internal.membership.*;
* @since GemFire 3.5
*/
public final class CacheConfigResponse extends AdminResponse {
- // instance variables
+
private RemoteCacheInfo info;
/**
@@ -44,14 +43,14 @@ public final class CacheConfigResponse extends AdminResponse {
private Exception exception;
/**
- * Returns a <code>CacheConfigResponse</code> that will be returned to the specified recipient.
+ * Returns a {@code CacheConfigResponse} that will be returned to the specified recipient.
*/
public static CacheConfigResponse create(DistributionManager dm,
InternalDistributedMember recipient, int cacheId, byte attributeCode, int newValue) {
CacheConfigResponse m = new CacheConfigResponse();
m.setRecipient(recipient);
try {
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getInstanceCloseOk(dm.getSystem());
+ InternalCache c = (InternalCache) CacheFactory.getInstanceCloseOk(dm.getSystem());
if (cacheId != System.identityHashCode(c)) {
m.info = null;
} else {
@@ -70,7 +69,7 @@ public final class CacheConfigResponse extends AdminResponse {
}
}
m.info = new RemoteCacheInfo(c);
- } catch (CancelException ex) {
+ } catch (CancelException ignore) {
m.info = null;
} catch (Exception ex) {
@@ -80,7 +79,7 @@ public final class CacheConfigResponse extends AdminResponse {
return m;
}
- public RemoteCacheInfo getCacheInfo() {
+ RemoteCacheInfo getCacheInfo() {
return this.info;
}
@@ -91,6 +90,7 @@ public final class CacheConfigResponse extends AdminResponse {
return this.exception;
}
+ @Override
public int getDSFID() {
return CACHE_CONFIG_RESPONSE;
}
@@ -105,8 +105,8 @@ public final class CacheConfigResponse extends AdminResponse {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.info = (RemoteCacheInfo) DataSerializer.readObject(in);
- this.exception = (Exception) DataSerializer.readObject(in);
+ this.info = DataSerializer.readObject(in);
+ this.exception = DataSerializer.readObject(in);
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
index ffa6f09..5a5c36c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
@@ -12,20 +12,18 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
-
package org.apache.geode.internal.admin.remote;
-// import org.apache.geode.internal.admin.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.*;
-import org.apache.geode.cache.*;
-// import org.apache.geode.internal.*;
-import org.apache.geode.internal.cache.*;
-import java.io.*;
-// import java.net.*;
-// import java.util.*;
-import org.apache.geode.distributed.internal.membership.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A message that is sent in response to a {@link CacheInfoRequest}.
@@ -33,30 +31,30 @@ import org.apache.geode.distributed.internal.membership.*;
* @since GemFire 3.5
*/
public final class CacheInfoResponse extends AdminResponse {
- // instance variables
- private RemoteCacheInfo info;
+ private RemoteCacheInfo info;
/**
- * Returns a <code>CacheInfoResponse</code> that will be returned to the specified recipient.
+ * Returns a {@code CacheInfoResponse} that will be returned to the specified recipient.
*/
public static CacheInfoResponse create(DistributionManager dm,
InternalDistributedMember recipient) {
CacheInfoResponse m = new CacheInfoResponse();
m.setRecipient(recipient);
try {
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getInstanceCloseOk(dm.getSystem());
+ InternalCache c = (InternalCache) CacheFactory.getInstanceCloseOk(dm.getSystem());
m.info = new RemoteCacheInfo(c);
- } catch (CancelException ex) {
+ } catch (CancelException ignore) {
m.info = null;
}
return m;
}
- public RemoteCacheInfo getCacheInfo() {
+ RemoteCacheInfo getCacheInfo() {
return this.info;
}
+ @Override
public int getDSFID() {
return CACHE_INFO_RESPONSE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
index 6894903..de0e301 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
@@ -24,7 +24,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DM;
@@ -33,14 +36,19 @@ import org.apache.geode.distributed.internal.DistributionMessage;
import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.internal.cache.DiskStoreImpl;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.ArrayUtils;
/**
* An instruction to all members with cache that they should compact their disk stores.
- *
*/
public class CompactRequest extends CliLegacyMessage {
- public CompactRequest() {}
+ private static final Logger logger = LogService.getLogger();
+
+ public CompactRequest() {
+ // do nothing
+ }
public static Map<DistributedMember, Set<PersistentID>> send(DM dm) {
Set recipients = dm.getOtherDistributionManagerIds();
@@ -61,7 +69,7 @@ public class CompactRequest extends CliLegacyMessage {
throw e;
}
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.warn(e);
}
return replyProcessor.results;
@@ -74,12 +82,12 @@ public class CompactRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- HashSet<PersistentID> compactedStores = new HashSet<PersistentID>();
+ InternalCache cache = GemFireCacheImpl.getInstance();
+ HashSet<PersistentID> compactedStores = new HashSet<>();
if (cache != null && !cache.isClosed()) {
- for (DiskStoreImpl store : cache.listDiskStoresIncludingRegionOwned()) {
+ for (DiskStore store : cache.listDiskStoresIncludingRegionOwned()) {
if (store.forceCompaction()) {
- compactedStores.add(store.getPersistentID());
+ compactedStores.add(((DiskStoreImpl) store).getPersistentID());
}
}
}
@@ -87,6 +95,7 @@ public class CompactRequest extends CliLegacyMessage {
return new CompactResponse(this.getSender(), compactedStores);
}
+ @Override
public int getDSFID() {
return COMPACT_REQUEST;
}
@@ -111,7 +120,7 @@ public class CompactRequest extends CliLegacyMessage {
Map<DistributedMember, Set<PersistentID>> results =
Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
- public CompactReplyProcessor(DM dm, Collection initMembers) {
+ CompactReplyProcessor(DM dm, Collection initMembers) {
super(dm, initMembers);
}
@@ -128,14 +137,12 @@ public class CompactRequest extends CliLegacyMessage {
@Override
protected void process(DistributionMessage msg, boolean warn) {
if (msg instanceof CompactResponse) {
- final HashSet<PersistentID> persistentIds = ((CompactResponse) msg).getPersistentIds();
+ final Set<PersistentID> persistentIds = ((CompactResponse) msg).getPersistentIds();
if (persistentIds != null && !persistentIds.isEmpty()) {
- results.put(msg.getSender(), persistentIds);
+ this.results.put(msg.getSender(), persistentIds);
}
}
super.process(msg, warn);
}
-
-
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
index ff62b50..6cc6f2f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
@@ -12,18 +12,18 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.admin.remote;
-// import org.apache.geode.internal.admin.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.*;
-import org.apache.geode.cache.*; // import org.apache.geode.internal.*;
-import org.apache.geode.internal.cache.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
-import java.io.*; // import java.net.*;
-// import java.util.*;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.CacheServerImpl;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A message that is sent in response to a {@link DurableClientInfoRequest}.
@@ -38,16 +38,15 @@ public class DurableClientInfoResponse extends AdminResponse {
private boolean returnVal = false;
/**
- * Returns a <code>DurableClientInfoResponse</code> that will be returned to the specified
- * recipient.
+ * Returns a {@code DurableClientInfoResponse} that will be returned to the specified recipient.
*/
public static DurableClientInfoResponse create(DistributionManager dm,
InternalDistributedMember recipient, DurableClientInfoRequest request) {
DurableClientInfoResponse m = new DurableClientInfoResponse();
m.setRecipient(recipient);
try {
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getInstanceCloseOk(dm.getSystem());
- if (c.getCacheServers().size() > 0) {
+ InternalCache c = (InternalCache) CacheFactory.getInstanceCloseOk(dm.getSystem());
+ if (!c.getCacheServers().isEmpty()) {
CacheServerImpl server = (CacheServerImpl) c.getCacheServers().iterator().next();
switch (request.action) {
@@ -63,35 +62,34 @@ public class DurableClientInfoResponse extends AdminResponse {
}
}
}
- } catch (CacheClosedException ex) {
+ } catch (CacheClosedException ignore) {
// do nothing
}
return m;
}
- public boolean getResultBoolean() {
+ boolean getResultBoolean() {
return this.returnVal;
}
+ @Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
out.writeBoolean(this.returnVal);
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.returnVal = in.readBoolean();
}
+ @Override
public String toString() {
return "DurableClientInfoResponse from " + this.getSender();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.DataSerializableFixedID#getDSFID()
- */
+ @Override
public int getDSFID() {
return DURABLE_CLIENT_INFO_RESPONSE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
index f5d9b4f..0e5686b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
@@ -22,18 +22,20 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.DistributionMessage;
import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
+import org.apache.geode.internal.logging.LogService;
/**
* A request to all members for any persistent members that they are waiting for. TODO prpersist -
@@ -41,6 +43,7 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
* request response to a single member. Maybe we need to a new base class.
*/
public class MissingPersistentIDsRequest extends CliLegacyMessage {
+ private static final Logger logger = LogService.getLogger();
public static Set<PersistentID> send(DM dm) {
Set recipients = dm.getOtherDistributionManagerIds();
@@ -59,12 +62,12 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
throw e;
}
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.warn(e);
}
+
Set<PersistentID> results = replyProcessor.missing;
Set<PersistentID> existing = replyProcessor.existing;
-
MissingPersistentIDsResponse localResponse =
(MissingPersistentIDsResponse) request.createResponse((DistributionManager) dm);
results.addAll(localResponse.getMissingIds());
@@ -76,9 +79,9 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- Set<PersistentID> missingIds = new HashSet<PersistentID>();
- Set<PersistentID> localPatterns = new HashSet<PersistentID>();
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ Set<PersistentID> missingIds = new HashSet<>();
+ Set<PersistentID> localPatterns = new HashSet<>();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
PersistentMemberManager mm = cache.getPersistentMemberManager();
Map<String, Set<PersistentMemberID>> waitingRegions = mm.getWaitingRegions();
@@ -96,8 +99,6 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
return new MissingPersistentIDsResponse(missingIds, localPatterns, this.getSender());
}
-
-
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
@@ -105,10 +106,11 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
@Override
protected Object clone() throws CloneNotSupportedException {
- // TODO Auto-generated method stub
+ // TODO: delete this clone method?
return super.clone();
}
+ @Override
public int getDSFID() {
return MISSING_PERSISTENT_IDS_REQUEST;
}
@@ -117,19 +119,15 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
Set<PersistentID> missing = Collections.synchronizedSet(new TreeSet<PersistentID>());
Set<PersistentID> existing = Collections.synchronizedSet(new TreeSet<PersistentID>());
- /**
- * @param dm
- * @param recipients
- */
- public MissingPersistentIDProcessor(DM dm, Set recipients) {
+ MissingPersistentIDProcessor(DM dm, Set recipients) {
super(dm, recipients);
}
@Override
protected void process(DistributionMessage msg, boolean warn) {
if (msg instanceof MissingPersistentIDsResponse) {
- missing.addAll(((MissingPersistentIDsResponse) msg).getMissingIds());
- existing.addAll(((MissingPersistentIDsResponse) msg).getLocalIds());
+ this.missing.addAll(((MissingPersistentIDsResponse) msg).getMissingIds());
+ this.existing.addAll(((MissingPersistentIDsResponse) msg).getLocalIds());
}
super.process(msg, warn);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
index 2f187ef..227fd06 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
@@ -19,6 +19,8 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.Set;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.cache.persistence.RevokeFailedException;
import org.apache.geode.distributed.internal.DM;
@@ -26,23 +28,27 @@ import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
/**
* An instruction to all members that they should forget about the persistent member described by
* this pattern. TODO prpersist - This extends AdminRequest, but it doesn't work with most of the
* admin paradigm, which is a request response to a single member. Maybe we need to a new base
* class.
- *
*/
public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
- PersistentMemberPattern pattern;
+ private static final Logger logger = LogService.getLogger();
+
+ private PersistentMemberPattern pattern;
+
private boolean cancel;
public PrepareRevokePersistentIDRequest() {
-
+ // do nothing
}
public PrepareRevokePersistentIDRequest(PersistentMemberPattern pattern, boolean cancel) {
@@ -77,7 +83,7 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
}
throw e;
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.warn(e);
}
request.setSender(dm.getId());
request.createResponse((DistributionManager) dm);
@@ -85,16 +91,16 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
PersistentMemberManager mm = cache.getPersistentMemberManager();
- if (cancel) {
- mm.cancelRevoke(pattern);
+ if (this.cancel) {
+ mm.cancelRevoke(this.pattern);
} else {
- if (!mm.prepareRevoke(pattern, dm, getSender())) {
+ if (!mm.prepareRevoke(this.pattern, dm, getSender())) {
throw new RevokeFailedException(
LocalizedStrings.RevokeFailedException_Member_0_is_already_running_1
- .toLocalizedString(dm.getId(), pattern));
+ .toLocalizedString(dm.getId(), this.pattern));
}
}
}
@@ -102,6 +108,7 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
return new RevokePersistentIDResponse(this.getSender());
}
+ @Override
public int getDSFID() {
return PREPARE_REVOKE_PERSISTENT_ID_REQUEST;
}
@@ -109,16 +116,15 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- pattern = new PersistentMemberPattern();
- InternalDataSerializer.invokeFromData(pattern, in);
- cancel = in.readBoolean();
+ this.pattern = new PersistentMemberPattern();
+ InternalDataSerializer.invokeFromData(this.pattern, in);
+ this.cancel = in.readBoolean();
}
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
- InternalDataSerializer.invokeToData(pattern, out);
- out.writeBoolean(cancel);
+ InternalDataSerializer.invokeToData(this.pattern, out);
+ out.writeBoolean(this.cancel);
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
index d7a910b..9e973f9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.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.internal.admin.remote;
import java.io.DataInput;
@@ -25,20 +24,19 @@ import org.apache.geode.cache.CacheFactory;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A message that is sent to a particular distribution manager to get its current
* {@link org.apache.geode.admin.GemFireMemberStatus}.
- *
*/
public class RefreshMemberSnapshotResponse extends AdminResponse {
- // instance variables
+
GemFireMemberStatus snapshot;
/**
- * Returns a <code>FetchSysCfgResponse</code> that will be returned to the specified recipient.
- * The message will contains a copy of the local manager's config.
+ * Returns a {@code FetchSysCfgResponse} that will be returned to the specified recipient. The
+ * message will contains a copy of the local manager's config.
*/
public static RefreshMemberSnapshotResponse create(DistributionManager dm,
InternalDistributedMember recipient) {
@@ -47,9 +45,9 @@ public class RefreshMemberSnapshotResponse extends AdminResponse {
try {
DistributedSystem sys = dm.getSystem();
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getInstance(sys);
+ InternalCache c = (InternalCache) CacheFactory.getInstance(sys);
m.snapshot = new GemFireMemberStatus(c);
- } catch (Exception ex) {
+ } catch (Exception ignore) {
m.snapshot = null;
}
return m;
@@ -71,17 +69,17 @@ public class RefreshMemberSnapshotResponse extends AdminResponse {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.snapshot = (GemFireMemberStatus) DataSerializer.readObject(in);
+ this.snapshot = DataSerializer.readObject(in);
}
/**
* Returns the DataSerializer fixed id for the class that implements this method.
*/
+ @Override
public int getDSFID() {
return REFRESH_MEMBER_SNAP_RESPONSE;
}
-
@Override
public String toString() {
return "RefreshMemberSnapshotResponse from " + this.getRecipient() + " snapshot="
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
index ba4d848..1ce35ad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.admin.remote;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.Iterator;
import java.util.Set;
import org.apache.logging.log4j.Logger;
@@ -29,25 +28,30 @@ import org.apache.geode.cache.Region;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
/**
* Admin response carrying region info for a member
- *
*/
public class RegionSubRegionsSizeResponse extends AdminResponse implements Cancellable {
private static final Logger logger = LogService.getLogger();
- public RegionSubRegionsSizeResponse() {}
+ private RegionSubRegionSnapshot snapshot;
+
+ private boolean cancelled;
+
+ public RegionSubRegionsSizeResponse() {
+ // do nothing
+ }
public RegionSubRegionSnapshot getSnapshot() {
return this.snapshot;
}
/**
- * Returns a <code>RegionSubRegionsSizeResponse</code> that will be returned to the specified
+ * Returns a {@code RegionSubRegionsSizeResponse} that will be returned to the specified
* recipient. The message will contains a copy of the region snapshot
*/
public static RegionSubRegionsSizeResponse create(DistributionManager dm,
@@ -60,15 +64,17 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
return m;
}
- public void populateSnapshot(DistributionManager dm) {
- if (cancelled)
+ void populateSnapshot(DistributionManager dm) {
+ if (this.cancelled) {
return;
+ }
DistributedSystem sys = dm.getSystem();
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getInstance(sys);
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(sys);
- if (cancelled)
+ if (this.cancelled) {
return;
+ }
RegionSubRegionSnapshot root = new RegionSubRegionSnapshot();
/*
@@ -93,19 +99,17 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
* @param regions collection of sub-regions of the region represented by parentSnapShot
* @param cache cache instance is used for to get the LogWriter instance to log exceptions if any
*/
- // Re-factored to fix #41060
- void populateRegionSubRegions(RegionSubRegionSnapshot parentSnapShot, Set regions,
- GemFireCacheImpl cache) {
- if (cancelled)
+ private void populateRegionSubRegions(RegionSubRegionSnapshot parentSnapShot, Set regions,
+ InternalCache cache) {
+ if (this.cancelled) {
return;
+ }
- Region subRegion = null;
- RegionSubRegionSnapshot subRegionSnapShot = null;
- for (Iterator iter = regions.iterator(); iter.hasNext();) {
- subRegion = (Region) iter.next();
+ for (Object region : regions) {
+ Region subRegion = (Region) region;
try {
- subRegionSnapShot = new RegionSubRegionSnapshot(subRegion);
+ RegionSubRegionSnapshot subRegionSnapShot = new RegionSubRegionSnapshot(subRegion);
parentSnapShot.addSubRegion(subRegionSnapShot);
Set subRegions = subRegion.subregions(false);
@@ -117,15 +121,15 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
}
}
-
+ @Override
public synchronized void cancel() {
- cancelled = true;
+ this.cancelled = true;
}
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
- out.writeBoolean(cancelled);
+ out.writeBoolean(this.cancelled);
DataSerializer.writeObject(this.snapshot, out);
}
@@ -133,23 +137,20 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.cancelled = in.readBoolean();
- this.snapshot = (RegionSubRegionSnapshot) DataSerializer.readObject(in);
+ this.snapshot = DataSerializer.readObject(in);
}
/**
* Returns the DataSerializer fixed id for the class that implements this method.
*/
+ @Override
public int getDSFID() {
return REGION_SUB_SIZE_RESPONSE;
}
@Override
public String toString() {
- return "RegionSubRegionsSizeResponse [from=" + this.getRecipient() + " "
- + (snapshot == null ? "null" : snapshot.toString());
+ return "RegionSubRegionsSizeResponse [from=" + this.getRecipient() + ' '
+ + (this.snapshot == null ? "null" : this.snapshot.toString());
}
-
- private RegionSubRegionSnapshot snapshot;
-
- private boolean cancelled;
}
[27/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndex.java
index 023fbb4..58bd2bf 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndex.java
@@ -12,10 +12,9 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.query.internal.index;
-import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+import static org.apache.geode.internal.lang.SystemUtils.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,14 +24,14 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.EntryDestroyedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
@@ -63,12 +62,13 @@ import org.apache.geode.cache.query.internal.RuntimeIterator;
import org.apache.geode.cache.query.internal.Support;
import org.apache.geode.cache.query.internal.index.HashIndex.IMQEvaluator.HashIndexComparator;
import org.apache.geode.cache.query.internal.index.IndexStore.IndexStoreEntry;
+import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.internal.types.StructTypeImpl;
import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.cache.query.types.ObjectType;
-import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionEntry;
import org.apache.geode.internal.cache.Token;
@@ -82,11 +82,10 @@ import org.apache.geode.internal.offheap.StoredObject;
* called explicitly with createHashIndex It requires the indexed expression be a path expression
* and the from clause has only one iterator. This implies there is only one value in the index for
* each region entry.
- *
+ * <p>
* This index does not support the storage of projection attributes.
- *
+ * <p>
* Currently this implementation only supports an index on a region path.
- *
*/
public class HashIndex extends AbstractIndex {
private static final Logger logger = LogService.getLogger();
@@ -118,7 +117,7 @@ public class HashIndex extends AbstractIndex {
/**
* Create a HashIndex that can be used when executing queries.
- *
+ *
* @param indexName the name of this index, used for statistics collection
* @param indexedExpression the expression to index on, a function dependent on region entries
* individually, limited to a path expression.
@@ -149,7 +148,7 @@ public class HashIndex extends AbstractIndex {
/**
* Get the index type
- *
+ *
* @return the type of index
*/
public IndexType getType() {
@@ -178,14 +177,10 @@ public class HashIndex extends AbstractIndex {
/**
* Add/Updates the index forward and reverse map. If index key for a RegionEntry is found same as
* previous key no update is performed.
- *
+ *
* This also updates the {@link IndexStatistics} numKeys and numValues as and when appropriate.
* One thing to notice though is no increment in numValues is performed if old key and new index
* key are found equal using {@link Object#equals(Object)}.
- *
- * @param key
- * @param entry
- * @throws IMQException
*/
private void basicAddMapping(Object key, RegionEntry entry) throws IMQException {
@@ -288,11 +283,10 @@ public class HashIndex extends AbstractIndex {
* inserted for the RegionEntry. In case of update only forward map is cleared of old key and NO
* update is performed on reverse map as that has already been done during
* {@link HashIndex#basicAddMapping(Object, RegionEntry)}.
- *
+ *
* @param key - Index key.
* @param entry RegionEntry for which is being updated by user.
* @param updateReverseMap true only when RegionEntry is invalidated/destroyed.
- * @throws IMQException
*/
private void basicRemoveMapping(Object key, RegionEntry entry, boolean updateReverseMap)
throws IMQException {
@@ -359,6 +353,7 @@ public class HashIndex extends AbstractIndex {
outerEntry = (Map.Entry) outer.next();
// }
outerKey = outerEntry.getKey();
+ // TODO: eliminate use of labels
inner: while (!incrementInner || inner.hasNext()) {
if (incrementInner) {
innerEntry = inner.next();
@@ -410,16 +405,8 @@ public class HashIndex extends AbstractIndex {
* used. Like, if condition is "p.ID = e.ID", {@link IndexInfo} will contain Left as p.ID, Right
* as e.ID and operator as TOK_EQ. This method will evaluate p.ID OR e.ID based on if it is inner
* or outer RegionEntry, and verify the p.ID = e.ID.
- *
- * @param entry
- * @param context
- * @param indexInfo
- * @param keyVal
+ *
* @return true if entry value and index value are consistent.
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
private boolean verifyInnerAndOuterEntryValues(RegionEntry entry, ExecutionContext context,
IndexInfo indexInfo, Object keyVal) throws FunctionDomainException, TypeMismatchException,
@@ -433,57 +420,6 @@ public class HashIndex extends AbstractIndex {
return evaluateEntry(indexInfo, context, keyVal);
}
- // TODO:Decsribe & test the function
- /**
- * @param outerEntries is a Set<RegionEntry>
- * @param innerEntries is a Set<RegionEntry>
- * @param key
- * @throws QueryInvocationTargetException
- * @throws NameResolutionException
- * @throws TypeMismatchException
- * @throws FunctionDomainException
- */
- private void populateListForEquiJoin(List list, Collection outerEntries, Collection innerEntries,
- ExecutionContext context, Object key) throws FunctionDomainException, TypeMismatchException,
- NameResolutionException, QueryInvocationTargetException {
-
- Assert.assertTrue((outerEntries != null && innerEntries != null),
- "OuterEntries or InnerEntries must not be null");
-
- Object values[][] = new Object[2][];
- int j = 0;
- Iterator itr = null;
- while (j < 2) {
- if (j == 0) {
- itr = outerEntries.iterator();
- } else {
- itr = innerEntries.iterator();
- }
- // TODO :Asif Identify appropriate size of the List
-
- // extract the values from the RegionEntries
- List dummy = new ArrayList();
- RegionEntry re = null;
- while (itr.hasNext()) {
- re = (RegionEntry) itr.next();
- // Bug#41010: We need to verify if Inner and Outer Entries
- // are consistent with index key values.
- boolean ok = true;
- if (re.isUpdateInProgress()) {
- IndexInfo[] indexInfo = (IndexInfo[]) context.cacheGet(CompiledValue.INDEX_INFO);
- IndexInfo indInfo = (j == 0) ? indexInfo[0] : indexInfo[1];
-
- ok = verifyInnerAndOuterEntryValues(re, context, indInfo, key);
- }
- if (ok) {
- dummy.add(getTargetObject(re));
- }
- }
- dummy.toArray(values[j++] = new Object[dummy.size()]);
- }
- list.add(values);
- }
-
public int getSizeEstimate(Object key, int operator, int matchLevel)
throws TypeMismatchException {
// Get approx size;
@@ -534,21 +470,19 @@ public class HashIndex extends AbstractIndex {
int limit = -1;
Boolean applyLimit = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_LIMIT_AT_INDEX);
- if (applyLimit != null && applyLimit.booleanValue()) {
- limit = ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)).intValue();
+ if (applyLimit != null && applyLimit) {
+ limit = (Integer) context.cacheGet(CompiledValue.RESULT_LIMIT);
}
Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
boolean applyOrderBy = false;
- boolean asc = true;
List orderByAttrs = null;
- boolean multiColOrderBy = false;
- if (orderByClause != null && orderByClause.booleanValue()) {
+ if (orderByClause != null && orderByClause) {
orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
CompiledSortCriterion csc = (CompiledSortCriterion) orderByAttrs.get(0);
- asc = !csc.getCriterion();
+ boolean asc = !csc.getCriterion();
applyOrderBy = true;
- multiColOrderBy = orderByAttrs.size() > 1;
+ boolean multiColOrderBy = orderByAttrs.size() > 1;
}
evaluate(key, operator, results, iterOps, runtimeItr, context, keysToRemove, projAttrib,
intermediateResults, isIntersection, limit, applyOrderBy, orderByAttrs);
@@ -623,8 +557,8 @@ public class HashIndex extends AbstractIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
- this.evaluator = new IMQEvaluator(ich);
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
+ this.evaluator = new IMQEvaluator(indexCreationHelper);
this.entriesSet.setEvaluator((HashIndex.IMQEvaluator) evaluator);
this.comparator = ((IMQEvaluator) evaluator).comparator;
}
@@ -747,18 +681,11 @@ public class HashIndex extends AbstractIndex {
* This evaluates the left and right side of a where condition for which this Index was used.
* Like, if condition is "ID > 1", {@link IndexInfo} will contain Left as ID, Right as '1' and
* operator as TOK_GT. This method will evaluate ID from region entry value and verify the ID > 1.
- *
+ *
* Note: IndexInfo is created for each query separately based on the condition being evaluated
* using the Index.
- *
- * @param indexInfo
- * @param context
- * @param keyVal
+ *
* @return true if RegionEntry value satisfies the where condition (contained in IndexInfo).
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
private boolean evaluateEntry(IndexInfo indexInfo, ExecutionContext context, Object keyVal)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
@@ -787,7 +714,7 @@ public class HashIndex extends AbstractIndex {
if (left == null && right == null) {
return Boolean.TRUE;
} else {
- return ((Boolean) TypeUtils.compare(left, right, operator)).booleanValue();
+ return (Boolean) TypeUtils.compare(left, right, operator);
}
}
@@ -797,7 +724,8 @@ public class HashIndex extends AbstractIndex {
*/
private Object getTargetObject(RegionEntry entry) {
if (this.indexOnValues) {
- Object o = entry.getValue((LocalRegion) getRegion()); // OFFHEAP: incrc, deserialize, decrc
+ // OFFHEAP: incrc, deserialize, decrc
+ Object o = entry.getValue((LocalRegion) getRegion());
try {
if (o == Token.INVALID) {
return null;
@@ -805,7 +733,7 @@ public class HashIndex extends AbstractIndex {
if (o instanceof CachedDeserializable) {
return ((CachedDeserializable) o).getDeserializedForReading();
}
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignored) {
return null;
}
return o;
@@ -829,7 +757,7 @@ public class HashIndex extends AbstractIndex {
} else if (o instanceof CachedDeserializable) {
o = ((CachedDeserializable) o).getDeserializedForReading();
}
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignored) {
return Token.INVALID;
}
return o;
@@ -861,61 +789,33 @@ public class HashIndex extends AbstractIndex {
}
public String dump() {
- StringBuffer sb = new StringBuffer(toString()).append(" {\n");
- // sb.append("Null Values\n");
- // Iterator nI = nullMappedEntries.iterator();
- // while (nI.hasNext()) {
- // RegionEntry e = (RegionEntry) nI.next();
- // Object value = getTargetObject(e);
- // sb.append(" RegionEntry.key = ").append(e.getKey());
- // sb.append(" Value.type = ").append(value.getClass().getName());
- // if (value instanceof Collection) {
- // sb.append(" Value.size = ").append(((Collection) value).size());
- // }
- // sb.append("\n");
- // }
- // sb.append(" -----------------------------------------------\n");
- // sb.append("Undefined Values\n");
- // Iterator uI = undefinedMappedEntries.iterator();
- // while (uI.hasNext()) {
- // RegionEntry e = (RegionEntry) uI.next();
- // Object value = getTargetObject(e);
- // sb.append(" RegionEntry.key = ").append(e.getKey());
- // sb.append(" Value.type = ").append(value.getClass().getName());
- // if (value instanceof Collection) {
- // sb.append(" Value.size = ").append(((Collection) value).size());
- // }
- // sb.append("\n");
- // }
- sb.append(" -----------------------------------------------\n");
- Iterator i1 = this.entriesSet.iterator();
- while (i1.hasNext()) {
- Map.Entry indexEntry = (Map.Entry) i1.next();
- sb.append(" Key = " + indexEntry.getKey()).append("\n");
- sb.append(" Value Type = ").append(" " + indexEntry.getValue().getClass().getName())
- .append("\n");
+ StringBuilder sb = new StringBuilder(toString()).append(" {").append(getLineSeparator());
+ sb.append(" -----------------------------------------------").append(getLineSeparator());
+ for (Object anEntriesSet : this.entriesSet) {
+ Entry indexEntry = (Entry) anEntriesSet;
+ sb.append(" Key = ").append(indexEntry.getKey()).append(getLineSeparator());
+ sb.append(" Value Type = ").append(' ').append(indexEntry.getValue().getClass().getName())
+ .append(getLineSeparator());
if (indexEntry.getValue() instanceof Collection) {
- sb.append(" Value Size = ").append(" " + ((Collection) indexEntry.getValue()).size())
- .append("\n");
+ sb.append(" Value Size = ").append(' ').append(((Collection) indexEntry.getValue()).size())
+ .append(getLineSeparator());
} else if (indexEntry.getValue() instanceof RegionEntry) {
- sb.append(" Value Size = ").append(" " + 1).append("\n");
+ sb.append(" Value Size = ").append(" " + 1).append(getLineSeparator());
} else {
throw new AssertionError("value instance of " + indexEntry.getValue().getClass().getName());
}
Collection entrySet = regionEntryCollection(indexEntry.getValue());
- Iterator i2 = entrySet.iterator();
- while (i2.hasNext()) {
- RegionEntry e = (RegionEntry) i2.next();
+ for (Object anEntrySet : entrySet) {
+ RegionEntry e = (RegionEntry) anEntrySet;
Object value = getTargetObject(e);
sb.append(" RegionEntry.key = ").append(e.getKey());
sb.append(" Value.type = ").append(value.getClass().getName());
if (value instanceof Collection) {
sb.append(" Value.size = ").append(((Collection) value).size());
}
- sb.append("\n");
- // sb.append(" Value.type = ").append(value).append("\n");
+ sb.append(getLineSeparator());
}
- sb.append(" -----------------------------------------------\n");
+ sb.append(" -----------------------------------------------").append(getLineSeparator());
}
sb.append("}// Index ").append(getName()).append(" end");
return sb.toString();
@@ -1038,21 +938,21 @@ public class HashIndex extends AbstractIndex {
}
public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("No Keys = ").append(getNumberOfKeys()).append("\n");
- sb.append("No Values = ").append(getNumberOfValues()).append("\n");
- sb.append("No Uses = ").append(getTotalUses()).append("\n");
- sb.append("No Updates = ").append(getNumUpdates()).append("\n");
- sb.append("Total Update time = ").append(getTotalUpdateTime()).append("\n");
+ StringBuilder sb = new StringBuilder();
+ sb.append("No Keys = ").append(getNumberOfKeys()).append(getLineSeparator());
+ sb.append("No Values = ").append(getNumberOfValues()).append(getLineSeparator());
+ sb.append("No Uses = ").append(getTotalUses()).append(getLineSeparator());
+ sb.append("No Updates = ").append(getNumUpdates()).append(getLineSeparator());
+ sb.append("Total Update time = ").append(getTotalUpdateTime()).append(getLineSeparator());
return sb.toString();
}
}
class IMQEvaluator implements IndexedExpressionEvaluator {
- private Cache cache;
+ private final InternalCache cache;
private List fromIterators = null;
private CompiledValue indexedExpr = null;
- final private String[] canonicalIterNames;
+ private final String[] canonicalIterNames;
private ObjectType indexResultSetType = null;
private Region rgn = null;
private Map dependencyGraph = null;
@@ -1098,7 +998,7 @@ public class HashIndex extends AbstractIndex {
this.canonicalIterNames = ((FunctionalIndexCreationHelper) helper).canonicalizedIteratorNames;
this.rgn = helper.getRegion();
- // The modified iterators for optmizing Index cxreation
+ // The modified iterators for optimizing Index creation
isFirstItrOnEntry = ((FunctionalIndexCreationHelper) helper).isFirstIteratorRegionEntry;
additionalProj = ((FunctionalIndexCreationHelper) helper).additionalProj;
Object params1[] = {new QRegion(rgn, false)};
@@ -1173,7 +1073,7 @@ public class HashIndex extends AbstractIndex {
/**
* This function is used for creating Index data at the start
- *
+ *
*/
public void initializeIndex(boolean loadEntries) throws IMQException {
this.initEntriesUpdated = 0;
@@ -1278,7 +1178,6 @@ public class HashIndex extends AbstractIndex {
/**
* @param add true if adding to index, false if removing
- * @param context
*/
private void doNestedIterations(int level, boolean add, ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, FunctionDomainException,
@@ -1302,7 +1201,6 @@ public class HashIndex extends AbstractIndex {
/**
* @param add true if adding, false if removing from index
- * @param context
*/
private void applyProjection(boolean add, ExecutionContext context)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
@@ -1375,33 +1273,30 @@ public class HashIndex extends AbstractIndex {
Object params[] = {dQRegion};
ExecutionContext context = new ExecutionContext(params, this.cache);
context.newScope(IndexCreationHelper.INDEX_QUERY_SCOPE_ID);
- try {
- if (this.dependencyGraph != null) {
- context.setDependencyGraph(dependencyGraph);
- }
- for (int i = 0; i < this.iteratorSize; i++) {
- CompiledIteratorDef iterDef = (CompiledIteratorDef) fromIterators.get(i);
- // We are re-using the same ExecutionContext on every evaluate -- this
- // is not how ExecutionContext was intended to be used.
- // Asif: Compute the dependency only once. The call to methods of this
- // class are thread safe as for update lock on Index is taken .
- if (this.dependencyGraph == null) {
- iterDef.computeDependencies(context);
- }
- RuntimeIterator rIter = iterDef.getRuntimeIterator(context);
- context.addToIndependentRuntimeItrMapForIndexCreation(iterDef);
- context.bindIterator(rIter);
- }
- // Save the dependency graph for future updates.
- if (dependencyGraph == null) {
- dependencyGraph = context.getDependencyGraph();
- }
-
- Support.Assert(this.indexResultSetType != null,
- "IMQEvaluator::evaluate:The StrcutType should have been initialized during index creation");
- } finally {
+ if (this.dependencyGraph != null) {
+ context.setDependencyGraph(dependencyGraph);
}
+ for (int i = 0; i < this.iteratorSize; i++) {
+ CompiledIteratorDef iterDef = (CompiledIteratorDef) fromIterators.get(i);
+ // We are re-using the same ExecutionContext on every evaluate -- this
+ // is not how ExecutionContext was intended to be used.
+ // Asif: Compute the dependency only once. The call to methods of this
+ // class are thread safe as for update lock on Index is taken .
+ if (this.dependencyGraph == null) {
+ iterDef.computeDependencies(context);
+ }
+ RuntimeIterator rIter = iterDef.getRuntimeIterator(context);
+ context.addToIndependentRuntimeItrMapForIndexCreation(iterDef);
+ context.bindIterator(rIter);
+ }
+ // Save the dependency graph for future updates.
+ if (dependencyGraph == null) {
+ dependencyGraph = context.getDependencyGraph();
+ }
+
+ Support.Assert(this.indexResultSetType != null,
+ "IMQEvaluator::evaluate:The StructType should have been initialized during index creation");
return context;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexCreationHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexCreationHelper.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexCreationHelper.java
index 50f6811..293d22a 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexCreationHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexCreationHelper.java
@@ -21,81 +21,78 @@ package org.apache.geode.cache.query.internal.index;
import java.util.List;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.*;
+import org.apache.geode.cache.query.IndexInvalidException;
import org.apache.geode.cache.query.internal.CompiledValue;
import org.apache.geode.cache.query.internal.QCompiler;
+import org.apache.geode.internal.cache.InternalCache;
-/**
- *
- */
public abstract class IndexCreationHelper {
public static int INDEX_QUERY_SCOPE_ID = -2;
- // Canonicalized attributes.
- // The value in these fields is set during the execution of prepareFromClause
- // function
- // While the value of fromClause is reset in execution of prepareFromClause,
- // to canonicalized from clause
+
+ /**
+ * Canonicalized attributes. The value in these fields is set during the execution of
+ * prepareFromClause function While the value of fromClause is reset in execution of
+ * prepareFromClause, to canonicalized from clause
+ */
String fromClause;
+
String indexedExpression;
+
String projectionAttributes;
- // String imports;
- QCompiler compiler; // use the same compiler for each query string to use
- // imports
- Cache cache;
- // Asif : The array containing the canonicalized iterator names
- // which will get reused.
- // TODO: Asif : How to make it final so that the invokers do not end up
- // modifying it
+
+ // use the same compiler for each query string to use
+ QCompiler compiler;
+
+ InternalCache cache;
+
+ /**
+ * The array containing the canonicalized iterator names which will get reused.
+ * <p>
+ * TODO: How to make it final so that the invokers do not end up modifying it
+ */
String[] canonicalizedIteratorNames = null;
- // Asif : Array containing canonicalized iterator definitions
- // TODO: Asif : How to make it final so that the invokers do not end up
- // modifying it
+
+ /**
+ * Array containing canonicalized iterator definitions
+ * <p>
+ * TODO: How to make it final so that the invokers do not end up modifying it
+ */
String[] canonicalizedIteratorDefinitions = null;
- IndexCreationHelper(String fromClause, String projectionAttributes, Cache cache)
+ IndexCreationHelper(String fromClause, String projectionAttributes, InternalCache cache)
throws IndexInvalidException {
this.cache = cache;
- // Asif:LThe fromClause,indexedExpression & projectionAttributes
+ // The fromClause,indexedExpression & projectionAttributes
// will get modified with the canonicalized value , once the
// constructor of derived class is over.
this.fromClause = fromClause;
- // this.indexedExpression = indexedExpression;
this.projectionAttributes = projectionAttributes;
- // this.imports = imports;
- this.compiler = new QCompiler(true /* used from index creation */);
- /*
- * if (this.imports != null) { this.compiler.compileImports(this.imports); }
- */
+ this.compiler = new QCompiler(true);
}
public String getCanonicalizedProjectionAttributes() {
- return projectionAttributes;
+ return this.projectionAttributes;
}
- /*
- * TODO:Asif . Check if this function is required public String getImports() { return
- * this.imports; }
- */
public String getCanonicalizedIndexedExpression() {
- return indexedExpression;
+ return this.indexedExpression;
}
public String getCanonicalizedFromClause() {
- return fromClause;
+ return this.fromClause;
}
- public Cache getCache() {
- return cache;
+ public InternalCache getCache() {
+ return this.cache;
}
- /*
- * Asif: This function returns the canonicalized Iterator Definitions of the from clauses used in
- * Index creation
+ /**
+ * This function returns the canonicalized Iterator Definitions of the from clauses used in Index
+ * creation
*/
- public String[] getCanonicalizedIteratorDefinitions() {
+ String[] getCanonicalizedIteratorDefinitions() {
return this.canonicalizedIteratorDefinitions;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexManager.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexManager.java
index ed4f47f..2433178 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexManager.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexManager.java
@@ -12,33 +12,70 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * IndexManager.java
- *
- * Created on February 15, 2005, 11:49 AM
- */
package org.apache.geode.cache.query.internal.index;
+import static org.apache.geode.internal.lang.SystemUtils.getLineSeparator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.*;
-import org.apache.geode.cache.query.internal.*;
+import org.apache.geode.cache.query.AmbiguousNameException;
+import org.apache.geode.cache.query.Index;
+import org.apache.geode.cache.query.IndexExistsException;
+import org.apache.geode.cache.query.IndexInvalidException;
+import org.apache.geode.cache.query.IndexMaintenanceException;
+import org.apache.geode.cache.query.IndexNameConflictException;
+import org.apache.geode.cache.query.IndexStatistics;
+import org.apache.geode.cache.query.IndexType;
+import org.apache.geode.cache.query.MultiIndexCreationException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.QueryException;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.cache.query.internal.CompiledPath;
+import org.apache.geode.cache.query.internal.CompiledValue;
+import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.cache.query.internal.ExecutionContext;
+import org.apache.geode.cache.query.internal.MapIndexable;
+import org.apache.geode.cache.query.internal.NullToken;
+import org.apache.geode.cache.query.internal.QueryMonitor;
+import org.apache.geode.cache.query.internal.QueryObserver;
+import org.apache.geode.cache.query.internal.QueryObserverHolder;
import org.apache.geode.cache.query.internal.index.AbstractIndex.InternalIndexStatistics;
import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.BucketRegion;
+import org.apache.geode.internal.cache.CachePerfStats;
+import org.apache.geode.internal.cache.HasCachePerfStats;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.RegionEntry;
+import org.apache.geode.internal.cache.TXManagerImpl;
+import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicLong;
-/**
- */
public class IndexManager {
private static final Logger logger = LogService.getLogger();
@@ -69,8 +106,7 @@ public class IndexManager {
// Threshold for Queue.
private final int INDEX_MAINTENANCE_BUFFER =
- Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceThreshold", -1)
- .intValue();
+ Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceThreshold", -1);
public static boolean JOIN_OPTIMIZATION =
!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "index.DisableJoinOptimization");
@@ -91,18 +127,14 @@ public class IndexManager {
* without this the old-values are not removed from the index-maps thus resulting in inconsistent
* results.
*/
- public static final boolean INPLACE_OBJECT_MODIFICATION = Boolean
- .valueOf(System.getProperty(
- DistributionConfig.GEMFIRE_PREFIX + "index.INPLACE_OBJECT_MODIFICATION", "false"))
- .booleanValue();
+ public static final boolean INPLACE_OBJECT_MODIFICATION = Boolean.valueOf(System.getProperty(
+ DistributionConfig.GEMFIRE_PREFIX + "index.INPLACE_OBJECT_MODIFICATION", "false"));
/**
* System property to turn-off the compact-index support.
*/
- public static final boolean RANGEINDEX_ONLY = Boolean
- .valueOf(
- System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "index.RANGEINDEX_ONLY", "false"))
- .booleanValue();
+ public static final boolean RANGEINDEX_ONLY = Boolean.valueOf(
+ System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "index.RANGEINDEX_ONLY", "false"));
/** For test purpose only */
public static boolean TEST_RANGEINDEX_ONLY = false;
@@ -149,7 +181,6 @@ public class IndexManager {
* This is a fix for #47475
*
* @param operationTime the last modified time from version tag
- * @param currentCacheTime
*/
public static boolean setIndexBufferTime(long operationTime, long currentCacheTime) {
long timeDifference = currentCacheTime - operationTime;
@@ -179,20 +210,12 @@ public class IndexManager {
* underneath could change.
*
* Small amounts of false positives are ok as it will have a slight impact on performance
- *
- * @param queryStartTime
- * @param lastModifiedTime
*/
public static boolean needsRecalculation(long queryStartTime, long lastModifiedTime) {
return ENABLE_UPDATE_IN_PROGRESS_INDEX_CALCULATION
&& queryStartTime <= SAFE_QUERY_TIME.get() - queryStartTime + lastModifiedTime;
}
- /**
- *
- * @param value
- * @param newValue
- */
private static boolean setNewLargestValue(AtomicLong value, long newValue) {
boolean done = false;
while (!done) {
@@ -253,7 +276,7 @@ public class IndexManager {
DefaultQuery.setPdxReadSerialized(this.region.getCache(), true);
TXStateProxy tx = null;
- if (!((GemFireCacheImpl) this.region.getCache()).isClient()) {
+ if (!((InternalCache) this.region.getCache()).isClient()) {
tx = ((TXManagerImpl) this.region.getCache().getCacheTransactionManager()).internalSuspend();
}
@@ -278,13 +301,14 @@ public class IndexManager {
}
if (indexType != IndexType.PRIMARY_KEY) {
helper = new FunctionalIndexCreationHelper(origFromClause, origIndexedExpression,
- projectionAttributes, imports, region.getCache(), externalContext, this);
+ projectionAttributes, imports, (InternalCache) region.getCache(), externalContext,
+ this);
// Asif: For now support Map index as non compact .expand later
// The limitation for compact range index also apply to hash index for now
isCompactOrHash = shouldCreateCompactIndex((FunctionalIndexCreationHelper) helper);
} else if (indexType == IndexType.PRIMARY_KEY) {
helper = new PrimaryKeyIndexCreationHelper(origFromClause, origIndexedExpression,
- projectionAttributes, region.getCache(), externalContext, this);
+ projectionAttributes, (InternalCache) region.getCache(), externalContext, this);
} else {
throw new AssertionError("Don't know how to set helper for " + indexType);
}
@@ -356,7 +380,7 @@ public class IndexManager {
if (!(oldIndex instanceof Index)) {
// Some other thread is creating the same index.
// Wait for index to be initialized from other thread.
- ((FutureTask) oldIndex).get();
+ ((Future) oldIndex).get();
}
// The Index is successfully created, throw appropriate error message
@@ -370,7 +394,7 @@ public class IndexManager {
LocalizedStrings.IndexManager_SIMILAR_INDEX_EXISTS.toLocalizedString());
}
}
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignored) {
interrupted = true;
} catch (ExecutionException ee) {
Throwable c = ee.getCause();
@@ -504,9 +528,6 @@ public class IndexManager {
* @param indexedExpression the indexedExpression for the index
* @param context ExecutionContext
* @return the sole index of the region with these parameters, or null if there isn't one
- * @throws NameResolutionException
- * @throws TypeMismatchException
- * @throws AmbiguousNameException
*/
public IndexData getIndex(IndexType indexType, String[] definitions,
CompiledValue indexedExpression, ExecutionContext context)
@@ -514,7 +535,7 @@ public class IndexManager {
IndexData indxData = null;
int qItrSize = definitions.length;
Iterator it = this.indexes.values().iterator();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
indexedExpression.generateCanonicalizedExpression(sb, context);
String indexExprStr = sb.toString();
while (it.hasNext()) {
@@ -569,9 +590,6 @@ public class IndexManager {
* created
* @param context ExecutionContext object
* @return IndexData object
- * @throws NameResolutionException
- * @throws TypeMismatchException
- * @throws AmbiguousNameException
*/
public IndexData getBestMatchIndex(IndexType indexType, String[] definitions,
CompiledValue indexedExpression, ExecutionContext context)
@@ -584,7 +602,7 @@ public class IndexManager {
int qItrSize = definitions.length;
int bestIndexMatchLevel = qItrSize;
Iterator iter = this.indexes.values().iterator();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
indexedExpression.generateCanonicalizedExpression(sb, context);
String indexExprStr = sb.toString();
PartitionedIndex prIndex = null;
@@ -632,7 +650,7 @@ public class IndexManager {
}
prIndex.verifyAndCreateMissingIndex(context.getBucketList());
- } catch (Exception ex) {
+ } catch (Exception ignored) {
// Index is not there on all buckets.
// ignore this index.
prIndex.releaseIndexReadLockForRemove();
@@ -784,9 +802,8 @@ public class IndexManager {
Index index = (Index) ind;
// Check if indexType needs to be matched.
- if (indexType == null) { // No type check.
- list.add(index);
- } else if (index.getType() == indexType) {
+ if (indexType == null || index.getType() == indexType) {
+ // No type check.
list.add(index);
}
}
@@ -802,7 +819,6 @@ public class IndexManager {
return getIndexes(null);
}
- // @todo need more specific list of exceptions
/**
* Remove the specified index.
*
@@ -858,8 +874,6 @@ public class IndexManager {
* Index Initialization query on the region & before doing this it makes theexisting data maps
* null. This is needed so that index does not miss any entry being put in the region when the
* Region.clear is in progress
- *
- * @throws QueryException
*/
public void rerunIndexCreationQuery() throws QueryException {
try {
@@ -954,7 +968,6 @@ public class IndexManager {
updateIndexes(entry, action, opCode, false);
}
- // @todo need more specific list of exceptions
/**
* Callback for IndexManager to update indexes Called from AbstractRegionMap.
*
@@ -962,7 +975,6 @@ public class IndexManager {
* @param action action to be taken (IndexManager.ADD_ENTRY, IndexManager.UPDATE_ENTRY,
* IndexManager.REMOVE_ENTRY)
* @param opCode one of IndexProtocol.OTHER_OP, BEFORE_UPDATE_OP, AFTER_UPDATE_OP.
- * @throws org.apache.geode.cache.query.IndexMaintenanceException
*/
public void updateIndexes(RegionEntry entry, int action, int opCode,
boolean isDiskRecoveryInProgress) throws QueryException {
@@ -992,7 +1004,7 @@ public class IndexManager {
final long startPA = getCachePerfStats().startIndexUpdate();
DefaultQuery.setPdxReadSerialized(this.region.getCache(), true);
TXStateProxy tx = null;
- if (!((GemFireCacheImpl) this.region.getCache()).isClient()) {
+ if (!((InternalCache) this.region.getCache()).isClient()) {
tx = ((TXManagerImpl) this.region.getCache().getCacheTransactionManager()).internalSuspend();
}
@@ -1084,7 +1096,7 @@ public class IndexManager {
if (((AbstractIndex) index).isPopulated() && index.getType() != IndexType.PRIMARY_KEY) {
if (logger.isDebugEnabled()) {
- logger.debug("Updating index: {}{} value: ", index.getName(),
+ logger.debug("Updating index: {}{} value: {}", index.getName(),
this.region.getFullPath(), entry.getKey());
}
start = ((AbstractIndex) index).updateIndexUpdateStats();
@@ -1154,7 +1166,7 @@ public class IndexManager {
boolean interrupted = Thread.interrupted();
try {
indexes.wait();
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignored) {
interrupted = true;
} finally {
if (interrupted) {
@@ -1233,7 +1245,7 @@ public class IndexManager {
boolean interrupted = Thread.interrupted();
try {
this.indexes.wait();
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignored) {
interrupted = true;
} finally {
if (interrupted) {
@@ -1263,7 +1275,7 @@ public class IndexManager {
}
private CachePerfStats getCachePerfStats() {
- return ((LocalRegion) this.region).getCachePerfStats();
+ return ((HasCachePerfStats) this.region).getCachePerfStats();
}
/**
@@ -1280,7 +1292,6 @@ public class IndexManager {
* {@link PartitionedIndex}.
*
* @param prRegion the partition region that this bucket belongs to
- * @throws QueryException
*/
public void removeBucketIndexes(PartitionedRegion prRegion) throws QueryException {
IndexManager parentManager = prRegion.getIndexManager();
@@ -1298,7 +1309,7 @@ public class IndexManager {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
Iterator iter = this.indexes.values().iterator();
while (iter.hasNext()) {
Object ind = iter.next();
@@ -1307,7 +1318,7 @@ public class IndexManager {
if (ind instanceof FutureTask) {
continue;
}
- sb.append(((Index) ind).toString()).append('\n');
+ sb.append(ind).append(getLineSeparator());
}
return sb.toString();
}
@@ -1340,7 +1351,7 @@ public class IndexManager {
String str = null;
synchronized (canonicalizedIteratorNameMap) {
if ((str = (String) this.canonicalizedIteratorNameMap.get(definition)) == null) {
- str = new StringBuffer("index_iter").append(this.getIncrementedCounter()).toString();
+ str = new StringBuilder("index_iter").append(this.getIncrementedCounter()).toString();
String temp;
if ((temp =
(String) this.canonicalizedIteratorNameMap.putIfAbsent(definition, str)) != null) {
@@ -1365,7 +1376,6 @@ public class IndexManager {
* Asif : Given a definition returns the canonicalized iterator name for the definition. If the
* definition does not exist , null is returned
*
- * @param definition
* @return String
*/
public String getCanonicalizedIteratorName(String definition) {
@@ -1384,9 +1394,6 @@ public class IndexManager {
/**
* Creates instance of IndexUpdaterThread
- *
- * @param updateThreshold
- * @param threadName
*/
IndexUpdaterThread(ThreadGroup group, int updateThreshold, String threadName) {
super(group, threadName);
@@ -1403,9 +1410,9 @@ public class IndexManager {
public void addTask(int action, RegionEntry entry, int opCode) {
Object[] task = new Object[3];
- task[0] = Integer.valueOf(action);
+ task[0] = action;
task[1] = entry;
- task[2] = Integer.valueOf(opCode); // !!!:ezoerner:20081029 change to valueOf jdk 1.5+
+ task[2] = opCode;
pendingTasks.add(task);
}
@@ -1454,9 +1461,9 @@ public class IndexManager {
}
private void updateIndexes(Object[] task) {
- int action = ((Integer) task[0]).intValue();
+ int action = (Integer) task[0];
RegionEntry entry = (RegionEntry) task[1];
- int opCode = ((Integer) task[2]).intValue();
+ int opCode = (Integer) task[2];
// System.out.println("entry = "+entry.getKey());
if (entry != null || action == RECREATE_INDEX) {
try {
@@ -1535,6 +1542,7 @@ public class IndexManager {
@Override
public boolean equals(Object other) {
+ // TODO: equals should check the class of its parameter
if (other == null) {
return false;
}
@@ -1549,6 +1557,7 @@ public class IndexManager {
}
String[] indexDefinitions = this.helper.getCanonicalizedIteratorDefinitions();
+ // TODO: avoid object creation in equals
int[] mapping = new int[indexDefinitions.length];
// compare index based on its type, expression and definition.
if (compareIndexData(this.indexType, indexDefinitions,
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexStats.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexStats.java
index a83cb9b..e1f4fa7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexStats.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexStats.java
@@ -12,21 +12,21 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.query.internal.index;
-import org.apache.geode.*;
-// import org.apache.geode.cache.query.*;
-import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
+import org.apache.geode.StatisticDescriptor;
+import org.apache.geode.Statistics;
+import org.apache.geode.StatisticsFactory;
+import org.apache.geode.StatisticsType;
+import org.apache.geode.StatisticsTypeFactory;
import org.apache.geode.internal.cache.CachePerfStats;
+import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
/**
* IndexStats tracks statistics about query index use.
*/
public class IndexStats {
- ////////////////// Static fields ///////////////////////////
-
private static final StatisticsType type;
private static final int numKeysId;
@@ -44,8 +44,6 @@ public class IndexStats {
/** The Statistics object that we delegate most behavior to */
private final Statistics stats;
- //////////////////////// Static methods ////////////////////////
-
static {
StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
@@ -84,8 +82,6 @@ public class IndexStats {
numBucketIndexesId = type.nameToId("numBucketIndexes");
}
- //////////////////////// Constructors ////////////////////////
-
/**
* Creates a new <code>CachePerfStats</code> and registers itself with the given statistics
* factory.
@@ -94,8 +90,6 @@ public class IndexStats {
stats = factory.createAtomicStatistics(type, indexName);
}
- ////////////////////// Accessing Stats //////////////////////
-
public long getNumberOfKeys() {
return stats.getLong(numKeysId);
}
@@ -132,8 +126,6 @@ public class IndexStats {
return stats.getInt(numBucketIndexesId);
}
- ////////////////////// Updating Stats //////////////////////
-
public void incNumUpdates() {
this.stats.incLong(numUpdatesId, 1);
}
@@ -189,11 +181,10 @@ public class IndexStats {
public void incNumBucketIndexes(int delta) {
this.stats.incInt(numBucketIndexesId, delta);
}
- ////// Special Instance Methods /////
/**
- * Closes these stats so that they can not longer be used. The stats are closed when the
- * {@linkplain org.apache.geode.internal.cache.GemFireCacheImpl#close cache} is closed.
+ * Closes these stats so that they can not longer be used. The stats are closed when the cache is
+ * closed.
*
* @since GemFire 3.5
*/
@@ -210,7 +201,6 @@ public class IndexStats {
return this.stats.isClosed();
}
-
/**
* Returns the Statistics instance that stores the cache perf stats.
*
@@ -220,4 +210,3 @@ public class IndexStats {
return this.stats;
}
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexUtils.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexUtils.java
index a6c5ec7..3bd41e0 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexUtils.java
@@ -12,30 +12,25 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * IndexUtils.java
- *
- * Created on March 4, 2005, 5:39 PM
- */
package org.apache.geode.cache.query.internal.index;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.AmbiguousNameException;
import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.NameResolutionException;
import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.cache.query.internal.CompiledValue;
+import org.apache.geode.cache.query.internal.DefaultQueryService;
+import org.apache.geode.cache.query.internal.ExecutionContext;
+import org.apache.geode.cache.query.internal.index.IndexManager.TestHook;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
-import org.apache.geode.cache.query.internal.*;
-import org.apache.geode.cache.query.internal.index.IndexManager.TestHook;
-/**
- */
public class IndexUtils {
public static final boolean indexesEnabled = System.getProperty("query.disableIndexes") == null;
+
public static final boolean useOnlyExactIndexs = false;
public static TestHook testHook;
@@ -45,8 +40,10 @@ public class IndexUtils {
}
public static IndexManager getIndexManager(Region region, boolean createIfNotAvailable) {
- if (region == null || region.isDestroyed())
+ if (region == null || region.isDestroyed()) {
return null;
+ }
+
LocalRegion lRegion = (LocalRegion) region;
IndexManager idxMgr = lRegion.getIndexManager();
if (idxMgr == null && createIfNotAvailable) {
@@ -68,13 +65,12 @@ public class IndexUtils {
return idxMgr;
}
- public static IndexData findIndex(String regionpath, String defintions[],
- CompiledValue indexedExpression, String projectionAttributes, Cache cache,
+ public static IndexData findIndex(String regionpath, String[] defintions,
+ CompiledValue indexedExpression, String projectionAttributes, InternalCache cache,
boolean usePrimaryIndex, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
- DefaultQueryService qs =
- (DefaultQueryService) ((GemFireCacheImpl) cache).getLocalQueryService();
- // IndexProtocol index = null;
+
+ DefaultQueryService qs = (DefaultQueryService) cache.getLocalQueryService();
IndexData indxData = null;
if (usePrimaryIndex) {
if (useOnlyExactIndexs) {
@@ -98,7 +94,6 @@ public class IndexUtils {
}
}
-
// If Primary Key Index not found or is not valid search for FUNCTIONAL
// Index
if (indxData == null || !indxData._index.isValid()) {
@@ -110,16 +105,11 @@ public class IndexUtils {
indexedExpression, context);
}
} else {
- // if exact PRIMARY_KEY Index not found then try to find exact FUNCTIONAL
- // Index
- // if (!fromClause.equals(index.getCanonicalizedFromClause())) {
+ // if exact PRIMARY_KEY Index not found then try to find exact FUNCTIONAL Index
if (indxData._matchLevel != 0) {
IndexData functionalIndxData = qs.getIndex(regionpath, defintions,
IndexType.FUNCTIONAL /* do not use pk index */, indexedExpression, context);
- // if FUNCTIONAL Index is exact match then use or else use PRIMARY_KEY
- // Index
- // if (functionalIndxInfo != null &&
- // fromClause.equals(functionalIndex.getCanonicalizedFromClause())
+ // if FUNCTIONAL Index is exact match then use or else use PRIMARY_KEY Index
if (functionalIndxData != null && functionalIndxData._index.isValid()) {
indxData = functionalIndxData;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
index e9cd070..6b07490 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
@@ -14,11 +14,11 @@
*/
package org.apache.geode.cache.query.internal.index;
-import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.EntryDestroyedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
@@ -40,6 +39,7 @@ import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionEntry;
import org.apache.geode.internal.cache.Token;
@@ -59,16 +59,19 @@ public class MemoryIndexStore implements IndexStore {
new ConcurrentSkipListMap(TypeUtils.getExtendedNumericComparator());
// number of keys
- protected volatile AtomicInteger numIndexKeys = new AtomicInteger(0);
+ private final AtomicInteger numIndexKeys = new AtomicInteger(0);
// Map for RegionEntries=>value of indexedExpression (reverse map)
private ConcurrentMap entryToValuesMap;
- private InternalIndexStatistics internalIndexStats;
+ private final InternalIndexStatistics internalIndexStats;
+
+ private final InternalCache cache;
+
+ private final Region region;
- private Cache cache;
- private Region region;
private boolean indexOnRegionKeys;
+
private boolean indexOnValues;
// Used as a place holder for an indexkey collection for when a thread is about to change
@@ -78,13 +81,14 @@ public class MemoryIndexStore implements IndexStore {
// while the other would execute a remove on the index elem.
// both would complete but the remove would have been lost because we had already added it to the
// new collection
- private Object TRANSITIONING_TOKEN = new IndexElemArray(1);
+ private final Object TRANSITIONING_TOKEN = new IndexElemArray(1);
- public MemoryIndexStore(Region region, InternalIndexStatistics internalIndexStats) {
+ MemoryIndexStore(Region region, InternalIndexStatistics internalIndexStats) {
this(region, internalIndexStats, GemFireCacheImpl.getInstance());
}
- public MemoryIndexStore(Region region, InternalIndexStatistics internalIndexStats, Cache cache) {
+ private MemoryIndexStore(Region region, InternalIndexStatistics internalIndexStats,
+ InternalCache cache) {
this.region = region;
RegionAttributes ra = region.getAttributes();
// Initialize the reverse-map if in-place modification is set by the
@@ -98,7 +102,7 @@ public class MemoryIndexStore implements IndexStore {
}
@Override
- public void updateMapping(Object newKey, Object oldKey, RegionEntry entry, Object oldValue)
+ public void updateMapping(Object indexKey, Object oldKey, RegionEntry re, Object oldValue)
throws IMQException {
try {
@@ -109,38 +113,39 @@ public class MemoryIndexStore implements IndexStore {
// Check if reverse-map is present.
if (IndexManager.isObjectModificationInplace()) {
// If reverse map get the old index key from reverse map.
- if (this.entryToValuesMap.containsKey(entry)) {
- oldKey = this.entryToValuesMap.get(entry);
+ if (this.entryToValuesMap.containsKey(re)) {
+ oldKey = this.entryToValuesMap.get(re);
}
} else {
// Check if the old value and new value same.
// If they are same, that means the value got updated in place.
// In the absence of reverse-map find the old index key from
// forward map.
- if (oldValue != null && oldValue == getTargetObjectInVM(entry)) {
- oldKey = getOldKey(newKey, entry);
+ if (oldValue != null && oldValue == getTargetObjectInVM(re)) {
+ oldKey = getOldKey(indexKey, re);
}
}
// No need to update the map if new and old index key are same.
- if (oldKey != null && oldKey.equals(TypeUtils.indexKeyFor(newKey))) {
+ if (oldKey != null && oldKey.equals(TypeUtils.indexKeyFor(indexKey))) {
return;
}
boolean retry = false;
- newKey = TypeUtils.indexKeyFor(newKey);
- if (newKey.equals(QueryService.UNDEFINED)) {
- Object targetObject = getTargetObjectForUpdate(entry);
+ indexKey = TypeUtils.indexKeyFor(indexKey);
+ if (indexKey.equals(QueryService.UNDEFINED)) {
+ Object targetObject = getTargetObjectForUpdate(re);
if (Token.isInvalidOrRemoved(targetObject)) {
if (oldKey != null) {
- basicRemoveMapping(oldKey, entry, false);
+ basicRemoveMapping(oldKey, re, false);
}
return;
}
}
+
do {
retry = false;
- Object regionEntries = this.valueToEntriesMap.putIfAbsent(newKey, entry);
+ Object regionEntries = this.valueToEntriesMap.putIfAbsent(indexKey, re);
if (regionEntries == TRANSITIONING_TOKEN) {
retry = true;
continue;
@@ -153,8 +158,8 @@ public class MemoryIndexStore implements IndexStore {
DefaultQuery.testHook.doTestHook("BEGIN_TRANSITION_FROM_REGION_ENTRY_TO_ELEMARRAY");
}
elemArray.add(regionEntries);
- elemArray.add(entry);
- if (!this.valueToEntriesMap.replace(newKey, regionEntries, elemArray)) {
+ elemArray.add(re);
+ if (!this.valueToEntriesMap.replace(indexKey, regionEntries, elemArray)) {
retry = true;
}
if (DefaultQuery.testHook != null) {
@@ -168,9 +173,9 @@ public class MemoryIndexStore implements IndexStore {
// ConcurrentHashSet when set size becomes zero during
// basicRemoveMapping();
synchronized (regionEntries) {
- ((IndexConcurrentHashSet) regionEntries).add(entry);
+ ((IndexConcurrentHashSet) regionEntries).add(re);
}
- if (regionEntries != this.valueToEntriesMap.get(newKey)) {
+ if (regionEntries != this.valueToEntriesMap.get(indexKey)) {
retry = true;
}
} else {
@@ -192,15 +197,15 @@ public class MemoryIndexStore implements IndexStore {
// captured
// by our instance of the elem array, or the remove operations will need to do a
// retry?
- if (!this.valueToEntriesMap.replace(newKey, regionEntries, TRANSITIONING_TOKEN)) {
+ if (!this.valueToEntriesMap.replace(indexKey, regionEntries, TRANSITIONING_TOKEN)) {
retry = true;
} else {
if (DefaultQuery.testHook != null) {
DefaultQuery.testHook.doTestHook("TRANSITIONED_FROM_ELEMARRAY_TO_TOKEN");
}
- set.add(entry);
+ set.add(re);
set.addAll(elemArray);
- if (!this.valueToEntriesMap.replace(newKey, TRANSITIONING_TOKEN, set)) {
+ if (!this.valueToEntriesMap.replace(indexKey, TRANSITIONING_TOKEN, set)) {
// This should never happen. If we see this in the log, then something is wrong
// with the TRANSITIONING TOKEN and synchronization of changing collection types
// we should then just go from RE to CHS and completely remove the Elem Array.
@@ -215,8 +220,8 @@ public class MemoryIndexStore implements IndexStore {
}
}
} else {
- elemArray.add(entry);
- if (regionEntries != this.valueToEntriesMap.get(newKey)) {
+ elemArray.add(re);
+ if (regionEntries != this.valueToEntriesMap.get(indexKey)) {
retry = true;
}
}
@@ -229,16 +234,16 @@ public class MemoryIndexStore implements IndexStore {
// remove from forward map in case of update
// oldKey is not null only for an update
if (oldKey != null) {
- basicRemoveMapping(oldKey, entry, false);
+ basicRemoveMapping(oldKey, re, false);
}
if (IndexManager.isObjectModificationInplace()) {
- this.entryToValuesMap.put(entry, newKey);
+ this.entryToValuesMap.put(re, indexKey);
}
}
} while (retry);
} catch (TypeMismatchException ex) {
- throw new IMQException("Could not add object of type " + newKey.getClass().getName(), ex);
+ throw new IMQException("Could not add object of type " + indexKey.getClass().getName(), ex);
}
internalIndexStats.incNumValues(1);
}
@@ -251,8 +256,8 @@ public class MemoryIndexStore implements IndexStore {
*/
private Object getOldKey(Object newKey, RegionEntry entry) throws TypeMismatchException {
for (Object mapEntry : valueToEntriesMap.entrySet()) {
- Object regionEntries = ((SimpleImmutableEntry) mapEntry).getValue();
- Object indexKey = ((SimpleImmutableEntry) mapEntry).getKey();
+ Object regionEntries = ((Entry) mapEntry).getValue();
+ Object indexKey = ((Entry) mapEntry).getKey();
// if more than one index key maps to the same RegionEntry that
// means there has been an in-place modification
if (TypeUtils.compare(indexKey, newKey, CompiledComparison.TOK_NE).equals(Boolean.TRUE)) {
@@ -270,34 +275,34 @@ public class MemoryIndexStore implements IndexStore {
}
@Override
- public void addMapping(Object newKey, RegionEntry entry) throws IMQException {
+ public void addMapping(Object indexKey, RegionEntry re) throws IMQException {
// for add, oldkey is null
- updateMapping(newKey, null, entry, null);
+ updateMapping(indexKey, null, re, null);
}
@Override
- public void removeMapping(Object key, RegionEntry entry) throws IMQException {
+ public void removeMapping(Object indexKey, RegionEntry re) throws IMQException {
// Remove from forward map
- boolean found = basicRemoveMapping(key, entry, true);
+ boolean found = basicRemoveMapping(indexKey, re, true);
// Remove from reverse map.
// We do NOT need to synchronize here as different RegionEntries will be
// operating concurrently i.e. different keys in entryToValuesMap which
// is a concurrent map.
if (found && IndexManager.isObjectModificationInplace()) {
- this.entryToValuesMap.remove(entry);
+ this.entryToValuesMap.remove(re);
}
}
- protected boolean basicRemoveMapping(Object key, RegionEntry entry, boolean findOldKey)
+ private boolean basicRemoveMapping(Object key, RegionEntry entry, boolean findOldKey)
throws IMQException {
boolean found = false;
boolean possiblyAlreadyRemoved = false;
try {
- boolean retry = false;
Object newKey = convertToIndexKey(key, entry);
if (DefaultQuery.testHook != null) {
DefaultQuery.testHook.doTestHook("ATTEMPT_REMOVE");
}
+ boolean retry = false;
do {
retry = false;
Object regionEntries = this.valueToEntriesMap.get(newKey);
@@ -309,7 +314,7 @@ public class MemoryIndexStore implements IndexStore {
continue;
} else if (regionEntries != null) {
if (regionEntries instanceof RegionEntry) {
- found = (regionEntries == entry);
+ found = regionEntries == entry;
if (found) {
if (this.valueToEntriesMap.remove(newKey, regionEntries)) {
numIndexKeys.decrementAndGet();
@@ -363,7 +368,7 @@ public class MemoryIndexStore implements IndexStore {
if (found) {
// Update stats if entry was actually removed
internalIndexStats.incNumValues(-1);
- } else if ((!found && !possiblyAlreadyRemoved) && !IndexManager.isObjectModificationInplace()
+ } else if (!found && !possiblyAlreadyRemoved && !IndexManager.isObjectModificationInplace()
&& key != null) {
// if there is an inplace-modification find old key by iterating
// over fwd map and then remove the mapping
@@ -375,12 +380,6 @@ public class MemoryIndexStore implements IndexStore {
throw new IMQException("Could not find old key: " + key.getClass().getName(), e);
}
}
- // The entry might have been already removed by other thread
- // if still not found
- // if (!found) {
- // throw new IMQException("index maintenance error: "
- // + "entry not found for " + key + " entry: " + entry);
- // }
}
return found;
}
@@ -395,14 +394,6 @@ public class MemoryIndexStore implements IndexStore {
return newKey;
}
- /**
- * Convert a RegionEntry or THashSet<RegionEntry> to be consistently a Collection
- */
- /*
- * private Collection regionEntryCollection(Object regionEntries) { if (regionEntries instanceof
- * RegionEntry) { return Collections.singleton(regionEntries); } return (Collection)
- * regionEntries; }
- */
@Override
public CloseableIterator<IndexStoreEntry> get(Object indexKey) {
return new MemoryIndexStoreIterator(
@@ -492,7 +483,7 @@ public class MemoryIndexStore implements IndexStore {
if (o instanceof CachedDeserializable) {
return ((CachedDeserializable) o).getDeserializedValue(this.region, entry);
}
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignore) {
return null;
}
return o;
@@ -502,6 +493,7 @@ public class MemoryIndexStore implements IndexStore {
return new CachedEntryWrapper(((LocalRegion) this.region).new NonTXEntry(entry));
}
+ @Override
public Object getTargetObjectInVM(RegionEntry entry) {
if (indexOnValues) {
Object o = entry.getValueInVM((LocalRegion) this.region);
@@ -522,7 +514,7 @@ public class MemoryIndexStore implements IndexStore {
return ((LocalRegion) this.region).new NonTXEntry(entry);
}
- public Object getTargetObjectForUpdate(RegionEntry entry) {
+ private Object getTargetObjectForUpdate(RegionEntry entry) {
if (indexOnValues) {
Object o = entry.getValue((LocalRegion) this.region);
try {
@@ -556,7 +548,7 @@ public class MemoryIndexStore implements IndexStore {
public int size(Object key) {
Object obj = valueToEntriesMap.get(key);
if (obj != null) {
- return (obj instanceof RegionEntry) ? 1 : ((Collection) obj).size();
+ return obj instanceof RegionEntry ? 1 : ((Collection) obj).size();
} else {
return 0;
}
@@ -575,15 +567,14 @@ public class MemoryIndexStore implements IndexStore {
final Map map;
Object indexKey;
Collection keysToRemove;
-
- protected Iterator<Map.Entry> mapIterator;
- protected Iterator valuesIterator;
- protected Object currKey;
- protected Object currValue; // RegionEntry
+ Iterator<Map.Entry> mapIterator;
+ Iterator valuesIterator;
+ Object currKey;
+ Object currValue; // RegionEntry
final long iteratorStartTime;
- protected MemoryIndexStoreEntry currentEntry;
+ MemoryIndexStoreEntry currentEntry;
- private MemoryIndexStoreIterator(Map submap, Object indexKey, Collection keysToRemove) {
+ MemoryIndexStoreIterator(Map submap, Object indexKey, Collection keysToRemove) {
this(submap, indexKey, keysToRemove, GemFireCacheImpl.getInstance().cacheTimeMillis());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PartitionedIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PartitionedIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PartitionedIndex.java
index 1938487..b8e7938 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PartitionedIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PartitionedIndex.java
@@ -550,7 +550,7 @@ public class PartitionedIndex extends AbstractIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndex.java
index 2db59b2..8cc036f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndex.java
@@ -12,11 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * PrimaryKeyIndex.java
- *
- * Created on March 20, 2005, 6:47 PM
- */
package org.apache.geode.cache.query.internal.index;
import java.util.Collection;
@@ -51,9 +46,6 @@ import org.apache.geode.internal.cache.RegionEntry;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.pdx.internal.PdxString;
-/**
- *
- */
public class PrimaryKeyIndex extends AbstractIndex {
protected long numUses = 0;
@@ -64,7 +56,7 @@ public class PrimaryKeyIndex extends AbstractIndex {
String origIndxExpr, String[] defintions, IndexStatistics indexStatistics) {
super(indexName, region, fromClause, indexedExpression, projectionAttributes, origFromClause,
origIndxExpr, defintions, indexStatistics);
- // TODO : Asif Check if the below is correct
+ // TODO: Check if the below is correct
Class constr = region.getAttributes().getValueConstraint();
if (constr == null)
constr = Object.class;
@@ -91,21 +83,13 @@ public class PrimaryKeyIndex extends AbstractIndex {
void addMapping(RegionEntry entry) throws IMQException {}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {}
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {}
@Override
void lockedQuery(Object key, int operator, Collection results, Set keysToRemove,
ExecutionContext context) throws TypeMismatchException {
assert keysToRemove == null;
- // System.out.println("PrimaryKeyIndex.lockedQuery");
- // System.out.println(" key="+key);
- // System.out.println(" key.class="+(key != null ? key.getClass().getName()
- // : "null"));
- // if(key == null){
- // numUses++;
- // return;
- // }
- // key = TypeUtils.indexKeyFor(key);
+
int limit = -1;
// Key cannot be PdxString in a region
@@ -114,8 +98,8 @@ public class PrimaryKeyIndex extends AbstractIndex {
}
Boolean applyLimit = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_LIMIT_AT_INDEX);
- if (applyLimit != null && applyLimit.booleanValue()) {
- limit = ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)).intValue();
+ if (applyLimit != null && applyLimit) {
+ limit = (Integer) context.cacheGet(CompiledValue.RESULT_LIMIT);
}
QueryObserver observer = QueryObserverHolder.getInstance();
if (limit != -1 && results.size() == limit) {
@@ -235,8 +219,7 @@ public class PrimaryKeyIndex extends AbstractIndex {
continue;
}
Object val = entry.getValue();
- // TODO:Asif: is this correct. What should be the behaviour of null
- // values?
+ // TODO: is this correct. What should be the behaviour of null values?
if (val != null) {
boolean ok = true;
if (runtimeItr != null) {
@@ -253,22 +236,6 @@ public class PrimaryKeyIndex extends AbstractIndex {
}
}
}
- // if (key != null && key != QueryService.UNDEFINED) {
- // Region.Entry entry = getRegion().getEntry(key);
- // if (entry != null) {
- // Object val = entry.getValue();
- // if (val != null) {
- // boolean ok = true;
- // if (runtimeItr != null) {
- // runtimeItr.setCurrent(val);
- // ok = QueryUtils.applyCondition(iterOps, context);
- // }
- // if (ok) {
- // applyProjection(projAttrib, context, results,val,intermediateResults,isIntersection);
- // }
- // }
- // }
- // }
break;
}
default: {
@@ -335,14 +302,6 @@ public class PrimaryKeyIndex extends AbstractIndex {
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.query.internal.index.AbstractIndex#lockedQuery(java.lang.Object,
- * int, java.lang.Object, int, java.util.Collection, java.util.Set)
- */
-
@Override
void lockedQuery(Object lowerBoundKey, int lowerBoundOperator, Object upperBoundKey,
int upperBoundOperator, Collection results, Set keysToRemove, ExecutionContext context)
@@ -359,8 +318,7 @@ public class PrimaryKeyIndex extends AbstractIndex {
@Override
void addMapping(Object key, Object value, RegionEntry entry) throws IMQException {
- // TODO Auto-generated method stub
-
+ // do nothing
}
@Override
@@ -368,7 +326,6 @@ public class PrimaryKeyIndex extends AbstractIndex {
// Do Nothing; We are not going to call this for PrimaryKeyIndex ever.
}
-
public boolean isEmpty() {
return createStats("primaryKeyIndex").getNumberOfKeys() == 0 ? true : false;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndexCreationHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndexCreationHelper.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndexCreationHelper.java
index 558aa3b..5800fc9 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndexCreationHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/PrimaryKeyIndexCreationHelper.java
@@ -12,16 +12,10 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * PrimaryIndexCreationHelper.java
- *
- * Created on March 20, 2005, 7:21 PM
- */
package org.apache.geode.cache.query.internal.index;
import java.util.List;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.IndexInvalidException;
import org.apache.geode.cache.query.internal.CompiledIteratorDef;
@@ -29,12 +23,10 @@ import org.apache.geode.cache.query.internal.CompiledValue;
import org.apache.geode.cache.query.internal.ExecutionContext;
import org.apache.geode.cache.query.internal.RuntimeIterator;
import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- *
- */
public class PrimaryKeyIndexCreationHelper extends IndexCreationHelper {
ExecutionContext context = null;
@@ -42,8 +34,8 @@ public class PrimaryKeyIndexCreationHelper extends IndexCreationHelper {
final Region region;
public PrimaryKeyIndexCreationHelper(String fromClause, String indexedExpression,
- String projectionAttributes, Cache cache, ExecutionContext externalContext, IndexManager imgr)
- throws IndexInvalidException {
+ String projectionAttributes, InternalCache cache, ExecutionContext externalContext,
+ IndexManager imgr) throws IndexInvalidException {
super(fromClause, projectionAttributes, cache);
if (externalContext == null) {
context = new ExecutionContext(null, cache);
@@ -76,7 +68,7 @@ public class PrimaryKeyIndexCreationHelper extends IndexCreationHelper {
String definition = rIter.getDefinition();
this.canonicalizedIteratorDefinitions = new String[1];
this.canonicalizedIteratorDefinitions[0] = definition;
- // Asif: Bind the Index_Internal_ID to the RuntimeIterator
+ // Bind the Index_Internal_ID to the RuntimeIterator
PartitionedRegion pr = this.context.getPartitionedRegion();
this.canonicalizedIteratorNames = new String[1];
String name = null;
@@ -88,7 +80,7 @@ public class PrimaryKeyIndexCreationHelper extends IndexCreationHelper {
rIter.setIndexInternalID(name);
this.canonicalizedIteratorNames = new String[1];
this.canonicalizedIteratorNames[0] = name;
- this.fromClause = new StringBuffer(definition).append(' ').append(name).toString();
+ this.fromClause = new StringBuilder(definition).append(' ').append(name).toString();
context.bindIterator(rIter);
} catch (IndexInvalidException e) {
throw e; // propagate
@@ -110,11 +102,10 @@ public class PrimaryKeyIndexCreationHelper extends IndexCreationHelper {
LocalizedStrings.PrimaryKeyIndexCreationHelper_INVALID_INDEXED_EXPRESSOION_0
.toLocalizedString(indexedExpression));
try {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
expr.generateCanonicalizedExpression(sb, context);
this.indexedExpression = sb.toString();
} catch (Exception e) {
- // e.printStackTrace();
throw new IndexInvalidException(
LocalizedStrings.PrimaryKeyIndexCreationHelper_INVALID_INDEXED_EXPRESSOION_0_N_1
.toLocalizedString(new Object[] {indexedExpression, e.getMessage()}));
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java
index 5ac48bc..316c30d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java
@@ -117,8 +117,8 @@ public class RangeIndex extends AbstractIndex {
}
@Override
- void instantiateEvaluator(IndexCreationHelper ich) {
- this.evaluator = new IMQEvaluator(ich);
+ void instantiateEvaluator(IndexCreationHelper indexCreationHelper) {
+ this.evaluator = new IMQEvaluator(indexCreationHelper);
}
@Override
@@ -992,7 +992,7 @@ public class RangeIndex extends AbstractIndex {
if (entriesMap == null || result == null)
return;
QueryObserver observer = QueryObserverHolder.getInstance();
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
@@ -1010,7 +1010,7 @@ public class RangeIndex extends AbstractIndex {
if (keysToRemove == null || !keysToRemove.remove(key)) {
RegionEntryToValuesMap rvMap = (RegionEntryToValuesMap) entry.getValue();
rvMap.addValuesToCollection(result, limit, context);
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
@@ -1048,7 +1048,7 @@ public class RangeIndex extends AbstractIndex {
if (entriesMap == null || result == null)
return;
QueryObserver observer = QueryObserverHolder.getInstance();
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
@@ -1062,7 +1062,7 @@ public class RangeIndex extends AbstractIndex {
if (foundKeyToRemove || !keyToRemove.equals(entry.getKey())) {
RegionEntryToValuesMap rvMap = (RegionEntryToValuesMap) entry.getValue();
rvMap.addValuesToCollection(result, limit, context);
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
return;
}
@@ -1078,8 +1078,7 @@ public class RangeIndex extends AbstractIndex {
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
boolean limitApplied = false;
- if (entriesMap == null || result == null
- || (limitApplied = verifyLimit(result, limit, context))) {
+ if (entriesMap == null || result == null || (limitApplied = verifyLimit(result, limit))) {
if (limitApplied) {
QueryObserver observer = QueryObserverHolder.getInstance();
if (observer != null) {
@@ -1106,7 +1105,7 @@ public class RangeIndex extends AbstractIndex {
RegionEntryToValuesMap rvMap = (RegionEntryToValuesMap) entry.getValue();
rvMap.addValuesToCollection(result, iterOps, runtimeItr, context, projAttrib,
intermediateResults, isIntersection, limit);
- if (verifyLimit(result, limit, context)) {
+ if (verifyLimit(result, limit)) {
observer.limitAppliedAtIndexLevel(this, limit, result);
break;
}
@@ -1526,10 +1525,6 @@ public class RangeIndex extends AbstractIndex {
this.vsdStats.incReadLockCount(delta);
}
- public long getUseTime() {
- return this.vsdStats.getUseTime();
- }
-
/**
* Returns the total amount of time (in nanoseconds) spent updating this index.
*/
[12/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index e15eb2a..176242c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -12,34 +12,141 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import static org.apache.geode.internal.lang.SystemUtils.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Lock;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.InternalGemFireException;
import org.apache.geode.StatisticsFactory;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.AttributesMutator;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheException;
+import org.apache.geode.cache.CacheListener;
+import org.apache.geode.cache.CacheLoader;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.CacheStatistics;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.CustomExpiry;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.DiskAccessException;
+import org.apache.geode.cache.EntryExistsException;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.InterestPolicy;
+import org.apache.geode.cache.InterestRegistrationEvent;
+import org.apache.geode.cache.LoaderHelper;
+import org.apache.geode.cache.LowMemoryException;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.PartitionResolver;
+import org.apache.geode.cache.PartitionedRegionDistributionException;
+import org.apache.geode.cache.PartitionedRegionStorageException;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.RegionEvent;
+import org.apache.geode.cache.RegionExistsException;
+import org.apache.geode.cache.RegionMembershipListener;
import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.TransactionDataNotColocatedException;
+import org.apache.geode.cache.TransactionDataRebalancedException;
+import org.apache.geode.cache.TransactionException;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import org.apache.geode.cache.client.internal.*;
-import org.apache.geode.cache.execute.*;
+import org.apache.geode.cache.client.internal.ClientMetadataService;
+import org.apache.geode.cache.execute.EmptyRegionFunctionException;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.FunctionException;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.cache.partition.PartitionListener;
import org.apache.geode.cache.partition.PartitionNotAvailableException;
import org.apache.geode.cache.persistence.PartitionOfflineException;
import org.apache.geode.cache.persistence.PersistentID;
-import org.apache.geode.cache.query.*;
-import org.apache.geode.cache.query.internal.*;
-import org.apache.geode.cache.query.internal.index.*;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.Index;
+import org.apache.geode.cache.query.IndexCreationException;
+import org.apache.geode.cache.query.IndexExistsException;
+import org.apache.geode.cache.query.IndexInvalidException;
+import org.apache.geode.cache.query.IndexNameConflictException;
+import org.apache.geode.cache.query.IndexType;
+import org.apache.geode.cache.query.MultiIndexCreationException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.QueryException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.cache.query.internal.Bag;
+import org.apache.geode.cache.query.internal.CompiledSelect;
+import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.cache.query.internal.ExecutionContext;
+import org.apache.geode.cache.query.internal.QCompiler;
+import org.apache.geode.cache.query.internal.QueryExecutor;
+import org.apache.geode.cache.query.internal.ResultsBag;
+import org.apache.geode.cache.query.internal.ResultsCollectionWrapper;
+import org.apache.geode.cache.query.internal.ResultsSet;
+import org.apache.geode.cache.query.internal.index.AbstractIndex;
+import org.apache.geode.cache.query.internal.index.IndexCreationData;
+import org.apache.geode.cache.query.internal.index.IndexManager;
+import org.apache.geode.cache.query.internal.index.IndexUtils;
+import org.apache.geode.cache.query.internal.index.PartitionedIndex;
import org.apache.geode.cache.query.internal.types.ObjectTypeImpl;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.LockServiceDestroyedException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionAdvisee;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.InternalDistributedSystem.DisconnectListener;
+import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.ProfileListener;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.distributed.internal.locks.DLockRemoteToken;
import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -58,27 +165,64 @@ import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryEvent;
import org.apache.geode.internal.cache.control.MemoryThresholds;
-import org.apache.geode.internal.cache.execute.*;
+import org.apache.geode.internal.cache.execute.AbstractExecution;
+import org.apache.geode.internal.cache.execute.FunctionExecutionNodePruner;
+import org.apache.geode.internal.cache.execute.FunctionRemoteContext;
+import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException;
+import org.apache.geode.internal.cache.execute.LocalResultCollector;
+import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionExecutor;
+import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionResultSender;
+import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionResultWaiter;
+import org.apache.geode.internal.cache.execute.RegionFunctionContextImpl;
+import org.apache.geode.internal.cache.execute.ServerToClientFunctionResultSender;
import org.apache.geode.internal.cache.ha.ThreadIdentifier;
import org.apache.geode.internal.cache.lru.HeapEvictor;
import org.apache.geode.internal.cache.lru.LRUStatistics;
-import org.apache.geode.internal.cache.partitioned.*;
+import org.apache.geode.internal.cache.lru.Sizeable;
+import org.apache.geode.internal.cache.partitioned.ContainsKeyValueMessage;
import org.apache.geode.internal.cache.partitioned.ContainsKeyValueMessage.ContainsKeyValueResponse;
+import org.apache.geode.internal.cache.partitioned.DestroyMessage;
import org.apache.geode.internal.cache.partitioned.DestroyMessage.DestroyResponse;
+import org.apache.geode.internal.cache.partitioned.DestroyRegionOnDataStoreMessage;
+import org.apache.geode.internal.cache.partitioned.DumpAllPRConfigMessage;
+import org.apache.geode.internal.cache.partitioned.DumpB2NRegion;
import org.apache.geode.internal.cache.partitioned.DumpB2NRegion.DumpB2NResponse;
+import org.apache.geode.internal.cache.partitioned.DumpBucketsMessage;
+import org.apache.geode.internal.cache.partitioned.FetchBulkEntriesMessage;
import org.apache.geode.internal.cache.partitioned.FetchBulkEntriesMessage.FetchBulkEntriesResponse;
+import org.apache.geode.internal.cache.partitioned.FetchEntriesMessage;
import org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesResponse;
+import org.apache.geode.internal.cache.partitioned.FetchEntryMessage;
import org.apache.geode.internal.cache.partitioned.FetchEntryMessage.FetchEntryResponse;
+import org.apache.geode.internal.cache.partitioned.FetchKeysMessage;
import org.apache.geode.internal.cache.partitioned.FetchKeysMessage.FetchKeysResponse;
+import org.apache.geode.internal.cache.partitioned.GetMessage;
import org.apache.geode.internal.cache.partitioned.GetMessage.GetResponse;
+import org.apache.geode.internal.cache.partitioned.IdentityRequestMessage;
import org.apache.geode.internal.cache.partitioned.IdentityRequestMessage.IdentityResponse;
+import org.apache.geode.internal.cache.partitioned.IdentityUpdateMessage;
import org.apache.geode.internal.cache.partitioned.IdentityUpdateMessage.IdentityUpdateResponse;
+import org.apache.geode.internal.cache.partitioned.IndexCreationMsg;
+import org.apache.geode.internal.cache.partitioned.InterestEventMessage;
import org.apache.geode.internal.cache.partitioned.InterestEventMessage.InterestEventResponse;
+import org.apache.geode.internal.cache.partitioned.InvalidateMessage;
import org.apache.geode.internal.cache.partitioned.InvalidateMessage.InvalidateResponse;
+import org.apache.geode.internal.cache.partitioned.PREntriesIterator;
+import org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException;
+import org.apache.geode.internal.cache.partitioned.PRSanityCheckMessage;
+import org.apache.geode.internal.cache.partitioned.PRUpdateEntryVersionMessage;
import org.apache.geode.internal.cache.partitioned.PRUpdateEntryVersionMessage.UpdateEntryVersionResponse;
import org.apache.geode.internal.cache.partitioned.PartitionMessage.PartitionResponse;
+import org.apache.geode.internal.cache.partitioned.PartitionedRegionObserver;
+import org.apache.geode.internal.cache.partitioned.PartitionedRegionObserverHolder;
+import org.apache.geode.internal.cache.partitioned.PutAllPRMessage;
+import org.apache.geode.internal.cache.partitioned.PutMessage;
import org.apache.geode.internal.cache.partitioned.PutMessage.PutResult;
+import org.apache.geode.internal.cache.partitioned.RegionAdvisor;
import org.apache.geode.internal.cache.partitioned.RegionAdvisor.PartitionProfile;
+import org.apache.geode.internal.cache.partitioned.RemoveAllPRMessage;
+import org.apache.geode.internal.cache.partitioned.RemoveIndexesMessage;
+import org.apache.geode.internal.cache.partitioned.SizeMessage;
import org.apache.geode.internal.cache.partitioned.SizeMessage.SizeResponse;
import org.apache.geode.internal.cache.persistence.PRPersistentConfig;
import org.apache.geode.internal.cache.tier.InterestType;
@@ -107,30 +251,18 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.sequencelog.RegionLogger;
import org.apache.geode.internal.util.TransformUtils;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
/**
* A Region whose total storage is split into chunks of data (partitions) which are copied up to a
* configurable level (for high availability) and placed on multiple VMs for improved performance
* and increased storage capacity.
- *
*/
public class PartitionedRegion extends LocalRegion
implements CacheDistributionAdvisee, QueryExecutor {
- public static final Random rand =
+ public static final Random RANDOM =
new Random(Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "PartitionedRegionRandomSeed",
- NanoTimer.getTime()).longValue());
+ NanoTimer.getTime()));
private static final AtomicInteger SERIAL_NUMBER_GENERATOR = new AtomicInteger();
@@ -143,7 +275,7 @@ public class PartitionedRegion extends LocalRegion
* getNetworkHopType byte indicating this was not the bucket owner and a message had to be sent to
* a primary in the same server group
*/
- public static final int NETWORK_HOP_TO_SAME_GROUP = 1;
+ private static final int NETWORK_HOP_TO_SAME_GROUP = 1;
/**
* getNetworkHopType byte indicating this was not the bucket owner and a message had to be sent to
@@ -151,12 +283,12 @@ public class PartitionedRegion extends LocalRegion
*/
public static final int NETWORK_HOP_TO_DIFFERENT_GROUP = 2;
-
private final DiskRegionStats diskRegionStats;
+
/**
* Changes scope of replication to secondary bucket to SCOPE.DISTRIBUTED_NO_ACK
*/
- public static final boolean DISABLE_SECONDARY_BUCKET_ACK =
+ static final boolean DISABLE_SECONDARY_BUCKET_ACK =
Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "disablePartitionedRegionBucketAck");
/**
@@ -170,11 +302,11 @@ public class PartitionedRegion extends LocalRegion
private static ThreadLocal threadRandom = new ThreadLocal() {
@Override
protected Object initialValue() {
- int i = rand.nextInt();
+ int i = RANDOM.nextInt();
if (i < 0) {
i = -1 * i;
}
- return Integer.valueOf(i);
+ return i;
}
};
@@ -203,7 +335,7 @@ public class PartitionedRegion extends LocalRegion
private boolean cleanPRRegistration = false;
/** Time to wait for for acquiring distributed lock ownership */
- final static long VM_OWNERSHIP_WAIT_TIME = PRSystemPropertyGetter.parseLong(
+ private static final long VM_OWNERSHIP_WAIT_TIME = PRSystemPropertyGetter.parseLong(
System.getProperty(PartitionedRegionHelper.VM_OWNERSHIP_WAIT_TIME_PROPERTY),
PartitionedRegionHelper.VM_OWNERSHIP_WAIT_TIME_DEFAULT);
@@ -284,7 +416,7 @@ public class PartitionedRegion extends LocalRegion
*
* Concurrency: {@link #isLocallyDestroyed} is volatile
*/
- public Thread locallyDestroyingThread;
+ Thread locallyDestroyingThread;
// TODO someone please add a javadoc for this
private volatile boolean hasPartitionedIndex = false;
@@ -324,8 +456,7 @@ public class PartitionedRegion extends LocalRegion
private ScheduledExecutorService bucketSorter;
- private ConcurrentMap<String, Integer[]> partitionsMap =
- new ConcurrentHashMap<String, Integer[]>();
+ private ConcurrentMap<String, Integer[]> partitionsMap = new ConcurrentHashMap<>();
public ConcurrentMap<String, Integer[]> getPartitionsMap() {
return this.partitionsMap;
@@ -342,34 +473,33 @@ public class PartitionedRegion extends LocalRegion
* Byte 0 = no NWHOP Byte 1 = NWHOP to servers in same server-grp Byte 2 = NWHOP tp servers in
* other server-grp
*/
- private final ThreadLocal<Byte> networkHopType = new ThreadLocal<Byte>() {
+ private static final ThreadLocal<Byte> networkHopType = new ThreadLocal<Byte>() {
@Override
protected Byte initialValue() {
- return Byte.valueOf((byte) NETWORK_HOP_NONE);
+ return (byte) NETWORK_HOP_NONE;
}
};
public void clearNetworkHopData() {
- this.networkHopType.remove();
+ networkHopType.remove();
this.metadataVersion.remove();
}
private void setNetworkHopType(Byte value) {
- this.networkHopType.set(value);
+ networkHopType.set(value);
}
/**
- * <p>
* If the last operation in the current thread required a one-hop to another server who held the
* primary bucket for the operation then this will return something other than NETWORK_HOP_NONE.
- * </p>
+ * <p>
* see NETWORK_HOP_NONE, NETWORK_HOP_TO_SAME_GROUP and NETWORK_HOP_TO_DIFFERENT_GROUP
*/
public byte getNetworkHopType() {
- return this.networkHopType.get().byteValue();
+ return networkHopType.get();
}
- private final ThreadLocal<Byte> metadataVersion = new ThreadLocal<Byte>() {
+ private static final ThreadLocal<Byte> metadataVersion = new ThreadLocal<Byte>() {
@Override
protected Byte initialValue() {
return ClientMetadataService.INITIAL_VERSION;
@@ -377,14 +507,13 @@ public class PartitionedRegion extends LocalRegion
};
private void setMetadataVersion(Byte value) {
- this.metadataVersion.set(value);
+ metadataVersion.set(value);
}
public byte getMetadataVersion() {
- return this.metadataVersion.get().byteValue();
+ return metadataVersion.get();
}
-
/**
* Returns the LRUStatistics for this PR. This is needed to find the single instance of
* LRUStatistics created early for a PR when it is recovered from disk. This fixes bug 41938
@@ -397,9 +526,6 @@ public class PartitionedRegion extends LocalRegion
return result;
}
-
- ////////////////// ConcurrentMap methods //////////////////
-
@Override
public boolean remove(Object key, Object value, Object callbackArg) {
final long startTime = PartitionedRegionStats.startTime();
@@ -410,11 +536,6 @@ public class PartitionedRegion extends LocalRegion
}
}
-
-
- ////////////////// End of ConcurrentMap methods //////////////////
-
-
public PartitionListener[] getPartitionListeners() {
return this.partitionListeners;
}
@@ -476,11 +597,11 @@ public class PartitionedRegion extends LocalRegion
public Object getRegion(Object key) throws PRLocallyDestroyedException {
if (cleared) {
- Cache c = GemFireCacheImpl.getInstance();
- if (c == null) {
+ Cache cache = GemFireCacheImpl.getInstance();
+ if (cache == null) {
throw new CacheClosedException();
} else {
- c.getCancelCriterion().checkCancelInProgress(null);
+ cache.getCancelCriterion().checkCancelInProgress(null);
}
}
Assert.assertTrue(key instanceof Integer);
@@ -532,12 +653,11 @@ public class PartitionedRegion extends LocalRegion
}
Assert.assertTrue(key instanceof Integer);
if (sendIdentityRequestMessage)
- IdentityRequestMessage.setLatestId(((Integer) key).intValue());
+ IdentityRequestMessage.setLatestId((Integer) key);
if ((super.get(key) == DESTROYED) && (value instanceof PartitionedRegion)) {
- PartitionedRegionException pre = new PartitionedRegionException(
+ throw new PartitionedRegionException(
LocalizedStrings.PartitionedRegion_CAN_NOT_REUSE_OLD_PARTITIONED_REGION_ID_0
.toLocalizedString(key));
- throw pre;
}
return super.put(key, value);
}
@@ -549,26 +669,24 @@ public class PartitionedRegion extends LocalRegion
}
public synchronized String dump() {
- StringBuffer b = new StringBuffer("prIdToPR Map@");
- b.append(System.identityHashCode(prIdToPR)).append(":\n");
- Map.Entry me;
- for (Iterator i = prIdToPR.entrySet().iterator(); i.hasNext();) {
- me = (Map.Entry) i.next();
- b.append(me.getKey()).append("=>").append(me.getValue());
- if (i.hasNext()) {
- b.append("\n");
+ StringBuilder sb = new StringBuilder("prIdToPR Map@");
+ sb.append(System.identityHashCode(prIdToPR)).append(':').append(getLineSeparator());
+ Map.Entry mapEntry;
+ for (Iterator iterator = prIdToPR.entrySet().iterator(); iterator.hasNext();) {
+ mapEntry = (Map.Entry) iterator.next();
+ sb.append(mapEntry.getKey()).append("=>").append(mapEntry.getValue());
+ if (iterator.hasNext()) {
+ sb.append(getLineSeparator());
}
}
- return b.toString();
+ return sb.toString();
}
}
private int partitionedRegionId = -3;
- // final private Scope userScope;
-
/** Node description */
- final private Node node;
+ private final Node node;
/** Helper Object for redundancy Management of PartitionedRegion */
private final PRHARedundancyProvider redundancyProvider;
@@ -583,15 +701,7 @@ public class PartitionedRegion extends LocalRegion
*/
private final StoppableCountDownLatch initializationLatchAfterBucketIntialization;
- /**
- * Constructor for a PartitionedRegion. This has an accessor (Region API) functionality and
- * contains a datastore for actual storage. An accessor can act as a local cache by having a local
- * storage enabled. A PartitionedRegion can be created by a factory method of RegionFactory.java
- * and also by invoking Cache.createRegion(). (Cache.xml etc to be added)
- *
- */
-
- static public final String RETRY_TIMEOUT_PROPERTY =
+ public static final String RETRY_TIMEOUT_PROPERTY =
DistributionConfig.GEMFIRE_PREFIX + "partitionedRegionRetryTimeout";
private final PartitionRegionConfigValidator validator;
@@ -609,16 +719,22 @@ public class PartitionedRegion extends LocalRegion
private AbstractGatewaySender parallelGatewaySender = null;
- public PartitionedRegion(String regionname, RegionAttributes ra, LocalRegion parentRegion,
- GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs) {
- super(regionname, ra, parentRegion, cache, internalRegionArgs);
+ /**
+ * Constructor for a PartitionedRegion. This has an accessor (Region API) functionality and
+ * contains a datastore for actual storage. An accessor can act as a local cache by having a local
+ * storage enabled. A PartitionedRegion can be created by a factory method of RegionFactory.java
+ * and also by invoking Cache.createRegion(). (Cache.xml etc to be added)
+ */
+ public PartitionedRegion(String regionName, RegionAttributes regionAttributes,
+ LocalRegion parentRegion, InternalCache cache, InternalRegionArguments internalRegionArgs) {
+ super(regionName, regionAttributes, parentRegion, cache, internalRegionArgs);
this.node = initializeNode();
this.prStats = new PartitionedRegionStats(cache.getDistributedSystem(), getFullPath());
this.regionIdentifier = getFullPath().replace('/', '#');
if (logger.isDebugEnabled()) {
- logger.debug("Constructing Partitioned Region {}", regionname);
+ logger.debug("Constructing Partitioned Region {}", regionName);
}
// By adding this disconnect listener we ensure that the pridmap is cleaned
@@ -627,40 +743,37 @@ public class PartitionedRegion extends LocalRegion
// (which prevents pridmap cleanup).
cache.getInternalDistributedSystem().addDisconnectListener(dsPRIdCleanUpListener);
- // this.userScope = ra.getScope();
- this.partitionAttributes = ra.getPartitionAttributes();
+ this.partitionAttributes = regionAttributes.getPartitionAttributes();
this.localMaxMemory = this.partitionAttributes.getLocalMaxMemory();
this.retryTimeout = Integer.getInteger(RETRY_TIMEOUT_PROPERTY,
- PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION).intValue();
+ PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION);
this.totalNumberOfBuckets = this.partitionAttributes.getTotalNumBuckets();
this.prStats.incTotalNumBuckets(this.totalNumberOfBuckets);
- this.distAdvisor = RegionAdvisor.createRegionAdvisor(this); // Warning: potential early escape
- // of instance
- this.redundancyProvider = new PRHARedundancyProvider(this); // Warning:
- // potential
- // early escape
- // instance
+
+ // Warning: potential early escape of instance
+ this.distAdvisor = RegionAdvisor.createRegionAdvisor(this);
+ // Warning: potential early escape of instance
+ this.redundancyProvider = new PRHARedundancyProvider(this);
// localCacheEnabled = ra.getPartitionAttributes().isLocalCacheEnabled();
// This is to make sure that local-cache get and put works properly.
// getScope is overridden to return the correct scope.
// this.scope = Scope.LOCAL;
- this.redundantCopies = ra.getPartitionAttributes().getRedundantCopies();
- this.prStats.setConfiguredRedundantCopies(ra.getPartitionAttributes().getRedundantCopies());
- this.prStats.setLocalMaxMemory(ra.getPartitionAttributes().getLocalMaxMemory() * 1024L * 1024);
+ this.redundantCopies = regionAttributes.getPartitionAttributes().getRedundantCopies();
+ this.prStats.setConfiguredRedundantCopies(
+ regionAttributes.getPartitionAttributes().getRedundantCopies());
+ this.prStats.setLocalMaxMemory(
+ regionAttributes.getPartitionAttributes().getLocalMaxMemory() * 1024L * 1024);
// No redundancy required for writes
- this.minimumWriteRedundancy =
- Integer
- .getInteger(
- DistributionConfig.GEMFIRE_PREFIX + "mimimumPartitionedRegionWriteRedundancy", 0)
- .intValue();
+ this.minimumWriteRedundancy = Integer.getInteger(
+ DistributionConfig.GEMFIRE_PREFIX + "mimimumPartitionedRegionWriteRedundancy", 0);
+
// No redundancy required for reads
- this.minimumReadRedundancy = Integer
- .getInteger(DistributionConfig.GEMFIRE_PREFIX + "mimimumPartitionedRegionReadRedundancy", 0)
- .intValue();
+ this.minimumReadRedundancy = Integer.getInteger(
+ DistributionConfig.GEMFIRE_PREFIX + "mimimumPartitionedRegionReadRedundancy", 0);
- this.haveCacheLoader = ra.getCacheLoader() != null;
+ this.haveCacheLoader = regionAttributes.getCacheLoader() != null;
this.initializationLatchAfterBucketIntialization =
new StoppableCountDownLatch(this.getCancelCriterion(), 1);
@@ -685,7 +798,7 @@ public class PartitionedRegion extends LocalRegion
}
if (logger.isDebugEnabled()) {
- logger.debug("Partitioned Region {} constructed {}", regionname,
+ logger.debug("Partitioned Region {} constructed {}", regionName,
(this.haveCacheLoader ? "with a cache loader" : ""));
}
if (this.getEvictionAttributes() != null
@@ -762,7 +875,7 @@ public class PartitionedRegion extends LocalRegion
});
}
- public final boolean isShadowPR() {
+ public boolean isShadowPR() {
return isShadowPR;
}
@@ -773,7 +886,7 @@ public class PartitionedRegion extends LocalRegion
public Set<String> getParallelGatewaySenderIds() {
Set<String> regionGatewaySenderIds = this.getAllGatewaySenderIds();
if (regionGatewaySenderIds.isEmpty()) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
Set<GatewaySender> cacheGatewaySenders = getCache().getAllGatewaySenders();
Set<String> parallelGatewaySenderIds = new HashSet<String>();
@@ -809,10 +922,9 @@ public class PartitionedRegion extends LocalRegion
if (config.getTotalNumBuckets() != this.getTotalNumberOfBuckets()) {
Object[] prms = new Object[] {this.getFullPath(), this.getTotalNumberOfBuckets(),
config.getTotalNumBuckets()};
- IllegalStateException ise = new IllegalStateException(
+ throw new IllegalStateException(
LocalizedStrings.PartitionedRegion_FOR_REGION_0_TotalBucketNum_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2
.toString(prms));
- throw ise;
}
// Make sure we don't change to be colocated with a different region
// We also can't change from colocated to not colocated without writing
@@ -825,10 +937,9 @@ public class PartitionedRegion extends LocalRegion
.toLocalizedString(this.getFullPath()),
null, dsi);
dsi.handleDiskAccessException(dae);
- IllegalStateException ise = new IllegalStateException(
+ throw new IllegalStateException(
LocalizedStrings.PartitionedRegion_FOR_REGION_0_ColocatedWith_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2
.toString(prms));
- throw ise;
}
} else {
@@ -870,8 +981,6 @@ public class PartitionedRegion extends LocalRegion
createAndValidatePersistentConfig();
initializePartitionedRegion();
- /* set the total number of buckets */
- // setTotalNumOfBuckets();
// If localMaxMemory is set to 0, do not initialize Data Store.
final boolean storesData = this.localMaxMemory > 0;
if (storesData) {
@@ -1028,7 +1137,7 @@ public class PartitionedRegion extends LocalRegion
if (!allGatewaySenderIds.isEmpty()) {
for (GatewaySender sender : cache.getAllGatewaySenders()) {
if (sender.isParallel() && allGatewaySenderIds.contains(sender.getId())) {
- /**
+ /*
* get the ParallelGatewaySender to create the colocated partitioned region for this
* region.
*/
@@ -1212,7 +1321,6 @@ public class PartitionedRegion extends LocalRegion
}
final RegionLock rl = getRegionLock();
try {
- // if (!rl.lock()) {
if (logger.isDebugEnabled()) {
logger.debug("registerPartitionedRegion: obtaining lock");
}
@@ -1231,8 +1339,7 @@ public class PartitionedRegion extends LocalRegion
this.getAllGatewaySenderIds());
logger.info(LocalizedMessage.create(
LocalizedStrings.PartitionedRegion_PARTITIONED_REGION_0_IS_BORN_WITH_PRID_1_IDENT_2,
- new Object[] {getFullPath(), Integer.valueOf(this.partitionedRegionId),
- getRegionIdentifier()}));
+ new Object[] {getFullPath(), this.partitionedRegionId, getRegionIdentifier()}));
PRSanityCheckMessage.schedule(this);
} else {
@@ -1246,11 +1353,11 @@ public class PartitionedRegion extends LocalRegion
this.partitionedRegionId = prConfig.getPRId();
logger.info(LocalizedMessage.create(
LocalizedStrings.PartitionedRegion_PARTITIONED_REGION_0_IS_CREATED_WITH_PRID_1,
- new Object[] {getFullPath(), Integer.valueOf(this.partitionedRegionId)}));
+ new Object[] {getFullPath(), this.partitionedRegionId}));
}
synchronized (prIdToPR) {
- prIdToPR.put(Integer.valueOf(this.partitionedRegionId), this); // last
+ prIdToPR.put(this.partitionedRegionId, this); // last
}
prConfig.addNode(this.node);
if (this.getFixedPartitionAttributesImpl() != null) {
@@ -1289,15 +1396,14 @@ public class PartitionedRegion extends LocalRegion
SystemFailure.checkFailure();
String registerErrMsg =
LocalizedStrings.PartitionedRegion_AN_EXCEPTION_WAS_CAUGHT_WHILE_REGISTERING_PARTITIONEDREGION_0_DUMPPRID_1
- .toLocalizedString(new Object[] {getFullPath(), prIdToPR.dump()});
+ .toLocalizedString(getFullPath(), prIdToPR.dump());
try {
synchronized (prIdToPR) {
- if (prIdToPR.containsKey(Integer.valueOf(this.partitionedRegionId))) {
- prIdToPR.put(Integer.valueOf(this.partitionedRegionId), PRIdMap.FAILED_REGISTRATION,
- false);
+ if (prIdToPR.containsKey(this.partitionedRegionId)) {
+ prIdToPR.put(this.partitionedRegionId, PRIdMap.FAILED_REGISTRATION, false);
logger.info(LocalizedMessage.create(
LocalizedStrings.PartitionedRegion_FAILED_REGISTRATION_PRID_0_NAMED_1,
- new Object[] {Integer.valueOf(this.partitionedRegionId), this.getName()}));
+ new Object[] {this.partitionedRegionId, this.getName()}));
}
}
} catch (VirtualMachineError err) {
@@ -1305,7 +1411,7 @@ public class PartitionedRegion extends LocalRegion
// If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Throwable ignore) {
+ } catch (Throwable e) {
// Whenever you catch Error or Throwable, you must also
// catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
@@ -1313,8 +1419,7 @@ public class PartitionedRegion extends LocalRegion
// is still usable:
SystemFailure.checkFailure();
if (logger.isDebugEnabled()) {
- logger.debug("Partitioned Region creation, could not clean up after caught exception",
- ignore);
+ logger.debug("Partitioned Region creation, could not clean up after caught exception", e);
}
}
throw new PartitionedRegionException(registerErrMsg, t);
@@ -1326,7 +1431,7 @@ public class PartitionedRegion extends LocalRegion
}
} catch (Exception es) {
if (logger.isDebugEnabled()) {
- logger.warn(es.getMessage(), es);
+ logger.debug(es.getMessage(), es);
}
}
}
@@ -1381,7 +1486,7 @@ public class PartitionedRegion extends LocalRegion
/**
* Get the Partitioned Region identifier used for DLocks (Bucket and Region)
*/
- final public String getRegionIdentifier() {
+ public String getRegionIdentifier() {
return this.regionIdentifier;
}
@@ -1392,8 +1497,6 @@ public class PartitionedRegion extends LocalRegion
/**
* Throw an exception if persistent data recovery from disk is not complete for this region.
- *
- * @throws PartitionOfflineException
*/
public void checkPROffline() throws PartitionOfflineException {
if (getDataPolicy().withPersistence() && !recoveredFromDisk) {
@@ -1406,7 +1509,7 @@ public class PartitionedRegion extends LocalRegion
}
}
- public final void updatePRConfig(PartitionRegionConfig prConfig, boolean putOnlyIfUpdated) {
+ public void updatePRConfig(PartitionRegionConfig prConfig, boolean putOnlyIfUpdated) {
final Set<Node> nodes = prConfig.getNodes();
final PartitionedRegion colocatedRegion = ColocationHelper.getColocatedRegion(this);
RegionLock colocatedLock = null;
@@ -1440,11 +1543,8 @@ public class PartitionedRegion extends LocalRegion
}
/**
- *
- * @param keyInfo
* @param access true if caller wants last accessed time updated
* @param allowTombstones - whether a tombstone can be returned
- * @return TODO
*/
@Override
protected Region.Entry<?, ?> nonTXGetEntry(KeyInfo keyInfo, boolean access,
@@ -1471,7 +1571,7 @@ public class PartitionedRegion extends LocalRegion
logger.trace("getEntryInBucket: " + "Key key={} ({}) from: {} bucketId={}", key,
key.hashCode(), targetNode, bucketStringForLogs(bucketId));
}
- Integer bucketIdInt = Integer.valueOf(bucketId);
+ Integer bucketIdInt = bucketId;
EntrySnapshot ret = null;
int count = 0;
RetryTimeKeeper retryTime = null;
@@ -1511,10 +1611,10 @@ public class PartitionedRegion extends LocalRegion
return ret;
} catch (PRLocallyDestroyedException pde) {
if (logger.isDebugEnabled()) {
- logger.debug("getEntryInBucket: Encountered PRLocallyDestroyedException ");
+ logger.debug("getEntryInBucket: Encountered PRLocallyDestroyedException", pde);
}
checkReadiness();
- } catch (EntryNotFoundException enfe) {
+ } catch (EntryNotFoundException ignore) {
return null;
} catch (ForceReattemptException prce) {
prce.checkKey(key);
@@ -1523,7 +1623,7 @@ public class PartitionedRegion extends LocalRegion
}
checkReadiness();
InternalDistributedMember lastNode = retryNode;
- retryNode = getOrCreateNodeForBucketRead(bucketIdInt.intValue());
+ retryNode = getOrCreateNodeForBucketRead(bucketIdInt);
if (lastNode.equals(retryNode)) {
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
@@ -1538,8 +1638,8 @@ public class PartitionedRegion extends LocalRegion
logger.debug("Bucket {} on Node {} not primary", notPrimary.getLocalizedMessage(),
retryNode);
}
- getRegionAdvisor().notPrimary(bucketIdInt.intValue(), retryNode);
- retryNode = getOrCreateNodeForBucketRead(bucketIdInt.intValue());
+ getRegionAdvisor().notPrimary(bucketIdInt, retryNode);
+ retryNode = getOrCreateNodeForBucketRead(bucketIdInt);
}
// It's possible this is a GemFire thread e.g. ServerConnection
@@ -1561,11 +1661,10 @@ public class PartitionedRegion extends LocalRegion
if (logger.isDebugEnabled()) {
e = new PartitionedRegionDistributionException(
LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GETENTRY_IN_0_ATTEMPTS
- .toLocalizedString(Integer.valueOf(count)));
+ .toLocalizedString(count));
}
logger.warn(LocalizedMessage.create(
- LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GETENTRY_IN_0_ATTEMPTS,
- Integer.valueOf(count)), e);
+ LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GETENTRY_IN_0_ATTEMPTS, count), e);
return null;
}
@@ -1589,7 +1688,6 @@ public class PartitionedRegion extends LocalRegion
* @param allowTombstones whether tombstones should be returned
* @throws EntryNotFoundException if the entry doesn't exist
* @throws ForceReattemptException if the peer is no longer available
- * @throws PrimaryBucketException
* @return true if the passed key is contained remotely.
*/
public EntrySnapshot getEntryRemotely(InternalDistributedMember targetNode, Integer bucketId,
@@ -1624,7 +1722,7 @@ public class PartitionedRegion extends LocalRegion
* @throws UnsupportedOperationException OVERRIDES
*/
@Override
- final public Region createSubregion(String subregionName, RegionAttributes regionAttributes)
+ public Region createSubregion(String subregionName, RegionAttributes regionAttributes)
throws RegionExistsException, TimeoutException {
throw new UnsupportedOperationException();
}
@@ -1718,7 +1816,7 @@ public class PartitionedRegion extends LocalRegion
for (;;) {
try {
return doExecuteQuery(query, parameters, buckets);
- } catch (ForceReattemptException fre) {
+ } catch (ForceReattemptException ignore) {
// fall through and loop
}
}
@@ -1744,20 +1842,20 @@ public class PartitionedRegion extends LocalRegion
while (remoteIter.hasNext()) {
allBuckets.add((Integer) remoteIter.next());
}
- } catch (NoSuchElementException stop) {
+ } catch (NoSuchElementException ignore) {
}
} else { // local buckets
Iterator localIter = null;
if (this.dataStore != null) {
localIter = buckets.iterator();
} else {
- localIter = Collections.EMPTY_SET.iterator();
+ localIter = Collections.emptySet().iterator();
}
try {
while (localIter.hasNext()) {
allBuckets.add((Integer) localIter.next());
}
- } catch (NoSuchElementException stop) {
+ } catch (NoSuchElementException ignore) {
}
}
@@ -1790,7 +1888,7 @@ public class PartitionedRegion extends LocalRegion
try {
results = prqe.queryBuckets(null);
break;
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} catch (FunctionDomainException e) {
throw e;
@@ -1814,7 +1912,7 @@ public class PartitionedRegion extends LocalRegion
// Drop Duplicates if this is a DISTINCT query
boolean allowsDuplicates = results.getCollectionType().allowsDuplicates();
- // Asif: No need to apply the limit to the SelectResults.
+ // No need to apply the limit to the SelectResults.
// We know that even if we do not apply the limit,
// the results will satisfy the limit
// as it has been evaluated in the iteration of List to
@@ -1829,16 +1927,14 @@ public class PartitionedRegion extends LocalRegion
if (selectExpr.getOrderByAttrs() != null) {
// Set limit also, its not applied while building the final result set as order by is
// involved.
- // results = new ResultsCollectionWrapper(elementType, results.asSet(),
- // query.getLimit(parameters));
} else if (allowsDuplicates) {
results = new ResultsCollectionWrapper(elementType, results.asSet());
}
if (selectExpr.isCount() && (results.isEmpty() || selectExpr.isDistinct())) {
- SelectResults resultCount = new ResultsBag(getCachePerfStats());// Constructor with
- // elementType not visible.
+ // Constructor with elementType not visible.
+ SelectResults resultCount = new ResultsBag(getCachePerfStats());
resultCount.setElementType(new ObjectTypeImpl(Integer.class));
- ((ResultsBag) resultCount).addAndGetOccurence(results.size());
+ ((Bag) resultCount).addAndGetOccurence(results.size());
return resultCount;
}
}
@@ -1882,11 +1978,6 @@ public class PartitionedRegion extends LocalRegion
throw new UnsupportedOperationException();
}
- // /////////////////////////////////////////////////////////////////////
- // ////////////// Operation Supported for this release
- // //////////////////////////////
- // /////////////////////////////////////////////////////////////////////
-
@Override
boolean virtualPut(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue,
boolean requireOldValue, long lastModified, boolean overwriteDestroyed)
@@ -1903,7 +1994,7 @@ public class PartitionedRegion extends LocalRegion
final Integer bucketId = event.getKeyInfo().getBucketId();
assert bucketId != KeyInfo.UNKNOWN_BUCKET;
// check in bucket2Node region
- InternalDistributedMember targetNode = getNodeForBucketWrite(bucketId.intValue(), null);
+ InternalDistributedMember targetNode = getNodeForBucketWrite(bucketId, null);
// force all values to be serialized early to make size computation cheap
// and to optimize distribution.
if (logger.isDebugEnabled()) {
@@ -1913,7 +2004,7 @@ public class PartitionedRegion extends LocalRegion
if (targetNode == null) {
try {
bucketStorageAssigned = false;
- targetNode = createBucket(bucketId.intValue(), event.getNewValSizeForPR(), null);
+ targetNode = createBucket(bucketId, event.getNewValSizeForPR(), null);
} catch (PartitionedRegionStorageException e) {
// try not to throw a PRSE if the cache is closing or this region was
// destroyed during createBucket() (bug 36574)
@@ -1955,18 +2046,7 @@ public class PartitionedRegion extends LocalRegion
rde2.initCause(rde);
throw rde2;
}
- }
- // catch (CacheWriterException cwe) {
- // throw cwe;
- // }
- // catch (TimeoutException te) {
- // throw te;
- // }
- // catch (RuntimeException re) {
- // throw re;
- // }
- finally {
- // event.setPutAllOperation(putAllOp_save); // Gester: temporary fix
+ } finally {
if (putAllOp_save == null) {
// only for normal put
if (ifNew) {
@@ -1978,8 +2058,8 @@ public class PartitionedRegion extends LocalRegion
}
if (!result) {
checkReadiness();
- if (!ifNew && !ifOld && !this.concurrencyChecksEnabled) { // may fail due to concurrency
- // conflict
+ if (!ifNew && !ifOld && !this.concurrencyChecksEnabled) {
+ // may fail due to concurrency conflict
// failed for unknown reason
// throw new PartitionedRegionStorageException("unable to execute operation");
logger.warn(
@@ -2008,16 +2088,10 @@ public class PartitionedRegion extends LocalRegion
getSharedDataView().destroyExistingEntry(event, true, null);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.LocalRegion#checkIfAboveThreshold(org.apache.geode.internal.
- * cache.EntryEventImpl)
- */
@Override
- public void checkIfAboveThreshold(EntryEventImpl evi) throws LowMemoryException {
- getRegionAdvisor().checkIfBucketSick(evi.getKeyInfo().getBucketId(), evi.getKey());
+ public void checkIfAboveThreshold(EntryEventImpl entryEvent) throws LowMemoryException {
+ getRegionAdvisor().checkIfBucketSick(entryEvent.getKeyInfo().getBucketId(),
+ entryEvent.getKey());
}
public boolean isFixedPartitionedRegion() {
@@ -2052,9 +2126,8 @@ public class PartitionedRegion extends LocalRegion
return 0;
}
-
@Override
- public void postPutAllFireEvents(DistributedPutAllOperation putallOp,
+ public void postPutAllFireEvents(DistributedPutAllOperation putAllOp,
VersionedObjectList successfulPuts) {
/*
* No op on pr, will happen in the buckets etc.
@@ -2062,22 +2135,21 @@ public class PartitionedRegion extends LocalRegion
}
@Override
- public void postRemoveAllFireEvents(DistributedRemoveAllOperation op,
+ public void postRemoveAllFireEvents(DistributedRemoveAllOperation removeAllOp,
VersionedObjectList successfulOps) {
/*
* No op on pr, will happen in the buckets etc.
*/
}
-
/**
* Create PutAllPRMsgs for each bucket, and send them.
*
- * @param putallO DistributedPutAllOperation object.
+ * @param putAllOp DistributedPutAllOperation object.
* @param successfulPuts not used in PartitionedRegion.
*/
@Override
- public long postPutAllSend(DistributedPutAllOperation putallO,
+ public long postPutAllSend(DistributedPutAllOperation putAllOp,
VersionedObjectList successfulPuts) {
final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -2085,94 +2157,85 @@ public class PartitionedRegion extends LocalRegion
throw new CacheClosedException("Cache is shutting down");
}
- try {
- final long startTime = PartitionedRegionStats.startTime();
- // build all the msgs by bucketid
- HashMap prMsgMap = putallO.createPRMessages();
- PutAllPartialResult partialKeys = new PutAllPartialResult(putallO.putAllDataSize);
-
- // clear the successfulPuts list since we're actually doing the puts here
- // and the basicPutAll work was just a way to build the DPAO object
- Map<Object, VersionTag> keyToVersionMap =
- new HashMap<Object, VersionTag>(successfulPuts.size());
- successfulPuts.clearVersions();
- Iterator itor = prMsgMap.entrySet().iterator();
- while (itor.hasNext()) {
- Map.Entry mapEntry = (Map.Entry) itor.next();
- Integer bucketId = (Integer) mapEntry.getKey();
- PutAllPRMessage prMsg = (PutAllPRMessage) mapEntry.getValue();
- checkReadiness();
- long then = 0;
- if (isDebugEnabled) {
- then = System.currentTimeMillis();
+ final long startTime = PartitionedRegionStats.startTime();
+ // build all the msgs by bucketid
+ HashMap prMsgMap = putAllOp.createPRMessages();
+ PutAllPartialResult partialKeys = new PutAllPartialResult(putAllOp.putAllDataSize);
+
+ // clear the successfulPuts list since we're actually doing the puts here
+ // and the basicPutAll work was just a way to build the DPAO object
+ Map<Object, VersionTag> keyToVersionMap =
+ new HashMap<Object, VersionTag>(successfulPuts.size());
+ successfulPuts.clearVersions();
+ Iterator itor = prMsgMap.entrySet().iterator();
+ while (itor.hasNext()) {
+ Map.Entry mapEntry = (Map.Entry) itor.next();
+ Integer bucketId = (Integer) mapEntry.getKey();
+ PutAllPRMessage prMsg = (PutAllPRMessage) mapEntry.getValue();
+ checkReadiness();
+ long then = 0;
+ if (isDebugEnabled) {
+ then = System.currentTimeMillis();
+ }
+ try {
+ VersionedObjectList versions = sendMsgByBucket(bucketId, prMsg);
+ if (versions.size() > 0) {
+ partialKeys.addKeysAndVersions(versions);
+ versions.saveVersions(keyToVersionMap);
+ } else if (!this.concurrencyChecksEnabled) { // no keys returned if not versioned
+ Set keys = prMsg.getKeys();
+ partialKeys.addKeys(keys);
}
- try {
- VersionedObjectList versions = sendMsgByBucket(bucketId, prMsg);
- if (versions.size() > 0) {
- partialKeys.addKeysAndVersions(versions);
- versions.saveVersions(keyToVersionMap);
- } else if (!this.concurrencyChecksEnabled) { // no keys returned if not versioned
- Set keys = prMsg.getKeys();
- partialKeys.addKeys(keys);
- }
- } catch (PutAllPartialResultException pre) {
- // sendMsgByBucket applied partial keys
- if (isDebugEnabled) {
- logger.debug("PR.postPutAll encountered PutAllPartialResultException, ", pre);
- }
- partialKeys.consolidate(pre.getResult());
- } catch (Exception ex) {
- // If failed at other exception
- if (isDebugEnabled) {
- logger.debug("PR.postPutAll encountered exception at sendMsgByBucket, ", ex);
- }
- @Released
- EntryEventImpl firstEvent = prMsg.getFirstEvent(this);
- try {
- partialKeys.saveFailedKey(firstEvent.getKey(), ex);
- } finally {
- firstEvent.release();
- }
+ } catch (PutAllPartialResultException pre) {
+ // sendMsgByBucket applied partial keys
+ if (isDebugEnabled) {
+ logger.debug("PR.postPutAll encountered PutAllPartialResultException, ", pre);
}
+ partialKeys.consolidate(pre.getResult());
+ } catch (Exception ex) {
+ // If failed at other exception
if (isDebugEnabled) {
- long now = System.currentTimeMillis();
- if ((now - then) >= 10000) {
- logger.debug("PR.sendMsgByBucket took " + (now - then) + " ms");
- }
+ logger.debug("PR.postPutAll encountered exception at sendMsgByBucket, ", ex);
+ }
+ @Released
+ EntryEventImpl firstEvent = prMsg.getFirstEvent(this);
+ try {
+ partialKeys.saveFailedKey(firstEvent.getKey(), ex);
+ } finally {
+ firstEvent.release();
}
}
- this.prStats.endPutAll(startTime);
- if (!keyToVersionMap.isEmpty()) {
- for (Iterator it = successfulPuts.getKeys().iterator(); it.hasNext();) {
- successfulPuts.addVersion(keyToVersionMap.get(it.next()));
+ if (isDebugEnabled) {
+ long now = System.currentTimeMillis();
+ if ((now - then) >= 10000) {
+ logger.debug("PR.sendMsgByBucket took " + (now - then) + " ms");
}
- keyToVersionMap.clear();
}
+ }
+ this.prStats.endPutAll(startTime);
+ if (!keyToVersionMap.isEmpty()) {
+ for (Iterator it = successfulPuts.getKeys().iterator(); it.hasNext();) {
+ successfulPuts.addVersion(keyToVersionMap.get(it.next()));
+ }
+ keyToVersionMap.clear();
+ }
- if (partialKeys.hasFailure()) {
- logger.info(LocalizedMessage.create(LocalizedStrings.Region_PutAll_Applied_PartialKeys_0_1,
- new Object[] {getFullPath(), partialKeys}));
- if (putallO.isBridgeOperation()) {
- if (partialKeys.getFailure() instanceof CancelException) {
- throw (CancelException) partialKeys.getFailure();
- } else {
- throw new PutAllPartialResultException(partialKeys);
- }
+ if (partialKeys.hasFailure()) {
+ logger.info(LocalizedMessage.create(LocalizedStrings.Region_PutAll_Applied_PartialKeys_0_1,
+ new Object[] {getFullPath(), partialKeys}));
+ if (putAllOp.isBridgeOperation()) {
+ if (partialKeys.getFailure() instanceof CancelException) {
+ throw (CancelException) partialKeys.getFailure();
} else {
- if (partialKeys.getFailure() instanceof RuntimeException) {
- throw (RuntimeException) partialKeys.getFailure();
- } else {
- throw new RuntimeException(partialKeys.getFailure());
- }
+ throw new PutAllPartialResultException(partialKeys);
+ }
+ } else {
+ if (partialKeys.getFailure() instanceof RuntimeException) {
+ throw (RuntimeException) partialKeys.getFailure();
+ } else {
+ throw new RuntimeException(partialKeys.getFailure());
}
}
- } finally {
- /*
- * // TODO XD OFFHEAP MERGE: do we have any events that need freeOffHeapReferences for
- * (PutAllPRMessage.PutAllResponse resp : responses) { PutAllPRMessage.PRMsgResponseContext
- * ctx = resp.getContextObject(); if (ctx != null) { EntryEventImpl e = ctx.getEvent(); if (e
- * != null) { e.release(); } } }
- */
}
return -1;
}
@@ -2280,7 +2343,7 @@ public class PartitionedRegion extends LocalRegion
EntryEventImpl event = prMsg.getFirstEvent(this);
try {
RetryTimeKeeper retryTime = null;
- InternalDistributedMember currentTarget = getNodeForBucketWrite(bucketId.intValue(), null);
+ InternalDistributedMember currentTarget = getNodeForBucketWrite(bucketId, null);
if (isDebugEnabled) {
logger.debug("PR.sendMsgByBucket:bucket {}'s currentTarget is {}", bucketId, currentTarget);
}
@@ -2312,7 +2375,7 @@ public class PartitionedRegion extends LocalRegion
boolean interrupted = Thread.interrupted();
try {
Thread.sleep(PartitionedRegionHelper.DEFAULT_WAIT_PER_RETRY_ITERATION);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -2351,9 +2414,9 @@ public class PartitionedRegion extends LocalRegion
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
if (isDebugEnabled) {
- logger.debug("PR.sendMsgByBucket: Old target was {}, Retrying", lastTarget,
+ logger.debug("PR.sendMsgByBucket: Old target was {}, Retrying {}", lastTarget,
currentTarget);
}
if (lastTarget.equals(currentTarget)) {
@@ -2377,11 +2440,11 @@ public class PartitionedRegion extends LocalRegion
logger.debug("Bucket {} on Node {} not primnary", notPrimary.getLocalizedMessage(),
currentTarget);
}
- getRegionAdvisor().notPrimary(bucketId.intValue(), currentTarget);
+ getRegionAdvisor().notPrimary(bucketId, currentTarget);
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
} catch (DataLocationException dle) {
if (isDebugEnabled) {
logger.debug("DataLocationException processing putAll", dle);
@@ -2421,7 +2484,7 @@ public class PartitionedRegion extends LocalRegion
EntryEventImpl event = prMsg.getFirstEvent(this);
try {
RetryTimeKeeper retryTime = null;
- InternalDistributedMember currentTarget = getNodeForBucketWrite(bucketId.intValue(), null);
+ InternalDistributedMember currentTarget = getNodeForBucketWrite(bucketId, null);
if (logger.isDebugEnabled()) {
logger.debug("PR.sendMsgByBucket:bucket {}'s currentTarget is {}", bucketId, currentTarget);
}
@@ -2453,7 +2516,7 @@ public class PartitionedRegion extends LocalRegion
boolean interrupted = Thread.interrupted();
try {
Thread.sleep(PartitionedRegionHelper.DEFAULT_WAIT_PER_RETRY_ITERATION);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -2492,7 +2555,7 @@ public class PartitionedRegion extends LocalRegion
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
if (logger.isTraceEnabled()) {
logger.trace("PR.sendMsgByBucket: Old target was {}, Retrying {}", lastTarget,
currentTarget);
@@ -2518,11 +2581,11 @@ public class PartitionedRegion extends LocalRegion
logger.debug("Bucket {} on Node {} not primary", notPrimary.getLocalizedMessage(),
currentTarget);
}
- getRegionAdvisor().notPrimary(bucketId.intValue(), currentTarget);
+ getRegionAdvisor().notPrimary(bucketId, currentTarget);
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
} catch (DataLocationException dle) {
if (logger.isDebugEnabled()) {
logger.debug("DataLocationException processing putAll", dle);
@@ -2666,8 +2729,7 @@ public class PartitionedRegion extends LocalRegion
boolean requireOldValue, final long lastModified) {
if (logger.isDebugEnabled()) {
logger.debug("putInBucket: {} ({}) to {} to bucketId={} retry={} ms", event.getKey(),
- event.getKey().hashCode(), targetNode, bucketStringForLogs(bucketId.intValue()),
- retryTimeout);
+ event.getKey().hashCode(), targetNode, bucketStringForLogs(bucketId), retryTimeout);
}
// retry the put remotely until it finds the right node managing the bucket
@@ -2700,7 +2762,7 @@ public class PartitionedRegion extends LocalRegion
boolean interrupted = Thread.interrupted();
try {
Thread.sleep(PartitionedRegionHelper.DEFAULT_WAIT_PER_RETRY_ITERATION);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -2734,11 +2796,6 @@ public class PartitionedRegion extends LocalRegion
}
checkIfAboveThreshold(event);
if (isLocal) {
- // final boolean cacheWrite = !event.isOriginRemote()
- // && !event.isNetSearch();
- // if (cacheWrite) {
- // doCacheWriteBeforePut(event, ifNew);
- // }
event.setInvokePRCallbacks(true);
long start = this.prStats.startPutLocal();
try {
@@ -2748,7 +2805,7 @@ public class PartitionedRegion extends LocalRegion
// given that most manipulation of values is remote (requiring serialization to send).
// But... function execution always implies local manipulation of
// values so keeping locally updated values in Object form should be more efficient.
- if (!DistributionManager.isFunctionExecutionThread.get().booleanValue()) {
+ if (!DistributionManager.isFunctionExecutionThread.get()) {
// TODO: this condition may not help since BucketRegion.virtualPut calls
// forceSerialized
br.forceSerialized(event);
@@ -2819,7 +2876,7 @@ public class PartitionedRegion extends LocalRegion
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
if (lastTarget.equals(currentTarget)) {
if (retryTime.overMaximum()) {
PRHARedundancyProvider.timedOut(this, null, null, "update an entry", this.retryTimeout);
@@ -2833,11 +2890,11 @@ public class PartitionedRegion extends LocalRegion
logger.debug("Bucket {} on Node {} not primary", notPrimary.getLocalizedMessage(),
currentTarget);
}
- getRegionAdvisor().notPrimary(bucketId.intValue(), currentTarget);
+ getRegionAdvisor().notPrimary(bucketId, currentTarget);
if (retryTime == null) {
retryTime = new RetryTimeKeeper(this.retryTimeout);
}
- currentTarget = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ currentTarget = getNodeForBucketWrite(bucketId, retryTime);
}
// It's possible this is a GemFire thread e.g. ServerConnection
@@ -2865,7 +2922,7 @@ public class PartitionedRegion extends LocalRegion
if (logger.isDebugEnabled()) {
logger.debug(
"putInBucket for bucketId = {} failed (attempt # {} ({} ms left), retrying with node {}",
- bucketStringForLogs(bucketId.intValue()), count, (timeOut - System.currentTimeMillis()),
+ bucketStringForLogs(bucketId), count, (timeOut - System.currentTimeMillis()),
currentTarget);
}
} // for
@@ -2893,45 +2950,16 @@ public class PartitionedRegion extends LocalRegion
}
retryTime.waitForBucketsRecovery();
- newNode = getNodeForBucketWrite(bucketId.intValue(), retryTime);
+ newNode = getNodeForBucketWrite(bucketId, retryTime);
if (newNode == null) {
- newNode = createBucket(bucketId.intValue(), getEntrySize(event), retryTime);
+ newNode = createBucket(bucketId, getEntrySize(event), retryTime);
}
return newNode;
}
/**
- * Serialize the key and value early (prior to creating the message) to gather the size of the
- * entry Assumes the new value from the <code>EntryEventImpl</code> is not serialized
- *
- * @return sum of bytes as reported by {@link CachedDeserializable#getSizeInBytes()}
- */
- // private int serializeValue(EntryEventImpl event)
- // {
- // TODO serialize the key as well
- // this code used to make the following call:
- // Object val = event.getNewValue();
- // which deserializes the value and we don't want to do that.
- // int numBytes = 0;
- // Object val = event.getNewValue();
- // if (val == null) {
- // // event.setSerializedNewValue(new byte[] {DataSerializer.NULL});
- // return 0;
- // }
- // if (val instanceof byte[]) {
- // byte[] v = (byte[]) val;
- // numBytes = v.length;
- // } else {
- // if (event.getSerializedNewValue() == null) {
- // event.setSerializedNewValue(EntryEventImpl.serialize(event.getNewValue()));
- // }
- // numBytes = getEntrySize(event);
- // }
- // return numBytes;
- // }
- /**
- * Get the serialized size of an <code>EntryEventImpl</code>
+ * Get the serialized size of an {@code EntryEventImpl}
*
* @param eei the entry from whcih to fetch the size
* @return the size of the serialized entry
@@ -2940,28 +2968,11 @@ public class PartitionedRegion extends LocalRegion
@Unretained
final Object v = eei.getRawNewValue();
if (v instanceof CachedDeserializable) {
- return ((CachedDeserializable) v).getSizeInBytes();
+ return ((Sizeable) v).getSizeInBytes();
}
return 0;
}
- // /**
- // * Gets the Node that is managing a specific bucketId. This does consider
- // the
- // * failed nodes.
- // *
- // * @param bucketId
- // * identifier for bucket
- // * @param failedNodeList
- // * of all the failedNodes to avoid these failed nodes to be picked in
- // * the next node selection.
- // * @return the Node managing the bucket
- // */
- // private Node getNodeForBucketExcludeFailedNode(final Long bucketId,
- // final List failedNodeList) {
- // throw new IllegalStateException("bucket2node should not be used");
- // }
-
public InternalDistributedMember getOrCreateNodeForBucketWrite(int bucketId,
final RetryTimeKeeper snoozer) {
InternalDistributedMember targetNode = getNodeForBucketWrite(bucketId, snoozer);
@@ -3023,8 +3034,7 @@ public class PartitionedRegion extends LocalRegion
final TimeoutException noTime = new TimeoutException(
LocalizedStrings.PartitionedRegion_ATTEMPT_TO_ACQUIRE_PRIMARY_NODE_FOR_WRITE_ON_BUCKET_0_TIMED_OUT_IN_1_MS_CURRENT_REDUNDANCY_2_DOES_NOT_SATISFY_MINIMUM_3
.toLocalizedString(new Object[] {bucketStringForLogs(bucketId),
- Integer.valueOf(localSnoozer.getRetryTime()), Integer.valueOf(red),
- Integer.valueOf(this.minimumWriteRedundancy)}));
+ localSnoozer.getRetryTime(), red, this.minimumWriteRedundancy}));
checkReadiness();
throw noTime;
}
@@ -3036,8 +3046,6 @@ public class PartitionedRegion extends LocalRegion
return waitForNoStorageOrPrimary(bucketId, "write");
}
-
-
/**
* wait until there is a primary or there is no storage
*
@@ -3142,8 +3150,7 @@ public class PartitionedRegion extends LocalRegion
if (isTX()) {
return getNodeForBucketWrite(bucketId, null);
}
- InternalDistributedMember result = getRegionAdvisor().getPreferredNode(bucketId);
- return result;
+ return getRegionAdvisor().getPreferredNode(bucketId);
}
/**
@@ -3315,9 +3322,6 @@ public class PartitionedRegion extends LocalRegion
* can be executed on just one fabric node, executed in parallel on a subset of nodes in parallel
* across all the nodes.
*
- * @param function
- * @param execution
- * @param rc
* @since GemFire 6.0
*/
public ResultCollector executeFunction(final Function function,
@@ -3371,9 +3375,6 @@ public class PartitionedRegion extends LocalRegion
/**
* Executes function on multiple nodes
- *
- * @param function
- * @param execution
*/
private ResultCollector executeOnMultipleNodes(final Function function,
final PartitionedRegionFunctionExecutor execution, ResultCollector rc, boolean isPRSingleHop,
@@ -3420,8 +3421,7 @@ public class PartitionedRegion extends LocalRegion
boolean hasRemovedNode = false;
while (iterator.hasNext()) {
- if (execution.getFailedNodes()
- .contains(((InternalDistributedMember) iterator.next()).getId())) {
+ if (execution.getFailedNodes().contains(((DistributedMember) iterator.next()).getId())) {
hasRemovedNode = true;
}
}
@@ -3490,7 +3490,7 @@ public class PartitionedRegion extends LocalRegion
.constructAndGetAllColocatedLocalDataSet(PartitionedRegion.this, localBucketSet),
localBucketSet, resultSender, execution.isReExecute());
if (logger.isDebugEnabled()) {
- logger.debug("FunctionService: Executing on local node with keys.{}" + localKeys);
+ logger.debug("FunctionService: Executing on local node with keys.{}", localKeys);
}
execution.executeFunctionOnLocalPRNode(function, prContext, resultSender, dm, isTX());
}
@@ -3508,8 +3508,8 @@ public class PartitionedRegion extends LocalRegion
recipMap.put(recip, context);
}
if (logger.isDebugEnabled()) {
- logger.debug("FunctionService: Executing on remote nodes with member to keys map.{}"
- + memberToKeysMap);
+ logger.debug("FunctionService: Executing on remote nodes with member to keys map.{}",
+ memberToKeysMap);
}
PartitionedRegionFunctionResultWaiter resultReciever =
new PartitionedRegionFunctionResultWaiter(getSystem(), this.getPRId(),
@@ -3517,14 +3517,11 @@ public class PartitionedRegion extends LocalRegion
return resultReciever.getPartitionedDataFrom(recipMap, this, execution);
}
return localResultCollector;
-
}
/**
* Single key execution on single node
*
- * @param function
- * @param execution
* @since GemFire 6.0
*/
private ResultCollector executeOnSingleNode(final Function function,
@@ -3534,14 +3531,14 @@ public class PartitionedRegion extends LocalRegion
final Object key = routingKeys.iterator().next();
final Integer bucketId;
if (isBucketSetAsFilter) {
- bucketId = ((Integer) key).intValue();
+ bucketId = (Integer) key;
} else {
- bucketId = Integer.valueOf(
- PartitionedRegionHelper.getHashKey(this, Operation.FUNCTION_EXECUTION, key, null, null));
+ bucketId =
+ PartitionedRegionHelper.getHashKey(this, Operation.FUNCTION_EXECUTION, key, null, null);
}
InternalDistributedMember targetNode = null;
if (function.optimizeForWrite()) {
- targetNode = createBucket(bucketId.intValue(), 0, null /* retryTimeKeeper */);
+ targetNode = createBucket(bucketId, 0, null /* retryTimeKeeper */);
HeapMemoryMonitor hmm =
((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
if (hmm.isMemberHeapCritical(targetNode)
@@ -3549,11 +3546,11 @@ public class PartitionedRegion extends LocalRegion
Set<DistributedMember> sm = Collections.singleton((DistributedMember) targetNode);
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
- .toLocalizedString(new Object[] {function.getId(), sm}),
+ .toLocalizedString(function.getId(), sm),
sm);
}
} else {
- targetNode = getOrCreateNodeForBucketRead(bucketId.intValue());
+ targetNode = getOrCreateNodeForBucketRead(bucketId);
}
final DistributedMember localVm = getMyId();
if (targetNode != null && isPRSingleHop && !localVm.equals(targetNode)) {
@@ -3588,7 +3585,7 @@ public class PartitionedRegion extends LocalRegion
* if (retryTime.overMaximum()) { PRHARedundancyProvider.timedOut(this, null, null,
* "doing function execution", this.retryTimeout); // NOTREACHED }
*/
- // Asif: Fix for Bug # 40083
+ // Fix for Bug # 40083
targetNode = null;
while (targetNode == null) {
if (retryTime.overMaximum()) {
@@ -3598,9 +3595,9 @@ public class PartitionedRegion extends LocalRegion
}
retryTime.waitToRetryNode();
if (function.optimizeForWrite()) {
- targetNode = getOrCreateNodeForBucketWrite(bucketId.intValue(), retryTime);
+ targetNode = getOrCreateNodeForBucketWrite(bucketId, retryTime);
} else {
- targetNode = getOrCreateNodeForBucketRead(bucketId.intValue());
+ targetNode = getOrCreateNodeForBucketRead(bucketId);
}
}
if (targetNode == null) {
@@ -3644,7 +3641,8 @@ public class PartitionedRegion extends LocalRegion
Set<Integer> actualBucketSet = this.getRegionAdvisor().getBucketSet();
try {
bucketSet.retainAll(actualBucketSet);
- } catch (NoSuchElementException done) {
+ } catch (NoSuchElementException ignore) {
+ // done
}
HashMap<InternalDistributedMember, HashSet<Integer>> memberToBuckets =
FunctionExecutionNodePruner.groupByMemberToBuckets(this, bucketSet,
@@ -3700,8 +3698,7 @@ public class PartitionedRegion extends LocalRegion
boolean hasRemovedNode = false;
while (iterator.hasNext()) {
- if (execution.getFailedNodes()
- .contains(((InternalDistributedMember) iterator.next()).getId())) {
+ if (execution.getFailedNodes().contains(((DistributedMember) iterator.next()).getId())) {
hasRemovedNode = true;
}
}
@@ -3728,7 +3725,7 @@ public class PartitionedRegion extends LocalRegion
Set<DistributedMember> sm = SetUtils.intersection(hcm, dest);
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
- .toLocalizedString(new Object[] {function.getId(), sm}),
+ .toLocalizedString(function.getId(), sm),
sm);
}
@@ -3746,8 +3743,6 @@ public class PartitionedRegion extends LocalRegion
execution.isReExecute(), execution.isFnSerializationReqd());
recipMap.put(recip, context);
}
- // final LocalResultCollector localResultCollector = new LocalResultCollector(function, rc,
- // execution);
final LocalResultCollector<?, ?> localRC = execution.getLocalResultCollector(function, rc);
final DM dm = getDistributionManager();
@@ -3763,28 +3758,18 @@ public class PartitionedRegion extends LocalRegion
execution.getArgumentsForMember(getMyId().getId()), null, ColocationHelper
.constructAndGetAllColocatedLocalDataSet(PartitionedRegion.this, localBucketSet),
localBucketSet, resultSender, execution.isReExecute());
- // final RegionFunctionContextImpl prContext = new RegionFunctionContextImpl(
- // function.getId(), PartitionedRegion.this, execution
- // .getArgumentsForMember(getMyId().getId()), null, ColocationHelper
- // .constructAndGetAllColocatedLocalDataSet(PartitionedRegion.this,
- // localBucketSet), resultSender, execution.isReExecute());
execution.executeFunctionOnLocalNode(function, prContext, resultSender, dm, isTX());
}
PartitionedRegionFunctionResultWaiter resultReciever =
new PartitionedRegionFunctionResultWaiter(getSystem(), this.getPRId(), localRC, function,
resultSender);
- ResultCollector reply = resultReciever.getPartitionedDataFrom(recipMap, this, execution);
-
- return reply;
-
+ return resultReciever.getPartitionedDataFrom(recipMap, this, execution);
}
/**
* Executes function on all bucket nodes
*
- * @param function
- * @param execution
* @return ResultCollector
* @since GemFire 6.0
*/
@@ -3796,7 +3781,7 @@ public class PartitionedRegion extends LocalRegion
while (itr.hasNext()) {
try {
bucketSet.add(itr.next());
- } catch (NoSuchElementException ex) {
+ } catch (NoSuchElementException ignore) {
}
}
HashMap<InternalDistributedMember, HashSet<Integer>> memberToBuckets =
@@ -3818,8 +3803,7 @@ public class PartitionedRegion extends LocalRegion
boolean hasRemovedNode = false;
while (iterator.hasNext()) {
- if (execution.getFailedNodes()
- .contains(((InternalDistributedMember) iterator.next()).getId())) {
+ if (execution.getFailedNodes().contains(((DistributedMember) iterator.next()).getId())) {
hasRemovedNode = true;
}
}
@@ -3876,18 +3860,11 @@ public class PartitionedRegion extends LocalRegion
new PartitionedRegionFunctionResultWaiter(getSystem(), this.getPRId(), localResultCollector,
function, resultSender);
- ResultCollector reply = resultReciever.getPartitionedDataFrom(recipMap, this, execution);
-
- return reply;
+ return resultReciever.getPartitionedDataFrom(recipMap, this, execution);
}
/**
- * no docs
- *
- * @param preferCD
* @param requestingClient the client requesting the object, or null if not from a client
- * @param clientEvent TODO
- * @param returnTombstones TODO
* @param allowRetry if false then do not retry
*/
private Object getFromBucket(final InternalDistributedMember targetNode, int bucketId,
@@ -3945,13 +3922,10 @@ public class PartitionedRegion extends LocalRegion
}
}
- // Test hook
- if (((LocalRegion) this).isTest())
- ((LocalRegion) this).incCountNotFoundInLocal();
obj = getRemotely(retryNode, bucketId, key, aCallbackArgument, preferCD, requestingClient,
clientEvent, returnTombstones);
- // TODO:Suranjan&Yogesh : there should be better way than this one
+ // TODO: there should be better way than this one
String name = Thread.currentThread().getName();
if (name.startsWith("ServerConnection") && !getMyId().equals(retryNode)) {
setNetworkHopType(bucketId, (InternalDistributedMember) retryNode);
@@ -4004,7 +3978,8 @@ public class PartitionedRegion extends LocalRegion
if (prce instanceof BucketNotFoundException) {
TransactionException ex = new TransactionDataRebalancedException(
LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING
- .toLocalizedString(key));
+ .toLocalizedString(key),
+ prce);
ex.initCause(prce);
throw ex;
}
@@ -4023,8 +3998,7 @@ public class PartitionedRegion extends LocalRegion
// Make transaction fail so client could retry
// instead of returning null if ForceReattemptException is thrown.
// Should not see it currently, added to be protected against future changes.
- TransactionException ex = new TransactionException("Failed to get key: " + key, prce);
- throw ex;
+ throw new TransactionException("Failed to get key: " + key, prce);
}
}
} catch (PrimaryBucketException notPrimary) {
@@ -4062,17 +4036,15 @@ public class PartitionedRegion extends LocalRegion
if (logger.isDebugEnabled()) {
e = new PartitionedRegionDistributionException(
LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GET_IN_0_ATTEMPTS
- .toLocalizedString(Integer.valueOf(count)));
+ .toLocalizedString(count));
}
- logger.warn(LocalizedMessage.create(
- LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GET_IN_0_ATTEMPTS,
- Integer.valueOf(count)), e);
+ logger.warn(LocalizedMessage
+ .create(LocalizedStrings.PartitionRegion_NO_VM_AVAILABLE_FOR_GET_IN_0_ATTEMPTS, count), e);
return null;
}
/**
* If a bucket is local, try to fetch the value from it
- *
*/
public Object getFromLocalBucket(int bucketId, final Object key, final Object aCallbackArgument,
boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
@@ -4095,14 +4067,11 @@ public class PartitionedRegion extends LocalRegion
return null;
}
-
/**
* This invokes a cache writer before a destroy operation. Although it has the same method
* signature as the method in LocalRegion, it is invoked in a different code path. LocalRegion
* invokes this method via its "entries" member, while PartitionedRegion invokes this method in
* its region operation methods and messages.
- *
- * @see LocalRegion#cacheWriteBeforeRegionDestroy(RegionEventImpl)
*/
@Override
boolean cacheWriteBeforeRegionDestroy(RegionEventImpl event)
@@ -4141,8 +4110,7 @@ public class PartitionedRegion extends LocalRegion
*/
public DistributedMember getMemberOwning(Object key) {
int bucketId = PartitionedRegionHelper.getHashKey(this, null, key, null, null);
- InternalDistributedMember targetNode = getNodeForBucketRead(bucketId);
- return targetNode;
+ return getNodeForBucketRead(bucketId);
}
/**
@@ -4166,7 +4134,6 @@ public class PartitionedRegion extends LocalRegion
public Object localCacheGet(Object key) {
RegionEntry re = getRegionMap().getEntry(key);
if (re == null || re.isDestroyedOrRemoved()) {
- // TODO:KIRK:OK if (re == null || Token.isRemoved(re.getValueInVM(this))) {
return null;
} else {
return re.getValue(this); // OFFHEAP: spin until we can copy into a heap cd?
@@ -4185,12 +4152,9 @@ public class PartitionedRegion extends LocalRegion
/**
* Test Method: Get a random set of keys from a randomly selected bucket using the provided
- * <code>Random</code> number generator.
+ * {@code Random} number generator.
*
- * @param rnd
* @return A set of keys from a randomly chosen bucket or {@link Collections#EMPTY_SET}
- * @throws IOException
- * @throws ClassNotFoundException
*/
public Set getSomeKeys(Random rnd) throws IOException, ClassNotFoundException {
InternalDistributedMember nod = null;
@@ -4212,7 +4176,7 @@ public class PartitionedRegion extends LocalRegion
}
buck = (Integer) buksA[ind];
- nod = getNodeForBucketRead(buck.intValue());
+ nod = getNodeForBucketRead(buck);
if (nod != null) {
logger.debug("getSomeKeys: iteration: {} for node {}", i, nod);
if (nod.equals(getMyId())) {
@@ -4233,7 +4197,7 @@ public class PartitionedRegion extends LocalRegion
"Test hook getSomeKeys caught a ForceReattemptException for bucketId={}{}{}. Moving on to another bucket",
getPRId(), BUCKET_ID_SEPARATOR, buck, movinOn);
continue;
- } catch (PRLocallyDestroyedException pde) {
+ } catch (PRLocallyDestroyedException ignore) {
logger.debug("getSomeKeys: Encountered PRLocallyDestroyedException");
checkReadiness();
continue;
@@ -4242,7 +4206,7 @@ public class PartitionedRegion extends LocalRegion
} // nod != null
} // for
logger.debug("getSomeKeys: no keys found returning empty set");
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
/**
@@ -4255,7 +4219,7 @@ public class PartitionedRegion extends LocalRegion
*/
public List<BucketDump> getAllBucketEntries(final int bucketId) throws ForceReattemptException {
if (bucketId >= getTotalNumberOfBuckets()) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
ArrayList<BucketDump> ret = new ArrayList<BucketDump>();
HashSet<InternalDistributedMember> collected = new HashSet<InternalDistributedMember>();
@@ -4279,6 +4243,7 @@ public class PartitionedRegion extends LocalRegion
if (owner.equals(getMyId())) {
BucketRegion br = this.dataStore.handleRemoteGetEntries(bucketId);
Map<Object, Object> m = new HashMap<Object, Object>() {
+ // TODO: clean this up -- outer class is not serializable
private static final long serialVersionUID = 0L;
@Override
@@ -4320,7 +4285,7 @@ public class PartitionedRegion extends LocalRegion
final FetchEntriesResponse r;
r = FetchEntriesMessage.send(owner, this, bucketId);
ret.add(r.waitForEntries());
- } catch (ForceReattemptException e) {
+ } catch (ForceReattemptException ignore) {
// node has departed? Ignore.
}
} // for
@@ -4328,11 +4293,9 @@ public class PartitionedRegion extends LocalRegion
return ret;
}
-
/**
* Fetch the keys for the given bucket identifier, if the bucket is local or remote.
*
- * @param bucketNum
* @return A set of keys from bucketNum or {@link Collections#EMPTY_SET}if no keys can be found.
*/
public Set getBucketKeys(int bucketNum) {
@@ -4343,12 +4306,11 @@ public class PartitionedRegion extends LocalRegion
* Fetch the keys for the given bucket identifier, if the bucket is local or remote. This version
* of the method allows you to retrieve Tombstone entries as well as undestroyed entries.
*
- * @param bucketNum
* @param allowTombstones whether to include destroyed entries in the result
* @return A set of keys from bucketNum or {@link Collections#EMPTY_SET}if no keys can be found.
*/
public Set getBucketKeys(int bucketNum, boolean allowTombstones) {
- Integer buck = Integer.valueOf(bucketNum);
+ Integer buck = bucketNum;
final int retryAttempts = calcRetry();
Set ret = null;
int count = 0;
@@ -4387,7 +4349,7 @@ public class PartitionedRegion extends LocalRegion
if (ret != null) {
return ret;
}
- } catch (PRLocallyDestroyedException pde) {
+ } catch (PRLocallyDestroyedException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("getBucketKeys: Encountered PRLocallyDestroyedException");
}
@@ -4401,14 +4363,13 @@ public class PartitionedRegion extends LocalRegion
snoozer = new RetryTimeKeeper(this.retryTimeout);
}
InternalDistributedMember oldNode = nod;
- nod = getNodeForBucketRead(buck.intValue());
+ nod = getNodeForBucketRead(buck);
if (nod != null && nod.equals(oldNode)) {
if (snoozer.overMaximum()) {
checkReadiness();
throw new TimeoutException(
LocalizedStrings.PartitionedRegion_ATTEMPT_TO_ACQUIRE_PRIMARY_NODE_FOR_READ_ON_BUCKET_0_TIMED_OUT_IN_1_MS
- .toLocalizedString(new Object[] {getBucketName(buck.intValue()),
- Integer.valueOf(snoozer.getRetryTime())}));
+ .toLocalizedString(new Object[] {getBucketName(buck), snoozer.getRetryTime()}));
}
snoozer.waitToRetryNode();
}
@@ -4419,7 +4380,7 @@ public class PartitionedRegion extends LocalRegion
if (logger.isDebugEnabled()) {
logger.debug("getBucketKeys: no keys found returning empty set");
}
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
/**
@@ -4494,12 +4455,7 @@ public class PartitionedRegion extends LocalRegion
}
/**
- *
- * @param nodeToBuckets
- * @param values
- * @param servConn
* @return set of bucket-ids that could not be read from.
- * @throws IOException
*/
private Set<Integer> handleOldNodes(HashMap nodeToBuckets, VersionedObjectList values,
ServerConnection servConn) throws IOException {
@@ -4526,7 +4482,7 @@ public class PartitionedRegion extends LocalRegion
try {
FetchKeysResponse fkr = FetchKeysMessage.send(member, this, bucket, true);
keys = fkr.waitForKeys();
- } catch (ForceReattemptException fre) {
+ } catch (ForceReattemptException ignore) {
failures.add(bucket);
}
} else {
@@ -4658,8 +4614,6 @@ public class PartitionedRegion extends LocalRegion
}
/**
- *
- * @param retryTime
* @return boolean False indicates caller should stop re-trying.
*/
private boolean waitForFetchRemoteEntriesRetry(RetryTimeKeeper retryTime) {
@@ -4680,9 +4634,9 @@ public class PartitionedRegion extends LocalRegion
keys = this.dataStore.getKeysLocally(id, true);
}
result.addAll(keys);
- } catch (ForceReattemptException fre) {
+ } catch (ForceReattemptException ignore) {
failures.add(id);
- } catch (PRLocallyDestroyedException prlde) {
+ } catch (PRLocallyDestroyedException ignore) {
failures.add(id);
}
return result;
@@ -4691,12 +4645,6 @@ public class PartitionedRegion extends LocalRegion
/**
* Sends FetchBulkEntriesMessage to each of the nodes hosting the buckets, unless the nodes
<TRUNCATED>
[33/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ConnectionImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ConnectionImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ConnectionImpl.java
index a494138..1c7e0bb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ConnectionImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ConnectionImpl.java
@@ -31,16 +31,16 @@ import org.apache.geode.cache.client.internal.ExecuteFunctionOp.ExecuteFunctionO
import org.apache.geode.cache.client.internal.ExecuteRegionFunctionOp.ExecuteRegionFunctionOpImpl;
import org.apache.geode.cache.client.internal.ExecuteRegionFunctionSingleHopOp.ExecuteRegionFunctionSingleHopOpImpl;
import org.apache.geode.cache.wan.GatewaySender;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.tier.sockets.HandShake;
import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
import org.apache.geode.internal.cache.tier.sockets.ServerQueueStatus;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+import org.apache.geode.internal.net.SocketCreator;
/**
* A single client to server connection.
@@ -49,10 +49,11 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
* server connection at the same time.
*
* @since GemFire 5.7
- *
*/
public class ConnectionImpl implements Connection {
+ // TODO: DEFAULT_CLIENT_FUNCTION_TIMEOUT should be private
+ public static final int DEFAULT_CLIENT_FUNCTION_TIMEOUT = 0;
private static Logger logger = LogService.getLogger();
/**
@@ -61,17 +62,21 @@ public class ConnectionImpl implements Connection {
*/
private static boolean TEST_DURABLE_CLIENT_CRASH = false;
+ // TODO: clientFunctionTimeout is not thread-safe and should be non-static
+ private static int clientFunctionTimeout;
+
private Socket theSocket;
private ByteBuffer commBuffer;
private ByteBuffer commBufferForAsyncRead;
- // private int handShakeTimeout = AcceptorImpl.DEFAULT_HANDSHAKE_TIMEOUT_MS;
private ServerQueueStatus status;
private volatile boolean connectFinished;
private final AtomicBoolean destroyed = new AtomicBoolean();
private Endpoint endpoint;
- private short wanSiteVersion = -1;// In Gateway communication version of connected wan site
- // will be stored after successful handshake
- // private final CancelCriterion cancelCriterion;
+
+ // In Gateway communication version of connected wan site will be stored after successful
+ // handshake
+ private short wanSiteVersion = -1;
+
private final InternalDistributedSystem ds;
private OutputStream out;
@@ -82,8 +87,14 @@ public class ConnectionImpl implements Connection {
private HandShake handShake;
public ConnectionImpl(InternalDistributedSystem ds, CancelCriterion cancelCriterion) {
- // this.cancelCriterion = cancelCriterion;
this.ds = ds;
+ int time = Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT",
+ DEFAULT_CLIENT_FUNCTION_TIMEOUT);
+ clientFunctionTimeout = time >= 0 ? time : DEFAULT_CLIENT_FUNCTION_TIMEOUT;
+ }
+
+ public static int getClientFunctionTimeout() {
+ return clientFunctionTimeout;
}
public ServerQueueStatus connect(EndpointManager endpointManager, ServerLocation location,
@@ -149,9 +160,9 @@ public class ConnectionImpl implements Connection {
commBuffer = null;
try {
theSocket.close();
- } catch (IOException e) {
+ } catch (IOException ignore) {
// ignore
- } catch (RuntimeException e) {
+ } catch (RuntimeException ignore) {
// ignore
}
}
@@ -256,7 +267,7 @@ public class ConnectionImpl implements Connection {
if (op instanceof ExecuteFunctionOpImpl || op instanceof ExecuteRegionFunctionOpImpl
|| op instanceof ExecuteRegionFunctionSingleHopOpImpl) {
int earliertimeout = this.getSocket().getSoTimeout();
- this.getSocket().setSoTimeout(GemFireCacheImpl.getClientFunctionTimeout());
+ this.getSocket().setSoTimeout(getClientFunctionTimeout());
try {
result = op.attempt(this);
} finally {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
index 54521d5..3da550a 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
@@ -14,7 +14,6 @@
*/
package org.apache.geode.cache.client.internal;
-
import org.apache.geode.cache.NoSubscriptionServersAvailableException;
import org.apache.geode.cache.client.SubscriptionNotEnabledException;
import org.apache.geode.distributed.internal.ServerLocation;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteFunctionOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteFunctionOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteFunctionOp.java
index d32e0f4..5e5a4e9 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteFunctionOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteFunctionOp.java
@@ -23,7 +23,6 @@ import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.execute.AbstractExecution;
import org.apache.geode.internal.cache.execute.FunctionStats;
import org.apache.geode.internal.cache.execute.InternalFunctionException;
@@ -500,8 +499,8 @@ public class ExecuteFunctionOp {
}
private void addBytes(byte isReexecute, byte fnStateOrHasResult) {
- if (GemFireCacheImpl
- .getClientFunctionTimeout() == GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
+ if (ConnectionImpl
+ .getClientFunctionTimeout() == ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
if (isReexecute == 1) {
getMessage().addBytesPart(
new byte[] {AbstractExecution.getReexecuteFunctionState(fnStateOrHasResult)});
@@ -515,7 +514,7 @@ public class ExecuteFunctionOp {
} else {
bytes[0] = fnStateOrHasResult;
}
- Part.encodeInt(GemFireCacheImpl.getClientFunctionTimeout(), bytes, 1);
+ Part.encodeInt(ConnectionImpl.getClientFunctionTimeout(), bytes, 1);
getMessage().addBytesPart(bytes);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOp.java
index 01f9081..70f3bbf 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionOp.java
@@ -32,7 +32,6 @@ import org.apache.geode.cache.execute.FunctionInvocationTargetException;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.execute.AbstractExecution;
import org.apache.geode.internal.cache.execute.BucketMovedException;
import org.apache.geode.internal.cache.execute.FunctionStats;
@@ -479,13 +478,13 @@ public class ExecuteRegionFunctionOp {
}
private void addBytes(byte functionStateOrHasResult) {
- if (GemFireCacheImpl
- .getClientFunctionTimeout() == GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
+ if (ConnectionImpl
+ .getClientFunctionTimeout() == ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
getMessage().addBytesPart(new byte[] {functionStateOrHasResult});
} else {
byte[] bytes = new byte[5];
bytes[0] = functionStateOrHasResult;
- Part.encodeInt(GemFireCacheImpl.getClientFunctionTimeout(), bytes, 1);
+ Part.encodeInt(ConnectionImpl.getClientFunctionTimeout(), bytes, 1);
getMessage().addBytesPart(bytes);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionSingleHopOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionSingleHopOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionSingleHopOp.java
index 1697b07..cf14e28 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionSingleHopOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecuteRegionFunctionSingleHopOp.java
@@ -33,7 +33,7 @@ import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.execute.AbstractExecution;
import org.apache.geode.internal.cache.execute.BucketMovedException;
@@ -68,7 +68,7 @@ public class ExecuteRegionFunctionSingleHopOp {
if (function.isHA()) {
maxRetryAttempts = mRetryAttempts;
}
- ClientMetadataService cms = ((GemFireCacheImpl) region.getCache()).getClientMetadataService();
+ ClientMetadataService cms = ((InternalCache) region.getCache()).getClientMetadataService();
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
@@ -114,7 +114,7 @@ public class ExecuteRegionFunctionSingleHopOp {
if (isHA) {
maxRetryAttempts = mRetryAttempts;
}
- ClientMetadataService cms = ((GemFireCacheImpl) region.getCache()).getClientMetadataService();
+ ClientMetadataService cms = ((InternalCache) region.getCache()).getClientMetadataService();
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
@@ -243,7 +243,7 @@ public class ExecuteRegionFunctionSingleHopOp {
}
getMessage().addObjPart(args);
getMessage().addObjPart(memberMappedArg);
- getMessage().addBytesPart(new byte[] {allBuckets ? (byte) 1 : (byte) 0});
+ getMessage().addBytesPart(new byte[] {(byte) (allBuckets ? 1 : 0)});
getMessage().addIntPart(routingObjects.size());
for (Object key : routingObjects) {
if (allBuckets) {
@@ -284,7 +284,7 @@ public class ExecuteRegionFunctionSingleHopOp {
getMessage().addStringOrObjPart(functionId);
getMessage().addObjPart(args);
getMessage().addObjPart(memberMappedArg);
- getMessage().addBytesPart(new byte[] {allBuckets ? (byte) 1 : (byte) 0});
+ getMessage().addBytesPart(new byte[] {(byte) (allBuckets ? 1 : 0)});
getMessage().addIntPart(routingObjects.size());
for (Object key : routingObjects) {
if (allBuckets) {
@@ -307,13 +307,13 @@ public class ExecuteRegionFunctionSingleHopOp {
}
private void addBytes(byte functionState) {
- if (GemFireCacheImpl
- .getClientFunctionTimeout() == GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
+ if (ConnectionImpl
+ .getClientFunctionTimeout() == ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT) {
getMessage().addBytesPart(new byte[] {functionState});
} else {
byte[] bytes = new byte[5];
bytes[0] = functionState;
- Part.encodeInt(GemFireCacheImpl.getClientFunctionTimeout(), bytes, 1);
+ Part.encodeInt(ConnectionImpl.getClientFunctionTimeout(), bytes, 1);
getMessage().addBytesPart(bytes);
}
}
@@ -336,7 +336,7 @@ public class ExecuteRegionFunctionSingleHopOp {
Object resultResponse = executeFunctionResponseMsg.getPart(0).getObject();
Object result;
if (resultResponse instanceof ArrayList) {
- result = ((ArrayList) resultResponse).get(0);
+ result = ((List) resultResponse).get(0);
} else {
result = resultResponse;
}
@@ -344,13 +344,12 @@ public class ExecuteRegionFunctionSingleHopOp {
FunctionException ex = ((FunctionException) result);
if (isDebugEnabled) {
logger.debug(
- "ExecuteRegionFunctionSingleHopOpImpl#processResponse: received Exception. {}",
+ "ExecuteRegionFunctionSingleHopOpImpl#processResponse: received Exception.",
ex.getCause());
}
if (ex instanceof InternalFunctionException) {
Throwable cause = ex.getCause();
- DistributedMember memberID =
- (DistributedMember) ((ArrayList) resultResponse).get(1);
+ DistributedMember memberID = (DistributedMember) ((List) resultResponse).get(1);
this.resultCollector.addResult(memberID, cause);
FunctionStats
.getFunctionStats(this.functionId, this.executor.getRegion().getSystem())
@@ -374,8 +373,7 @@ public class ExecuteRegionFunctionSingleHopOp {
new InternalFunctionInvocationTargetException(
((CacheClosedException) result).getMessage());
if (resultResponse instanceof ArrayList) {
- DistributedMember memberID =
- (DistributedMember) ((ArrayList) resultResponse).get(1);
+ DistributedMember memberID = (DistributedMember) ((List) resultResponse).get(1);
this.failedNodes.add(memberID.getId());
}
exception = new FunctionException(fite);
@@ -383,8 +381,7 @@ public class ExecuteRegionFunctionSingleHopOp {
String s = "While performing a remote " + getOpName();
exception = new ServerOperationException(s, (Throwable) result);
} else {
- DistributedMember memberID =
- (DistributedMember) ((ArrayList) resultResponse).get(1);
+ DistributedMember memberID = (DistributedMember) ((List) resultResponse).get(1);
this.resultCollector.addResult(memberID, result);
FunctionStats
.getFunctionStats(this.functionId, this.executor.getRegion().getSystem())
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/GetOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/GetOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/GetOp.java
index 3c4fe10..271c92e 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/GetOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/GetOp.java
@@ -25,7 +25,6 @@ import org.apache.geode.cache.client.ServerOperationException;
import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.EntryEventImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.Token;
import org.apache.geode.internal.cache.tier.MessageType;
@@ -60,7 +59,7 @@ public class GetOp {
*/
public static Object execute(ExecutablePool pool, LocalRegion region, Object key,
Object callbackArg, boolean prSingleHopEnabled, EntryEventImpl clientEvent) {
- ClientMetadataService cms = ((GemFireCacheImpl) region.getCache()).getClientMetadataService();
+ ClientMetadataService cms = region.getCache().getClientMetadataService();
GetOpImpl op = new GetOpImpl(region, key, callbackArg, prSingleHopEnabled, clientEvent);
if (logger.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/InternalClientCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/InternalClientCache.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/InternalClientCache.java
new file mode 100644
index 0000000..537d632
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/InternalClientCache.java
@@ -0,0 +1,37 @@
+/*
+ * 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.cache.client.internal;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionExistsException;
+import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.client.Pool;
+import org.apache.geode.cache.client.PoolFactory;
+
+public interface InternalClientCache extends ClientCache {
+
+ boolean isClient();
+
+ void determineDefaultPool();
+
+ Pool determineDefaultPool(PoolFactory poolFactory);
+
+ <K, V> Region<K, V> basicCreateRegion(String name, RegionAttributes<K, V> attrs)
+ throws RegionExistsException, TimeoutException;
+
+ Pool getDefaultPool();
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
index 32d0f8e..8b70c01 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.client.internal.EndpointManager.EndpointListenerAdapter;
import org.apache.geode.cache.client.internal.PoolImpl.PoolTask;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
/**
@@ -93,7 +94,7 @@ public class LiveServerPinger extends EndpointListenerAdapter {
logger.debug("Error occured while pinging server: {} - {}", endpoint.getLocation(),
e.getMessage());
}
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
ClientMetadataService cms = cache.getClientMetadataService();
cms.removeBucketServerLocation(endpoint.getLocation());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PdxRegistryRecoveryListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PdxRegistryRecoveryListener.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PdxRegistryRecoveryListener.java
index 93063e0..8c52551 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PdxRegistryRecoveryListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PdxRegistryRecoveryListener.java
@@ -19,6 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.Logger;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.pdx.internal.TypeRegistry;
@@ -72,7 +73,7 @@ public class PdxRegistryRecoveryListener extends EndpointManager.EndpointListene
logger.debug("PdxRegistryRecoveryListener - EndpointNowInUse. Now have {} endpoints", count);
}
if (count == 1) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
return;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
index 88369e1..57b3992 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
@@ -14,11 +14,33 @@
*/
package org.apache.geode.cache.client.internal;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.CancelException;
import org.apache.geode.StatisticsFactory;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.NoSubscriptionServersAvailableException;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionService;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.ServerConnectivityException;
import org.apache.geode.cache.client.SubscriptionNotEnabledException;
@@ -31,26 +53,21 @@ import org.apache.geode.distributed.PoolCancelledException;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.internal.statistics.DummyStatisticsFactory;
import org.apache.geode.internal.ScheduledThreadPoolExecutorWithKeepAlive;
import org.apache.geode.internal.admin.ClientStatsManager;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.PoolFactoryImpl;
+import org.apache.geode.internal.cache.PoolManagerImpl;
+import org.apache.geode.internal.cache.PoolStats;
import org.apache.geode.internal.cache.tier.sockets.AcceptorImpl;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.net.InetSocketAddress;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.geode.internal.statistics.DummyStatisticsFactory;
/**
* Manages the client side of client to server connections and client queues.
@@ -58,26 +75,29 @@ import java.util.concurrent.atomic.AtomicInteger;
* @since GemFire 5.7
*/
public class PoolImpl implements InternalPool {
+
public static final String ON_DISCONNECT_CLEAR_PDXTYPEIDS =
DistributionConfig.GEMFIRE_PREFIX + "ON_DISCONNECT_CLEAR_PDXTYPEIDS";
private static final Logger logger = LogService.getLogger();
- public static final int HANDSHAKE_TIMEOUT =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.HANDSHAKE_TIMEOUT",
- AcceptorImpl.DEFAULT_HANDSHAKE_TIMEOUT_MS).intValue();
- public static final long SHUTDOWN_TIMEOUT = Long
- .getLong(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.SHUTDOWN_TIMEOUT", 30000).longValue();
- public static final int BACKGROUND_TASK_POOL_SIZE = Integer
- .getInteger(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.BACKGROUND_TASK_POOL_SIZE", 20)
- .intValue();
- public static final int BACKGROUND_TASK_POOL_KEEP_ALIVE =
- Integer
- .getInteger(
- DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.BACKGROUND_TASK_POOL_KEEP_ALIVE", 1000)
- .intValue();
- // For durable client tests only. Connection Sources read this flag
- // and return an empty list of servers.
+ private static final int HANDSHAKE_TIMEOUT =
+ Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.HANDSHAKE_TIMEOUT",
+ AcceptorImpl.DEFAULT_HANDSHAKE_TIMEOUT_MS);
+
+ public static final long SHUTDOWN_TIMEOUT =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.SHUTDOWN_TIMEOUT", 30000);
+
+ private static final int BACKGROUND_TASK_POOL_SIZE = Integer
+ .getInteger(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.BACKGROUND_TASK_POOL_SIZE", 20);
+
+ private static final int BACKGROUND_TASK_POOL_KEEP_ALIVE = Integer.getInteger(
+ DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.BACKGROUND_TASK_POOL_KEEP_ALIVE", 1000);
+
+ /**
+ * For durable client tests only. Connection Sources read this flag and return an empty list of
+ * servers.
+ */
public volatile static boolean TEST_DURABLE_IS_NET_DOWN = false;
private final String name;
@@ -152,7 +172,7 @@ public class PoolImpl implements InternalPool {
} catch (RuntimeException e) {
try {
destroy(false);
- } catch (RuntimeException e2) {
+ } catch (RuntimeException ignore) {
// do nothing
}
throw e;
@@ -219,7 +239,7 @@ public class PoolImpl implements InternalPool {
}
this.stats = this.startDisabled ? null
: new PoolStats(statFactory,
- getName() + "->" + (serverGroup == null || serverGroup.equals("") ? "[any servers]"
+ getName() + "->" + (serverGroup == null || serverGroup.isEmpty() ? "[any servers]"
: "[" + getServerGroup() + "]"));
source = getSourceImpl(((PoolFactoryImpl.PoolAttributes) attributes).locatorCallback);
@@ -521,7 +541,7 @@ public class PoolImpl implements InternalPool {
if (cnt > 0) {
throw new IllegalStateException(
LocalizedStrings.PoolImpl_POOL_COULD_NOT_BE_DESTROYED_BECAUSE_IT_IS_STILL_IN_USE_BY_0_REGIONS
- .toLocalizedString(Integer.valueOf(cnt)));
+ .toLocalizedString(cnt));
}
}
if (this.pm.unregister(this)) {
@@ -867,8 +887,6 @@ public class PoolImpl implements InternalPool {
/**
* Hook to return connections that were acquired using acquireConnection.
- *
- * @param conn
*/
public void returnConnection(Connection conn) {
manager.returnConnection(conn);
@@ -900,9 +918,9 @@ public class PoolImpl implements InternalPool {
*/
public Map getThreadIdToSequenceIdMap() {
if (this.queueManager == null)
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
if (this.queueManager.getState() == null)
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
return this.queueManager.getState().getThreadIdToSequenceIdMap();
}
@@ -928,7 +946,7 @@ public class PoolImpl implements InternalPool {
Exception e = new Exception(msg);
try {
processException(e, con);
- } catch (ServerConnectivityException expected) {
+ } catch (ServerConnectivityException ignore) {
} finally {
logger.info("<ExpectedException action=remove>{}</ExpectedException>", msg);
}
@@ -1033,7 +1051,7 @@ public class PoolImpl implements InternalPool {
* redundant server. An empty list is returned if we have no redundant servers.
*/
public List<String> getRedundantNames() {
- List result = Collections.EMPTY_LIST;
+ List result = Collections.emptyList();
if (this.queueManager != null) {
QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
List<Connection> backupCons = cons.getBackups();
@@ -1055,7 +1073,7 @@ public class PoolImpl implements InternalPool {
* redundant server. An empty list is returned if we have no redundant servers.
*/
public List<ServerLocation> getRedundants() {
- List result = Collections.EMPTY_LIST;
+ List result = Collections.emptyList();
if (this.queueManager != null) {
QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
List<Connection> backupCons = cons.getBackups();
@@ -1176,8 +1194,8 @@ public class PoolImpl implements InternalPool {
logger.debug("PoolImpl - endpointsNetDownForDUnitTest");
setTEST_DURABLE_IS_NET_DOWN(true);
try {
- java.lang.Thread.sleep(this.pingInterval * 2);
- } catch (java.lang.InterruptedException ex) {
+ Thread.sleep(this.pingInterval * 2);
+ } catch (java.lang.InterruptedException ignore) {
// do nothing.
}
@@ -1195,8 +1213,8 @@ public class PoolImpl implements InternalPool {
public void endpointsNetUpForDUnitTest() {
setTEST_DURABLE_IS_NET_DOWN(false);
try {
- java.lang.Thread.sleep(this.pingInterval * 2);
- } catch (java.lang.InterruptedException ex) {
+ Thread.sleep(this.pingInterval * 2);
+ } catch (java.lang.InterruptedException ignore) {
// do nothing.
}
}
@@ -1293,9 +1311,8 @@ public class PoolImpl implements InternalPool {
SystemFailure.initiateFailure(e);
throw e;
} catch (CancelException e) {
- // throw e;
if (logger.isDebugEnabled()) {
- logger.debug("Pool task <{}> cancelled", this, logger.isTraceEnabled() ? e : null);
+ logger.debug("Pool task <{}> cancelled", this);
}
} catch (Throwable t) {
logger.error(LocalizedMessage
@@ -1391,7 +1408,7 @@ public class PoolImpl implements InternalPool {
for (Entry<Object, Object> entry : properties.entrySet()) {
props.setProperty((String) entry.getKey(), (String) entry.getValue());
}
- ProxyCache proxy = new ProxyCache(props, (GemFireCacheImpl) cache, this);
+ ProxyCache proxy = new ProxyCache(props, (InternalCache) cache, this);
synchronized (this.proxyCacheList) {
this.proxyCacheList.add(proxy);
}
@@ -1405,7 +1422,7 @@ public class PoolImpl implements InternalPool {
if (re != null) {
return re;
}
- Cache cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
if (cacheCriterion != null) {
return cacheCriterion.generateCancelledException(e);
@@ -1433,7 +1450,7 @@ public class PoolImpl implements InternalPool {
if (reason != null) {
return reason;
}
- Cache cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
if (cacheCriterion != null) {
return cacheCriterion.cancelInProgress();
@@ -1462,7 +1479,7 @@ public class PoolImpl implements InternalPool {
}
public boolean getKeepAlive() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
return keepAlive;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 f4a8d5b..8953e8c 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
@@ -15,6 +15,13 @@
package org.apache.geode.cache.client.internal;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.Region;
@@ -23,18 +30,11 @@ import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.internal.ProxyQueryService;
import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxInstanceFactory;
import org.apache.geode.pdx.internal.PdxInstanceFactoryImpl;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
/**
* A wrapper class over an actual Cache instance. This is used when the multiuser-authentication
* attribute is set to true. Application must use its {@link #getRegion(String)} API instead that of
@@ -50,17 +50,24 @@ import java.util.Set;
*/
public class ProxyCache implements RegionService {
- private final GemFireCacheImpl cache;
+ /**
+ * package-private to avoid synthetic accessor
+ * <p>
+ * TODO: if this is only in inside client then this should be InternalClientCache
+ */
+ final InternalCache cache;
+
private UserAttributes userAttributes;
private ProxyQueryService proxyQueryService;
private boolean isClosed = false;
private final Stopper stopper = new Stopper();
- public ProxyCache(Properties properties, GemFireCacheImpl cache, PoolImpl pool) {
+ public ProxyCache(Properties properties, InternalCache cache, PoolImpl pool) {
this.userAttributes = new UserAttributes(properties, pool);
this.cache = cache;
}
+ @Override
public void close() {
close(false);
}
@@ -76,18 +83,16 @@ public class ProxyCache implements RegionService {
this.proxyQueryService.closeCqs(keepAlive);
}
UserAttributes.userAttributes.set(this.userAttributes);
- Iterator<ServerLocation> iter = this.userAttributes.getServerToId().keySet().iterator();
- while (iter.hasNext()) {
- ProxyCacheCloseOp.executeOn(iter.next(), (PoolImpl) this.userAttributes.getPool(),
+ for (final ServerLocation serverLocation : this.userAttributes.getServerToId().keySet()) {
+ ProxyCacheCloseOp.executeOn(serverLocation, (ExecutablePool) this.userAttributes.getPool(),
this.userAttributes.getCredentials(), keepAlive);
}
- ArrayList<ProxyCache> proxyCache =
- ((PoolImpl) this.userAttributes.getPool()).getProxyCacheList();
+ List<ProxyCache> proxyCache = ((PoolImpl) this.userAttributes.getPool()).getProxyCacheList();
synchronized (proxyCache) {
proxyCache.remove(this);
}
} finally {
- // @todo I think some NPE will be caused by this code.
+ // TODO: I think some NPE will be caused by this code.
// It would be safer to not null things out.
// It is really bad that we null out and then set isClosed true.
this.isClosed = true;
@@ -98,28 +103,19 @@ public class ProxyCache implements RegionService {
}
}
- // TODO remove this method
- public String getName() {
- return this.cache.getName();
- }
-
+ @Override
public QueryService getQueryService() {
preOp();
if (this.proxyQueryService == null) {
this.proxyQueryService =
- new ProxyQueryService(this, userAttributes.getPool().getQueryService());
+ new ProxyQueryService(this, this.userAttributes.getPool().getQueryService());
}
return this.proxyQueryService;
}
+ @Override
public <K, V> Region<K, V> getRegion(String path) {
preOp();
- // TODO Auto-generated method stub
- // ProxyRegion region = this.proxyRegionList.get(path);
- // if (region != null) {
- // return region;
- // }
- // else {
if (this.cache.getRegion(path) == null) {
return null;
} else {
@@ -129,9 +125,9 @@ public class ProxyCache implements RegionService {
}
return new ProxyRegion(this, this.cache.getRegion(path));
}
- // }
}
+ @Override
public boolean isClosed() {
return this.isClosed;
}
@@ -170,11 +166,6 @@ public class ProxyCache implements RegionService {
}
protected class Stopper extends CancelCriterion {
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.CancelCriterion#cancelInProgress()
- */
@Override
public String cancelInProgress() {
String reason = cache.getCancelCriterion().cancelInProgress();
@@ -187,11 +178,6 @@ public class ProxyCache implements RegionService {
return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.CancelCriterion#generateCancelledException(java.lang.Throwable)
- */
@Override
public RuntimeException generateCancelledException(Throwable e) {
String reason = cancelInProgress();
@@ -209,7 +195,7 @@ public class ProxyCache implements RegionService {
try {
return new CacheClosedException(reason, e);
- } catch (IllegalStateException e2) {
+ } catch (IllegalStateException ignore) {
// Bug 39496 (Jrockit related) Give up. The following
// error is not entirely sane but gives the correct general picture.
return new CacheClosedException(reason);
@@ -217,6 +203,7 @@ public class ProxyCache implements RegionService {
}
}
+ @Override
public CancelCriterion getCancelCriterion() {
return this.stopper;
}
@@ -233,14 +220,16 @@ public class ProxyCache implements RegionService {
return Collections.unmodifiableSet(rootRegions);
}
+ @Override
public PdxInstanceFactory createPdxInstanceFactory(String className) {
return PdxInstanceFactoryImpl.newCreator(className, true);
}
- public PdxInstanceFactory createPdxInstanceFactory(String className, boolean b) {
- return PdxInstanceFactoryImpl.newCreator(className, b);
+ public PdxInstanceFactory createPdxInstanceFactory(String className, boolean expectDomainClass) {
+ return PdxInstanceFactoryImpl.newCreator(className, expectDomainClass);
}
+ @Override
public PdxInstance createPdxEnum(String className, String enumName, int enumOrdinal) {
return PdxInstanceFactoryImpl.createPdxEnum(className, enumName, enumOrdinal, this.cache);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
index 965ee57..6c367e9 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
@@ -34,10 +34,10 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import org.apache.geode.GemFireConfigException;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
+import org.apache.geode.GemFireConfigException;
import org.apache.geode.GemFireException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.InterestResultPolicy;
@@ -52,13 +52,14 @@ import org.apache.geode.cache.query.internal.CqStateImpl;
import org.apache.geode.cache.query.internal.DefaultQueryService;
import org.apache.geode.cache.query.internal.cq.ClientCQ;
import org.apache.geode.cache.query.internal.cq.CqService;
-import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ServerLocation;
+import org.apache.geode.i18n.StringId;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.ClientServerObserver;
import org.apache.geode.internal.cache.ClientServerObserverHolder;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.tier.InterestType;
import org.apache.geode.internal.cache.tier.sockets.CacheClientUpdater;
@@ -69,14 +70,12 @@ import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.security.GemFireSecurityException;
-import org.apache.geode.i18n.StringId;
/**
* Manages Client Queues. Responsible for creating callback connections and satisfying redundancy
* requirements.
*
* @since GemFire 5.7
- *
*/
public class QueueManagerImpl implements QueueManager {
private static final Logger logger = LogService.getLogger();
@@ -154,7 +153,7 @@ public class QueueManagerImpl implements QueueManager {
if (primary != null) {
ClientUpdater cu = primary.getUpdater();
if (cu != null) {
- result = ((CacheClientUpdater) cu).isAlive();
+ result = cu.isAlive();
}
}
return result;
@@ -175,7 +174,7 @@ public class QueueManagerImpl implements QueueManager {
&& pool.getPoolOrCacheCancelInProgress() == null) {
try {
lock.wait();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
break;
}
@@ -221,7 +220,7 @@ public class QueueManagerImpl implements QueueManager {
logger.warn(LocalizedMessage.create(
LocalizedStrings.QueueManagerImpl_TIMEOUT_WAITING_FOR_RECOVERY_THREAD_TO_COMPLETE));
}
- } catch (InterruptedException e1) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
logger.debug("Interrupted waiting for recovery thread termination");
}
@@ -332,7 +331,7 @@ public class QueueManagerImpl implements QueueManager {
while (primary == null) {
try {
primary = (QueueConnectionImpl) getAllConnections().getPrimary();
- } catch (NoSubscriptionServersAvailableException e) {
+ } catch (NoSubscriptionServersAvailableException ignore) {
primary = null;
break;
}
@@ -606,7 +605,7 @@ public class QueueManagerImpl implements QueueManager {
}
private void cqsConnected() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
CqService cqService = cache.getCqService();
// Primary queue was found, alert the affected cqs if necessary
@@ -616,7 +615,7 @@ public class QueueManagerImpl implements QueueManager {
private void cqsDisconnected() {
// No primary queue was found, alert the affected cqs if necessary
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
CqService cqService = cache.getCqService();
cqService.cqsDisconnected(pool);
@@ -659,8 +658,7 @@ public class QueueManagerImpl implements QueueManager {
if (printRedundancyNotSatisfiedError) {
logger.info(LocalizedMessage.create(
LocalizedStrings.QueueManagerImpl_REDUNDANCY_LEVEL_0_IS_NOT_SATISFIED_BUT_THERE_ARE_NO_MORE_SERVERS_AVAILABLE_REDUNDANCY_IS_CURRENTLY_1,
- new Object[] {Integer.valueOf(redundancyLevel),
- Integer.valueOf(getCurrentRedundancy())}));
+ new Object[] {redundancyLevel, getCurrentRedundancy()}));
}
}
printRedundancyNotSatisfiedError = false;// printed above
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/client/internal/RegisterInterestOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/RegisterInterestOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/RegisterInterestOp.java
index dd1118d..ce9d8f0 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/RegisterInterestOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/RegisterInterestOp.java
@@ -14,22 +14,22 @@
*/
package org.apache.geode.cache.client.internal;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.cache.InterestResultPolicy;
+import org.apache.geode.cache.client.ServerOperationException;
+import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.tier.InterestType;
import org.apache.geode.internal.cache.tier.MessageType;
-import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.ChunkedMessage;
+import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.internal.cache.tier.InterestType;
-import org.apache.geode.cache.InterestResultPolicy;
-import org.apache.geode.cache.client.ServerOperationException;
-import org.apache.geode.distributed.internal.ServerLocation;
-
-import java.util.ArrayList;
-import java.util.List;
/**
* Does a region registerInterest on a server
@@ -159,17 +159,15 @@ public class RegisterInterestOp {
@Override
protected Object processResponse(Message m, Connection con) throws Exception {
- ChunkedMessage msg = (ChunkedMessage) m;
- msg.readHeader();
- switch (msg.getMessageType()) {
+ ChunkedMessage chunkedMessage = (ChunkedMessage) m;
+ chunkedMessage.readHeader();
+ switch (chunkedMessage.getMessageType()) {
case MessageType.RESPONSE_FROM_PRIMARY: {
- ArrayList serverKeys = new ArrayList();
- VersionedObjectList serverEntries = null;
- LocalRegion r = null;
+ LocalRegion localRegion = null;
try {
- r = (LocalRegion) GemFireCacheImpl.getInstance().getRegion(this.region);
- } catch (Exception ex) {
+ localRegion = (LocalRegion) GemFireCacheImpl.getInstance().getRegion(this.region);
+ } catch (Exception ignore) {
// ignore but read message
// GemFireCacheImpl.getInstance().getLogger().config("hitesh error " + ex.getClass());
}
@@ -179,12 +177,14 @@ public class RegisterInterestOp {
listOfList.add(list);
// Process the chunks
+ List serverKeys = new ArrayList();
+ VersionedObjectList serverEntries = null;
do {
// Read the chunk
- msg.receiveChunk();
+ chunkedMessage.receiveChunk();
// Deserialize the result
- Part part = msg.getPart(0);
+ Part part = chunkedMessage.getPart(0);
Object partObj = part.getObject();
if (partObj instanceof Throwable) {
@@ -203,9 +203,9 @@ public class RegisterInterestOp {
list.clear();
list.add(partObj);
- if (r != null) {
+ if (localRegion != null) {
try {
- r.refreshEntriesFromServerKeys(con, listOfList,
+ localRegion.refreshEntriesFromServerKeys(con, listOfList,
InterestResultPolicy.KEYS_VALUES);
} catch (Exception ex) {
// GemFireCacheImpl.getInstance().getLogger().config("hitesh error2 " +
@@ -218,7 +218,7 @@ public class RegisterInterestOp {
}
}
- } while (!msg.isLastChunk());
+ } while (!chunkedMessage.isLastChunk());
if (serverEntries != null) {
list.clear();
list.add(serverEntries); // serverEntries will always be empty.
@@ -228,13 +228,13 @@ public class RegisterInterestOp {
}
case MessageType.RESPONSE_FROM_SECONDARY:
// Read the chunk
- msg.receiveChunk();
+ chunkedMessage.receiveChunk();
return null;
case MessageType.EXCEPTION:
// Read the chunk
- msg.receiveChunk();
+ chunkedMessage.receiveChunk();
// Deserialize the result
- Part part = msg.getPart(0);
+ Part part = chunkedMessage.getPart(0);
// Get the exception toString part.
// This was added for c++ thin client and not used in java
// Part exceptionToStringPart = msg.getPart(1);
@@ -244,14 +244,14 @@ public class RegisterInterestOp {
}
case MessageType.REGISTER_INTEREST_DATA_ERROR:
// Read the chunk
- msg.receiveChunk();
+ chunkedMessage.receiveChunk();
// Deserialize the result
- String errorMessage = msg.getPart(0).getString();
+ String errorMessage = chunkedMessage.getPart(0).getString();
String s = this + ": While performing a remote " + getOpName() + ": ";
throw new ServerOperationException(s + errorMessage);
default:
- throw new InternalGemFireError("Unknown message type " + msg.getMessageType());
+ throw new InternalGemFireError("Unknown message type " + chunkedMessage.getMessageType());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/execute/internal/FunctionServiceManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/internal/FunctionServiceManager.java b/geode-core/src/main/java/org/apache/geode/cache/execute/internal/FunctionServiceManager.java
index bb31989..f6573a7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/internal/FunctionServiceManager.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/internal/FunctionServiceManager.java
@@ -14,12 +14,24 @@
*/
package org.apache.geode.cache.execute.internal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionService;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache.client.internal.ProxyCache;
import org.apache.geode.cache.client.internal.ProxyRegion;
import org.apache.geode.cache.execute.Execution;
@@ -33,12 +45,13 @@ import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.execute.*;
+import org.apache.geode.internal.cache.execute.DistributedRegionFunctionExecutor;
+import org.apache.geode.internal.cache.execute.MemberFunctionExecutor;
+import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionExecutor;
+import org.apache.geode.internal.cache.execute.ServerFunctionExecutor;
+import org.apache.geode.internal.cache.execute.ServerRegionFunctionExecutor;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
/**
* Provides the entry point into execution of user defined {@linkplain Function}s.
* <p>
@@ -52,8 +65,9 @@ import java.util.concurrent.ConcurrentHashMap;
* @since GemFire 7.0
*/
public class FunctionServiceManager {
- private final static ConcurrentHashMap<String, Function> idToFunctionMap =
- new ConcurrentHashMap<String, Function>();
+
+ private static final ConcurrentHashMap<String, Function> idToFunctionMap =
+ new ConcurrentHashMap<>();
/**
* use when the optimization to execute onMember locally is not desired.
@@ -61,8 +75,9 @@ public class FunctionServiceManager {
public static final boolean RANDOM_onMember =
Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "randomizeOnMember");
- public FunctionServiceManager() {}
-
+ public FunctionServiceManager() {
+ // do nothing
+ }
/**
* Returns an {@link Execution} object that can be used to execute a data dependent function on
@@ -80,12 +95,11 @@ public class FunctionServiceManager {
* with DataPolicy.PARTITION, it executes on members where the data resides as specified by the
* filter.
*
- * @param region
* @return Execution
* @throws FunctionException if the region passed in is null
* @since GemFire 6.0
*/
- public final Execution onRegion(Region region) {
+ public Execution onRegion(Region region) {
if (region == null) {
throw new FunctionException(
LocalizedStrings.FunctionService_0_PASSED_IS_NULL.toLocalizedString("Region instance "));
@@ -97,9 +111,9 @@ public class FunctionServiceManager {
Pool pool = PoolManager.find(poolName);
if (pool.getMultiuserAuthentication()) {
if (region instanceof ProxyRegion) {
- ProxyRegion pr = (ProxyRegion) region;
- region = pr.getRealRegion();
- proxyCache = (ProxyCache) pr.getAuthenticatedCache();
+ ProxyRegion proxyRegion = (ProxyRegion) region;
+ region = proxyRegion.getRealRegion();
+ proxyCache = proxyRegion.getAuthenticatedCache();
} else {
throw new UnsupportedOperationException();
}
@@ -127,7 +141,7 @@ public class FunctionServiceManager {
* @throws FunctionException if Pool instance passed in is null
* @since GemFire 6.0
*/
- public final Execution onServer(Pool pool, String... groups) {
+ public Execution onServer(Pool pool, String... groups) {
if (pool == null) {
throw new FunctionException(
LocalizedStrings.FunctionService_0_PASSED_IS_NULL.toLocalizedString("Pool instance "));
@@ -150,7 +164,7 @@ public class FunctionServiceManager {
* @throws FunctionException if Pool instance passed in is null
* @since GemFire 6.0
*/
- public final Execution onServers(Pool pool, String... groups) {
+ public Execution onServers(Pool pool, String... groups) {
if (pool == null) {
throw new FunctionException(
LocalizedStrings.FunctionService_0_PASSED_IS_NULL.toLocalizedString("Pool instance "));
@@ -177,23 +191,24 @@ public class FunctionServiceManager {
* pool
* @since GemFire 6.5
*/
- public final Execution onServer(RegionService regionService, String... groups) {
+ public Execution onServer(RegionService regionService, String... groups) {
if (regionService == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("RegionService instance "));
}
if (regionService instanceof GemFireCacheImpl) {
- GemFireCacheImpl gfc = (GemFireCacheImpl) regionService;
- if (!gfc.isClient()) {
+ InternalClientCache internalCache = (InternalClientCache) regionService;
+ if (!internalCache.isClient()) {
throw new FunctionException("The cache was not a client cache");
- } else if (gfc.getDefaultPool() != null) {
- return onServer(gfc.getDefaultPool(), groups);
+ } else if (internalCache.getDefaultPool() != null) {
+ return onServer(internalCache.getDefaultPool(), groups);
} else {
throw new FunctionException("The client cache does not have a default pool");
}
} else {
- ProxyCache pc = (ProxyCache) regionService;
- return new ServerFunctionExecutor(pc.getUserAttributes().getPool(), false, pc, groups);
+ ProxyCache proxyCache = (ProxyCache) regionService;
+ return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), false, proxyCache,
+ groups);
}
}
@@ -209,23 +224,24 @@ public class FunctionServiceManager {
* pool
* @since GemFire 6.5
*/
- public final Execution onServers(RegionService regionService, String... groups) {
+ public Execution onServers(RegionService regionService, String... groups) {
if (regionService == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("RegionService instance "));
}
if (regionService instanceof GemFireCacheImpl) {
- GemFireCacheImpl gfc = (GemFireCacheImpl) regionService;
- if (!gfc.isClient()) {
+ InternalClientCache internalCache = (InternalClientCache) regionService;
+ if (!internalCache.isClient()) {
throw new FunctionException("The cache was not a client cache");
- } else if (gfc.getDefaultPool() != null) {
- return onServers(gfc.getDefaultPool(), groups);
+ } else if (internalCache.getDefaultPool() != null) {
+ return onServers(internalCache.getDefaultPool(), groups);
} else {
throw new FunctionException("The client cache does not have a default pool");
}
} else {
- ProxyCache pc = (ProxyCache) regionService;
- return new ServerFunctionExecutor(pc.getUserAttributes().getPool(), true, pc, groups);
+ ProxyCache proxyCache = (ProxyCache) regionService;
+ return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), true, proxyCache,
+ groups);
}
}
@@ -242,7 +258,7 @@ public class FunctionServiceManager {
* @since GemFire 6.0
*
*/
- public final Execution onMember(DistributedSystem system, DistributedMember distributedMember) {
+ public Execution onMember(DistributedSystem system, DistributedMember distributedMember) {
if (system == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("DistributedSystem instance "));
@@ -265,7 +281,7 @@ public class FunctionServiceManager {
* @throws FunctionException if DistributedSystem instance passed is null
* @since GemFire 6.0
*/
- public final Execution onMembers(DistributedSystem system, String... groups) {
+ public Execution onMembers(DistributedSystem system, String... groups) {
if (system == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("DistributedSystem instance "));
@@ -294,8 +310,7 @@ public class FunctionServiceManager {
* @throws FunctionException if DistributedSystem instance passed is null
* @since GemFire 6.0
*/
- public final Execution onMembers(DistributedSystem system,
- Set<DistributedMember> distributedMembers) {
+ public Execution onMembers(DistributedSystem system, Set<DistributedMember> distributedMembers) {
if (system == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("DistributedSystem instance "));
@@ -311,12 +326,11 @@ public class FunctionServiceManager {
* Returns the {@link Function} defined by the functionId, returns null if no function is found
* for the specified functionId
*
- * @param functionId
* @return Function
* @throws FunctionException if functionID passed is null
* @since GemFire 6.0
*/
- public final Function getFunction(String functionId) {
+ public Function getFunction(String functionId) {
if (functionId == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("functionId instance "));
@@ -336,7 +350,7 @@ public class FunctionServiceManager {
* @throws FunctionException if function instance passed is null or Function.getId() returns null
* @since GemFire 6.0
*/
- public final void registerFunction(Function function) {
+ public void registerFunction(Function function) {
if (function == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("function instance "));
@@ -361,7 +375,7 @@ public class FunctionServiceManager {
* @throws FunctionException if function instance passed is null or Function.getId() returns null
* @since GemFire 6.0
*/
- public final void unregisterFunction(String functionId) {
+ public void unregisterFunction(String functionId) {
if (functionId == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("functionId instance "));
@@ -375,7 +389,7 @@ public class FunctionServiceManager {
* @throws FunctionException if function instance passed is null or Function.getId() returns null
* @since GemFire 6.0
*/
- public final boolean isRegistered(String functionId) {
+ public boolean isRegistered(String functionId) {
if (functionId == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("functionId instance "));
@@ -389,7 +403,7 @@ public class FunctionServiceManager {
* @return A view of registered functions as a Map of {@link Function#getId()} to {@link Function}
* @since GemFire 6.0
*/
- public final Map<String, Function> getRegisteredFunctions() {
+ public Map<String, Function> getRegisteredFunctions() {
// We have to remove the internal functions before returning the map to the users
final Map<String, Function> tempIdToFunctionMap = new HashMap<String, Function>();
for (Map.Entry<String, Function> entry : idToFunctionMap.entrySet()) {
@@ -400,7 +414,7 @@ public class FunctionServiceManager {
return tempIdToFunctionMap;
}
- public final void unregisterAllFunctions() {
+ public void unregisterAllFunctions() {
// Unregistering all the functions registered with the FunctionService.
Map<String, Function> functions = new HashMap<String, Function>(idToFunctionMap);
for (String functionId : idToFunctionMap.keySet()) {
@@ -409,25 +423,22 @@ public class FunctionServiceManager {
}
/**
- * @param region
* @return true if the method is called on a region has a {@link Pool}.
* @since GemFire 6.0
*/
- private final boolean isClientRegion(Region region) {
+ private boolean isClientRegion(Region region) {
LocalRegion localRegion = (LocalRegion) region;
return localRegion.hasServerProxy();
}
-
- public final Execution onMember(DistributedSystem system, String... groups) {
+ public Execution onMember(DistributedSystem system, String... groups) {
if (system == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("DistributedSystem instance "));
}
- Set<DistributedMember> members = new HashSet<DistributedMember>();
+ Set<DistributedMember> members = new HashSet<>();
for (String group : groups) {
- List<DistributedMember> grpMembers =
- new ArrayList<DistributedMember>(system.getGroupMembers(group));
+ List<DistributedMember> grpMembers = new ArrayList<>(system.getGroupMembers(group));
if (!grpMembers.isEmpty()) {
if (!RANDOM_onMember && grpMembers.contains(system.getDistributedMember())) {
members.add(system.getDistributedMember());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
index bf79edb..41c022c 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
@@ -16,7 +16,6 @@ package org.apache.geode.cache.partition;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -35,7 +34,7 @@ import org.apache.geode.cache.execute.RegionFunctionContext;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.ColocationHelper;
import org.apache.geode.internal.cache.FixedPartitionAttributesImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalDataSet;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PartitionedRegion.RecoveryLock;
@@ -50,7 +49,6 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* Utility methods for handling partitioned Regions, for example during execution of {@link Function
* Functions} on a Partitioned Region.
- *
* <p>
* Example of a Function using utility methods:
*
@@ -68,12 +66,14 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* // ...
* </pre>
*
- *
* @since GemFire 6.0
* @see FunctionService#onRegion(Region)
*/
public final class PartitionRegionHelper {
- private PartitionRegionHelper() {}
+
+ private PartitionRegionHelper() {
+ // do nothing
+ }
/**
* Given a partitioned Region, return a map of
@@ -157,8 +157,8 @@ public final class PartitionRegionHelper {
* @since GemFire 6.0
*/
public static Set<PartitionRegionInfo> getPartitionRegionInfo(final Cache cache) {
- Set<PartitionRegionInfo> prDetailsSet = new TreeSet<PartitionRegionInfo>();
- fillInPartitionedRegionInfo((GemFireCacheImpl) cache, prDetailsSet, false);
+ Set<PartitionRegionInfo> prDetailsSet = new TreeSet<>();
+ fillInPartitionedRegionInfo((InternalCache) cache, prDetailsSet, false);
return prDetailsSet;
}
@@ -172,26 +172,25 @@ public final class PartitionRegionHelper {
*/
public static PartitionRegionInfo getPartitionRegionInfo(final Region<?, ?> region) {
try {
- PartitionedRegion pr = isPartitionedCheck(region);
- GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache();
- return pr.getRedundancyProvider().buildPartitionedRegionInfo(false,
- cache.getInternalResourceManager().getLoadProbe()); // may return null
- } catch (ClassCastException e) {
+ PartitionedRegion partitionedRegion = isPartitionedCheck(region);
+ InternalCache cache = (InternalCache) region.getCache();
+ return partitionedRegion.getRedundancyProvider().buildPartitionedRegionInfo(false,
+ cache.getInternalResourceManager().getLoadProbe());
+ } catch (ClassCastException ignore) {
// not a PR so return null
}
return null;
}
- private static void fillInPartitionedRegionInfo(GemFireCacheImpl cache, final Set prDetailsSet,
+ private static void fillInPartitionedRegionInfo(final InternalCache cache, final Set prDetailsSet,
final boolean internal) {
// TODO: optimize by fetching all PR details from each member at once
- Set<PartitionedRegion> prSet = cache.getPartitionedRegions();
- if (prSet.isEmpty()) {
+ Set<PartitionedRegion> partitionedRegions = cache.getPartitionedRegions();
+ if (partitionedRegions.isEmpty()) {
return;
}
- for (Iterator<PartitionedRegion> iter = prSet.iterator(); iter.hasNext();) {
- PartitionedRegion pr = iter.next();
- PartitionRegionInfo prDetails = pr.getRedundancyProvider()
+ for (PartitionedRegion partitionedRegion : partitionedRegions) {
+ PartitionRegionInfo prDetails = partitionedRegion.getRedundancyProvider()
.buildPartitionedRegionInfo(internal, cache.getInternalResourceManager().getLoadProbe());
if (prDetails != null) {
prDetailsSet.add(prDetails);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractCompiledValue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractCompiledValue.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractCompiledValue.java
index d635e02..b0d216c 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractCompiledValue.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractCompiledValue.java
@@ -248,7 +248,7 @@ public abstract class AbstractCompiledValue implements CompiledValue, Filter, OQ
}
// This function needs to be appropriately overridden in the derived classes
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
clauseBuffer.insert(0, System.currentTimeMillis());
clauseBuffer.insert(0, this.getClass());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledAggregateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledAggregateFunction.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledAggregateFunction.java
index 21607de..9544bbb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledAggregateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledAggregateFunction.java
@@ -156,7 +156,7 @@ public class CompiledAggregateFunction extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
clauseBuffer.insert(0, ')');
if (this.expr != null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledBindArgument.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledBindArgument.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledBindArgument.java
index 106d389..03ec478 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledBindArgument.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledBindArgument.java
@@ -43,7 +43,7 @@ public class CompiledBindArgument extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// When compiling a new query, a context is created where there are no bind arguments at this
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java
index d47509f..6351e99 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java
@@ -479,7 +479,7 @@ public class CompiledComparison extends AbstractCompiledValue
}
}
if (conditioningNeeded) {
- return QueryUtils.getconditionedIndexResults(set, indexInfo, context, indexFieldsSize,
+ return QueryUtils.getConditionedIndexResults(set, indexInfo, context, indexFieldsSize,
completeExpansionNeeded, iterOperands, indpndntItr);
} else {
return set;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledFunction.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledFunction.java
index 0c81d24..349e3f4 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledFunction.java
@@ -18,8 +18,6 @@ package org.apache.geode.cache.query.internal;
import java.util.*;
import org.apache.geode.cache.query.*;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.pdx.internal.PdxString;
-
/**
@@ -89,7 +87,7 @@ public class CompiledFunction extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
clauseBuffer.insert(0, ')');
int len = this._args.length;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledGroupBySelect.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledGroupBySelect.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledGroupBySelect.java
index 0ad093d..1c4a691 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledGroupBySelect.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledGroupBySelect.java
@@ -67,7 +67,7 @@ public class CompiledGroupBySelect extends CompiledSelect {
if (aggMap != null) {
int i = 0;
for (Map.Entry<Integer, CompiledAggregateFunction> entry : aggMap.entrySet()) {
- this.aggregateColsPos.set(entry.getKey().intValue());
+ this.aggregateColsPos.set(entry.getKey());
this.aggregateFunctions[i++] = entry.getValue();
}
}
@@ -100,7 +100,7 @@ public class CompiledGroupBySelect extends CompiledSelect {
if (param == null && aggFunc.getFunctionType() == OQLLexerTokenTypes.COUNT) {
// * case of *, substitue a dummy parameter of compiled literal = 0 to
// satisfy the code
- param = new CompiledLiteral(Integer.valueOf(0));
+ param = new CompiledLiteral(0);
} else if (param == null) {
throw new QueryInvalidException("aggregate function passed invalid parameter");
@@ -468,7 +468,7 @@ public class CompiledGroupBySelect extends CompiledSelect {
private boolean checkProjectionInGroupBy(Object[] projElem, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
boolean found = false;
- StringBuffer projAttribBuffer = new StringBuffer();
+ StringBuilder projAttribBuffer = new StringBuilder();
CompiledValue cvProj = (CompiledValue) TypeUtils.checkCast(projElem[1], CompiledValue.class);
cvProj.generateCanonicalizedExpression(projAttribBuffer, context);
String projAttribStr = projAttribBuffer.toString();
@@ -482,7 +482,7 @@ public class CompiledGroupBySelect extends CompiledSelect {
}
// the grpup by expr is not an alias check for path
- StringBuffer groupByExprBuffer = new StringBuffer();
+ StringBuilder groupByExprBuffer = new StringBuilder();
grpBy.generateCanonicalizedExpression(groupByExprBuffer, context);
final String grpByExprStr = groupByExprBuffer.toString();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledID.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledID.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledID.java
index cfb02f7..6eb716b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledID.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledID.java
@@ -82,7 +82,7 @@ public class CompiledID extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// The compiled ID can be an iterator variable or it can be a path variable.
// So first resolve the type of variable using ExecutionContext
[05/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
index 5d44b20..e1c708a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
@@ -181,7 +181,7 @@ public final class FetchKeysMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
index 76a0dac..5f4dec1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
@@ -120,7 +120,7 @@ public class FetchPartitionDetailsMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; internal=").append(this.internal);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
index 54e80c6..1c2a6a7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
@@ -219,7 +219,7 @@ public final class GetMessage extends PartitionMessageWithDirectReply {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; key=").append(this.key).append("; callback arg=").append(this.cbArg)
.append("; context=").append(this.context);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
index a0cda9b..8259818 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
@@ -96,7 +96,7 @@ public class InterestEventMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; event=").append(this.event);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
index 65cb072..786006e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
@@ -192,9 +192,10 @@ public final class ManageBackupBucketMessage extends PartitionMessage {
* Assists the toString method in reporting the contents of this message
*
* @see PartitionMessage#toString()
+ * @param buff
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
buff.append("; isRebalance=").append(this.isRebalance);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
index 85b9af8..1092145 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
@@ -189,9 +189,10 @@ public final class ManageBucketMessage extends PartitionMessage {
* Assists the toString method in reporting the contents of this message
*
* @see PartitionMessage#toString()
+ * @param buff
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId).append("; bucketSize=")
.append(this.bucketSize);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
index 43e4341..8a607c0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
@@ -119,7 +119,7 @@ public class MoveBucketMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
buff.append("; source=").append(this.source);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
index fe1acfa..5c5af24 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
@@ -68,7 +68,7 @@ public final class PRSanityCheckMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append(" regionName=").append(this.regionName);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
index 0e6b707..3552b5d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
@@ -25,7 +25,6 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.Operation;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.DistributionMessage;
@@ -113,7 +112,7 @@ public final class PRTombstoneMessage extends PartitionMessageWithDirectReply
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; keys=").append(this.keys.size());
buff.append("; eventID=").append(this.eventID);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
index 1dcf27f..eb7dcaf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
@@ -200,10 +200,11 @@ public class PRUpdateEntryVersionMessage extends PartitionMessageWithDirectReply
* Assists the toString method in reporting the contents of this message
*
* @see PartitionMessage#toString()
+ * @param buff
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; key=").append(getKey());
buff.append("; op=").append(this.op);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
index bdd26ce..2314674 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
@@ -56,7 +56,6 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PartitionedRegionException;
import org.apache.geode.internal.cache.PrimaryBucketException;
-import org.apache.geode.internal.cache.TXId;
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.cache.TransactionMessage;
@@ -134,7 +133,7 @@ public abstract class PartitionMessage extends DistributionMessage
setRecipient(recipient);
this.regionId = regionId;
this.processorId = processor == null ? 0 : processor.getProcessorId();
- if (processor != null && this.isSevereAlertCompatible()) {
+ if (processor != null && isSevereAlertCompatible()) {
processor.enableSevereAlertProcessing();
}
initTxMemberId();
@@ -146,7 +145,7 @@ public abstract class PartitionMessage extends DistributionMessage
setRecipients(recipients);
this.regionId = regionId;
this.processorId = processor == null ? 0 : processor.getProcessorId();
- if (processor != null && this.isSevereAlertCompatible()) {
+ if (processor != null && isSevereAlertCompatible()) {
processor.enableSevereAlertProcessing();
}
initTxMemberId();
@@ -174,8 +173,6 @@ public abstract class PartitionMessage extends DistributionMessage
/**
* Copy constructor that initializes the fields declared in this class
- *
- * @param other
*/
public PartitionMessage(PartitionMessage other) {
this.regionId = other.regionId;
@@ -321,8 +318,7 @@ public abstract class PartitionMessage extends DistributionMessage
// the partitioned region can't be found (bug 36585)
thr = new ForceReattemptException(
LocalizedStrings.PartitionMessage_0_COULD_NOT_FIND_PARTITIONED_REGION_WITH_ID_1
- .toLocalizedString(
- new Object[] {dm.getDistributionManagerId(), Integer.valueOf(regionId)}));
+ .toLocalizedString(dm.getDistributionManagerId(), regionId));
return; // reply sent in finally block below
}
@@ -401,8 +397,8 @@ public abstract class PartitionMessage extends DistributionMessage
.toLocalizedString());
}
}
- if (logger.isTraceEnabled(LogMarker.DM) && (t instanceof RuntimeException)) {
- logger.trace(LogMarker.DM, "Exception caught while processing message: ", t.getMessage(),
+ if (logger.isTraceEnabled(LogMarker.DM) && t instanceof RuntimeException) {
+ logger.trace(LogMarker.DM, "Exception caught while processing message: {}", t.getMessage(),
t);
}
} finally {
@@ -598,7 +594,7 @@ public abstract class PartitionMessage extends DistributionMessage
@Override
public String toString() {
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
String className = getClass().getName();
// className.substring(className.lastIndexOf('.', className.lastIndexOf('.') - 1) + 1); //
// partition.<foo> more generic version
@@ -613,7 +609,7 @@ public abstract class PartitionMessage extends DistributionMessage
if (pr != null) {
name = pr.getFullPath();
}
- } catch (Exception e) {
+ } catch (Exception ignore) {
/* ignored */
name = null;
}
@@ -630,10 +626,10 @@ public abstract class PartitionMessage extends DistributionMessage
/**
* Helper class of {@link #toString()}
- *
+ *
* @param buff buffer in which to append the state of this instance
*/
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
buff.append(" processorId=").append(this.processorId);
if (this.notificationOnly) {
buff.append(" notificationOnly=").append(this.notificationOnly);
@@ -704,7 +700,7 @@ public abstract class PartitionMessage extends DistributionMessage
return false;
}
return pr.notifiesMultipleSerialGateways();
- } catch (PRLocallyDestroyedException e) {
+ } catch (PRLocallyDestroyedException ignore) {
return false;
} catch (RuntimeException ignore) {
return false;
@@ -770,15 +766,15 @@ public abstract class PartitionMessage extends DistributionMessage
if (removeMember(id, true)) {
this.prce = new ForceReattemptException(
LocalizedStrings.PartitionMessage_PARTITIONRESPONSE_GOT_MEMBERDEPARTED_EVENT_FOR_0_CRASHED_1
- .toLocalizedString(new Object[] {id, Boolean.valueOf(crashed)}));
+ .toLocalizedString(id, crashed));
}
checkIfDone();
} else {
Exception e = new Exception(
LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID.toLocalizedString());
logger.info(LocalizedMessage.create(
- LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0,
- Boolean.valueOf(crashed)), e);
+ LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0, crashed),
+ e);
}
}
@@ -788,7 +784,6 @@ public abstract class PartitionMessage extends DistributionMessage
* @throws CacheException if the recipient threw a cache exception during message processing
* @throws ForceReattemptException if the recipient left the distributed system before the
* response was received.
- * @throws PrimaryBucketException
*/
final public void waitForCacheException()
throws CacheException, ForceReattemptException, PrimaryBucketException {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
index 6bead2e..b5f5e6f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
@@ -122,7 +122,7 @@ public abstract class PartitionMessageWithDirectReply extends PartitionMessage
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; posDup=").append(this.posDup);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
index c24a0aa..f7ca7e6 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
@@ -170,7 +170,7 @@ public class PartitionedRegionFunctionStreamingMessage extends PartitionMessage
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
index 27f5aa0..fbbd6fc 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
@@ -78,7 +78,7 @@ import org.apache.geode.internal.offheap.annotations.Retained;
*
* @since GemFire 6.0
*/
-public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
+public class PutAllPRMessage extends PartitionMessageWithDirectReply {
private static final Logger logger = LogService.getLogger();
private PutAllEntryData[] putAllPRData;
@@ -118,7 +118,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
public PutAllPRMessage(int bucketId, int size, boolean notificationOnly, boolean posDup,
boolean skipCallbacks, Object callbackArg) {
- this.bucketId = Integer.valueOf(bucketId);
+ this.bucketId = bucketId;
putAllPRData = new PutAllEntryData[size];
this.notificationOnly = notificationOnly;
this.posDup = posDup;
@@ -217,7 +217,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.bucketId = Integer.valueOf((int) InternalDataSerializer.readSignedVL(in));
+ this.bucketId = (int) InternalDataSerializer.readSignedVL(in);
if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
this.bridgeContext = DataSerializer.readObject(in);
}
@@ -249,7 +249,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
if (bucketId == null) {
InternalDataSerializer.writeSignedVL(-1, out);
} else {
- InternalDataSerializer.writeSignedVL(bucketId.intValue(), out);
+ InternalDataSerializer.writeSignedVL(bucketId, out);
}
if (this.bridgeContext != null) {
DataSerializer.writeObject(this.bridgeContext, out);
@@ -313,7 +313,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
* indefinitely for the acknowledgement
*/
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr,
long startTime) throws EntryExistsException, ForceReattemptException, DataLocationException {
boolean sendReply = true;
@@ -321,14 +321,14 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
long lastModified = 0L;
try {
- result = doLocalPutAll(r, eventSender, lastModified);
+ result = doLocalPutAll(pr, eventSender, lastModified);
} catch (ForceReattemptException fre) {
- sendReply(getSender(), getProcessorId(), dm, new ReplyException(fre), r, startTime);
+ sendReply(getSender(), getProcessorId(), dm, new ReplyException(fre), pr, startTime);
return false;
}
if (sendReply) {
- sendReply(getSender(), getProcessorId(), dm, null, r, startTime);
+ sendReply(getSender(), getProcessorId(), dm, null, pr, startTime);
}
return false;
}
@@ -363,8 +363,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
* lastModified timestamp for last modification
* @return If succeeds, return true, otherwise, throw exception
*/
- @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "IMSE_DONT_CATCH_IMSE")
- public final boolean doLocalPutAll(PartitionedRegion r, InternalDistributedMember eventSender,
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings("IMSE_DONT_CATCH_IMSE")
+ public boolean doLocalPutAll(PartitionedRegion r, InternalDistributedMember eventSender,
long lastModified)
throws EntryExistsException, ForceReattemptException, DataLocationException {
boolean didPut = false;
@@ -501,10 +501,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
}
} // for
- } catch (IllegalMonitorStateException ex) {
- ForceReattemptException fre =
- new ForceReattemptException("unable to get lock for primary, retrying... ");
- throw fre;
+ } catch (IllegalMonitorStateException ignore) {
+ throw new ForceReattemptException("unable to get lock for primary, retrying... ");
} catch (CacheWriterException cwe) {
// encounter cacheWriter exception
partialKeys.saveFailedKey(key, cwe);
@@ -650,7 +648,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
@Override
- protected final void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; putAllPRDataSize=").append(putAllPRDataSize).append("; bucketId=")
.append(bucketId);
@@ -661,21 +659,16 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
buff.append("; directAck=").append(this.directAck);
for (int i = 0; i < putAllPRDataSize; i++) {
- // buff.append("; entry"+i+":").append(putAllPRData[i]);
- buff.append("; entry" + i + ":").append(putAllPRData[i].getKey()).append(",")
+ buff.append("; entry").append(i).append(":").append(putAllPRData[i].getKey()).append(",")
.append(putAllPRData[i].versionTag);
}
}
- public final InternalDistributedSystem getInternalDs() {
- return internalDs;
- }
-
- public final void setInternalDs(InternalDistributedSystem internalDs) {
+ public void setInternalDs(InternalDistributedSystem internalDs) {
this.internalDs = internalDs;
}
- public final void setDirectAck(boolean directAck) {
+ public void setDirectAck(boolean directAck) {
this.directAck = directAck;
}
@@ -686,10 +679,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
@Override
public String toString() {
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
String className = getClass().getName();
- // className.substring(className.lastIndexOf('.', className.lastIndexOf('.') - 1) + 1); //
- // partition.<foo> more generic version
buff.append(className.substring(className.indexOf(PN_TOKEN) + PN_TOKEN.length())); // partition.<foo>
buff.append("(prid="); // make sure this is the first one
buff.append(this.regionId);
@@ -701,7 +692,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
if (pr != null) {
name = pr.getFullPath();
}
- } catch (Exception e) {
+ } catch (Exception ignore) {
/* ignored */
name = null;
}
@@ -721,7 +712,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
return buff.toString();
}
- public static final class PutAllReplyMessage extends ReplyMessage {
+ public static class PutAllReplyMessage extends ReplyMessage {
/** Result of the PutAll operation */
boolean result;
VersionedObjectList versions;
@@ -801,7 +792,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("PutAllReplyMessage ").append("processorid=").append(this.processorId)
.append(" returning ").append(this.result).append(" exception=").append(getException())
.append(" versions= ").append(this.versions);
@@ -843,17 +834,6 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
} catch (ForceReattemptException e) {
throw e;
}
- // try {
- // waitForRepliesUninterruptibly();
- // }
- // catch (ReplyException e) {
- // Throwable t = e.getCause();
- // if (t instanceof CacheClosedException) {
- // throw new PartitionedRegionCommunicationException("Put operation received an exception",
- // t);
- // }
- // e.handleAsUnexpected();
- // }
return new PutAllResult(this.returnValue, this.versions);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
index dd2698c..1c41e61 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
@@ -44,7 +44,6 @@ import org.apache.geode.internal.Assert;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.NanoTimer;
import org.apache.geode.internal.cache.CachedDeserializable;
-import org.apache.geode.internal.cache.CachedDeserializableFactory;
import org.apache.geode.internal.cache.DataLocationException;
import org.apache.geode.internal.cache.DistributedCacheOperation;
import org.apache.geode.internal.cache.EntryEventImpl;
@@ -58,7 +57,6 @@ import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PartitionedRegionDataStore;
import org.apache.geode.internal.cache.PrimaryBucketException;
import org.apache.geode.internal.cache.RemotePutMessage;
-import org.apache.geode.internal.cache.VMCachedDeserializable;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -67,7 +65,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
-import org.apache.geode.internal.util.BlobHelper;
import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
@@ -826,7 +823,7 @@ public final class PutMessage extends PartitionMessageWithDirectReply implements
@Override
- protected final void appendFields(StringBuffer buff) {
+ protected final void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; key=").append(getKey()).append("; value=");
// buff.append(getValBytes());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
index 51844aa..b6028fe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
@@ -64,18 +64,18 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
private volatile boolean isPdxSerialized;
private volatile boolean traceOn;
- // private transient PRQueryResultCollector resultCollector = new PRQueryResultCollector();
- private transient List<Collection> resultCollector = new ArrayList<Collection>();
- private transient int tokenCount = 0; // counts how many end of stream tokens received
- private transient Iterator currentResultIterator;
- private transient Iterator<Collection> currentSelectResultIterator;
- private transient boolean isTraceInfoIteration = false;
- private transient boolean isStructType = false;
+ private final List<Collection> resultCollector = new ArrayList<>();
+ private Iterator currentResultIterator;
+ private Iterator<Collection> currentSelectResultIterator;
+ private boolean isTraceInfoIteration = false;
+ private boolean isStructType = false;
/**
* Empty constructor to satisfy {@link DataSerializer} requirements
*/
- public QueryMessage() {}
+ public QueryMessage() {
+ // do nothing
+ }
public QueryMessage(InternalDistributedMember recipient, int regionId, ReplyProcessor21 processor,
DefaultQuery query, Object[] parameters, final List buckets) {
@@ -87,7 +87,6 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
this.traceOn = query.isTraced() || DefaultQuery.QUERY_VERBOSE;
}
-
/**
* Provide results to send back to requestor. terminate by returning END_OF_STREAM token object
*/
@@ -101,10 +100,11 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
.toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
throw new QueryExecutionLowMemoryException(reason);
}
- if (Thread.interrupted())
+ if (Thread.interrupted()) {
throw new InterruptedException();
+ }
- while ((this.currentResultIterator == null || !this.currentResultIterator.hasNext())) {
+ while (this.currentResultIterator == null || !this.currentResultIterator.hasNext()) {
if (this.currentSelectResultIterator.hasNext()) {
if (this.isTraceInfoIteration && this.currentResultIterator != null) {
this.isTraceInfoIteration = false;
@@ -115,22 +115,20 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
}
this.currentResultIterator = results.iterator();
} else {
- // Assert.assertTrue(this.resultCollector.isEmpty());
return Token.END_OF_STREAM;
}
}
Object data = this.currentResultIterator.next();
boolean isPostGFE_8_1 = this.getSender().getVersionObject().compareTo(Version.GFE_81) > 0;
- // Asif: There is a bug in older versions of GFE such that the query node expects the structs to
- // have
+
+ // There is a bug in older versions of GFE such that the query node expects the structs to have
// type as ObjectTypes only & not specific types. So the new version needs to send the
- // inaccurate
- // struct type for backward compatibility.
+ // inaccurate struct type for backward compatibility.
if (this.isStructType && !this.isTraceInfoIteration && isPostGFE_8_1) {
return ((Struct) data).getFieldValues();
} else if (this.isStructType && !this.isTraceInfoIteration) {
- Struct s = (Struct) data;
- ObjectType[] fieldTypes = s.getStructType().getFieldTypes();
+ Struct struct = (Struct) data;
+ ObjectType[] fieldTypes = struct.getStructType().getFieldTypes();
for (int i = 0; i < fieldTypes.length; ++i) {
fieldTypes[i] = new ObjectTypeImpl(Object.class);
}
@@ -140,32 +138,27 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
}
}
-
@Override
- protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr,
long startTime)
throws CacheException, QueryException, ForceReattemptException, InterruptedException {
- // calculate trace start time if trace is on
- // this is because the start time is only set if enableClock stats is on
- // in this case we still want to see trace time even if clock is not enabled
+ // calculate trace start time if trace is on this is because the start time is only set if
+ // enableClock stats is on in this case we still want to see trace time even if clock is not
+ // enabled
long traceStartTime = 0;
if (this.traceOn) {
traceStartTime = NanoTimer.getTime();
}
- PRQueryTraceInfo queryTraceInfo = null;
- List queryTraceList = null;
- if (Thread.interrupted())
+ if (Thread.interrupted()) {
throw new InterruptedException();
+ }
if (logger.isTraceEnabled(LogMarker.DM)) {
logger.trace(LogMarker.DM, "QueryMessage operateOnPartitionedRegion: {} buckets {}",
- r.getFullPath(), buckets);
+ pr.getFullPath(), this.buckets);
}
- r.waitOnInitialization();
-
- // PartitionedRegionDataStore ds = r.getDataStore();
+ pr.waitOnInitialization();
- // if (ds != null) {
if (QueryMonitor.isLowMemory()) {
String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY
.toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
@@ -174,25 +167,26 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
throw new QueryExecutionLowMemoryException(reason);
}
- DefaultQuery query = new DefaultQuery(this.queryString, r.getCache(), false);
+ DefaultQuery query = new DefaultQuery(this.queryString, pr.getCache(), false);
// Remote query, use the PDX types in serialized form.
- DefaultQuery.setPdxReadSerialized(r.getCache(), true);
- // In case of "select *" queries we can keep the results in serialized
- // form and send
+ DefaultQuery.setPdxReadSerialized(pr.getCache(), true);
+ // In case of "select *" queries we can keep the results in serialized form and send
query.setRemoteQuery(true);
QueryObserver indexObserver = query.startTrace();
boolean isQueryTraced = false;
+ List queryTraceList = null;
+
try {
query.setIsCqQuery(this.cqQuery);
- // ds.queryLocalNode(query, this.parameters, this.buckets,
- // this.resultCollector);
- PRQueryProcessor qp = new PRQueryProcessor(r, query, parameters, buckets);
+ PRQueryProcessor qp = new PRQueryProcessor(pr, query, this.parameters, this.buckets);
if (logger.isDebugEnabled()) {
logger.debug("Started executing query from remote node: {}", query.getQueryString());
}
isQueryTraced =
query.isTraced() && this.sender.getVersionObject().compareTo(Version.GFE_81) >= 0;
+
// Adds a query trace info object to the results list for remote queries
+ PRQueryTraceInfo queryTraceInfo = null;
if (isQueryTraced) {
this.isTraceInfoIteration = true;
if (DefaultQuery.testHook != null) {
@@ -200,85 +194,77 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
}
queryTraceInfo = new PRQueryTraceInfo();
queryTraceList = Collections.singletonList(queryTraceInfo);
-
}
this.isStructType = qp.executeQuery(this.resultCollector);
- // Add the trace info list object after the NWayMergeResults is created so as to
- // exclude it from the sorted collection of NWayMergeResults
+ // Add the trace info list object after the NWayMergeResults is created so as to exclude it
+ // from the sorted collection of NWayMergeResults
if (isQueryTraced) {
this.resultCollector.add(0, queryTraceList);
}
this.currentSelectResultIterator = this.resultCollector.iterator();
- // If trace is enabled, we will generate a trace object to send back
- // The time info will be slightly different than the one logged on this
- // node
- // due to generating the trace object information here rather than the
- // finally
- // block.
+ // If trace is enabled, we will generate a trace object to send back. The time info will be
+ // slightly different than the one logged on this node due to generating the trace object
+ // information here rather than the finally block.
if (isQueryTraced) {
if (DefaultQuery.testHook != null) {
DefaultQuery.testHook.doTestHook("Populating Trace Info for Remote Query");
}
+
// calculate the number of rows being sent
- int traceSize = 0;
- traceSize = queryTraceInfo.calculateNumberOfResults(resultCollector);
- traceSize -= 1; // subtract the query trace info object
+ int traceSize = queryTraceInfo.calculateNumberOfResults(this.resultCollector);
+ // subtract the query trace info object
+ traceSize -= 1;
queryTraceInfo.setTimeInMillis((NanoTimer.getTime() - traceStartTime) / 1.0e6f);
queryTraceInfo.setNumResults(traceSize);
+
// created the indexes used string
if (indexObserver instanceof IndexTrackingQueryObserver) {
Map indexesUsed = ((IndexTrackingQueryObserver) indexObserver).getUsedIndexes();
- StringBuffer buf = new StringBuffer();
- buf.append(" indexesUsed(").append(indexesUsed.size()).append(")");
+ StringBuilder sb = new StringBuilder();
+ sb.append(" indexesUsed(").append(indexesUsed.size()).append(")");
if (indexesUsed.size() > 0) {
- buf.append(":");
+ sb.append(":");
for (Iterator itr = indexesUsed.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry) itr.next();
- buf.append(entry.getKey().toString() + entry.getValue());
+ sb.append(entry.getKey()).append(entry.getValue());
if (itr.hasNext()) {
- buf.append(",");
+ sb.append(",");
}
}
}
- queryTraceInfo.setIndexesUsed(buf.toString());
+ queryTraceInfo.setIndexesUsed(sb.toString());
}
}
- // resultSize = this.resultCollector.size() - this.buckets.size(); //Minus
- // END_OF_BUCKET elements.
if (QueryMonitor.isLowMemory()) {
String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY
.toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
throw new QueryExecutionLowMemoryException(reason);
}
- super.operateOnPartitionedRegion(dm, r, startTime);
+ super.operateOnPartitionedRegion(dm, pr, startTime);
} finally {
- // remove trace info so that it is not included in the num results when
- // logged
+ // remove trace info so that it is not included in the num results when logged
if (isQueryTraced) {
- resultCollector.remove(queryTraceList);
+ this.resultCollector.remove(queryTraceList);
}
- DefaultQuery.setPdxReadSerialized(r.getCache(), false);
+ DefaultQuery.setPdxReadSerialized(pr.getCache(), false);
query.setRemoteQuery(false);
query.endTrace(indexObserver, traceStartTime, this.resultCollector);
}
- // }
- // else {
- // l.warning(LocalizedStrings.QueryMessage_QUERYMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER);
- // }
// Unless there was an exception thrown, this message handles sending the response
return false;
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; query=").append(this.queryString).append("; bucketids=").append(this.buckets);
}
+ @Override
public int getDSFID() {
return PR_QUERY_MESSAGE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
index f4f6299..296389f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
@@ -67,7 +67,6 @@ import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
import org.apache.geode.internal.cache.versions.VersionTag;
-import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.annotations.Released;
@@ -632,7 +631,7 @@ public final class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
@Override
- protected final void appendFields(StringBuffer buff) {
+ protected final void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; removeAllPRDataSize=").append(removeAllPRDataSize).append("; bucketId=")
.append(bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
index d7699ee..6336841 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
@@ -116,7 +116,7 @@ public class RemoveBucketMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
index 7e371f9..3dc5217 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
@@ -185,7 +185,7 @@ public final class SizeMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketIds=").append(this.bucketIds);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
index d2672df..8e39e18 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
@@ -16,6 +16,7 @@ package org.apache.geode.internal.cache.persistence;
import org.apache.commons.io.FileUtils;
import org.apache.geode.InternalGemFireError;
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DM;
@@ -81,9 +82,9 @@ public class BackupManager implements MembershipListener {
private void cleanup() {
isCancelled = true;
allowDestroys.countDown();
- Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned();
- for (DiskStoreImpl store : diskStores) {
- store.releaseBackupLock();
+ Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
+ for (DiskStore store : diskStores) {
+ ((DiskStoreImpl) store).releaseBackupLock();
}
final DM distributionManager = cache.getInternalDistributedSystem().getDistributionManager();
distributionManager.removeAllMembershipListener(this);
@@ -92,12 +93,13 @@ public class BackupManager implements MembershipListener {
public HashSet<PersistentID> prepareBackup() {
HashSet<PersistentID> persistentIds = new HashSet<PersistentID>();
- Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned();
- for (DiskStoreImpl store : diskStores) {
- store.lockStoreBeforeBackup();
- if (store.hasPersistedData()) {
- persistentIds.add(store.getPersistentID());
- store.getStats().startBackup();
+ Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
+ for (DiskStore store : diskStores) {
+ DiskStoreImpl storeImpl = (DiskStoreImpl) store;
+ storeImpl.lockStoreBeforeBackup();
+ if (storeImpl.hasPersistedData()) {
+ persistentIds.add(storeImpl.getPersistentID());
+ storeImpl.getStats().startBackup();
}
}
return persistentIds;
@@ -116,9 +118,10 @@ public class BackupManager implements MembershipListener {
/*
* Find the first matching DiskStoreId directory for this member.
*/
- for (DiskStoreImpl diskStore : cache.listDiskStoresIncludingRegionOwned()) {
+ for (DiskStore diskStore : cache.listDiskStoresIncludingRegionOwned()) {
File[] matchingFiles = baselineParentDir.listFiles(new FilenameFilter() {
- Pattern pattern = Pattern.compile(".*" + diskStore.getBackupDirName() + "$");
+ Pattern pattern =
+ Pattern.compile(".*" + ((DiskStoreImpl) diskStore).getBackupDirName() + "$");
public boolean accept(File dir, String name) {
Matcher m = pattern.matcher(name);
@@ -142,7 +145,6 @@ public class BackupManager implements MembershipListener {
* option. May be null if the user specified a full backup.
* @return null if the backup is to be a full backup otherwise return the data store directory in
* the previous backup for this member (if incremental).
- * @throws IOException
*/
private File checkBaseline(File baselineParentDir) throws IOException {
File baselineDir = null;
@@ -188,12 +190,12 @@ public class BackupManager implements MembershipListener {
File storesDir = new File(backupDir, DATA_STORES);
RestoreScript restoreScript = new RestoreScript();
HashSet<PersistentID> persistentIds = new HashSet<PersistentID>();
- Collection<DiskStoreImpl> diskStores =
- new ArrayList<DiskStoreImpl>(cache.listDiskStoresIncludingRegionOwned());
+ Collection<DiskStore> diskStores =
+ new ArrayList<DiskStore>(cache.listDiskStoresIncludingRegionOwned());
boolean foundPersistentData = false;
- for (Iterator<DiskStoreImpl> itr = diskStores.iterator(); itr.hasNext();) {
- DiskStoreImpl store = itr.next();
+ for (Iterator<DiskStore> itr = diskStores.iterator(); itr.hasNext();) {
+ DiskStoreImpl store = (DiskStoreImpl) itr.next();
if (store.hasPersistedData()) {
if (!foundPersistentData) {
createBackupDir(backupDir);
@@ -210,10 +212,11 @@ public class BackupManager implements MembershipListener {
allowDestroys.countDown();
- for (DiskStoreImpl store : diskStores) {
- store.finishBackup(this);
- store.getStats().endBackup();
- persistentIds.add(store.getPersistentID());
+ for (DiskStore store : diskStores) {
+ DiskStoreImpl storeImpl = (DiskStoreImpl) store;
+ storeImpl.finishBackup(this);
+ storeImpl.getStats().endBackup();
+ persistentIds.add(storeImpl.getPersistentID());
}
if (foundPersistentData) {
@@ -330,10 +333,7 @@ public class BackupManager implements MembershipListener {
cache.getInternalDistributedSystem().getDistributedMember();
String vmId = memberId.toString();
vmId = cleanSpecialCharacters(vmId);
- File backupDir = new File(targetDir, vmId);
-
-
- return backupDir;
+ return new File(targetDir, vmId);
}
private void createBackupDir(File backupDir) throws IOException {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
index f67dd81..86b2466 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.LowMemoryException;
+import org.apache.geode.cache.client.internal.ConnectionImpl;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.FunctionException;
@@ -32,7 +33,6 @@ import org.apache.geode.cache.operations.ExecuteFunctionOperationContext;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -96,7 +96,7 @@ public class ExecuteFunction66 extends BaseCommand {
boolean isReexecute = false;
boolean allMembers = false;
boolean ignoreFailedMembers = false;
- int functionTimeout = GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
+ int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
byte[] bytes = msg.getPart(0).getSerializedForm();
functionState = bytes[0];
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
index ade0aca..0ed7235 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
@@ -19,6 +19,7 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.internal.ConnectionImpl;
import org.apache.geode.cache.client.internal.ExecuteFunctionHelper;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionException;
@@ -28,7 +29,6 @@ import org.apache.geode.cache.operations.ExecuteFunctionOperationContext;
import org.apache.geode.cache.query.QueryInvocationTargetException;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.DistributedRegion;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.execute.AbstractExecution;
import org.apache.geode.internal.cache.execute.DistributedRegionFunctionExecutor;
@@ -78,7 +78,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
int filterSize = 0, partNumber = 0;
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
byte functionState = 0;
- int functionTimeout = GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
+ int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
byte[] bytes = msg.getPart(0).getSerializedForm();
functionState = bytes[0];
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
index 792b1ff..8b2cf75 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
@@ -20,13 +20,13 @@ import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.internal.ConnectionImpl;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionException;
import org.apache.geode.cache.execute.FunctionInvocationTargetException;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.operations.ExecuteFunctionOperationContext;
import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.execute.AbstractExecution;
import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException;
@@ -77,7 +77,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
Set<Object> removedNodesSet = null;
int filterSize = 0, bucketIdsSize = 0, partNumber = 0;
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- int functionTimeout = GemFireCacheImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
+ int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
byte[] bytes = msg.getPart(0).getSerializedForm();
functionState = bytes[0];
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
index ab3b3cf..832391d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
@@ -292,7 +292,7 @@ public abstract class AbstractGatewaySender implements GatewaySender, Distributi
this.getSenderAdvisor().setIsPrimary(isPrimary);
}
- public Cache getCache() {
+ public InternalCache getCache() {
return this.cache;
}
[30/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java
index 8eaa74a..6de88d9 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java
@@ -18,13 +18,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
-import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.query.AmbiguousNameException;
@@ -42,6 +40,7 @@ import org.apache.geode.cache.query.internal.index.IndexManager;
import org.apache.geode.cache.query.internal.index.IndexProtocol;
import org.apache.geode.cache.query.internal.index.IndexUtils;
import org.apache.geode.cache.query.internal.index.PartitionedIndex;
+import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.internal.types.StructTypeImpl;
import org.apache.geode.cache.query.types.CollectionType;
import org.apache.geode.cache.query.types.ObjectType;
@@ -50,6 +49,7 @@ import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.CachePerfStats;
import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -94,7 +94,7 @@ public class QueryUtils {
}
}
- public static void assertCompatible(SelectResults sr1, SelectResults sr2) {
+ private static void assertCompatible(SelectResults sr1, SelectResults sr2) {
Assert.assertTrue(
sr1.getCollectionType().getElementType().equals(sr2.getCollectionType().getElementType()));
}
@@ -124,12 +124,11 @@ public class QueryUtils {
: new StructBag(elementType, context.getCachePerfStats());
}
-
/**
- * Returns an appropriate, empty <code>SelectResults</code>
+ * Returns an appropriate, empty {@code SelectResults}
*
- * @param objectType The <code>ObjectType</code> of the query results
- * @return an appropriate, empty <code>SelectResults</code>
+ * @param objectType The {@code ObjectType} of the query results
+ * @return an appropriate, empty {@code SelectResults}
*/
public static SelectResults getEmptySelectResults(ObjectType objectType,
CachePerfStats statsOrNull) {
@@ -143,10 +142,12 @@ public class QueryUtils {
}
/**
- * Returns an appropriate, empty <code>SelectResults</code>
+ * Returns an appropriate, empty {@code SelectResults}
+ *
+ * TODO: statsOrNull is always null
*
- * @param collectionType The <code>CollectionType</code> of the query results
- * @return an appropriate, empty <code>SelectResults</code>
+ * @param collectionType The {@code CollectionType} of the query results
+ * @return an appropriate, empty {@code SelectResults}
*/
public static SelectResults getEmptySelectResults(CollectionType collectionType,
CachePerfStats statsOrNull) {
@@ -179,8 +180,7 @@ public class QueryUtils {
// minimum number between the two bags
private static SelectResults sizeSortedIntersection(SelectResults small, SelectResults large,
ExecutionContext contextOrNull) {
- // if one is a set and one is a bag,
- // then treat the set like a bag (and return a bag)
+ // if one is a set and one is a bag, then treat the set like a bag (and return a bag)
boolean smallModifiable = small.isModifiable() && (isBag(small) || !isBag(large));
boolean largeModifiable = large.isModifiable() && (isBag(large) || !isBag(small));
if (smallModifiable) {
@@ -188,13 +188,13 @@ public class QueryUtils {
for (Iterator itr = small.iterator(); itr.hasNext();) {
Object element = itr.next();
int count = large.occurrences(element);
- if (small.occurrences(element) > count) { // bag intersection: only retain smaller number
- // of dups
+ if (small.occurrences(element) > count) {
+ // bag intersection: only retain smaller number of dups
itr.remove();
}
}
return small;
- } catch (UnsupportedOperationException e1) {
+ } catch (UnsupportedOperationException ignore) {
// didn't succeed because small is actually unmodifiable
}
}
@@ -203,13 +203,13 @@ public class QueryUtils {
for (Iterator itr = large.iterator(); itr.hasNext();) {
Object element = itr.next();
int count = small.occurrences(element);
- if (large.occurrences(element) > count) { // bag intersection: only retain smaller number
- // of dups
+ if (large.occurrences(element) > count) {
+ // bag intersection: only retain smaller number of dups
itr.remove();
}
}
return large;
- } catch (UnsupportedOperationException e2) {
+ } catch (UnsupportedOperationException ignore) {
// didn't succeed because large is actually unmodifiable
}
}
@@ -237,38 +237,34 @@ public class QueryUtils {
// union should be the sum of the occurrences in the two bags
// Is this Ok? There may be tuples which are actually common to both set so
// union in such cases should not increase count. right.?
-
private static SelectResults sizeSortedUnion(SelectResults small, SelectResults large,
ExecutionContext contextOrNull) {
- // if one is a set and one is a bag,
- // then treat the set like a bag (and return a bag)
+ // if one is a set and one is a bag, then treat the set like a bag (and return a bag)
boolean smallModifiable = small.isModifiable() && (isBag(small) || !isBag(large));
boolean largeModifiable = large.isModifiable() && (isBag(large) || !isBag(small));
if (largeModifiable) {
try {
- for (Iterator itr = small.iterator(); itr.hasNext();) {
- Object element = itr.next();
+ for (Object element : small) {
int count = small.occurrences(element);
if (large.occurrences(element) < count) {
large.add(element);
}
}
return large;
- } catch (UnsupportedOperationException e1) {
+ } catch (UnsupportedOperationException ignore) {
// didn't succeed because large is actually unmodifiable
}
}
if (smallModifiable) {
try {
- for (Iterator itr = large.iterator(); itr.hasNext();) {
- Object element = itr.next();
+ for (Object element : large) {
int count = large.occurrences(element);
if (small.occurrences(element) < count) {
small.add(element);
}
}
return small;
- } catch (UnsupportedOperationException e2) {
+ } catch (UnsupportedOperationException ignore) {
// didn't succeed because small is actually unmodifiable
}
}
@@ -280,10 +276,7 @@ public class QueryUtils {
rs = new ResultsBag(large, null);
}
- for (Iterator itr = small.iterator(); itr.hasNext();) {
- Object element = itr.next();
- rs.add(element);
- }
+ rs.addAll(small);
return rs;
}
@@ -294,18 +287,16 @@ public class QueryUtils {
* iterator is its independent iterator
*
* @param indpndntItrs array of independent RuntimeIterators
- * @param context
*/
- public static List getDependentItrChainForIndpndntItrs(RuntimeIterator[] indpndntItrs,
+ static List getDependentItrChainForIndpndntItrs(RuntimeIterator[] indpndntItrs,
ExecutionContext context) {
List ret = new ArrayList();
- for (int k = 0; k < indpndntItrs.length; ++k) {
- ret.addAll(context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(indpndntItrs[k]));
+ for (RuntimeIterator indpndntItr : indpndntItrs) {
+ ret.addAll(context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(indpndntItr));
}
return ret;
}
-
/**
* This util function does a cartesian of the array of SelectResults object , expanding the
* resultant set to the number of iterators passed in expansionList. The position of the iterator
@@ -336,11 +327,6 @@ public class QueryUtils {
* @param operand The CompiledValue which needs to be iter evaluated during cartesian. Only those
* tuples will be selected in the final Result for which oerand evaluates to true.
* @return SelectResults object representing the final result of the cartesian
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
- *
*/
public static SelectResults cartesian(SelectResults[] results,
RuntimeIterator[][] itrsForResultFields, List expansionList, List finalList,
@@ -359,10 +345,8 @@ public class QueryUtils {
returnSet = QueryUtils.createStructCollection(context, structType);
}
ListIterator expnItr = expansionList.listIterator();
- // RuntimeIterator levelExpnItr =
- // expnItr.hasNext()?(RuntimeIterator)expnItr.next():null;
doNestedIterations(0, returnSet, results, itrsForResultFields, finalList, expnItr,
- (results.length + expansionList.size()), context, operand);
+ results.length + expansionList.size(), context, operand);
return returnSet;
}
@@ -400,17 +384,15 @@ public class QueryUtils {
SelectResults individualResultSet = results[level];
RuntimeIterator[] itrsForFields = itrsForResultFields[level];
int len = itrsForFields.length;
- Iterator itr = individualResultSet.iterator();
- while (itr.hasNext()) {
+ for (Object anIndividualResultSet : individualResultSet) {
// Check if query execution on this thread is canceled.
QueryMonitor.isQueryExecutionCanceled();
- Object value = itr.next();
if (len == 1) {
// this means we have a ResultSet
- itrsForFields[0].setCurrent(value);
+ itrsForFields[0].setCurrent(anIndividualResultSet);
} else {
- Struct struct = (Struct) value;
- Object fieldValues[] = struct.getFieldValues();
+ Struct struct = (Struct) anIndividualResultSet;
+ Object[] fieldValues = struct.getFieldValues();
int size = fieldValues.length;
for (int i = 0; i < size; ++i) {
itrsForFields[i].setCurrent(fieldValues[i]);
@@ -423,13 +405,11 @@ public class QueryUtils {
RuntimeIterator currLevel = (RuntimeIterator) expansionItrs.next();
SelectResults c = currLevel.evaluateCollection(context);
if (c == null) {
- // TODO:Asif Check this out
expansionItrs.previous();
return;
}
- Iterator cIter = c.iterator();
- while (cIter.hasNext()) {
- currLevel.setCurrent(cIter.next());
+ for (Object aC : c) {
+ currLevel.setCurrent(aC);
doNestedIterations(level + 1, returnSet, results, itrsForResultFields, finalItrs,
expansionItrs, finalLevel, context, operand);
}
@@ -444,7 +424,7 @@ public class QueryUtils {
return true;
Object result = operand.evaluate(context);
if (result instanceof Boolean) {
- return ((Boolean) result).booleanValue();
+ return (Boolean) result;
} else if (result != null && result != QueryService.UNDEFINED) {
throw new TypeMismatchException(
LocalizedStrings.QueryUtils_ANDOR_OPERANDS_MUST_BE_OF_TYPE_BOOLEAN_NOT_TYPE_0
@@ -454,35 +434,32 @@ public class QueryUtils {
}
}
- // TODO:Asif This function is used to do cartesian of index resultset while
- // expanding/cutting down index resultset
- // with the intermediate resultset
- // TODO :Asif :Explain the parameters& Unit test it
+ /**
+ * NOTE: intermediateResults should be a single element array
+ * <p>
+ * NOTE: itrsForIntermediateResults should be a two dimensional array but with only one row
+ * <p>
+ * TODO: This function is used to do cartesian of index resultset while
+ * <p>
+ * expanding/cutting down index resultset with the intermediate resultset
+ */
private static void mergeRelationshipIndexResultsWithIntermediateResults(SelectResults returnSet,
- SelectResults[] intermediateResults /*
- * Asif This should be a single element array
- */,
- RuntimeIterator[][] itrsForIntermediateResults /*
- * Asif This should be a two dimensional array
- * but with only one row
- */, Object[][] indexResults,
- RuntimeIterator[][] indexFieldToItrsMapping, ListIterator expansionListItr, List finalItrs,
- ExecutionContext context, List[] checkList, CompiledValue iterOps,
- IndexCutDownExpansionHelper icdeh[], int level, int maxExpnCartesianDepth)
- throws FunctionDomainException, TypeMismatchException, NameResolutionException,
- QueryInvocationTargetException {
- // Object[] checkFields = null;
- // int len = indexFieldToItrsMapping[level].length;
- // RuntimeIterator rItr = null;
+ SelectResults[] intermediateResults, RuntimeIterator[][] itrsForIntermediateResults,
+ Object[][] indexResults, RuntimeIterator[][] indexFieldToItrsMapping,
+ ListIterator expansionListItr, List finalItrs, ExecutionContext context, List[] checkList,
+ CompiledValue iterOps, IndexCutDownExpansionHelper[] icdeh, int level,
+ int maxExpnCartesianDepth) throws FunctionDomainException, TypeMismatchException,
+ NameResolutionException, QueryInvocationTargetException {
+
int resultSize = indexResults[level].length;
- // TODO ASif : Since this is constant for a given merge call, pass it as a
+ // TODO: Since this is constant for a given merge call, pass it as a
// parameter to
// the function rather than calling it every time
for (int j = 0; j < resultSize; ++j) {
if (setIndexFieldValuesInRespectiveIterators(indexResults[level][j],
indexFieldToItrsMapping[level], icdeh[level])) {
- if (level == (indexResults.length - 1)) {
- // Asif :Set the values in the Intermedaite Resultset
+ if (level == indexResults.length - 1) {
+ // Set the values in the Intermedaite Resultset
doNestedIterations(0, returnSet, intermediateResults, itrsForIntermediateResults,
finalItrs, expansionListItr, maxExpnCartesianDepth, context, iterOps);
} else {
@@ -497,15 +474,14 @@ public class QueryUtils {
}
}
- // TODO:Asif : Test the function & write expnanation of the parameters
+ // TODO: Test the function & write expnanation of the parameters
private static void mergeAndExpandCutDownRelationshipIndexResults(Object[][] values,
SelectResults result, RuntimeIterator[][] indexFieldToItrsMapping,
ListIterator expansionListIterator, List finalItrs, ExecutionContext context,
- List[] checkList, CompiledValue iterOps, IndexCutDownExpansionHelper icdeh[], int level)
+ List[] checkList, CompiledValue iterOps, IndexCutDownExpansionHelper[] icdeh, int level)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- // int len = indexFieldToItrsMapping[level].length;
- // RuntimeIterator rItr = null;
+
int resultSize = values[level].length;
int limit = getLimitValue(context);
// stops recursion if limit has already been met
@@ -518,7 +494,7 @@ public class QueryUtils {
if (setIndexFieldValuesInRespectiveIterators(values[level][j], indexFieldToItrsMapping[level],
icdeh[level])) {
- if (level == (values.length - 1)) {
+ if (level == values.length - 1) {
doNestedIterationsForIndex(expansionListIterator.hasNext(), result, finalItrs,
expansionListIterator, context, iterOps, limit, null);
if (limit != -1 && result.size() >= limit) {
@@ -535,32 +511,30 @@ public class QueryUtils {
}
}
- // TODO:Asif : Explain the function & write test cases. A boolean false means
- // ,
- // by pass i.e the set value to be ignored
-
+ // TODO: Explain the function & write test cases. A boolean false means by pass i.e the set value
+ // to be ignored
// End result if we have not already expanded is that we have created a new struct and added to a
// set to prevent future expansions of the same object
// It also advances the current object for the iterator.
private static boolean setIndexFieldValuesInRespectiveIterators(Object value,
RuntimeIterator[] indexFieldToItrsMapping, IndexCutDownExpansionHelper icdeh) {
- Object[] checkFields = null;
boolean select = true;
int len = indexFieldToItrsMapping.length;
- RuntimeIterator rItr = null;
if (len == 1) {
- // Asif : this means we have a ResultSet
+ // this means we have a ResultSet
Support.Assert(!icdeh.cutDownNeeded,
"If the index fields to iter mapping is of of size 1 then cut down cannot occur");
indexFieldToItrsMapping[0].setCurrent(value);
} else {
Struct struct = (Struct) value;
- Object fieldValues[] = struct.getFieldValues();
+ Object[] fieldValues = struct.getFieldValues();
int size = fieldValues.length;
+ Object[] checkFields = null;
if (icdeh.cutDownNeeded)
checkFields = new Object[icdeh.checkSize];
// Object values[] = new Object[numItersInResultSet];
int j = 0;
+ RuntimeIterator rItr = null;
for (int i = 0; i < size; i++) {
rItr = indexFieldToItrsMapping[i];
if (rItr != null) {
@@ -593,15 +567,16 @@ public class QueryUtils {
ExecutionContext context, List checkList, CompiledValue iterOps, IndexInfo theFilteringIndex)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- SelectResults returnSet = null;
+
boolean useLinkedDataStructure = false;
boolean nullValuesAtStart = true;
Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
- if (orderByClause != null && orderByClause.booleanValue()) {
+ if (orderByClause != null && orderByClause) {
List orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
useLinkedDataStructure = orderByAttrs.size() == 1;
nullValuesAtStart = !((CompiledSortCriterion) orderByAttrs.get(0)).getCriterion();
}
+ SelectResults returnSet = null;
if (finalItrs.size() == 1) {
ObjectType resultType = ((RuntimeIterator) finalItrs.iterator().next()).getElementType();
if (useLinkedDataStructure) {
@@ -626,13 +601,13 @@ public class QueryUtils {
return returnSet;
}
- // TODO:Asif Explain the parameters passed
+ // TODO: Explain the parameters passed
private static void cutDownAndExpandIndexResults(SelectResults returnSet, SelectResults result,
RuntimeIterator[] indexFieldToItrsMapping, List expansionList, List finalItrs,
ExecutionContext context, List checkList, CompiledValue iterOps, IndexInfo theFilteringIndex)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- // Object[] checkFields = null;
+
IndexCutDownExpansionHelper icdeh = new IndexCutDownExpansionHelper(checkList, context);
int len = indexFieldToItrsMapping.length;
// don't call instanceof ResultsBag here, since a StructBag is a subtype of ResultsBag
@@ -650,20 +625,8 @@ public class QueryUtils {
derivedInfo.setExpansionList(expansionList);
}
Object value = itr.next();
- if (setIndexFieldValuesInRespectiveIterators(value, indexFieldToItrsMapping, icdeh)) { // does
- // that
- // mean
- // we
- // don't
- // get
- // dupes
- // even
- // if
- // they
- // exist
- // in
- // the
- // index?
+ if (setIndexFieldValuesInRespectiveIterators(value, indexFieldToItrsMapping, icdeh)) {
+ // does that mean we don't get dupes even if they exist in the index?
// DO NESTED LOOPING
if (IndexManager.JOIN_OPTIMIZATION) {
derivedInfo.computeDerivedJoinResults(theFilteringIndex, context, iterOps);
@@ -685,13 +648,13 @@ public class QueryUtils {
private static int getLimitValue(ExecutionContext context) {
int limit = -1;
if (context.cacheGet(CompiledValue.ORDERBY_ATTRIB) == null) {
- limit = ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)) != null
- ? ((Integer) context.cacheGet(CompiledValue.RESULT_LIMIT)).intValue() : -1;
+ limit = context.cacheGet(CompiledValue.RESULT_LIMIT) != null
+ ? (Integer) context.cacheGet(CompiledValue.RESULT_LIMIT) : -1;
}
return limit;
}
- public static CompiledID getCompiledIdFromPath(CompiledValue path) {
+ static CompiledID getCompiledIdFromPath(CompiledValue path) {
int type = path.getType();
if (type == OQLLexerTokenTypes.Identifier) {
return (CompiledID) path;
@@ -699,7 +662,6 @@ public class QueryUtils {
return getCompiledIdFromPath(path.getReceiver());
}
- // Add comments
private static void doNestedIterationsForIndex(boolean continueRecursion, SelectResults resultSet,
List finalItrs, ListIterator expansionItrs, ExecutionContext context, CompiledValue iterOps,
int limit, Map<String, SelectResults> derivedResults) throws FunctionDomainException,
@@ -717,10 +679,10 @@ public class QueryUtils {
boolean isOrdered = resultSet.getCollectionType().isOrdered();
StructTypeImpl elementType =
(StructTypeImpl) resultSet.getCollectionType().getElementType();
- // TODO:Asif Optimize the LinkedStructSet implementation so that
- // Object[] can be added rather than Struct
- Object values[] = new Object[len];
+ // TODO: Optimize the LinkedStructSet implementation so that
+
+ Object[] values = new Object[len];
int j = 0;
// creates tuple
while (itr.hasNext()) {
@@ -735,9 +697,7 @@ public class QueryUtils {
// Can be LinkedStructSet or SortedResultsBag ( containing underlying LinkedHashMap)
resultSet.add(new StructImpl(elementType, values));
} else {
-
((StructFields) resultSet).addFieldValues(values);
-
}
}
} else {
@@ -746,7 +706,6 @@ public class QueryUtils {
}
} else {
RuntimeIterator currentLevel = (RuntimeIterator) expansionItrs.next();
- SelectResults c = null;
// Calculate the key to find the derived join results. If we are a non nested lookup it will
// be a Compiled Region otherwise it will be a CompiledPath that
// we can extract the id from. In the end the result will be the alias which is used as a
@@ -756,32 +715,29 @@ public class QueryUtils {
boolean useDerivedResults = true;
if (currentLevel.getCmpIteratorDefn().getCollectionExpr()
.getType() == OQLLexerTokenTypes.RegionPath) {
- key = currentLevel.getCmpIteratorDefn().getName() + ":" + currentLevel.getDefinition();
+ key = currentLevel.getCmpIteratorDefn().getName() + ':' + currentLevel.getDefinition();
} else if (currentLevel.getCmpIteratorDefn().getCollectionExpr()
.getType() == OQLLexerTokenTypes.LITERAL_select) {
useDerivedResults = false;
} else {
key = getCompiledIdFromPath(currentLevel.getCmpIteratorDefn().getCollectionExpr()).getId()
- + ":" + currentLevel.getDefinition();
+ + ':' + currentLevel.getDefinition();
}
+ SelectResults c;
if (useDerivedResults && derivedResults != null && derivedResults.containsKey(key)) {
c = derivedResults.get(key);
} else {
c = currentLevel.evaluateCollection(context);
}
- // RuntimeIterator next = expansionItrs.hasNext() ?
- // (RuntimeIterator)expansionItrs.next() : null;
if (c == null) {
- // TODO:Asif Check this out
expansionItrs.previous();
return;
}
- Iterator cIter = c.iterator();
- while (cIter.hasNext()) {
+ for (Object aC : c) {
// Check if query execution on this thread is canceled.
QueryMonitor.isQueryExecutionCanceled();
- currentLevel.setCurrent(cIter.next());
+ currentLevel.setCurrent(aC);
doNestedIterationsForIndex(expansionItrs.hasNext(), resultSet, finalItrs, expansionItrs,
context, iterOps, limit, derivedResults);
if (limit != -1 && resultSet.size() >= limit) {
@@ -793,8 +749,8 @@ public class QueryUtils {
}
/**
- * Ketan/Asif : This function will evaluate the starting CompiledValue for a given CompliedValue.
- * The value returned will always be either the original CompiledValue, or a CompiledID, or a
+ * This function will evaluate the starting CompiledValue for a given CompliedValue. The value
+ * returned will always be either the original CompiledValue, or a CompiledID, or a
* CompiledRegion, or a CompiledBindArgument, or a CompiledOperation. The ExecutionContext passed
* can be null. If it is null, then for a CompiledOperation , if supposed to get resolved
* implicitly, will have its receiver as null. This is because in normal cases , a CompiledID
@@ -803,7 +759,7 @@ public class QueryUtils {
* @param expr CompiledValue object
* @return CompiledValue
*/
- public static CompiledValue obtainTheBottomMostCompiledValue(CompiledValue expr) {
+ static CompiledValue obtainTheBottomMostCompiledValue(CompiledValue expr) {
boolean toContinue = true;
int exprType = expr.getType();
while (toContinue) {
@@ -813,47 +769,46 @@ public class QueryUtils {
break;
case OQLLexerTokenTypes.METHOD_INV:
CompiledOperation operation = (CompiledOperation) expr;
- expr = operation.getReceiver(null/*
- * pass the ExecutionContext as null, thus never
- * implicitly resolving to RuntimeIterator
- */);
+ // pass the ExecutionContext as null, thus never implicitly resolving to RuntimeIterator
+ expr = operation.getReceiver(null);
if (expr == null) {
expr = operation;
toContinue = false;
}
break;
case CompiledValue.PATH:
- expr = ((CompiledPath) expr).getReceiver();
+ expr = expr.getReceiver();
break;
case OQLLexerTokenTypes.TOK_LBRACK:
- expr = ((CompiledIndexOperation) expr).getReceiver();
+ expr = expr.getReceiver();
break;
default:
toContinue = false;
break;
}
- if (toContinue)
+ if (toContinue) {
exprType = expr.getType();
+ }
}
return expr;
}
/**
- * Asif : This function creates a StructType using Internal IDs of the iterators as the field
- * names for the StructType. It should be invoked iff the iterators size is greater than 1
+ * This function creates a StructType using Internal IDs of the iterators as the field names for
+ * the StructType. It should be invoked iff the iterators size is greater than 1
*
* @param runTimeIterators List of RuntimeIterator objects
* @return StructType object
*
*/
- public static StructType createStructTypeForRuntimeIterators(List runTimeIterators) {
+ static StructType createStructTypeForRuntimeIterators(List runTimeIterators) {
Support.Assert(runTimeIterators.size() > 1,
"The number of Iterators passed should be greater than 1 to create a structSet");
int len = runTimeIterators.size();
- String fieldNames[] = new String[len];
+ String[] fieldNames = new String[len];
String[] indexAlternativeFieldNames = new String[len];
- ObjectType fieldTypes[] = new ObjectType[len];
- // Asif : use an Iterator as the chances are that we will be sending
+ ObjectType[] fieldTypes = new ObjectType[len];
+ // use an Iterator as the chances are that we will be sending
// LinkedList rather than ArrayList
Iterator itr = runTimeIterators.iterator();
int i = 0;
@@ -863,26 +818,23 @@ public class QueryUtils {
indexAlternativeFieldNames[i] = iter.getIndexInternalID();
fieldTypes[i++] = iter.getElementType();
}
- StructTypeImpl type = new StructTypeImpl(fieldNames, indexAlternativeFieldNames, fieldTypes);
- return type;
+ return new StructTypeImpl(fieldNames, indexAlternativeFieldNames, fieldTypes);
}
/**
- * Asif :This function returns the ultimate independent RuntimeIterators of current scope on which
- * the CompiledValue passed is dependent upon. This does not return the RuntimeIterators on which
- * it may be dependent but are not part of the current scope. If no such RuntimeIterator exists it
+ * This function returns the ultimate independent RuntimeIterators of current scope on which the
+ * CompiledValue passed is dependent upon. This does not return the RuntimeIterators on which it
+ * may be dependent but are not part of the current scope. If no such RuntimeIterator exists it
* returns empty set.
*
* @param compiledValue CompiledValue Object
* @param context ExecutionContextobject
* @return Set containing the ultimate independent RuntimeIterators of current scope
- *
*/
- public static Set getCurrentScopeUltimateRuntimeIteratorsIfAny(CompiledValue compiledValue,
+ static Set getCurrentScopeUltimateRuntimeIteratorsIfAny(CompiledValue compiledValue,
ExecutionContext context) {
- HashSet set = new HashSet();
- context.computeUtlimateDependencies(compiledValue, set);
- // if (set.size() != 1) return null;
+ Set set = new HashSet();
+ context.computeUltimateDependencies(compiledValue, set);
Iterator iter = set.iterator();
while (iter.hasNext()) {
RuntimeIterator rIter = (RuntimeIterator) iter.next();
@@ -893,8 +845,8 @@ public class QueryUtils {
}
/**
- * Asif :Returns the pair of RangeIndexes available for a composite condition ( equi join across
- * the region). It will either return two indexes or will return null. *
+ * Returns the pair of RangeIndexes available for a composite condition ( equi join across the
+ * region). It will either return two indexes or will return null. *
*
* @param lhs One of the operands of the equi-join condition
* @param rhs The other operand of the equi-join condition
@@ -902,22 +854,23 @@ public class QueryUtils {
* @param operator The operator which necesarily has to be an equality ( ' = ' )
* @return An array of IndexData object with 0th IndexData for the lhs operand & 1th object for
* rhs operad
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
- *
*/
static IndexData[] getRelationshipIndexIfAny(CompiledValue lhs, CompiledValue rhs,
ExecutionContext context, int operator)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
- if (operator != OQLLexerTokenTypes.TOK_EQ)
- return null;// Operator must be
- // '='
- IndexData lhsIndxData =
- QueryUtils.getAvailableIndexIfAny(lhs, context, false /* Do not use PrimaryKey Index */);// findOnlyFunctionalIndex.
- if (lhsIndxData == null)
+ if (operator != OQLLexerTokenTypes.TOK_EQ) {
+ // Operator must be '='
+ return null;
+ }
+
+ // Do not use PrimaryKey Index
+ IndexData lhsIndxData = QueryUtils.getAvailableIndexIfAny(lhs, context, false);
+ if (lhsIndxData == null) {
return null;
- IndexData rhsIndxData =
- QueryUtils.getAvailableIndexIfAny(rhs, context, false /* Do not use PrimaryKey Index */);// findOnlyFunctionalIndex.
+ }
+
+ // Do not use PrimaryKey Index
+ IndexData rhsIndxData = QueryUtils.getAvailableIndexIfAny(rhs, context, false /* */);
if (rhsIndxData == null) {
// release the lock held on lhsIndex as it will not be used
Index index = lhsIndxData.getIndex();
@@ -929,6 +882,7 @@ public class QueryUtils {
}
return null;
}
+
Index lhsIndx = lhsIndxData.getIndex();
Index rhsIndx = rhsIndxData.getIndex();
if (((IndexProtocol) lhsIndx).isValid() && ((IndexProtocol) rhsIndx).isValid()) {
@@ -938,30 +892,26 @@ public class QueryUtils {
}
/**
- * Asif : Gets an Index available for the condition
+ * Gets an Index available for the condition
*
* @param cv Condition on which index needs to be obtained
* @param context ExecutionContext object
* @param operator int argument identifying the type of operator
* @return IndexData object
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
- *
*/
static IndexData getAvailableIndexIfAny(CompiledValue cv, ExecutionContext context, int operator)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// If operator is = or != then first search for PRIMARY_KEY Index
boolean usePrimaryIndex =
- (operator == OQLLexerTokenTypes.TOK_EQ || operator == OQLLexerTokenTypes.TOK_NE);
+ operator == OQLLexerTokenTypes.TOK_EQ || operator == OQLLexerTokenTypes.TOK_NE;
return getAvailableIndexIfAny(cv, context, usePrimaryIndex);
}
- // TODO:Asif : Provide description of the function.
private static IndexData getAvailableIndexIfAny(CompiledValue cv, ExecutionContext context,
boolean usePrimaryIndex)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
Set set = new HashSet();
- context.computeUtlimateDependencies(cv, set);
+ context.computeUltimateDependencies(cv, set);
if (set.size() != 1)
return null;
RuntimeIterator rIter = (RuntimeIterator) set.iterator().next();
@@ -973,7 +923,7 @@ public class QueryUtils {
|| (regionPath = context.getRegionPathForIndependentRuntimeIterator(rIter)) == null) {
return null;
}
- // Asif : The independent iterator is added as the first element
+ // The independent iterator is added as the first element
List groupRuntimeItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(rIter);
String[] definitions = new String[groupRuntimeItrs.size()];
Iterator iterator = groupRuntimeItrs.iterator();
@@ -981,11 +931,8 @@ public class QueryUtils {
while (iterator.hasNext()) {
RuntimeIterator rIterator = (RuntimeIterator) iterator.next();
definitions[i++] = rIterator.getDefinition();
-
}
- // StringBuffer sb = new StringBuffer();
- // cv.generateCanonicalizedExpression(sb, context);
IndexData indexData = IndexUtils.findIndex(regionPath, definitions, cv, "*", context.getCache(),
usePrimaryIndex, context);
if (indexData != null) {
@@ -999,17 +946,17 @@ public class QueryUtils {
}
/**
- * Asif : Conditions the raw index result obtained on a non composite condition ( i.e a condition
- * with a format of variable = constant . A constant may be either a CompiledLiteral or an
- * expression which is completely dependent on iterators other than the current scope. The
- * variable is a path expression which is completely dependent on iterators belonging only to a
- * single region ( i.e iterators belonging to a Group of iterators only dependent on a single
- * indpendent iterator for the region). The raw index result is appropriately expanded / cutdown
- * with evaluation of iter operand if any , StructType/ObjectType appropriately set, Shuffling of
- * the fields appropriately done, such that the final result is compatible, in terms of the
- * position and names of the fields of SelectResults( StructBag) , with the Iterators of the query
- * from clause ( if complete expansion flag is true) or the chain of iterators identified by the
- * indpendent iterator for the group.
+ * Conditions the raw index result obtained on a non composite condition ( i.e a condition with a
+ * format of variable = constant . A constant may be either a CompiledLiteral or an expression
+ * which is completely dependent on iterators other than the current scope. The variable is a path
+ * expression which is completely dependent on iterators belonging only to a single region ( i.e
+ * iterators belonging to a Group of iterators only dependent on a single indpendent iterator for
+ * the region). The raw index result is appropriately expanded / cutdown with evaluation of iter
+ * operand if any , StructType/ObjectType appropriately set, Shuffling of the fields appropriately
+ * done, such that the final result is compatible, in terms of the position and names of the
+ * fields of SelectResults( StructBag) , with the Iterators of the query from clause ( if complete
+ * expansion flag is true) or the chain of iterators identified by the indpendent iterator for the
+ * group.
*
* @param indexResults The raw index results which may be a ResultBag object or an StructBag
* object
@@ -1026,18 +973,13 @@ public class QueryUtils {
* The conditioned Index Resultset will be created as per the chain of dependent iterators
* for each group.
* @return SelectResults object representing the conditioned Results
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
- *
*/
- static SelectResults getconditionedIndexResults(SelectResults indexResults, IndexInfo indexInfo,
+ static SelectResults getConditionedIndexResults(SelectResults indexResults, IndexInfo indexInfo,
ExecutionContext context, int indexFieldsSize, boolean completeExpansion,
CompiledValue iterOperands, RuntimeIterator[] grpIndpndntItr) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
if (!completeExpansion && grpIndpndntItr != null && grpIndpndntItr.length > 1) {
- // Asif : If for a Single Base Collection Index usage we are having
+ // If for a Single Base Collection Index usage we are having
// independent
// group of iterators with size greater than 1 , that implies it is being
// invoked
@@ -1059,8 +1001,8 @@ public class QueryUtils {
List newExpList = new ArrayList();
int len = grpIndpndntItr.length;
RuntimeIterator tempItr = null;
- for (int i = 0; i < len; ++i) {
- tempItr = grpIndpndntItr[i];
+ for (RuntimeIterator aGrpIndpndntItr : grpIndpndntItr) {
+ tempItr = aGrpIndpndntItr;
if (tempItr != ich.indpndntItr) {
newExpList.addAll(context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(tempItr));
}
@@ -1097,20 +1039,21 @@ public class QueryUtils {
}
/**
- * Asif :This function is used to evaluate a filter evaluatable CompositeCondition(ie Range
- * Indexes available on both LHS & RHS operands).This function is invoked from AND junction
- * evaluation of CompositeGroupJunction. It expands the intermediate resultset passed , to the
- * level of groups determined by the LHS & RHS operand, using the range indexes. It is possible
- * that the group of iterators for an operand of condition already exists in the intermediate
- * resultset passed. In such situation, the intermediate resultset is iterated & the operand (
- * whose group of iterators are available in the intermediate resultset ) is evaluated. For each
- * such evaluated value , the other operand's Range Index is queried & the Range Index's results
- * are appropriately expanded & cut down & a final tuple obtained( which includes the previously
- * existing fields of intermediate resultset). The array of independent iterators passed from the
- * Composite Group junction will be null, except for the final condition ( subject to the fact
- * that complete expansion flag is false. Otherwise even for final condition , the array will be
- * null) as that array will be used to get the final position of iterators in the resultant
- * StructBag
+ * This function is used to evaluate a filter evaluatable CompositeCondition(ie Range Indexes
+ * available on both LHS & RHS operands).This function is invoked from AND junction evaluation of
+ * CompositeGroupJunction. It expands the intermediate resultset passed , to the level of groups
+ * determined by the LHS & RHS operand, using the range indexes. It is possible that the group of
+ * iterators for an operand of condition already exists in the intermediate resultset passed. In
+ * such situation, the intermediate resultset is iterated & the operand ( whose group of iterators
+ * are available in the intermediate resultset ) is evaluated. For each such evaluated value , the
+ * other operand's Range Index is queried & the Range Index's results are appropriately expanded &
+ * cut down & a final tuple obtained( which includes the previously existing fields of
+ * intermediate resultset). The array of independent iterators passed from the Composite Group
+ * junction will be null, except for the final condition ( subject to the fact that complete
+ * expansion flag is false. Otherwise even for final condition , the array will be null) as that
+ * array will be used to get the final position of iterators in the resultant StructBag
+ *
+ * TODO: break this method up
*
* @param intermediateResults SelectResults object containing the intermediate resultset obtained
* by evaluation of previous filter evaluatable composite conditions of the
@@ -1127,11 +1070,6 @@ public class QueryUtils {
* representative groups forming the CompositeGroupJunction *
* @return SelectResults The Result object created by evaluating the filter evaluatable condition
* merged with the intermediate results
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
- *
*/
static SelectResults getRelationshipIndexResultsMergedWithIntermediateResults(
SelectResults intermediateResults, IndexInfo[] indxInfo, ExecutionContext context,
@@ -1145,31 +1083,32 @@ public class QueryUtils {
int indexFieldsSize2 = resultType2 instanceof StructType
? ((StructTypeImpl) resultType2).getFieldNames().length : 1;
/*
- * Asif : even if th complete expansion is needed pass the flag of complete expansion as false.
- * Thus for LHS & RHS we will get the expnasionList for that individual group.
+ * even if th complete expansion is needed pass the flag of complete expansion as false. Thus
+ * for LHS & RHS we will get the expnasionList for that individual group.
*/
- IndexConditioningHelper ich1 =
- new IndexConditioningHelper(indxInfo[0], context, indexFieldsSize1,
- false/* Asif : pass it as false, irrespective of actual value */, iterOperands, null);
- IndexConditioningHelper ich2 =
- new IndexConditioningHelper(indxInfo[1], context, indexFieldsSize2,
- false/* Asif : pass it as false, irrespective of actual value */, iterOperands, null);
- // Asif : We cannot have a condition where in intermediateResultset is empty
+
+ // NOTE: use false for completeExpansion irrespective of actual value
+ IndexConditioningHelper ich1 = new IndexConditioningHelper(indxInfo[0], context,
+ indexFieldsSize1, false, iterOperands, null);
+
+ // NOTE: use false for completeExpansion irrespective of actual value
+ IndexConditioningHelper ich2 = new IndexConditioningHelper(indxInfo[1], context,
+ indexFieldsSize2, false, iterOperands, null);
+
+ // We cannot have a condition where in intermediateResultset is empty
// or null & complete
// expansion flag true because in that case instead of this function we should
// have called
- // getconditionedRelationshipIndexResultsExpandedToTopOrCGJLevel
- int noOfIndexesToUse = (intermediateResults == null || intermediateResults.isEmpty()) ? 2 : 0;
+ int noOfIndexesToUse = intermediateResults == null || intermediateResults.isEmpty() ? 2 : 0;
RuntimeIterator[] resultFieldsItrMapping = null;
List allItrs = context.getCurrentIterators();
IndexConditioningHelper singleUsableICH = null;
IndexConditioningHelper nonUsableICH = null;
List finalList =
completeExpansionNeeded ? allItrs : indpdntItrs == null ? new ArrayList() : null;
- // Asif : the set will contain those iterators which we don't have to expand
- // to
- // either because they are already present ( because of intermediate results or
- // because index result already contains them
+ // the set will contain those iterators which we don't have to expand to either because they are
+ // already present ( because of intermediate results or because index result already contains
+ // them
Set expnItrsToIgnore = null;
if (noOfIndexesToUse == 0) {
// If the intermediate Resultset is not empty then check if the resultset
@@ -1199,15 +1138,14 @@ public class QueryUtils {
int pos = Integer.parseInt(fieldName.substring(4));
RuntimeIterator itrPrsntInIntermdtRes = (RuntimeIterator) allItrs.get(pos - 1);
resultFieldsItrMapping[i] = itrPrsntInIntermdtRes;
- // Asif : the iterator below is already present in resultset so needs to
- // be ignored for expansion
+ // the iterator below is already present in resultset so needs to be ignored for expansion
if (completeExpansionNeeded) {
if (expnItrsToIgnore == null) {
expnItrsToIgnore = new HashSet();
}
expnItrsToIgnore.add(itrPrsntInIntermdtRes);
} else if (indpdntItrs == null) {
- // Asif:We will need to know the intermediate iterators so as to know
+ // We will need to know the intermediate iterators so as to know
// the final list which will be used to obtain the correct structset.
// But if the independent group of iterators is passed, the final list needs
// to be calculated
@@ -1242,37 +1180,29 @@ public class QueryUtils {
totalExpList.addAll(ich2.expansionList);
if (completeExpansionNeeded) {
if (expnItrsToIgnore == null) {
- // Asif : The expnItrsToIgnore set being null at this point implies
- // that though
- // complete expansion flag is true but intermediate result set is
- // empty
+ // The expnItrsToIgnore set being null at this point implies that though complete
+ // expansion flag is true but intermediate result set is empty
Support.Assert(intermediateResults == null || intermediateResults.isEmpty(),
"expnItrsToIgnore should not have been null if the intermediate result set is not empty");
expnItrsToIgnore = new HashSet();
}
expnItrsToIgnore.addAll(ich1.finalList);
expnItrsToIgnore.addAll(ich2.finalList);
- // Asif : identify the iterators which we need to expand to
- // TODO:Asif :Make the code compact by using a common function to take
- // care of this
+ // identify the iterators which we need to expand to
+ // TODO: Make the code compact by using a common function to take care of this
int size = finalList.size();
for (int i = 0; i < size; ++i) {
RuntimeIterator currItr = (RuntimeIterator) finalList.get(i);
- // Asif :If the runtimeIterators of scope not present in CheckSet add
- // it
- // to
- // the expansion list
+ // If the runtimeIterators of scope not present in CheckSet add it to the expansion list
if (!expnItrsToIgnore.contains(currItr)) {
totalExpList.add(currItr);
}
}
} else {
- // Asif : If the independent itrs passed is not null, this implies
- // that we are evaluating the last filterable cc of the AND junction
- // so the final resultset should have placement of iterators in the
- // order of indpendent iterators present in CGJ. Otherwise we will have
- // struct
- // set mismatch while doing intersection with GroupJunction results
+ // If the independent itrs passed is not null, this implies that we are evaluating the last
+ // filterable cc of the AND junction so the final resultset should have placement of
+ // iterators in the order of indpendent iterators present in CGJ. Otherwise we will have
+ // struct set mismatch while doing intersection with GroupJunction results
if (indpdntItrs != null) {
finalList = getDependentItrChainForIndpndntItrs(indpdntItrs, context);
} else {
@@ -1303,23 +1233,15 @@ public class QueryUtils {
intermediateResults != null && !intermediateResults.isEmpty();
int maxCartesianDepth = totalExpList.size() + (doMergeWithIntermediateResults ? 1 : 0);
while (dataItr.hasNext()) {
- // TODO:Asif Change the code in range Index so that while collecting
- // data
- // instead of creating
- // two dimensional object array , we create one dimensional Object
- // array
- // of size 2, & each elemnt
- // stores an Object array
+ // TODO: Change the code in range Index so that while collecting data instead of
+ // creating two dimensional object array , we create one dimensional Object array of
+ // size 2, & each elemnt stores an Object array
Object[][] values = (Object[][]) dataItr.next();
- // Asif : Before doing the cartesian of the Results , we need to
- // clear
- // the CheckSet of InexCutDownExpansionHelper. This is needed
- // because for
- // a new key , the row of sets needs to be considered fresh as
- // presence of old row in
- // checkset may cause us to wrongly skip the similar row of a set ,
- // even when the row in its entirety
- // is unique ( made by different data in the other set)
+ // Before doing the cartesian of the Results , we need to clear the CheckSet of
+ // InexCutDownExpansionHelper. This is needed because for a new key , the row of sets
+ // needs to be considered fresh as presence of old row in checkset may cause us to
+ // wrongly skip the similar row of a set , even when the row in its entirety is unique (
+ // made by different data in the other set)
if (doMergeWithIntermediateResults) {
mergeRelationshipIndexResultsWithIntermediateResults(returnSet,
new SelectResults[] {intermediateResults}, resultMappings, values, mappings,
@@ -1328,7 +1250,7 @@ public class QueryUtils {
} else {
mergeAndExpandCutDownRelationshipIndexResults(values, returnSet, mappings,
expansionListIterator, finalList, context, totalCheckList, iterOperands, icdeh,
- 0 /* Level */);
+ 0);
}
if (icdeh[0].cutDownNeeded)
icdeh[0].checkSet.clear();
@@ -1339,65 +1261,53 @@ public class QueryUtils {
}
return returnSet;
} else if (noOfIndexesToUse == 1) {
- // Asif : There exists one independent iterator in the current condition
- // which is also a part of the intermediate resultset
- // Identify the final List which will depend upon the complete expansion
- // flag
- // Identify the iterators to be expanded to, which will also depend upon
- // complete
- // expansion flag..
+ // There exists one independent iterator in the current condition which is also a part of the
+ // intermediate resultset Identify the final List which will depend upon the complete
+ // expansion flag Identify the iterators to be expanded to, which will also depend upon
+ // complete expansion flag..
List totalExpList = new ArrayList();
totalExpList.addAll(singleUsableICH.expansionList);
if (completeExpansionNeeded) {
Support.Assert(expnItrsToIgnore != null,
"expnItrsToIgnore should not have been null as we are in this block itself indicates that intermediate results was not null");
expnItrsToIgnore.addAll(singleUsableICH.finalList);
- // Asif : identify the iterators which we need to expand to
- // TODO:Asif :Make the code compact by using a common function to take
- // care of this
+ // identify the iterators which we need to expand to
+ // TODO: Make the code compact by using a common function to take care of this
int size = finalList.size();
for (int i = 0; i < size; ++i) {
RuntimeIterator currItr = (RuntimeIterator) finalList.get(i);
- // Asif :If the runtimeIterators of scope not present in CheckSet add
- // it
- // to
- // the expansion list
+ // If the runtimeIterators of scope not present in CheckSet add it to the expansion list
if (!expnItrsToIgnore.contains(currItr)) {
totalExpList.add(currItr);
}
}
} else {
- // Asif : If the independent itrs passed is not null, this implies
- // that we are evaluating the last filterable cc of the AND junction
- // so the final resultset should have placement of iterators in the
- // order of indpendent iterators present in CGJ. Otherwise we will havve
- // struct
- // set mismatch while doing intersection with GroupJunction results
+ // If the independent itrs passed is not null, this implies that we are evaluating the last
+ // filterable cc of the AND junction so the final resultset should have placement of
+ // iterators in the order of indpendent iterators present in CGJ. Otherwise we will havve
+ // struct set mismatch while doing intersection with GroupJunction results
if (indpdntItrs != null) {
finalList = getDependentItrChainForIndpndntItrs(indpdntItrs, context);
} else {
finalList.addAll(singleUsableICH.finalList);
}
}
- // List[] checkList = new List[] { ich1.checkList, ich2.checkList};
+
StructType stype = createStructTypeForRuntimeIterators(finalList);
SelectResults returnSet = QueryUtils.createStructCollection(context, stype);
- // Asif :Obtain the empty resultset for the single usable index
+ // Obtain the empty resultset for the single usable index
IndexProtocol singleUsblIndex = singleUsableICH.indxInfo._index;
CompiledValue nonUsblIndxPath = nonUsableICH.indxInfo._path;
ObjectType singlUsblIndxResType = singleUsblIndex.getResultSetType();
- // int singleUsblIndexFieldsSize = -1;
+
SelectResults singlUsblIndxRes = null;
if (singlUsblIndxResType instanceof StructType) {
singlUsblIndxRes =
QueryUtils.createStructCollection(context, (StructTypeImpl) singlUsblIndxResType);
- // singleUsblIndexFieldsSize = ((StructTypeImpl) singlUsblIndxResType)
- // .getFieldNames().length;
} else {
singlUsblIndxRes = QueryUtils.createResultCollection(context, singlUsblIndxResType);
- // singleUsblIndexFieldsSize = 1;
}
- // Asif iterate over the intermediate structset
+ // iterate over the intermediate structset
Iterator intrmdtRsItr = intermediateResults.iterator();
observer = QueryObserverHolder.getInstance();
try {
@@ -1410,11 +1320,12 @@ public class QueryUtils {
for (int i = 0; i < len; ++i) {
resultFieldsItrMapping[i].setCurrent(val[i]);
}
- // TODO:Asif : Issue relevant index use callbacks to QueryObserver
+ // TODO: Issue relevant index use callbacks to QueryObserver
Object key = nonUsblIndxPath.evaluate(context);
- // TODO:Asif : Check this logic out
- if (key != null && key.equals(QueryService.UNDEFINED))
+ // TODO: Check this logic out
+ if (key != null && key.equals(QueryService.UNDEFINED)) {
continue;
+ }
singleUsblIndex.query(key, OQLLexerTokenTypes.TOK_EQ, singlUsblIndxRes, context);
cutDownAndExpandIndexResults(returnSet, singlUsblIndxRes,
singleUsableICH.indexFieldToItrsMapping, totalExpList, finalList, context,
@@ -1427,7 +1338,7 @@ public class QueryUtils {
}
return returnSet;
} else {
- // Asif : This condition is filter evaluatable but both the RHS group as
+ // This condition is filter evaluatable but both the RHS group as
// well as
// LHS group of iterators are present in the intermediate resultset. As a
// result indexes
@@ -1437,8 +1348,8 @@ public class QueryUtils {
// IT BECOMES
// PART OF ITER OPERANDS
if (logger.isDebugEnabled()) {
- StringBuffer tempBuffLhs = new StringBuffer();
- StringBuffer tempBuffRhs = new StringBuffer();
+ StringBuilder tempBuffLhs = new StringBuilder();
+ StringBuilder tempBuffRhs = new StringBuilder();
ich1.indxInfo._path.generateCanonicalizedExpression(tempBuffLhs, context);
ich2.indxInfo._path.generateCanonicalizedExpression(tempBuffRhs, context);
logger.debug("For better performance indexes are not used for the condition {} = {}",
@@ -1449,7 +1360,7 @@ public class QueryUtils {
// Add this reconstructed value to the iter operand if any
CompiledValue finalVal = reconstructedVal;
if (iterOperands != null) {
- // Asif : The type of CompiledJunction has to be AND junction as this
+ // The type of CompiledJunction has to be AND junction as this
// function gets invoked only for AND . Also it is OK if we have
// iterOperands which
// itself is a CompiledJunction. We can have a tree of CompiledJunction
@@ -1463,16 +1374,16 @@ public class QueryUtils {
RuntimeIterator[][] resultMappings = new RuntimeIterator[1][];
resultMappings[0] = resultFieldsItrMapping;
return cartesian(new SelectResults[] {intermediateResults}, resultMappings,
- Collections.EMPTY_LIST, finalList, context, finalVal);
+ Collections.emptyList(), finalList, context, finalVal);
}
}
/**
- * Asif :This function is used to evaluate a filter evaluatable composite condition. It gets
- * invoked either from a CompositeGroupJunction of "OR" type or a where clause containing single
- * composite condition. In the later case the boolean completeExpansion flag is always true. While
- * in the former case it may be true or false. If it is false, the array of independent iterators
- * passed is not null.
+ * This function is used to evaluate a filter evaluatable composite condition. It gets invoked
+ * either from a CompositeGroupJunction of "OR" type or a where clause containing single composite
+ * condition. In the later case the boolean completeExpansion flag is always true. While in the
+ * former case it may be true or false. If it is false, the array of independent iterators passed
+ * is not null.
*
* @param data A List object whose elements are two dimensional object array. Each element of the
* List represent a value which satisfies the equi-join condition. Since there may be more
@@ -1494,11 +1405,6 @@ public class QueryUtils {
* @return SelectResults objet representing the result obtained by evaluating a filter evaluatable
* composite condition in an OR junction. The returned Result is expanded either to the
* CompositeGroupJunction level or to the top level as the case may be
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
- *
*/
static SelectResults getconditionedRelationshipIndexResultsExpandedToTopOrCGJLevel(List data,
IndexInfo[] indxInfo, ExecutionContext context, boolean completeExpansionNeeded,
@@ -1511,22 +1417,25 @@ public class QueryUtils {
int indexFieldsSize2 = resultType2 instanceof StructType
? ((StructTypeImpl) resultType2).getFieldNames().length : 1;
/*
- * Asif : even if th complete expansion is needed pass the flag of complete expansion as false.
- * Thus for LHS & RHS we will get the expansionList for that individual group. Thus the total
+ * even if th complete expansion is needed pass the flag of complete expansion as false. Thus
+ * for LHS & RHS we will get the expansionList for that individual group. Thus the total
* expansion List wil contain sum of the individual expansion lists plus all the iterators of
* the current scope which are dependent on any other groups or are composite iterators ( i.e
* dependent on both the independent groups currently under consideration
*/
- IndexConditioningHelper ich1 =
- new IndexConditioningHelper(indxInfo[0], context, indexFieldsSize1,
- false/* Asif : pass it as false, irrespective of actual value */, iterOperands, null);
- IndexConditioningHelper ich2 =
- new IndexConditioningHelper(indxInfo[1], context, indexFieldsSize2,
- false/* Asif : pass it as false, irrespective of actual value */, iterOperands, null);
+
+ // pass completeExpansion as false, irrespective of actual value
+ IndexConditioningHelper ich1 = new IndexConditioningHelper(indxInfo[0], context,
+ indexFieldsSize1, false, iterOperands, null);
+
+ // pass completeExpansion as false, irrespective of actual value
+ IndexConditioningHelper ich2 = new IndexConditioningHelper(indxInfo[1], context,
+ indexFieldsSize2, false, iterOperands, null);
+
List totalExpList = new ArrayList();
totalExpList.addAll(ich1.expansionList);
totalExpList.addAll(ich2.expansionList);
- // List[] checkList = new List[] { ich1.checkList, ich2.checkList};
+
List totalFinalList = null;
if (completeExpansionNeeded) {
totalFinalList = context.getCurrentIterators();
@@ -1536,7 +1445,7 @@ public class QueryUtils {
int size = totalFinalList.size();
for (int i = 0; i < size; ++i) {
RuntimeIterator currItr = (RuntimeIterator) totalFinalList.get(i);
- // Asif :If the runtimeIterators of scope not present in CheckSet add it
+ // If the runtimeIterators of scope not present in CheckSet add it
// to
// the expansion list
if (!expnItrsAlreadyAccounted.contains(currItr)) {
@@ -1577,7 +1486,7 @@ public class QueryUtils {
observer.beforeMergeJoinOfDoubleIndexResults(ich1.indxInfo._index, ich2.indxInfo._index,
data);
while (dataItr.hasNext()) {
- // TODO:Asif Change the code in range Index so that while collecting
+ // TODO: Change the code in range Index so that while collecting
// data
// instead of creating
// two dimensional object array , we create one dimensional Object
@@ -1585,7 +1494,7 @@ public class QueryUtils {
// of size 2, & each elemnt
// stores an Object array
Object[][] values = (Object[][]) dataItr.next();
- // Asif : Before doing the cartesian of the Results , we need to clear
+ // Before doing the cartesian of the Results , we need to clear
// the
// CheckSet of IndexCutDownExpansionHelper. This is needed because for
// a
@@ -1610,8 +1519,8 @@ public class QueryUtils {
return returnSet;
}
- /*
- * Asif : This function is used ony for testing the private visibility function
+ /**
+ * This function is used ony for testing the private visibility function
*/
static SelectResults testCutDownAndExpandIndexResults(List dataList)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
@@ -1624,27 +1533,27 @@ public class QueryUtils {
static List queryEquijoinConditionBucketIndexes(IndexInfo[] indxInfo, ExecutionContext context)
throws QueryInvocationTargetException, TypeMismatchException, FunctionDomainException,
NameResolutionException {
- List data = null;
- ArrayList resultData = new ArrayList();
+ List resultData = new ArrayList();
AbstractIndex index0 = (AbstractIndex) indxInfo[0]._index;
AbstractIndex index1 = (AbstractIndex) indxInfo[1]._index;
PartitionedRegion pr0 = null;
- PartitionedRegion pr1 = null;
- IndexProtocol i0 = null;
- IndexProtocol i1 = null;
if (index0.getRegion() instanceof BucketRegion) {
- pr0 = ((BucketRegion) index0.getRegion()).getPartitionedRegion();
+ pr0 = ((Bucket) index0.getRegion()).getPartitionedRegion();
}
+ PartitionedRegion pr1 = null;
if (index1.getRegion() instanceof BucketRegion) {
- pr1 = ((BucketRegion) index1.getRegion()).getPartitionedRegion();
+ pr1 = ((Bucket) index1.getRegion()).getPartitionedRegion();
}
+ List data = null;
+ IndexProtocol i0 = null;
+ IndexProtocol i1 = null;
for (Object b : context.getBucketList()) {
- i0 = (pr0 != null) ? PartitionedIndex.getBucketIndex(pr0, index0.getName(), (Integer) b)
+ i0 = pr0 != null ? PartitionedIndex.getBucketIndex(pr0, index0.getName(), (Integer) b)
: indxInfo[0]._index;
- i1 = (pr1 != null) ? PartitionedIndex.getBucketIndex(pr1, index1.getName(), (Integer) b)
+ i1 = pr1 != null ? PartitionedIndex.getBucketIndex(pr1, index1.getName(), (Integer) b)
: indxInfo[1]._index;
if (i0 == null || i1 == null) {
@@ -1657,286 +1566,3 @@ public class QueryUtils {
return data;
}
}
-
-
-/**
- *
- * This is a helper class which provides information on how an index data be used so as to make it
- * compatible with the query.
- *
- */
-
-class IndexConditioningHelper {
-
- /**
- * boolean if true implies that the index results need to be iterated so as to make it compatible
- * with from clause. Shuffling may be needed for any of the following reasons: 1) Match level not
- * zero ( implying index result expansion or cutdown) 2) Match level zero , but the relative
- * positions of iterators in the List of iterators for the group not matching the positions in the
- * index result StructBag 3) Iter operand is not null. *
- *
- */
- // If shuffling is not needed , then it can be bcoz of two reasons
- // 1) The Index results is a ResultSet & match level is zero ( in that case we
- // don't have to do anything)
- // 2) The Index results is a StructBag with match level as zero & inddex
- // fields matching
- // the order of RuntimeIterators. In that case we just have to change the
- // StructType of the StructBag
- boolean shufflingNeeded = true;
- /**
- * An arary of RuntimeIterators whose size is equal to the number of fields in the Index results.
- * It identifies the RuntimeIterator for the field in the Index Results. Thus the Runtime Iterator
- * at position 0 will be that for field 0 in the index result & so on. For those index fields
- * which do not have a Runtime Iterator assosciated , the value is null (This is the case if index
- * results require cut down)
- *
- */
- RuntimeIterator[] indexFieldToItrsMapping = null;
- /**
- * The List containing RuntimeIterators to which the index results need to be expanded This will
- * usually be Final List of RuntimeIterators - RuntimeIteratosr already accounted for in the index
- * results
- */
- // Asif : The default is initialized as empty List rather than null to avoid
- // Null Pointer Exception in the function
- // getconditionedRelationshipIndexResults
- List expansionList = Collections.EMPTY_LIST;
- /**
- * The List containing RuntimeIterators which define the final SelectResults after the relevant
- * expansion/cutdown of index results
- */
- // Asif : Though in case of single index usage , if no shuffling is needed (
- // exact match) we
- // do not need finalList , but it is used in relation ship index , even if
- // match level is zero.
- // So we should never leave it as null
- List finalList = null;
- /**
- * This is the List of RuntimeIterators which gets created only if the index resulst require a
- * cutdown. In such cases , it identifies those Runtime Iterators of Index Results which will be
- * selected to form the result tuple. The RuntimeIterators in this List will have corresponding
- * fields in the resultset obtained from Index usage. This List will be populated only if there
- * exists fields in index resultset which will not be selected.If all the fields of index
- * resultset will be used , then this List should be null or empty. It is used in preventing
- * unnecessary expansion of same type, when a similar expansion has already occured. as for eg
- *
- * consider a index result containing 3 fields field1 field2 & field3 . Assume that field3 is for
- * cutdown. Since the expansion iterators can either be independent of all the fields in the index
- * result or at the max be dependent on field1 & field2, we should expand for a given combination
- * of field1 & field2 , only once ( as we have resulst as Set, we can only have unique entries)
- * ie. suppose a index result tuple has values ( 1,2 , 3 ) & ( 1,2,4) , we should expand only once
- * ( as field with value 3 & 4 are to be discarded).
- *
- *
- *
- */
- /*
- * Asif: Below Can be null or empty collections if the match level is exact & no shuffling needed
- */
- List checkList = null;
- /**
- * Asif : This field is meaninful iff the match level is zero, no shuffling needed & there exists
- * a StructBag (& not a ResultBag)
- */
- StructType structType = null;
- /**
- * Independent Iterator for the Group to which the Path expression belongs to
- */
- RuntimeIterator indpndntItr = null;
- /**
- * Indexnfo object for the path expression
- */
- IndexInfo indxInfo = null;
-
- // TODO:Asif :Test this function out
- public IndexConditioningHelper(IndexInfo indexInfo, ExecutionContext context, int indexFieldsSize,
- boolean completeExpansion, CompiledValue iterOperands, RuntimeIterator grpIndpndntItr) {
- /*
- * Asif : First obtain the match level of index resultset. If the match level happens to be zero
- * , this implies that we just have to change the StructType ( again if only the Index resultset
- * is a StructBag). If the match level is zero & expand to to top level flag is true & iff the
- * total no. of iterators in current scope is greater than the no. of fields in StructBag , then
- * only we need to do any expansion. The grpIndpndtItr passed can be null if the where clause
- * comprises of just this condition. However if it is invoked from GroupJunction , it will be
- * not null
- *
- */
- this.indxInfo = indexInfo;
- List grpItrs = null;
- int size = indexInfo.mapping.length;
- this.indpndntItr = grpIndpndntItr;
- this.indexFieldToItrsMapping = new RuntimeIterator[indexFieldsSize];
- // Asif Obtain the grpIndpndt iterator if it is passed as null
- if (this.indpndntItr == null) {
- Set set1 = new HashSet();
- context.computeUtlimateDependencies(indexInfo._path, set1);
- Support.Assert(set1.size() == 1,
- " Since we are in Indexed Evaluate that means there has to be exactly one independent iterator for this compiled comparison");
- // The ultimate independent RuntimeIterator
- this.indpndntItr = (RuntimeIterator) set1.iterator().next();
- Support.Assert(
- this.indpndntItr.getScopeID() == context.currentScope()
- .getScopeID()/* context.getScopeCount() */,
- " Since we are in Indexed Evaluate that means the current scope count & indpenedent iterator's scope count should match");
- }
- if (indexInfo._matchLevel == 0
- && (!completeExpansion || context.getCurrentIterators().size() == size)) {
- // Asif: Don't do anything , just change the StructType if the set is
- // structset.
- if (size > 1) {
- // The Index resultset is a structType.
- Support.Assert(indexInfo._index.getResultSetType() instanceof StructType,
- " If the match level is zero & the size of mapping array is 1 then Index is surely ResultBag else StructBag");
- // Asif : The independent iterator is added as the first element
- grpItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(this.indpndntItr);
- // Asif : Check if reshuffling is needed or just changing the struct
- // type will suffice
- boolean isReshufflingNeeded = false;
- int pos = -1;
- for (int i = 0; i < size; ++i) {
- pos = indexInfo.mapping[i];
- isReshufflingNeeded = isReshufflingNeeded || (pos != (i + 1));
- this.indexFieldToItrsMapping[pos - 1] = (RuntimeIterator) grpItrs.get(i);
- }
- this.finalList = grpItrs;
- // Asif : Even if Reshuffle is not need but if the iter conditions are
- // present we need to do evaluation
- // We can avoid iterating over the set iff reshuffling is not needed &
- // there is no iter eval condition
- if (isReshufflingNeeded || iterOperands != null) {
- // this.expansionList = Collections.EMPTY_LIST;
- this.checkList = null;
- // indexReults = QueryUtils.cutDownAndExpandIndexResults(indexReults,
- // indexFieldToItrsMapping, Collections.EMPTY_LIST, grpItrs,
- // context, Collections.EMPTY_LIST, iterOperands);
- } else {
- this.structType = QueryUtils.createStructTypeForRuntimeIterators(grpItrs);
- // indexReults.setElementType(structType);
- // Asif : Shuffling is not needed. Index results is a StructBag
- // with match level zero & no expansion needed & index fields map
- // with the RuntimeIterators. But we need to change the StructType
- // of the StructBag
- this.shufflingNeeded = false;
- }
- } else {
- // Asif : The finalList should not be left uninitialized, & if the match
- // level is zero
- // & the Index Results is a ResultBag ( & not an StructBag ) implying
- // indexFieldsSize of
- // 1 , then the final List should contain only the independent iterator
- this.finalList = new ArrayList();
- this.finalList.add(this.indpndntItr);
- Support.Assert(this.indexFieldToItrsMapping.length == 1,
- "In this else block , it should be guaranteed that there exists only one iterator in query as well as index from clause & that should be nothing but the independent RuntimeIterator of the group ");
- this.indexFieldToItrsMapping[0] = this.indpndntItr;
- // Asif :Shuffling is needed if iter operand is not null even if index results is a
- // ResultSet
- // with match level zero & no expansion needed
- this.shufflingNeeded = (iterOperands != null);
- }
- } else {
- // Asif : There is some expansion or truncation needed on the data
- // obtained from index.Identify a the iterators belonging to this group
- // The independent iterator is added as the first element
- grpItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(this.indpndntItr);
- // Asif Create an array of RuntimeIterators which map to the fields of the
- // Index set.
- // For those fields which do not have corresponding RuntimeIterator , keep
- // it as null;
- int pos = -1;
- this.finalList = completeExpansion ? context.getCurrentIterators() : grpItrs;
- // This is the List of runtimeIterators which have corresponding fields
- // in the resultset obtained from Index usage. This List will be populated
- // only if there exists fields in index resultset which will not be
- // selected
- // If all the fields of index resultset will be used , then this List
- // should
- // be null or empty
- this.checkList = new ArrayList();
- // This List contains the RuntimeIterators which are missing from
- // index resultset but are present in the final iterators
- this.expansionList = new LinkedList(finalList);
- RuntimeIterator tempItr = null;
- // boolean cutDownNeeded = false;
- int unMappedFields = indexFieldsSize;
- for (int i = 0; i < size; ++i) {
- pos = indexInfo.mapping[i];
- if (pos > 0) {
- tempItr = (RuntimeIterator) grpItrs.get(i);
- this.indexFieldToItrsMapping[pos - 1] = tempItr;
- this.expansionList.remove(tempItr);
- this.checkList.add(tempItr);
- --unMappedFields;
- }
- }
- boolean cutDownNeeded = unMappedFields > 0;
- if (!cutDownNeeded)
- this.checkList = null;
- /*
- * indexReults = QueryUtils.cutDownAndExpandIndexResults(indexReults, indexFieldToItrsMapping,
- * expansionList, finalList, context, checkList, iterOperands);
- */
- }
- }
-}
-
-
-/**
- *
- * This is a helper class which contains informaion on how to expand / cutdown index results for
- * making it compatible with the query.
- *
- */
-
-class IndexCutDownExpansionHelper {
-
- /**
- * booelan which identifies if a cutdown of index results is needed or not.
- */
- boolean cutDownNeeded = false;
- /**
- * A SelectResults ( ResultBag or StructBag) object used to prevent unnecessary expansion of index
- * results as described in IndexConditionalHelper class.
- */
- SelectResults checkSet = null;
- /**
- * ObjectType for the checkSet object ( An ObjectType for a ResultBag & StructType for a
- * StructBag)
- */
- ObjectType checkType = null;
- int checkSize = -1;
-
- IndexCutDownExpansionHelper(List checkList, ExecutionContext context) {
- cutDownNeeded = checkList != null && (checkSize = checkList.size()) > 0;
- if (cutDownNeeded) {
- Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
- boolean useLinkedDataStructure = false;
- boolean nullValuesAtStart = true;
- if (orderByClause != null && orderByClause.booleanValue()) {
- List orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
- useLinkedDataStructure = orderByAttrs.size() == 1;
- nullValuesAtStart = !((CompiledSortCriterion) orderByAttrs.get(0)).getCriterion();
- }
- if (checkSize > 1) {
-
- checkType = QueryUtils.createStructTypeForRuntimeIterators(checkList);
- if (useLinkedDataStructure) {
- checkSet = context.isDistinct() ? new LinkedStructSet((StructTypeImpl) checkType)
- : new SortedResultsBag<Struct>((StructTypeImpl) checkType, nullValuesAtStart);
- } else {
- checkSet = QueryUtils.createStructCollection(context, (StructTypeImpl) checkType);
- }
- } else {
- checkType = ((RuntimeIterator) checkList.get(0)).getElementType();
- if (useLinkedDataStructure) {
- checkSet = context.isDistinct() ? new LinkedResultSet(checkType)
- : new SortedResultsBag(checkType, nullValuesAtStart);
- } else {
- checkSet = QueryUtils.createResultCollection(context, checkType);
- }
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RangeJunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RangeJunction.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/RangeJunction.java
index 42fb30d..72137d0 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RangeJunction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/RangeJunction.java
@@ -774,7 +774,7 @@ public class RangeJunction extends AbstractGroupOrRangeJunction {
} finally {
observer.afterIndexLookup(set);
}
- return QueryUtils.getconditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
+ return QueryUtils.getConditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
completeExpansionNeeded, iterOperands, indpndntItrs);
}
@@ -961,7 +961,7 @@ public class RangeJunction extends AbstractGroupOrRangeJunction {
} finally {
observer.afterIndexLookup(set);
}
- return QueryUtils.getconditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
+ return QueryUtils.getConditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
completeExpansionNeeded, iterOperands, indpndntItrs);
}
@@ -1103,7 +1103,7 @@ public class RangeJunction extends AbstractGroupOrRangeJunction {
} finally {
observer.afterIndexLookup(set);
}
- return QueryUtils.getconditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
+ return QueryUtils.getConditionedIndexResults(set, this.indxInfo, context, indexFieldsSize,
completeExpansionNeeded, iterOperands, indpndntItrs);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RuntimeIterator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RuntimeIterator.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/RuntimeIterator.java
index b204e0a..8a3fcf3 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/RuntimeIterator.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/RuntimeIterator.java
@@ -311,7 +311,7 @@ public class RuntimeIterator extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException {
// Asif: prepend the internal iterator variable name for this
// RunTimeIterator
[21/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index 1f4e50c..31e7a25 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -12,16 +12,66 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.DataSerializer;
-import org.apache.geode.cache.*;
-import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
+import org.apache.geode.cache.AttributesMutator;
+import org.apache.geode.cache.CacheCallback;
+import org.apache.geode.cache.CacheListener;
+import org.apache.geode.cache.CacheLoader;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.CacheStatistics;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.CustomExpiry;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.DiskWriteAttributes;
+import org.apache.geode.cache.EntryExistsException;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.EvictionAttributes;
+import org.apache.geode.cache.EvictionAttributesMutator;
+import org.apache.geode.cache.ExpirationAction;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.MembershipAttributes;
+import org.apache.geode.cache.MirrorType;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAccessException;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.RegionMembershipListener;
+import org.apache.geode.cache.RegionService;
+import org.apache.geode.cache.RoleException;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.StatisticsDisabledException;
+import org.apache.geode.cache.SubscriptionAttributes;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.internal.PoolImpl;
-import org.apache.geode.cache.query.*;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.TypeMismatchException;
import org.apache.geode.cache.query.internal.index.IndexManager;
import org.apache.geode.cache.snapshot.RegionSnapshotService;
import org.apache.geode.cache.wan.GatewaySender;
@@ -31,6 +81,7 @@ import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.DataSerializableFixedID;
import org.apache.geode.internal.cache.extension.Extensible;
import org.apache.geode.internal.cache.extension.ExtensionPoint;
@@ -42,23 +93,14 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.atomic.AtomicLong;
/**
* Takes care of RegionAttributes, AttributesMutator, and some no-brainer method implementations.
- *
*/
@SuppressWarnings("deprecation")
public abstract class AbstractRegion implements Region, RegionAttributes, AttributesMutator,
CacheStatistics, DataSerializableFixedID, RegionEntryContext, Extensible<Region<?, ?>> {
+
private static final Logger logger = LogService.getLogger();
/**
@@ -67,7 +109,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*/
private final int serialNumber;
- // RegionAttributes //
/**
* Used to synchronize WRITES to cacheListeners. Always do copy on write.
*/
@@ -89,11 +130,15 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
private LRUAlgorithm evictionController;
protected int entryIdleTimeout;
- protected ExpirationAction entryIdleTimeoutExpirationAction;
+
+ private ExpirationAction entryIdleTimeoutExpirationAction;
+
protected CustomExpiry customEntryIdleTimeout;
protected int entryTimeToLive;
- protected ExpirationAction entryTimeToLiveExpirationAction;
+
+ ExpirationAction entryTimeToLiveExpirationAction;
+
protected CustomExpiry customEntryTimeToLive;
protected int initialCapacity;
@@ -108,20 +153,21 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
protected int regionIdleTimeout;
- protected ExpirationAction regionIdleTimeoutExpirationAction;
+ private ExpirationAction regionIdleTimeoutExpirationAction;
protected int regionTimeToLive;
- protected ExpirationAction regionTimeToLiveExpirationAction;
+ private ExpirationAction regionTimeToLiveExpirationAction;
public static final Scope DEFAULT_SCOPE = Scope.DISTRIBUTED_NO_ACK;
+
protected Scope scope = DEFAULT_SCOPE;
protected boolean statisticsEnabled;
protected boolean isLockGrantor;
- protected boolean mcastEnabled;
+ private boolean mcastEnabled;
protected int concurrencyLevel;
@@ -129,20 +175,17 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
protected boolean earlyAck;
- // merge42004: revision 42004 has not defined isPdxTypesRegion. It has come to cheetah branch from
- // merge revision 39860. This is getting used in method getRemoteDsIds.
-
- protected final boolean isPdxTypesRegion;
+ private final boolean isPdxTypesRegion;
protected Set<String> gatewaySenderIds;
- protected boolean isGatewaySenderEnabled = false;
+ private boolean isGatewaySenderEnabled = false;
protected Set<String> asyncEventQueueIds;
- protected Set<String> visibleAsyncEventQueueIds;
+ private Set<String> visibleAsyncEventQueueIds;
- protected Set<String> allGatewaySenderIds;
+ private Set<String> allGatewaySenderIds;
protected boolean enableSubscriptionConflation;
@@ -159,7 +202,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
private boolean cloningEnable = false;
- protected DiskWriteAttributes diskWriteAttributes;
+ private DiskWriteAttributes diskWriteAttributes;
protected File[] diskDirs;
protected int[] diskSizes;
@@ -169,14 +212,14 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
protected volatile IndexManager indexManager = null;
- // Asif : The ThreadLocal is used to identify if the thread is an
+ // The ThreadLocal is used to identify if the thread is an
// index creation thread. This identification helps skip the synchronization
// block
// if the value is "REMOVED" token. This prevents the dead lock , in case the
// lock
// over the entry is held by any Index Update Thread.
// This is used to fix Bug # 33336.
- private final ThreadLocal isIndexCreator = new ThreadLocal();
+ private static final ThreadLocal<Boolean> isIndexCreator = new ThreadLocal<>();
/** Attributes that define this Region as a PartitionedRegion */
protected PartitionAttributes partitionAttributes;
@@ -198,6 +241,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
private static final boolean trackHits =
!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "ignoreHits");
+
private static final boolean trackMisses =
!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "ignoreMisses");
@@ -213,19 +257,19 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @see #getExtensionPoint()
* @since GemFire 8.1
*/
- protected ExtensionPoint<Region<?, ?>> extensionPoint =
+ private ExtensionPoint<Region<?, ?>> extensionPoint =
new SimpleExtensionPoint<Region<?, ?>>(this, this);
- protected final GemFireCacheImpl cache;
+ protected final InternalCache cache;
/** Creates a new instance of AbstractRegion */
- protected AbstractRegion(GemFireCacheImpl cache, RegionAttributes attrs, String regionName,
+ protected AbstractRegion(InternalCache cache, RegionAttributes attrs, String regionName,
InternalRegionArguments internalRegionArgs) {
this.cache = cache;
this.serialNumber = DistributionAdvisor.createSerialNumber();
this.isPdxTypesRegion = PeerTypeRegistration.REGION_NAME.equals(regionName);
this.lastAccessedTime = new AtomicLong(cacheTimeMillis());
- this.lastModifiedTime = new AtomicLong(lastAccessedTime.get());
+ this.lastModifiedTime = new AtomicLong(this.lastAccessedTime.get());
setAttributes(attrs, regionName, internalRegionArgs);
}
@@ -234,11 +278,11 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 8.1
* @deprecated For unit testing only. Use
- * {@link #AbstractRegion(GemFireCacheImpl, RegionAttributes, String, InternalRegionArguments)}
+ * {@link #AbstractRegion(InternalCache, RegionAttributes, String, InternalRegionArguments)}
* .
*/
@Deprecated
- AbstractRegion(GemFireCacheImpl cache, int serialNumber, boolean isPdxTypeRegion,
+ AbstractRegion(InternalCache cache, int serialNumber, boolean isPdxTypeRegion,
long lastAccessedTime, long lastModifiedTime) {
this.cache = cache;
this.serialNumber = serialNumber;
@@ -247,8 +291,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
this.lastModifiedTime = new AtomicLong(lastModifiedTime);
}
- /** ******************** No-Brainer methods ******************************** */
-
/**
* configure this region to ignore or not ignore in-progress JTA transactions. Setting this to
* true will cause cache operations to no longer notice JTA transactions. The default setting is
@@ -258,33 +300,39 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*/
@Deprecated
public void setIgnoreJTA(boolean ignore) {
- ignoreJTA = ignore;
+ this.ignoreJTA = ignore;
}
- public final void create(Object key, Object value)
+ @Override
+ public void create(Object key, Object value)
throws TimeoutException, EntryExistsException, CacheWriterException {
create(key, value, null);
}
- public final Object destroy(Object key)
+ @Override
+ public Object destroy(Object key)
throws TimeoutException, EntryNotFoundException, CacheWriterException {
return destroy(key, null);
}
- public Object get(Object name) throws CacheLoaderException, TimeoutException {
- return get(name, null, true, null);
+ @Override
+ public Object get(Object key) throws CacheLoaderException, TimeoutException {
+ return get(key, null, true, null);
}
- public Object put(Object name, Object value) throws TimeoutException, CacheWriterException {
- return put(name, value, null);
+ @Override
+ public Object put(Object key, Object value) throws TimeoutException, CacheWriterException {
+ return put(key, value, null);
}
- public Object get(Object name, Object aCallbackArgument)
+ @Override
+ public Object get(Object key, Object aCallbackArgument)
throws CacheLoaderException, TimeoutException {
- return get(name, aCallbackArgument, true, null);
+ return get(key, aCallbackArgument, true, null);
}
- public final void localDestroyRegion() {
+ @Override
+ public void localDestroyRegion() {
localDestroyRegion(null);
}
@@ -294,32 +342,36 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @param generateCallbacks whether callbacks should be invoked
* @param clientEvent client-side event, if any (used to pass back version information)
* @return the value associated with the key
- * @throws TimeoutException
- * @throws CacheLoaderException
*/
abstract Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
EntryEventImpl clientEvent) throws TimeoutException, CacheLoaderException;
+ @Override
public final void localDestroy(Object key) throws EntryNotFoundException {
localDestroy(key, null);
}
+ @Override
public final void destroyRegion() throws CacheWriterException, TimeoutException {
destroyRegion(null);
}
+ @Override
public final void invalidate(Object key) throws TimeoutException, EntryNotFoundException {
invalidate(key, null);
}
+ @Override
public final void localInvalidate(Object key) throws EntryNotFoundException {
localInvalidate(key, null);
}
+ @Override
public final void localInvalidateRegion() {
localInvalidateRegion(null);
}
+ @Override
public final void invalidateRegion() throws TimeoutException {
invalidateRegion(null);
}
@@ -337,8 +389,9 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*/
abstract boolean generateEventID();
- protected abstract DistributedMember getMyId();
+ protected abstract InternalDistributedMember getMyId();
+ @Override
public void clear() {
checkReadiness();
checkForLimitedOrNoAccess();
@@ -349,6 +402,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
abstract void basicLocalClear(RegionEventImpl rEvent);
+ @Override
public void localClear() {
checkReadiness();
checkForNoAccess();
@@ -363,13 +417,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
@Override
- public Map getAll(Collection keys, Object callback) {
+ public Map getAll(Collection keys, Object aCallbackArgument) {
if (keys == null) {
throw new NullPointerException("The collection of keys for getAll cannot be null");
}
checkReadiness();
checkForLimitedOrNoAccess();
- return keys.isEmpty() ? new HashMap() : basicGetAll(keys, callback);
+ return keys.isEmpty() ? new HashMap() : basicGetAll(keys, aCallbackArgument);
}
abstract Map basicGetAll(Collection keys, Object callback);
@@ -392,15 +446,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return getStringBuilder().append(']').toString();
}
- /** ********************* RegionAttributes ********************************* */
-
+ @Override
public CacheLoader getCacheLoader() {
- // checkReadiness();
return this.cacheLoader;
}
+ @Override
public CacheWriter getCacheWriter() {
- // checkReadiness();
return this.cacheWriter;
}
@@ -410,9 +462,8 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 5.7
*/
- public CacheLoader basicGetLoader() {
- CacheLoader result = this.cacheLoader;
- return result;
+ CacheLoader basicGetLoader() {
+ return this.cacheLoader;
}
/**
@@ -422,15 +473,15 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @since GemFire 5.7
*/
public CacheWriter basicGetWriter() {
- CacheWriter result = this.cacheWriter;
- return result;
+ return this.cacheWriter;
}
+ @Override
public Class getKeyConstraint() {
- // checkReadiness();
return this.keyConstraint;
}
+ @Override
public Class getValueConstraint() {
return this.valueConstraint;
}
@@ -442,51 +493,58 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
new ExpirationAttributes(this.regionTimeToLive, this.regionTimeToLiveExpirationAction);
}
+ @Override
public ExpirationAttributes getRegionTimeToLive() {
return this.regionTimeToLiveAtts;
}
- private volatile ExpirationAttributes regionIdleTimeoutAtts;
+ private volatile ExpirationAttributes regionIdleTimeoutAttributes;
- private void setRegionIdleTimeoutAtts() {
- this.regionIdleTimeoutAtts =
+ private void setRegionIdleTimeoutAttributes() {
+ this.regionIdleTimeoutAttributes =
new ExpirationAttributes(this.regionIdleTimeout, this.regionIdleTimeoutExpirationAction);
}
+ @Override
public ExpirationAttributes getRegionIdleTimeout() {
- return this.regionIdleTimeoutAtts;
+ return this.regionIdleTimeoutAttributes;
}
private volatile ExpirationAttributes entryTimeToLiveAtts;
- protected void setEntryTimeToLiveAtts() {
+ void setEntryTimeToLiveAttributes() {
this.entryTimeToLiveAtts =
new ExpirationAttributes(this.entryTimeToLive, this.entryTimeToLiveExpirationAction);
}
+ @Override
public ExpirationAttributes getEntryTimeToLive() {
return this.entryTimeToLiveAtts;
}
+ @Override
public CustomExpiry getCustomEntryTimeToLive() {
return this.customEntryTimeToLive;
}
- private volatile ExpirationAttributes entryIdleTimeoutAtts;
+ private volatile ExpirationAttributes entryIdleTimeoutAttributes;
- protected void setEntryIdleTimeoutAtts() {
- this.entryIdleTimeoutAtts =
+ private void setEntryIdleTimeoutAttributes() {
+ this.entryIdleTimeoutAttributes =
new ExpirationAttributes(this.entryIdleTimeout, this.entryIdleTimeoutExpirationAction);
}
+ @Override
public ExpirationAttributes getEntryIdleTimeout() {
- return this.entryIdleTimeoutAtts;
+ return this.entryIdleTimeoutAttributes;
}
+ @Override
public CustomExpiry getCustomEntryIdleTimeout() {
return this.customEntryIdleTimeout;
}
+ @Override
public MirrorType getMirrorType() {
if (this.dataPolicy.isNormal() || this.dataPolicy.isPreloaded() || this.dataPolicy.isEmpty()
|| this.dataPolicy.withPartitioning()) {
@@ -500,24 +558,23 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
-
+ @Override
public String getPoolName() {
- // checkReadiness();
return this.poolName;
}
+ @Override
public DataPolicy getDataPolicy() {
- // checkReadiness();
return this.dataPolicy;
}
+ @Override
public Scope getScope() {
- // checkReadiness();
return this.scope;
}
+ @Override
public CacheListener getCacheListener() {
- // checkReadiness();
CacheListener[] listeners = fetchCacheListenersField();
if (listeners == null || listeners.length == 0) {
return null;
@@ -530,93 +587,44 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- public final boolean isPdxTypesRegion() {
+ public boolean isPdxTypesRegion() {
return this.isPdxTypesRegion;
}
+ @Override
public Set<String> getGatewaySenderIds() {
return this.gatewaySenderIds;
}
+ @Override
public Set<String> getAsyncEventQueueIds() {
return this.asyncEventQueueIds;
}
- public Set<String> getVisibleAsyncEventQueueIds() {
+ Set<String> getVisibleAsyncEventQueueIds() {
return this.visibleAsyncEventQueueIds;
}
- public final Set<String> getAllGatewaySenderIds() {
+ public Set<String> getAllGatewaySenderIds() {
return Collections.unmodifiableSet(this.allGatewaySenderIds);
}
- public final boolean checkNotifyGatewaySender() {
- return (this.cache.getAllGatewaySenders().size() > 0 && this.allGatewaySenderIds.size() > 0);
- }
-
- public final Set<String> getActiveGatewaySenderIds() {
- final Set<GatewaySender> allGatewaySenders;
- HashSet<String> activeGatewaySenderIds = null;
- final int sz = this.gatewaySenderIds.size();
- if (sz > 0 && (allGatewaySenders = this.cache.getGatewaySenders()).size() > 0) {
- for (GatewaySender sender : allGatewaySenders) {
- if (sender.isRunning() && this.gatewaySenderIds.contains(sender.getId())) {
- if (activeGatewaySenderIds == null) {
- activeGatewaySenderIds = new HashSet<String>();
- }
- activeGatewaySenderIds.add(sender.getId());
- }
- }
- }
- return activeGatewaySenderIds;
- }
-
- public final Set<String> getActiveAsyncQueueIds() {
- final Set<AsyncEventQueue> allAsyncQueues;
- HashSet<String> activeAsyncQueueIds = null;
- final int sz = this.asyncEventQueueIds.size();
- if (sz > 0 && (allAsyncQueues = this.cache.getAsyncEventQueues()).size() > 0) {
- for (AsyncEventQueue asyncQueue : allAsyncQueues) {
- // merge42004:In cheetah asyncEventQueue has isRunning Method. It has come from merging
- // branches. A mail regarding the asyncEventQueue is sent to Barry to get more
- // clarification. We need to sort this out.
- if (/*
- * asyncQueue.isRunning() &&
- */ this.asyncEventQueueIds.contains(asyncQueue.getId())) {
- if (activeAsyncQueueIds == null) {
- activeAsyncQueueIds = new HashSet<String>();
- }
- activeAsyncQueueIds.add(asyncQueue.getId());
- }
- }
- }
- return activeAsyncQueueIds;
- }
-
/**
* Return the remote DS IDs that need to receive events for this region.
*
* @param allGatewaySenderIds the set of gateway sender IDs to consider
*/
- public final List<Integer> getRemoteDsIds(Set<String> allGatewaySenderIds)
- throws IllegalStateException {
- final Set<GatewaySender> allGatewaySenders;
- final int sz = allGatewaySenderIds.size();
- if ((sz > 0 || isPdxTypesRegion)
- && (allGatewaySenders = this.cache.getAllGatewaySenders()).size() > 0) {
- List<Integer> allRemoteDSIds = new ArrayList<Integer>(sz);
+ List<Integer> getRemoteDsIds(Set<String> allGatewaySenderIds) throws IllegalStateException {
+ int sz = allGatewaySenderIds.size();
+ Set<GatewaySender> allGatewaySenders = this.cache.getAllGatewaySenders();
+ if ((sz > 0 || this.isPdxTypesRegion) && !allGatewaySenders.isEmpty()) {
+ List<Integer> allRemoteDSIds = new ArrayList<>(sz);
for (GatewaySender sender : allGatewaySenders) {
// This is for all regions except pdx Region
- if (!isPdxTypesRegion) {
+ if (!this.isPdxTypesRegion) {
// Make sure we are distributing to only those senders whose id
- // is avaialble on this region
+ // is available on this region
if (allGatewaySenderIds.contains(sender.getId())) {
- /*
- * // ParalleGatewaySender with DR is not allowed if (this.partitionAttributes == null
- * && sender.isParallel()) { throw new IllegalStateException(LocalizedStrings
- * .AttributesFactory_PARALLELGATEWAYSENDER_0_IS_INCOMPATIBLE_WITH_DISTRIBUTED_REPLICATION
- * .toLocalizedString(sender.getId())); }
- */
allRemoteDSIds.add(sender.getRemoteDSId());
}
} else { // this else is for PDX region
@@ -628,26 +636,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return null;
}
- // protected final void initAllGatewaySenderIds() {
- // HashSet<String> senderIds = new HashSet<String>();
- // this.allGatewaySenderIds = senderIds;
- // if (getGatewaySenderIds().isEmpty() && getAsyncEventQueueIds().isEmpty()) {
- // return Collections.emptySet(); // fix for bug 45774
- // }
- // Set<String> tmp = new CopyOnWriteArraySet<String>();
- // tmp.addAll(this.getGatewaySenderIds());
- // for(String asyncQueueId : this.getAsyncEventQueueIds()){
- // tmp.add(AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncQueueId));
- // }
- // return tmp;
- // }
-
- public boolean isGatewaySenderEnabled() {
+ boolean isGatewaySenderEnabled() {
return this.isGatewaySenderEnabled;
}
private static final CacheListener[] EMPTY_LISTENERS = new CacheListener[0];
+ @Override
public CacheListener[] getCacheListeners() {
CacheListener[] listeners = fetchCacheListenersField();
if (listeners == null || listeners.length == 0) {
@@ -662,12 +657,12 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
/**
* Sets the cacheListeners field.
*/
- private final void storeCacheListenersField(CacheListener[] value) {
+ private void storeCacheListenersField(CacheListener[] value) {
synchronized (this.clSync) {
if (value != null && value.length != 0) {
- CacheListener[] nv = new CacheListener[value.length];
- System.arraycopy(value, 0, nv, 0, nv.length);
- value = nv;
+ CacheListener[] cacheListeners = new CacheListener[value.length];
+ System.arraycopy(value, 0, cacheListeners, 0, cacheListeners.length);
+ value = cacheListeners;
} else {
value = EMPTY_LISTENERS;
}
@@ -679,24 +674,24 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* Fetches the value in the cacheListeners field. NOTE: callers should not modify the contents of
* the returned array.
*/
- protected final CacheListener[] fetchCacheListenersField() {
+ CacheListener[] fetchCacheListenersField() {
return this.cacheListeners;
}
+ @Override
public int getInitialCapacity() {
- // checkReadiness();
return this.initialCapacity;
}
+ @Override
public float getLoadFactor() {
- // checkReadiness();
return this.loadFactor;
}
protected abstract boolean isCurrentlyLockGrantor();
+ @Override
public boolean isLockGrantor() {
- // checkReadiness();
return this.isLockGrantor;
}
@@ -704,37 +699,38 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* RegionAttributes implementation. Returns true if multicast can be used by the cache for this
* region
*/
+ @Override
public boolean getMulticastEnabled() {
- // checkReadiness();
return this.mcastEnabled;
}
+ @Override
public boolean getStatisticsEnabled() {
- // checkReadiness();
return this.statisticsEnabled;
}
+ @Override
public boolean getIgnoreJTA() {
- // checkRediness();
return this.ignoreJTA;
}
+ @Override
public int getConcurrencyLevel() {
- // checkReadiness();
return this.concurrencyLevel;
}
+ @Override
public boolean getConcurrencyChecksEnabled() {
return this.concurrencyChecksEnabled;
}
+ @Override
public boolean getPersistBackup() {
- // checkReadiness();
return getDataPolicy().withPersistence();
}
+ @Override
public boolean getEarlyAck() {
- // checkReadiness();
return this.earlyAck;
}
@@ -742,22 +738,27 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @deprecated as of prPersistSprint1
*/
@Deprecated
+ @Override
public boolean getPublisher() {
return this.publisher;
}
+ @Override
public boolean getEnableConflation() { // deprecated in 5.0
return getEnableSubscriptionConflation();
}
+ @Override
public boolean getEnableBridgeConflation() {// deprecated in 5.7
return getEnableSubscriptionConflation();
}
+ @Override
public boolean getEnableSubscriptionConflation() {
return this.enableSubscriptionConflation;
}
+ @Override
public boolean getEnableAsyncConflation() {
return this.enableAsyncConflation;
}
@@ -766,33 +767,40 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @deprecated as of prPersistSprint2
*/
@Deprecated
+ @Override
public DiskWriteAttributes getDiskWriteAttributes() {
- // checkReadiness();
return this.diskWriteAttributes;
}
+ @Override
public abstract File[] getDiskDirs();
- public final String getDiskStoreName() {
+ @Override
+ public String getDiskStoreName() {
return this.diskStoreName;
}
+ @Override
public boolean isDiskSynchronous() {
return this.isDiskSynchronous;
}
+ @Override
public boolean getIndexMaintenanceSynchronous() {
return this.indexMaintenanceSynchronous;
}
+ @Override
public PartitionAttributes getPartitionAttributes() {
return this.partitionAttributes;
}
+ @Override
public MembershipAttributes getMembershipAttributes() {
return this.membershipAttributes;
}
+ @Override
public SubscriptionAttributes getSubscriptionAttributes() {
return this.subscriptionAttributes;
}
@@ -820,50 +828,37 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @return {@link IndexManager} lock.
*/
public Object getIMSync() {
- return imSync;
+ return this.imSync;
}
- // Asif : The ThreadLocal is used to identify if the thread is an
+ // The ThreadLocal is used to identify if the thread is an
// index creation thread. This is used to fix Bug # 33336. The value
// is set from IndexManager ,if the thread happens to be an IndexCreation
// Thread.
// Once the thread has created the Index , it will unset the value in the
// ThreadLocal Object
- public void setFlagForIndexCreationThread(boolean bool) {
- this.isIndexCreator.set(bool ? Boolean.TRUE : null);
+ public void setFlagForIndexCreationThread(boolean value) {
+ isIndexCreator.set(value ? Boolean.TRUE : null);
}
- // Asif : The boolean is used in AbstractRegionEntry to skip the synchronized
+ // The boolean is used in AbstractRegionEntry to skip the synchronized
// block
// in case the value of the entry is "REMOVED" token. This prevents dead lock
// caused by the Bug # 33336
boolean isIndexCreationThread() {
- Boolean bool = (Boolean) this.isIndexCreator.get();
- return (bool != null) ? bool.booleanValue() : false;
+ Boolean value = isIndexCreator.get();
+ return value != null ? value : false;
}
- /** ********************* AttributesMutator ******************************** */
-
+ @Override
public Region getRegion() {
return this;
}
- // /**
- // * A CacheListener implementation that delegates to an array of listeners.
- // */
- // public static class ArrayCacheListener implements CacheListener {
- // private final CacheListener [] listeners;
- // /**
- // * Creates a cache listener given the list of listeners it will delegate to.
- // */
- // public ArrayCacheListener(CacheListener[] listeners) {
- // this.listeners = listeners;
- // }
- // }
+ @Override
public CacheListener setCacheListener(CacheListener aListener) {
checkReadiness();
- CacheListener result = null;
- CacheListener[] oldListeners = null;
+ CacheListener[] oldListeners;
synchronized (this.clSync) {
oldListeners = this.cacheListeners;
if (oldListeners != null && oldListeners.length > 1) {
@@ -874,13 +869,14 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
this.cacheListeners = new CacheListener[] {aListener};
}
// moved the following out of the sync for bug 34512
+ CacheListener result = null;
if (oldListeners != null && oldListeners.length > 0) {
if (oldListeners.length == 1) {
result = oldListeners[0];
}
- for (int i = 0; i < oldListeners.length; i++) {
- if (aListener != oldListeners[i]) {
- closeCacheCallback(oldListeners[i]);
+ for (CacheListener oldListener : oldListeners) {
+ if (aListener != oldListener) {
+ closeCacheCallback(oldListener);
}
}
if (aListener == null) {
@@ -895,22 +891,26 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return result;
}
+ @Override
public void addGatewaySenderId(String gatewaySenderId) {
getGatewaySenderIds().add(gatewaySenderId);
setAllGatewaySenderIds();
}
+ @Override
public void removeGatewaySenderId(String gatewaySenderId) {
getGatewaySenderIds().remove(gatewaySenderId);
setAllGatewaySenderIds();
}
+ @Override
public void addAsyncEventQueueId(String asyncEventQueueId) {
getAsyncEventQueueIds().add(asyncEventQueueId);
getVisibleAsyncEventQueueIds().add(asyncEventQueueId);
setAllGatewaySenderIds();
}
+ @Override
public void removeAsyncEventQueueId(String asyncEventQueueId) {
getAsyncEventQueueIds().remove(asyncEventQueueId);
getVisibleAsyncEventQueueIds().remove(asyncEventQueueId);
@@ -919,34 +919,35 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
private void setAllGatewaySenderIds() {
if (getGatewaySenderIds().isEmpty() && getAsyncEventQueueIds().isEmpty()) {
- allGatewaySenderIds = Collections.emptySet(); // fix for bug 45774
+ this.allGatewaySenderIds = Collections.emptySet(); // fix for bug 45774
}
Set<String> tmp = new CopyOnWriteArraySet<String>();
tmp.addAll(this.getGatewaySenderIds());
for (String asyncQueueId : this.getAsyncEventQueueIds()) {
tmp.add(AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncQueueId));
}
- allGatewaySenderIds = tmp;
+ this.allGatewaySenderIds = tmp;
}
private void initializeVisibleAsyncEventQueueIds(InternalRegionArguments internalRegionArgs) {
- Set<String> asyncEventQueueIds = new CopyOnWriteArraySet<>();
+ Set<String> visibleAsyncEventQueueIds = new CopyOnWriteArraySet<>();
// Add all configured aeqIds
- asyncEventQueueIds.addAll(getAsyncEventQueueIds());
+ visibleAsyncEventQueueIds.addAll(getAsyncEventQueueIds());
// Remove all internal aeqIds from internal region args if necessary
if (internalRegionArgs.getInternalAsyncEventQueueIds() != null) {
- asyncEventQueueIds.removeAll(internalRegionArgs.getInternalAsyncEventQueueIds());
+ visibleAsyncEventQueueIds.removeAll(internalRegionArgs.getInternalAsyncEventQueueIds());
}
- this.visibleAsyncEventQueueIds = asyncEventQueueIds;
+ this.visibleAsyncEventQueueIds = visibleAsyncEventQueueIds;
}
- public void addCacheListener(CacheListener cl) {
+ @Override
+ public void addCacheListener(CacheListener aListener) {
checkReadiness();
- if (cl == null) {
+ if (aListener == null) {
throw new IllegalArgumentException(
LocalizedStrings.AbstractRegion_ADDCACHELISTENER_PARAMETER_WAS_NULL.toLocalizedString());
}
- CacheListener wcl = wrapRegionMembershipListener(cl);
+ CacheListener wcl = wrapRegionMembershipListener(aListener);
boolean changed = false;
synchronized (this.clSync) {
CacheListener[] oldListeners = this.cacheListeners;
@@ -954,8 +955,8 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
this.cacheListeners = new CacheListener[] {wcl};
changed = true;
} else {
- List l = Arrays.asList(oldListeners);
- if (!l.contains(cl)) {
+ List<CacheListener> listeners = Arrays.asList(oldListeners);
+ if (!listeners.contains(aListener)) {
this.cacheListeners =
(CacheListener[]) ArrayUtils.insert(oldListeners, oldListeners.length, wcl);
}
@@ -971,57 +972,57 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* We wrap RegionMembershipListeners in a container when adding them at runtime, so that we can
* properly initialize their membership set prior to delivering events to them.
*
- * @param cl a cache listener to be added to the region
+ * @param listener a cache listener to be added to the region
*/
- private CacheListener wrapRegionMembershipListener(CacheListener cl) {
- if (cl instanceof RegionMembershipListener) {
- return new WrappedRegionMembershipListener((RegionMembershipListener) cl);
+ private CacheListener wrapRegionMembershipListener(CacheListener listener) {
+ if (listener instanceof RegionMembershipListener) {
+ return new WrappedRegionMembershipListener((RegionMembershipListener) listener);
}
- return cl;
+ return listener;
}
/**
* Initialize any wrapped RegionMembershipListeners in the cache listener list
*/
void initPostCreateRegionMembershipListeners(Set initialMembers) {
- DistributedMember[] initMbrs = null;
- CacheListener[] newcl = null;
- synchronized (clSync) {
- for (int i = 0; i < cacheListeners.length; i++) {
- CacheListener cl = cacheListeners[i];
+ synchronized (this.clSync) {
+ DistributedMember[] members = null;
+ CacheListener[] newListeners = null;
+ for (int i = 0; i < this.cacheListeners.length; i++) {
+ CacheListener cl = this.cacheListeners[i];
if (cl instanceof WrappedRegionMembershipListener) {
WrappedRegionMembershipListener wrml = (WrappedRegionMembershipListener) cl;
if (!wrml.isInitialized()) {
- if (initMbrs == null) {
- initMbrs = (DistributedMember[]) initialMembers
+ if (members == null) {
+ members = (DistributedMember[]) initialMembers
.toArray(new DistributedMember[initialMembers.size()]);
}
- wrml.initialMembers(this, initMbrs);
- if (newcl == null) {
- newcl = new CacheListener[cacheListeners.length];
- System.arraycopy(cacheListeners, 0, newcl, 0, newcl.length);
+ wrml.initialMembers(this, members);
+ if (newListeners == null) {
+ newListeners = new CacheListener[this.cacheListeners.length];
+ System.arraycopy(this.cacheListeners, 0, newListeners, 0, newListeners.length);
}
- newcl[i] = wrml.getWrappedListener();
+ newListeners[i] = wrml.getWrappedListener();
}
}
}
- if (newcl != null) {
- cacheListeners = newcl;
+ if (newListeners != null) {
+ this.cacheListeners = newListeners;
}
}
}
-
- public void initCacheListeners(CacheListener[] addedListeners) {
+ @Override
+ public void initCacheListeners(CacheListener[] newListeners) {
checkReadiness();
- CacheListener[] oldListeners = null;
CacheListener[] listenersToAdd = null;
- if (addedListeners != null) {
- listenersToAdd = new CacheListener[addedListeners.length];
- for (int i = 0; i < addedListeners.length; i++) {
- listenersToAdd[i] = wrapRegionMembershipListener(addedListeners[i]);
+ if (newListeners != null) {
+ listenersToAdd = new CacheListener[newListeners.length];
+ for (int i = 0; i < newListeners.length; i++) {
+ listenersToAdd[i] = wrapRegionMembershipListener(newListeners[i]);
}
}
+ CacheListener[] oldListeners;
synchronized (this.clSync) {
oldListeners = this.cacheListeners;
if (listenersToAdd == null || listenersToAdd.length == 0) {
@@ -1032,23 +1033,23 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
LocalizedStrings.AbstractRegion_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT
.toLocalizedString());
}
- CacheListener[] newListeners = new CacheListener[listenersToAdd.length];
- System.arraycopy(listenersToAdd, 0, newListeners, 0, newListeners.length);
- this.cacheListeners = newListeners;
+ CacheListener[] newCacheListeners = new CacheListener[listenersToAdd.length];
+ System.arraycopy(listenersToAdd, 0, newCacheListeners, 0, newCacheListeners.length);
+ this.cacheListeners = newCacheListeners;
}
}
// moved the following out of the sync for bug 34512
if (listenersToAdd == null || listenersToAdd.length == 0) {
if (oldListeners != null && oldListeners.length > 0) {
- for (int i = 0; i < oldListeners.length; i++) {
- closeCacheCallback(oldListeners[i]);
+ for (CacheListener oldListener : oldListeners) {
+ closeCacheCallback(oldListener);
}
cacheListenersChanged(false);
}
} else { // we had some listeners to add
if (oldListeners != null && oldListeners.length > 0) {
- for (int i = 0; i < oldListeners.length; i++) {
- closeCacheCallback(oldListeners[i]);
+ for (CacheListener oldListener : oldListeners) {
+ closeCacheCallback(oldListener);
}
} else {
cacheListenersChanged(true);
@@ -1056,9 +1057,10 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- public void removeCacheListener(CacheListener cl) {
+ @Override
+ public void removeCacheListener(CacheListener aListener) {
checkReadiness();
- if (cl == null) {
+ if (aListener == null) {
throw new IllegalArgumentException(
LocalizedStrings.AbstractRegion_REMOVECACHELISTENER_PARAMETER_WAS_NULL
.toLocalizedString());
@@ -1067,17 +1069,17 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
synchronized (this.clSync) {
CacheListener[] oldListeners = this.cacheListeners;
if (oldListeners != null && oldListeners.length > 0) {
- List l = new ArrayList(Arrays.asList(oldListeners));
- if (l.remove(cl)) {
- if (l.isEmpty()) {
+ List newListeners = new ArrayList(Arrays.asList(oldListeners));
+ if (newListeners.remove(aListener)) {
+ if (newListeners.isEmpty()) {
this.cacheListeners = EMPTY_LISTENERS;
} else {
- CacheListener[] newListeners = new CacheListener[l.size()];
- l.toArray(newListeners);
- this.cacheListeners = newListeners;
+ CacheListener[] newCacheListeners = new CacheListener[newListeners.size()];
+ newListeners.toArray(newCacheListeners);
+ this.cacheListeners = newCacheListeners;
}
- closeCacheCallback(cl);
- if (l.isEmpty()) {
+ closeCacheCallback(aListener);
+ if (newListeners.isEmpty()) {
changed = true;
}
}
@@ -1088,11 +1090,11 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- // synchronized so not reentrant
- public synchronized CacheLoader setCacheLoader(CacheLoader cl) {
+ @Override
+ public synchronized CacheLoader setCacheLoader(CacheLoader cacheLoader) {
checkReadiness();
CacheLoader oldLoader = this.cacheLoader;
- assignCacheLoader(cl);
+ assignCacheLoader(cacheLoader);
cacheLoaderChanged(oldLoader);
return oldLoader;
}
@@ -1101,7 +1103,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
this.cacheLoader = cl;
}
- // synchronized so not reentrant
+ @Override
public synchronized CacheWriter setCacheWriter(CacheWriter cacheWriter) {
checkReadiness();
CacheWriter oldWriter = this.cacheWriter;
@@ -1116,13 +1118,14 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
void checkEntryTimeoutAction(String mode, ExpirationAction ea) {
if ((this.dataPolicy.withReplication() || this.dataPolicy.withPartitioning())
- && (ea == ExpirationAction.LOCAL_DESTROY || ea == ExpirationAction.LOCAL_INVALIDATE)) {
+ && ea == ExpirationAction.LOCAL_DESTROY || ea == ExpirationAction.LOCAL_INVALIDATE) {
throw new IllegalArgumentException(
LocalizedStrings.AbstractRegion_0_ACTION_IS_INCOMPATIBLE_WITH_THIS_REGIONS_DATA_POLICY
.toLocalizedString(mode));
}
}
+ @Override
public ExpirationAttributes setEntryIdleTimeout(ExpirationAttributes idleTimeout) {
checkReadiness();
if (idleTimeout == null) {
@@ -1139,12 +1142,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
ExpirationAttributes oldAttrs = getEntryIdleTimeout();
this.entryIdleTimeout = idleTimeout.getTimeout();
this.entryIdleTimeoutExpirationAction = idleTimeout.getAction();
- setEntryIdleTimeoutAtts();
+ setEntryIdleTimeoutAttributes();
updateEntryExpiryPossible();
idleTimeoutChanged(oldAttrs);
return oldAttrs;
}
+ @Override
public CustomExpiry setCustomEntryIdleTimeout(CustomExpiry custom) {
checkReadiness();
if (custom != null && !this.statisticsEnabled) {
@@ -1160,6 +1164,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return old;
}
+ @Override
public ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive) {
checkReadiness();
if (timeToLive == null) {
@@ -1175,12 +1180,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
ExpirationAttributes oldAttrs = getEntryTimeToLive();
this.entryTimeToLive = timeToLive.getTimeout();
this.entryTimeToLiveExpirationAction = timeToLive.getAction();
- setEntryTimeToLiveAtts();
+ setEntryTimeToLiveAttributes();
updateEntryExpiryPossible();
timeToLiveChanged(oldAttrs);
return oldAttrs;
}
+ @Override
public CustomExpiry setCustomEntryTimeToLive(CustomExpiry custom) {
checkReadiness();
if (custom != null && !this.statisticsEnabled) {
@@ -1210,6 +1216,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
+ @Override
public ExpirationAttributes setRegionIdleTimeout(ExpirationAttributes idleTimeout) {
checkReadiness();
if (idleTimeout == null) {
@@ -1233,11 +1240,12 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
ExpirationAttributes oldAttrs = getRegionIdleTimeout();
this.regionIdleTimeout = idleTimeout.getTimeout();
this.regionIdleTimeoutExpirationAction = idleTimeout.getAction();
- this.setRegionIdleTimeoutAtts();
+ this.setRegionIdleTimeoutAttributes();
regionIdleTimeoutChanged(oldAttrs);
return oldAttrs;
}
+ @Override
public ExpirationAttributes setRegionTimeToLive(ExpirationAttributes timeToLive) {
checkReadiness();
if (timeToLive == null) {
@@ -1267,6 +1275,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return oldAttrs;
}
+ @Override
public void becomeLockGrantor() {
checkReadiness();
checkForLimitedOrNoAccess();
@@ -1280,8 +1289,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
this.isLockGrantor = true;
}
- /** ********************* CacheStatistics ******************************** */
-
+ @Override
public CacheStatistics getStatistics() {
// prefer region destroyed exception over statistics disabled exception
checkReadiness();
@@ -1298,20 +1306,21 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* all its subregions. This implementation trades performance of stat retrieval for performance of
* get/put, which is more critical.
*/
+ @Override
public synchronized long getLastModifiedTime() {
checkReadiness();
long mostRecent = basicGetLastModifiedTime();
+
// don't need to wait on getInitialImage for this operation in subregions
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
- Iterator subIt = subregions(false).iterator();
- while (subIt.hasNext()) {
+ for (Object region : subregions(false)) {
try {
- LocalRegion r = (LocalRegion) subIt.next();
- if (r.isInitialized()) {
- mostRecent = Math.max(mostRecent, r.getLastModifiedTime());
+ LocalRegion localRegion = (LocalRegion) region;
+ if (localRegion.isInitialized()) {
+ mostRecent = Math.max(mostRecent, localRegion.getLastModifiedTime());
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// pass over destroyed region
}
}
@@ -1321,19 +1330,19 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return mostRecent;
}
- protected long basicGetLastModifiedTime() {
+ private long basicGetLastModifiedTime() {
return this.lastModifiedTime.get();
}
- protected long basicGetLastAccessedTime() {
+ private long basicGetLastAccessedTime() {
return this.lastAccessedTime.get();
}
- protected void basicSetLastModifiedTime(long t) {
+ private void basicSetLastModifiedTime(long t) {
this.lastModifiedTime.set(t);
}
- protected void basicSetLastAccessedTime(long t) {
+ private void basicSetLastAccessedTime(long t) {
this.lastAccessedTime.set(t);
}
@@ -1342,20 +1351,20 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* all its subregions. This implementation trades performance of stat retrieval for performance of
* get/put, which is more critical.
*/
+ @Override
public synchronized long getLastAccessedTime() {
checkReadiness();
long mostRecent = basicGetLastAccessedTime();
// don't need to wait on getInitialImage for this operation in subregions
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
- Iterator subIt = subregions(false).iterator();
- while (subIt.hasNext()) {
+ for (Object region : subregions(false)) {
try {
- LocalRegion r = (LocalRegion) subIt.next();
- if (r.isInitialized()) {
- mostRecent = Math.max(mostRecent, r.getLastAccessedTime());
+ LocalRegion localRegion = (LocalRegion) region;
+ if (localRegion.isInitialized()) {
+ mostRecent = Math.max(mostRecent, localRegion.getLastAccessedTime());
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// pass over destroyed region
}
}
@@ -1371,18 +1380,18 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
protected synchronized void updateStats() {
long mostRecentAccessed = basicGetLastAccessedTime();
long mostRecentModified = basicGetLastModifiedTime();
+
// don't need to wait on getInitialImage for this operation in subregions
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
- Iterator subIt = subregions(false).iterator();
- while (subIt.hasNext()) {
+ for (Object region : subregions(false)) {
try {
- LocalRegion r = (LocalRegion) subIt.next();
- if (r.isInitialized()) {
- mostRecentAccessed = Math.max(mostRecentAccessed, r.getLastAccessedTime());
- mostRecentModified = Math.max(mostRecentModified, r.getLastModifiedTime());
+ LocalRegion localRegion = (LocalRegion) region;
+ if (localRegion.isInitialized()) {
+ mostRecentAccessed = Math.max(mostRecentAccessed, localRegion.getLastAccessedTime());
+ mostRecentModified = Math.max(mostRecentModified, localRegion.getLastModifiedTime());
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// pass over destroyed region
}
}
@@ -1394,7 +1403,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
protected void setLastModifiedTime(long time) {
- // checkReadiness();
if (time > this.lastModifiedTime.get()) {
this.lastModifiedTime.set(time);
}
@@ -1403,7 +1411,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- protected void setLastAccessedTime(long time, boolean hit) {
+ void setLastAccessedTime(long time, boolean hit) {
this.lastAccessedTime.set(time);
if (hit) {
if (trackHits) {
@@ -1416,25 +1424,25 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- public final float getHitRatio() {
- // checkReadiness();
+ @Override
+ public float getHitRatio() {
long hits = getHitCount();
long total = hits + getMissCount();
- return total == 0L ? 0.0f : ((float) hits / total);
+ return total == 0L ? 0.0f : (float) hits / total;
}
+ @Override
public long getHitCount() {
- // checkReadiness();
return this.hitCount.get();
}
+ @Override
public long getMissCount() {
- // checkReadiness();
return this.missCount.get();
}
+ @Override
public void resetCounts() {
- // checkReadiness();
if (trackMisses) {
this.missCount.set(0);
}
@@ -1443,9 +1451,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- /** ****************** Protected Methods *********************************** */
-
- protected void closeCacheCallback(CacheCallback cb) {
+ void closeCacheCallback(CacheCallback cb) {
if (cb != null) {
try {
cb.close();
@@ -1479,13 +1485,21 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
}
}
- protected void timeToLiveChanged(ExpirationAttributes oldTimeToLive) {}
+ protected void timeToLiveChanged(ExpirationAttributes oldTimeToLive) {
+ // nothing
+ }
- protected void idleTimeoutChanged(ExpirationAttributes oldIdleTimeout) {}
+ protected void idleTimeoutChanged(ExpirationAttributes oldIdleTimeout) {
+ // nothing
+ }
- protected void regionTimeToLiveChanged(ExpirationAttributes oldTimeToLive) {}
+ protected void regionTimeToLiveChanged(ExpirationAttributes oldTimeToLive) {
+ // nothing
+ }
- protected void regionIdleTimeoutChanged(ExpirationAttributes oldIdleTimeout) {};
+ protected void regionIdleTimeoutChanged(ExpirationAttributes oldIdleTimeout) {
+ // nothing
+ }
/** Throws CacheClosedException or RegionDestroyedException */
abstract void checkReadiness();
@@ -1495,7 +1509,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 5.0
*/
- protected final boolean isProxy() {
+ protected boolean isProxy() {
return getDataPolicy().isEmpty();
}
@@ -1505,7 +1519,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 5.0
*/
- protected final boolean isCacheContentProxy() {
+ boolean isCacheContentProxy() {
// method added to fix bug 35195
return isProxy() && getSubscriptionAttributes().getInterestPolicy().isCacheContent();
}
@@ -1523,23 +1537,30 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
private boolean entryExpiryPossible = false;
protected void updateEntryExpiryPossible() {
- this.entryExpiryPossible = !isProxy() && (this.entryTimeToLive > 0 || this.entryIdleTimeout > 0
- || this.customEntryIdleTimeout != null || this.customEntryTimeToLive != null);
+ this.entryExpiryPossible = !isProxy() && (hasTimeToLive() || hasIdleTimeout());
+ }
+
+ private boolean hasTimeToLive() {
+ return this.entryTimeToLive > 0 || this.customEntryTimeToLive != null;
+ }
+
+ private boolean hasIdleTimeout() {
+ return this.entryIdleTimeout > 0 || this.customEntryIdleTimeout != null;
}
/**
* Returns true if this region could expire an entry
*/
- protected boolean isEntryExpiryPossible() {
+ boolean isEntryExpiryPossible() {
return this.entryExpiryPossible;
}
- public ExpirationAction getEntryExpirationAction() {
+ ExpirationAction getEntryExpirationAction() {
if (this.entryIdleTimeoutExpirationAction != null) {
- return entryIdleTimeoutExpirationAction;
+ return this.entryIdleTimeoutExpirationAction;
}
if (this.entryTimeToLiveExpirationAction != null) {
- return entryTimeToLiveExpirationAction;
+ return this.entryTimeToLiveExpirationAction;
}
return null;
}
@@ -1551,7 +1572,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return this.evictionController != null;
}
- /** ****************** Private Methods ************************************* */
private void setAttributes(RegionAttributes attrs, String regionName,
InternalRegionArguments internalRegionArgs) {
this.dataPolicy = attrs.getDataPolicy(); // do this one first
@@ -1562,10 +1582,10 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
// fix bug #52033 by invoking setOffHeap now (localMaxMemory may now be the temporary
// placeholder for off-heap until DistributedSystem is created
// found non-null PartitionAttributes and offHeap is true so let's setOffHeap on PA now
- PartitionAttributes<?, ?> pa = attrs.getPartitionAttributes();
- if (this.offHeap && pa != null) {
- PartitionAttributesImpl impl = (PartitionAttributesImpl) pa;
- impl.setOffHeap(this.offHeap);
+ PartitionAttributes<?, ?> partitionAttributes = attrs.getPartitionAttributes();
+ if (this.offHeap && partitionAttributes != null) {
+ PartitionAttributesImpl impl = (PartitionAttributesImpl) partitionAttributes;
+ impl.setOffHeap(true);
}
this.evictionAttributes =
@@ -1579,12 +1599,9 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
attrs.getPartitionAttributes().getLocalMaxMemory()}));
this.evictionAttributes.setMaximum(attrs.getPartitionAttributes().getLocalMaxMemory());
}
- // final boolean isNotPartitionedRegion = !(attrs.getPartitionAttributes() != null || attrs
- // .getDataPolicy().withPartitioning());
- // if (isNotPartitionedRegion && this.evictionAttributes != null
if (this.evictionAttributes != null && !this.evictionAttributes.getAlgorithm().isNone()) {
- this.setEvictionController(
+ setEvictionController(
this.evictionAttributes.createEvictionController(this, attrs.getOffHeap()));
}
storeCacheListenersField(attrs.getCacheListeners());
@@ -1595,14 +1612,14 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
setRegionTimeToLiveAtts();
this.regionIdleTimeout = attrs.getRegionIdleTimeout().getTimeout();
this.regionIdleTimeoutExpirationAction = attrs.getRegionIdleTimeout().getAction();
- setRegionIdleTimeoutAtts();
+ setRegionIdleTimeoutAttributes();
this.entryTimeToLive = attrs.getEntryTimeToLive().getTimeout();
this.entryTimeToLiveExpirationAction = attrs.getEntryTimeToLive().getAction();
- setEntryTimeToLiveAtts();
+ setEntryTimeToLiveAttributes();
this.customEntryTimeToLive = attrs.getCustomEntryTimeToLive();
this.entryIdleTimeout = attrs.getEntryIdleTimeout().getTimeout();
this.entryIdleTimeoutExpirationAction = attrs.getEntryIdleTimeout().getAction();
- setEntryIdleTimeoutAtts();
+ setEntryIdleTimeoutAttributes();
this.customEntryIdleTimeout = attrs.getCustomEntryIdleTimeout();
updateEntryExpiryPossible();
this.statisticsEnabled = attrs.getStatisticsEnabled();
@@ -1680,43 +1697,47 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return result;
}
- public boolean existsValue(String predicate) throws FunctionDomainException,
+ @Override
+ public boolean existsValue(String queryPredicate) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
- return !query(predicate).isEmpty();
+ return !query(queryPredicate).isEmpty();
}
- public Object selectValue(String predicate) throws FunctionDomainException, TypeMismatchException,
- NameResolutionException, QueryInvocationTargetException {
- SelectResults result = query(predicate);
+ @Override
+ public Object selectValue(String queryPredicate) throws FunctionDomainException,
+ TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
+ SelectResults result = query(queryPredicate);
if (result.isEmpty()) {
return null;
}
if (result.size() > 1)
throw new FunctionDomainException(
LocalizedStrings.AbstractRegion_SELECTVALUE_EXPECTS_RESULTS_OF_SIZE_1_BUT_FOUND_RESULTS_OF_SIZE_0
- .toLocalizedString(Integer.valueOf(result.size())));
+ .toLocalizedString(result.size()));
return result.iterator().next();
}
+ @Override
public Set entrySet(boolean recursive) {
return entries(recursive);
}
+ @Override
public EvictionAttributes getEvictionAttributes() {
return this.evictionAttributes;
}
+ @Override
public EvictionAttributesMutator getEvictionAttributesMutator() {
return this.evictionAttributes;
}
-
- public void setEvictionController(LRUAlgorithm evictionController) {
+ private void setEvictionController(LRUAlgorithm evictionController) {
this.evictionController = evictionController;
}
public LRUAlgorithm getEvictionController() {
- return evictionController;
+ return this.evictionController;
}
/**
@@ -1724,7 +1745,9 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @throws RegionAccessException if required roles are missing and the LossAction is NO_ACCESS
*/
- protected void checkForNoAccess() {}
+ protected void checkForNoAccess() {
+ // nothing
+ }
/**
* Throws RegionAccessException is required roles are missing and the LossAction is either
@@ -1733,7 +1756,9 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
* @throws RegionAccessException if required roles are missing and the LossAction is either
* NO_ACCESS or LIMITED_ACCESS
*/
- protected void checkForLimitedOrNoAccess() {}
+ protected void checkForLimitedOrNoAccess() {
+ // nothing
+ }
/**
* Makes sure that the data was distributed to every required role. If it was not it either queues
@@ -1754,7 +1779,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return false;
}
-
/**
* Returns the serial number which identifies the static order in which this region was created in
* relation to other regions or other instances of this region during the life of this JVM.
@@ -1763,7 +1787,8 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return this.serialNumber;
}
- public /* final */ GemFireCacheImpl getCache() {
+ @Override
+ public InternalCache getCache() {
return this.cache;
}
@@ -1771,11 +1796,12 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return this.cache.getInternalDistributedSystem().getClock().cacheTimeMillis();
}
- public final RegionService getRegionService() {
+ @Override
+ public RegionService getRegionService() {
return this.cache;
}
- public final DM getDistributionManager() {
+ public DM getDistributionManager() {
return getSystem().getDistributionManager();
}
@@ -1783,49 +1809,53 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return getCache().getInternalDistributedSystem();
}
- // DataSerializableFixedID support
- public final int getDSFID() {
+ @Override
+ public int getDSFID() {
return REGION;
}
- // DataSerializableFixedID support
- public final void toData(DataOutput out) throws IOException {
+ @Override
+ public void toData(DataOutput out) throws IOException {
DataSerializer.writeRegion(this, out);
}
- // DataSerializableFixedID support
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
// should never be called since the special DataSerializer.readRegion is used.
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException("fromData is not implemented");
}
public boolean forceCompaction() {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException("forceCompaction is not implemented");
}
+ @Override
public boolean getCloningEnabled() {
return this.cloningEnable;
}
+ @Override
public void setCloningEnabled(boolean cloningEnable) {
this.cloningEnable = cloningEnable;
}
- protected static Object handleNotAvailable(Object v) {
- if (v == Token.NOT_AVAILABLE) {
- v = null;
+ static Object handleNotAvailable(Object object) {
+ if (object == Token.NOT_AVAILABLE) {
+ object = null;
}
- return v;
+ return object;
}
- public GemFireCacheImpl getGemFireCache() {
+ public InternalCache getGemFireCache() {
return this.cache;
}
+ @Override
public RegionSnapshotService<?, ?> getSnapshotService() {
return new RegionSnapshotServiceImpl(this);
}
+ @Override
public Compressor getCompressor() {
return this.compressor;
}
@@ -1835,9 +1865,10 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*/
@Override
public ExtensionPoint<Region<?, ?>> getExtensionPoint() {
- return extensionPoint;
+ return this.extensionPoint;
}
+ @Override
public boolean getOffHeap() {
return this.offHeap;
}
[14/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
index d0dd084..bcc998f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
@@ -50,10 +50,6 @@ import org.apache.geode.internal.cache.execute.MultiRegionFunctionContextImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- *
- */
public class MemberFunctionStreamingMessage extends DistributionMessage
implements TransactionMessage, MessageWithReply {
@@ -72,6 +68,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
private int processorId;
private int txUniqId = TXManagerImpl.NOTX;
+
private InternalDistributedMember txMemberId = null;
private boolean isFnSerializationReqd;
@@ -80,8 +77,6 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
private boolean isReExecute;
- // private final Object lastResultLock = new Object();
-
private static final short IS_REEXECUTE = UNRESERVED_FLAGS_START;
public MemberFunctionStreamingMessage() {}
@@ -124,7 +119,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
if (this.txUniqId == TXManagerImpl.NOTX) {
return null;
} else {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// ignore and return, we are shutting down!
return null;
@@ -134,9 +129,9 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
}
}
- private void cleanupTransasction(TXStateProxy tx) {
+ private void cleanupTransaction(TXStateProxy tx) {
if (this.txUniqId != TXManagerImpl.NOTX) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// ignore and return, we are shutting down!
return;
@@ -167,7 +162,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
ResultSender resultSender = new MemberFunctionResultSender(dm, this, this.functionObject);
Set<Region> regions = new HashSet<Region>();
if (this.regionPathSet != null) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
for (String regionPath : this.regionPathSet) {
if (checkCacheClosing(dm) || checkDSClosing(dm)) {
thr =
@@ -181,7 +176,6 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
FunctionContextImpl context = new MultiRegionFunctionContextImpl(this.functionObject.getId(),
this.args, resultSender, regions, isReExecute);
-
long start = stats.startTime();
stats.startFunctionExecution(this.functionObject.hasResult());
if (logger.isDebugEnabled()) {
@@ -235,7 +229,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
SystemFailure.checkFailure();
thr = t;
} finally {
- cleanupTransasction(tx);
+ cleanupTransaction(tx);
if (thr != null) {
rex = new ReplyException(thr);
replyWithException(dm, rex);
@@ -268,7 +262,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
if ((flags & HAS_TX_ID) != 0)
this.txUniqId = in.readInt();
if ((flags & HAS_TX_MEMBERID) != 0) {
- this.txMemberId = (InternalDistributedMember) DataSerializer.readObject(in);
+ this.txMemberId = DataSerializer.readObject(in);
}
Object object = DataSerializer.readObject(in);
@@ -358,8 +352,8 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
/**
* check to see if the cache is closing
*/
- final public boolean checkCacheClosing(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ private boolean checkCacheClosing(DistributionManager dm) {
+ InternalCache cache = GemFireCacheImpl.getInstance();
return (cache == null || cache.getCancelCriterion().isCancelInProgress());
}
@@ -368,25 +362,15 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
*
* @return true if the distributed system is closing
*/
- final public boolean checkDSClosing(DistributionManager dm) {
+ private boolean checkDSClosing(DistributionManager dm) {
InternalDistributedSystem ds = dm.getSystem();
return (ds == null || ds.isDisconnecting());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TransactionMessage#canStartRemoteTransaction()
- */
public boolean canStartRemoteTransaction() {
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TransactionMessage#getTXUniqId()
- */
public int getTXUniqId() {
return this.txUniqId;
}
@@ -400,7 +384,6 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
}
public InternalDistributedMember getTXOriginatorClient() {
- // TODO Auto-generated method stub
return null;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
index faec43a..bfcf6ff 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
@@ -349,13 +349,6 @@ public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
.toLocalizedString());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.RegionEntry#getSerializedValueOnDisk(org.apache.geode.internal.
- * cache.LocalRegion)
- */
public Object getSerializedValueOnDisk(LocalRegion localRegion) {
throw new UnsupportedOperationException(
LocalizedStrings.PartitionedRegion_NOT_APPROPRIATE_FOR_PARTITIONEDREGIONNONLOCALREGIONENTRY
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
index ca9468d..9db2bbf 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
@@ -14,12 +14,49 @@
*/
package org.apache.geode.internal.cache;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.io.SyncFailedException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
import org.apache.geode.SerializationException;
@@ -78,52 +115,14 @@ import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.internal.util.TransformUtils;
import org.apache.geode.pdx.internal.PdxWriterImpl;
-import org.apache.logging.log4j.Logger;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.SyncFailedException;
-import java.nio.ByteBuffer;
-import java.nio.channels.ClosedChannelException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
/**
* Implements an operation log to write to disk. As of prPersistSprint2 this file only supports
* persistent regions. For overflow only regions see {@link OverflowOplog}.
*
- *
* @since GemFire 5.1
*/
-
-public final class Oplog implements CompactableOplog, Flushable {
+public class Oplog implements CompactableOplog, Flushable {
private static final Logger logger = LogService.getLogger();
/** Extension of the oplog file * */
@@ -141,8 +140,6 @@ public final class Oplog implements CompactableOplog, Flushable {
private final OplogFile drf = new OplogFile();
private final KRFile krf = new KRFile();
- /** preallocated space available for writing to* */
- // volatile private long opLogSpace = 0L;
/** The stats for this store */
private final DiskStoreStats stats;
@@ -190,6 +187,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* The HighWaterMark of recentValues.
*/
private final AtomicLong totalCount = new AtomicLong(0);
+
/**
* The number of records in this oplog that contain the most recent value of the entry.
*/
@@ -209,13 +207,13 @@ public final class Oplog implements CompactableOplog, Flushable {
* Set to true after the first drf recovery.
*/
private boolean haveRecoveredDrf = true;
+
/**
* Set to true after the first crf recovery.
*/
private boolean haveRecoveredCrf = true;
- private OpState opState;
- /** OPCODES - byte appended before being written to disk* */
+ private OpState opState;
/**
* Written to CRF, and DRF.
@@ -239,7 +237,9 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_NEW_ENTRY_BASE_ID = 63;
+
static final int OPLOG_NEW_ENTRY_BASE_REC_SIZE = 1 + 8 + 1;
+
/**
* Written to CRF. The OplogEntryId is +1 the previous new_entry OplogEntryId. Byte Format: 1:
* userBits RegionId 4: valueLength (optional depending on bits) valueLength: value bytes
@@ -258,6 +258,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_1ID = 65;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 2 bytes. Byte Format: 1: userBits 2: OplogEntryId RegionId 4:
@@ -297,6 +298,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_5ID = 69;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 6 bytes. Byte Format: 1: userBits 6: OplogEntryId RegionId 4:
@@ -306,6 +308,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_6ID = 70;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 7 bytes. Byte Format: 1: userBits 7: OplogEntryId RegionId 4:
@@ -315,6 +318,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_7ID = 71;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 8 bytes. Byte Format: 1: userBits 8: OplogEntryId RegionId 4:
@@ -334,6 +338,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_WITH_KEY_1ID = 73;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 2 bytes. Byte Format: 1: userBits 2: OplogEntryId RegionId 4:
@@ -373,6 +378,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_WITH_KEY_5ID = 77;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 6 bytes. Byte Format: 1: userBits 6: OplogEntryId RegionId 4:
@@ -382,6 +388,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_WITH_KEY_6ID = 78;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 7 bytes. Byte Format: 1: userBits 7: OplogEntryId RegionId 4:
@@ -391,6 +398,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_MOD_ENTRY_WITH_KEY_7ID = 79;
+
/**
* Written to CRF. The OplogEntryId is relative to the previous mod_entry OplogEntryId. The signed
* difference is encoded in 8 bytes. Byte Format: 1: userBits 8: OplogEntryId RegionId 4:
@@ -439,6 +447,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_DEL_ENTRY_5ID = 85;
+
/**
* Written to DRF. The OplogEntryId is relative to the previous del_entry OplogEntryId. The signed
* difference is encoded in 6 bytes. Byte Format: 6: OplogEntryId 1: EndOfRecord
@@ -446,6 +455,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_DEL_ENTRY_6ID = 86;
+
/**
* Written to DRF. The OplogEntryId is relative to the previous del_entry OplogEntryId. The signed
* difference is encoded in 7 bytes. Byte Format: 7: OplogEntryId 1: EndOfRecord
@@ -453,6 +463,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* @since GemFire prPersistSprint1
*/
private static final byte OPLOG_DEL_ENTRY_7ID = 87;
+
/**
* Written to DRF. The OplogEntryId is relative to the previous del_entry OplogEntryId. The signed
* difference is encoded in 8 bytes. Byte Format: 8: OplogEntryId 1: EndOfRecord
@@ -488,6 +499,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* such as 7.0.0.beta EndOfRecord
*/
private static final byte OPLOG_GEMFIRE_VERSION = 91;
+
static final int OPLOG_GEMFIRE_VERSION_REC_SIZE = 1 + 3 + 1;
/**
@@ -499,14 +511,14 @@ public final class Oplog implements CompactableOplog, Flushable {
*/
static final byte OPLOG_MAGIC_SEQ_ID = 92;
- public static enum OPLOG_TYPE {
+ public enum OPLOG_TYPE {
CRF(new byte[] {0x47, 0x46, 0x43, 0x52, 0x46, 0x31}), // GFCRF1
DRF(new byte[] {0x47, 0x46, 0x44, 0x52, 0x46, 0x31}), // GFDRF1
IRF(new byte[] {0x47, 0x46, 0x49, 0x52, 0x46, 0x31}), // GFIRF1
KRF(new byte[] {0x47, 0x46, 0x4b, 0x52, 0x46, 0x31}), // GFKRF1
IF(new byte[] {0x47, 0x46, 0x49, 0x46, 0x30, 0x31}); // GFIF01
- private byte[] bytes;
+ private final byte[] bytes;
OPLOG_TYPE(byte[] byteSeq) {
this.bytes = byteSeq;
@@ -527,10 +539,10 @@ public final class Oplog implements CompactableOplog, Flushable {
private final boolean compactOplogs;
/**
- * Asif: This object is used to correctly identify the OpLog size so as to cause a switch of
- * oplogs
+ * This object is used to correctly identify the OpLog size so as to cause a switch of oplogs
*/
final Object lock = new Object();
+
final ByteBuffer[] bbArray = new ByteBuffer[2];
private boolean lockedForKRFcreate = false;
@@ -542,16 +554,7 @@ public final class Oplog implements CompactableOplog, Flushable {
private boolean doneAppending = false;
/**
- * Extra bytes to be skipped before reading value bytes. Value is currently 6 : 1 byte for opcode,
- * 1 byte for userbits and 4 bytes for value length.
- */
- private static final long SKIP_BYTES = 6;
-
- private static final ByteBuffer EMPTY = ByteBuffer.allocate(0);
-
- // ///////////////////// Constructors ////////////////////////
- /**
- * Creates new <code>Oplog</code> for the given region.
+ * Creates new {@code Oplog} for the given region.
*
* @param oplogId int identifying the new oplog
* @param dirHolder The directory in which to create new Oplog
@@ -620,8 +623,8 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: A copy constructor used for creating a new oplog based on the previous Oplog. This
- * constructor is invoked only from the function switchOplog
+ * A copy constructor used for creating a new oplog based on the previous Oplog. This constructor
+ * is invoked only from the function switchOplog
*
* @param oplogId integer identifying the new oplog
* @param dirHolder The directory in which to create new Oplog
@@ -773,7 +776,7 @@ public final class Oplog implements CompactableOplog, Flushable {
this.dirHolder.incrementTotalOplogSize(getOpStateSize());
}
- public final Version currentRecoveredGFVersion() {
+ public Version currentRecoveredGFVersion() {
return this.gfversion;
}
@@ -790,7 +793,6 @@ public final class Oplog implements CompactableOplog, Flushable {
* @param olf the oplog to write to
* @param diskRegions the set of disk regions we should write the RVV of
* @param writeGCRVV true to write write the GC RVV
- * @throws IOException
*/
private void writeRVVRecord(OplogFile olf, Map<Long, AbstractDiskRegion> diskRegions,
boolean writeGCRVV) throws IOException {
@@ -835,9 +837,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* This constructor will get invoked only in case of persistent region when it is recovering an
* oplog.
- *
- * @param oplogId
- * @param parent
*/
Oplog(long oplogId, PersistentOplogSet parent) {
// @todo have the crf and drf use different directories.
@@ -850,8 +849,7 @@ public final class Oplog implements CompactableOplog, Flushable {
this.parent = parent.getParent();
this.oplogSet = parent;
this.opState = new OpState();
- long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes();
- this.maxOplogSize = maxOplogSizeParam;
+ this.maxOplogSize = getParent().getMaxOplogSizeInBytes();
setMaxCrfDrfSize();
this.stats = getParent().getStats();
this.compactOplogs = getParent().getAutoCompact();
@@ -1084,8 +1082,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* Creates the crf oplog file
- *
- * @throws IOException
*/
private void createCrf(OplogFile prevOlf) throws IOException {
File f = new File(this.diskFile.getPath() + CRF_FILE_EXT);
@@ -1121,14 +1117,12 @@ public final class Oplog implements CompactableOplog, Flushable {
prevOlf.writeBuf = null;
return result;
} else {
- return ByteBuffer.allocateDirect(Integer.getInteger("WRITE_BUF_SIZE", 32768).intValue());
+ return ByteBuffer.allocateDirect(Integer.getInteger("WRITE_BUF_SIZE", 32768));
}
}
/**
* Creates the drf oplog file
- *
- * @throws IOException
*/
private void createDrf(OplogFile prevOlf) throws IOException {
File f = new File(this.diskFile.getPath() + DRF_FILE_EXT);
@@ -1150,27 +1144,18 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Returns the <code>DiskStoreStats</code> for this oplog
+ * Returns the {@code DiskStoreStats} for this oplog
*/
public DiskStoreStats getStats() {
return this.stats;
}
/**
- * Flushes any pending writes to disk.
- *
- * public final void flush() { forceFlush(); }
- */
-
- /**
* Test Method to be used only for testing purposes. Gets the underlying File object for the Oplog
* . Oplog class uses this File object to obtain the RandomAccessFile object. Before returning the
* File object , the dat present in the buffers of the RandomAccessFile object is flushed.
* Otherwise, for windows the actual file length does not match with the File size obtained from
* the File object
- *
- * @throws IOException
- * @throws SyncFailedException
*/
File getOplogFile() throws SyncFailedException, IOException {
// @todo check callers for drf
@@ -1271,7 +1256,7 @@ public final class Oplog implements CompactableOplog, Flushable {
* present. @param faultingIn @param bitOnly boolean indicating whether to extract just the
* UserBit or UserBit with value @return BytesAndBits object wrapping the value & user bit
*/
- public final BytesAndBits getBytesAndBits(DiskRegionView dr, DiskId id, boolean faultingIn,
+ public BytesAndBits getBytesAndBits(DiskRegionView dr, DiskId id, boolean faultingIn,
boolean bitOnly) {
Oplog retryOplog = null;
long offset = 0;
@@ -1292,22 +1277,18 @@ public final class Oplog implements CompactableOplog, Flushable {
BytesAndBits bb = null;
long start = this.stats.startRead();
- // Asif: If the offset happens to be -1, still it is possible that
+ // If the offset happens to be -1, still it is possible that
// the data is present in the current oplog file.
if (offset == -1) {
- // Asif: Since it is given that a get operation has alreadty
+ // Since it is given that a get operation has alreadty
// taken a
// lock on an entry , no put operation could have modified the
// oplog ID
// there fore synchronization is not needed
- // synchronized (id) {
- // if (id.getOplogId() == this.oplogId) {
offset = id.getOffsetInOplog();
- // }
- // }
}
- // Asif :If the current OpLog is not destroyed ( its opLogRaf file
+ // If the current OpLog is not destroyed ( its opLogRaf file
// is still open) we can retrieve the value from this oplog.
try {
bb = basicGet(dr, offset, bitOnly, id.getValueLength(), id.getUserBits());
@@ -1321,7 +1302,7 @@ public final class Oplog implements CompactableOplog, Flushable {
if (bb == null) {
throw new EntryDestroyedException(
LocalizedStrings.Oplog_NO_VALUE_WAS_FOUND_FOR_ENTRY_WITH_DISK_ID_0_ON_A_REGION_WITH_SYNCHRONOUS_WRITING_SET_TO_1
- .toLocalizedString(new Object[] {id, Boolean.valueOf(dr.isSync())}));
+ .toLocalizedString(new Object[] {id, dr.isSync()}));
}
if (bitOnly) {
dr.endRead(start, this.stats.endRead(start, 1), 1);
@@ -1339,17 +1320,14 @@ public final class Oplog implements CompactableOplog, Flushable {
* HTree with the oplog being destroyed
*
* @param id A DiskId object for which the value on disk will be fetched
- *
*/
- public final BytesAndBits getNoBuffer(DiskRegion dr, DiskId id) {
+ public BytesAndBits getNoBuffer(DiskRegion dr, DiskId id) {
if (logger.isDebugEnabled()) {
logger.debug("Oplog::getNoBuffer:Before invoking Oplog.basicGet for DiskID ={}", id);
}
try {
- BytesAndBits bb =
- basicGet(dr, id.getOffsetInOplog(), false, id.getValueLength(), id.getUserBits());
- return bb;
+ return basicGet(dr, id.getOffsetInOplog(), false, id.getValueLength(), id.getUserBits());
} catch (DiskAccessException dae) {
logger.error(LocalizedMessage.create(
LocalizedStrings.Oplog_OPLOGGETNOBUFFEREXCEPTION_IN_RETRIEVING_VALUE_FROM_DISK_FOR_DISKID_0,
@@ -1612,32 +1590,24 @@ public final class Oplog implements CompactableOplog, Flushable {
+ getParent().getInitFile() + "\". Drf did not contain a disk store id.",
getParent());
}
- } catch (EOFException ex) {
+ } catch (EOFException ignore) {
// ignore since a partial record write can be caused by a crash
- // if (byteCount < fileLength) {
- // throw new
- // DiskAccessException(LocalizedStrings.Oplog_FAILED_READING_FILE_DURING_RECOVERY_FROM_0
- // .toLocalizedString(drfFile.getPath()), ex, getParent());
- // }// else do nothing, this is expected in crash scenarios
} catch (IOException ex) {
getParent().getCancelCriterion().checkCancelInProgress(ex);
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FILE_DURING_RECOVERY_FROM_0
.toLocalizedString(drfFile.getPath()),
ex, getParent());
- } catch (CancelException ignore) {
+ } catch (CancelException e) {
if (logger.isDebugEnabled()) {
- logger.debug("Oplog::readOplog:Error in recovery as Cache was closed", ignore);
+ logger.debug("Oplog::readOplog:Error in recovery as Cache was closed", e);
}
- } catch (RegionDestroyedException ignore) {
+ } catch (RegionDestroyedException e) {
if (logger.isDebugEnabled()) {
- logger.debug("Oplog::readOplog:Error in recovery as Region was destroyed", ignore);
+ logger.debug("Oplog::readOplog:Error in recovery as Region was destroyed", e);
}
- } catch (IllegalStateException ex) {
- // @todo
- // if (!rgn.isClosed()) {
- throw ex;
- // }
+ } catch (IllegalStateException e) {
+ throw e;
}
// Add the Oplog size to the Directory Holder which owns this oplog,
// so that available space is correctly calculated & stats updated.
@@ -1711,7 +1681,7 @@ public final class Oplog implements CompactableOplog, Flushable {
FileInputStream fis;
try {
fis = new FileInputStream(f);
- } catch (FileNotFoundException ex) {
+ } catch (FileNotFoundException ignore) {
return false;
}
try {
@@ -1735,7 +1705,7 @@ public final class Oplog implements CompactableOplog, Flushable {
validateOpcode(dis, OPLOG_DISK_STORE_ID);
readDiskStoreRecord(dis, f);
- } catch (DiskAccessException notInNewFormatErr) {
+ } catch (DiskAccessException ignore) {
// Failed to read the file. There are two possibilities. Either this
// file is in old format which does not have a magic seq in the
// beginning or this is not a valid file at all. Try reading it as a
@@ -1744,7 +1714,7 @@ public final class Oplog implements CompactableOplog, Flushable {
fis = new FileInputStream(f);
dis = new DataInputStream(new BufferedInputStream(fis, 1024 * 1024));
readDiskStoreRecord(dis, f);
- } catch (IllegalStateException notOldFileErr) {
+ } catch (IllegalStateException ignore) {
// Failed to read the file. There are two possibilities. Either this
// is in new format which has a magic seq in the beginning or this is
// not a valid file at all
@@ -2023,32 +1993,24 @@ public final class Oplog implements CompactableOplog, Flushable {
+ getParent().getInitFile() + "\". Crf did not contain a disk store id.",
getParent());
}
- } catch (EOFException ex) {
+ } catch (EOFException ignore) {
// ignore since a partial record write can be caused by a crash
- // if (byteCount < fileLength) {
- // throw new
- // DiskAccessException(LocalizedStrings.Oplog_FAILED_READING_FILE_DURING_RECOVERY_FROM_0
- // .toLocalizedString(this.crf.f.getPath()), ex, getParent());
- // }// else do nothing, this is expected in crash scenarios
} catch (IOException ex) {
getParent().getCancelCriterion().checkCancelInProgress(ex);
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FILE_DURING_RECOVERY_FROM_0
.toLocalizedString(this.crf.f.getPath()),
ex, getParent());
- } catch (CancelException ignore) {
+ } catch (CancelException e) {
if (logger.isDebugEnabled()) {
- logger.debug("Oplog::readOplog:Error in recovery as Cache was closed", ignore);
+ logger.debug("Oplog::readOplog:Error in recovery as Cache was closed", e);
}
- } catch (RegionDestroyedException ignore) {
+ } catch (RegionDestroyedException e) {
if (logger.isDebugEnabled()) {
- logger.debug("Oplog::readOplog:Error in recovery as Region was destroyed", ignore);
+ logger.debug("Oplog::readOplog:Error in recovery as Region was destroyed", e);
}
- } catch (IllegalStateException ex) {
- // @todo
- // if (!rgn.isClosed()) {
- throw ex;
- // }
+ } catch (IllegalStateException e) {
+ throw e;
}
// Add the Oplog size to the Directory Holder which owns this oplog,
@@ -2109,7 +2071,7 @@ public final class Oplog implements CompactableOplog, Flushable {
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < OPLOG_TYPE.getLen(); i++) {
- sb.append(" " + seq[i]);
+ sb.append(" ").append(seq[i]);
}
logger.trace(LogMarker.PERSIST_RECOVERY, "oplog magic code: {}", sb);
}
@@ -2222,7 +2184,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
} else {
- boolean rvvTrusted = InternalDataSerializer.readBoolean(dis);
+ boolean rvvTrusted = DataSerializer.readBoolean(dis);
if (drs != null) {
if (latestOplog) {
// only set rvvtrust based on the newest oplog recovered
@@ -2491,8 +2453,6 @@ public final class Oplog implements CompactableOplog, Flushable {
*
* @param dis DataInputStream from which the oplog is being read
* @param opcode byte whether the id is short/int/long
- * @param recoverValue
- * @throws IOException
*/
private void readNewEntry(CountingDataInputStream dis, byte opcode, OplogEntryIdSet deletedIds,
boolean recoverValue, final LocalRegion currentRegion, Version version, ByteArrayDataInput in,
@@ -2679,10 +2639,6 @@ public final class Oplog implements CompactableOplog, Flushable {
*
* @param dis DataInputStream from which the oplog is being read
* @param opcode byte whether the id is short/int/long
- * @param recoverValue
- * @param currentRegion
- * @param keyRequiresRegionContext
- * @throws IOException
*/
private void readModifyEntry(CountingDataInputStream dis, byte opcode, OplogEntryIdSet deletedIds,
boolean recoverValue, LocalRegion currentRegion, Version version, ByteArrayDataInput in,
@@ -2891,7 +2847,7 @@ public final class Oplog implements CompactableOplog, Flushable {
DiskEntry.Helper.readSerializedValue(valueBytes, version, in, true);
} catch (SerializationException ex) {
if (logger.isDebugEnabled()) {
- logger.debug("Could not deserialize recovered value: {}" + ex.getCause(), ex);
+ logger.debug("Could not deserialize recovered value: {}", ex.getCause(), ex);
}
}
}
@@ -2904,9 +2860,6 @@ public final class Oplog implements CompactableOplog, Flushable {
*
* @param dis DataInputStream from which the oplog is being read
* @param opcode byte whether the id is short/int/long
- * @param deletedIds
- * @param recoverValue
- * @throws IOException
*/
private void readModifyEntryWithKey(CountingDataInputStream dis, byte opcode,
OplogEntryIdSet deletedIds, boolean recoverValue, final LocalRegion currentRegion,
@@ -3099,12 +3052,9 @@ public final class Oplog implements CompactableOplog, Flushable {
* @param dis DataInputStream from which the oplog is being read
* @param opcode byte whether the id is short/int/long
* @param parent instance of disk region
- * @throws IOException
*/
private void readDelEntry(CountingDataInputStream dis, byte opcode, OplogEntryIdSet deletedIds,
- DiskStoreImpl parent) throws IOException
-
- {
+ DiskStoreImpl parent) throws IOException {
int idByteCount = (opcode - OPLOG_DEL_ENTRY_1ID) + 1;
// long debugRecoverDelEntryId = this.recoverDelEntryId;
long oplogKeyId = getDelEntryId(dis, idByteCount);
@@ -3161,8 +3111,6 @@ public final class Oplog implements CompactableOplog, Flushable {
* Returns true if it is ok the skip the current modify record which had the given oplogEntryId.
* It is ok to skip if any of the following are true: 1. deletedIds contains the id 2. the last
* modification of the entry was done by a record read from an oplog other than this oplog
- *
- * @param tag
*/
private OkToSkipResult okToSkipModifyRecord(OplogEntryIdSet deletedIds, long drId,
DiskRecoveryStore drs, long oplogEntryId, boolean checkRecoveryMap, VersionTag tag) {
@@ -3230,8 +3178,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* Returns true if the drId region has been destroyed or if oplogKeyId preceeds the last clear
* done on the drId region
- *
- * @param tag
*/
private OkToSkipResult okToSkipRegion(DiskRegionView drv, long oplogKeyId, VersionTag tag) {
long lastClearKeyId = drv.getClearOplogEntryId();
@@ -3300,25 +3246,16 @@ public final class Oplog implements CompactableOplog, Flushable {
assert idByteCount >= 1 && idByteCount <= 8 : idByteCount;
long delta;
- byte firstByte = dis.readByte();
- // if (firstByte < 0) {
- // delta = 0xFFFFFFFFFFFFFF00L | firstByte;
- // } else {
- // delta = firstByte;
- // }
- delta = firstByte;
+ delta = dis.readByte();
idByteCount--;
while (idByteCount > 0) {
delta <<= 8;
delta |= (0x00FF & dis.readByte());
idByteCount--;
}
- // this.lastDelta = delta; // HACK DEBUG
return delta;
}
- // private long lastDelta; // HACK DEBUG
-
/**
* Call this when the cache is closed or region is destroyed. Deletes the lock files.
*/
@@ -3501,8 +3438,6 @@ public final class Oplog implements CompactableOplog, Flushable {
* @param opCode The int value identifying whether it is create/modify or delete operation
* @param entry The DiskEntry object being operated upon
* @param value The byte array representing the value
- * @param userBits
- * @throws IOException
*/
private void initOpState(byte opCode, DiskRegionView dr, DiskEntry entry, ValueWrapper value,
byte userBits, boolean notToUseUserBits) throws IOException {
@@ -3545,17 +3480,14 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Modified the code so as to reuse the already created ByteBuffer during transition.
- * Creates a key/value pair from a region entry on disk. Updates all of the necessary
+ * Modified the code so as to reuse the already created ByteBuffer during transition. Creates a
+ * key/value pair from a region entry on disk. Updates all of the necessary
* {@linkplain DiskStoreStats statistics} and invokes basicCreate
*
* @param entry The DiskEntry object for this key/value pair.
* @param value byte array representing the value
- * @throws DiskAccessException
- * @throws IllegalStateException
- *
*/
- public final void create(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) {
+ public void create(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) {
if (this != getOplogSet().getChild()) {
getOplogSet().getChild().create(region, entry, value, async);
@@ -3612,13 +3544,11 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: A helper function which identifies whether to create the entry in the current oplog or to
- * make the switch to the next oplog. This function enables us to reuse the byte buffer which got
+ * A helper function which identifies whether to create the entry in the current oplog or to make
+ * the switch to the next oplog. This function enables us to reuse the byte buffer which got
* created for an oplog which no longer permits us to use itself
*
* @param entry DiskEntry object representing the current Entry
- * @throws IOException
- * @throws InterruptedException
*/
private void basicCreate(DiskRegion dr, DiskEntry entry, ValueWrapper value, byte userBits,
boolean async) throws IOException, InterruptedException {
@@ -3634,7 +3564,7 @@ public final class Oplog implements CompactableOplog, Flushable {
// contention point
// synchronized (this.crf) {
initOpState(OPLOG_NEW_ENTRY_0ID, dr, entry, value, userBits, false);
- // Asif : Check if the current data in ByteBuffer will cause a
+ // Check if the current data in ByteBuffer will cause a
// potential increase in the size greater than the max allowed
long temp = (getOpStateSize() + this.crf.currSize);
if (!this.wroteNewEntryBase) {
@@ -3662,10 +3592,10 @@ public final class Oplog implements CompactableOplog, Flushable {
id.setKeyId(createOplogEntryId);
// startPosForSynchOp = this.crf.currSize;
- // Asif: Allow it to be added to the OpLOg so increase the
+ // Allow it to be added to the OpLOg so increase the
// size of currenstartPosForSynchOpt oplog
int dataLength = getOpStateSize();
- // Asif: It is necessary that we set the
+ // It is necessary that we set the
// Oplog ID here without releasing the lock on object as we are
// writing to the file after releasing the lock. This can cause
// a situation where the
@@ -3705,7 +3635,7 @@ public final class Oplog implements CompactableOplog, Flushable {
if (logger.isTraceEnabled()) {
logger.trace("Oplog::basicCreate:Release dByteBuffer with data for Disk ID = {}", id);
}
- // Asif: As such for any put or get operation , a synch is taken
+ // As such for any put or get operation , a synch is taken
// on the Entry object in the DiskEntry's Helper functions.
// Compactor thread will also take a lock on entry object. Therefore
// we do not require a lock on DiskID, as concurrent access for
@@ -3767,15 +3697,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* This oplog will be forced to switch to a new oplog
- *
- *
- * public void forceRolling() { if (getOplogSet().getChild() == this) { synchronized (this.lock) {
- * if (getOplogSet().getChild() == this) { switchOpLog(0, null); } } if (!this.sync) {
- * this.writer.activateThreadToTerminate(); } } }
- */
-
- /**
- * This oplog will be forced to switch to a new oplog
*/
void forceRolling(DiskRegion dr) {
if (getOplogSet().getChild() == this) {
@@ -3798,11 +3719,11 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: This function is used to switch from one op Log to another , when the size of the current
- * oplog has reached the maximum permissible. It is always called from synch block with lock
- * object being the OpLog File object We will reuse the ByteBuffer Pool. We should add the current
- * Oplog for compaction first & then try to get next directory holder as in case there is only a
- * single directory with space being full, compaction has to happen before it can be given a new
+ * This function is used to switch from one op Log to another , when the size of the current oplog
+ * has reached the maximum permissible. It is always called from synch block with lock object
+ * being the OpLog File object We will reuse the ByteBuffer Pool. We should add the current Oplog
+ * for compaction first & then try to get next directory holder as in case there is only a single
+ * directory with space being full, compaction has to happen before it can be given a new
* directory. If the operation causing the switching is on an Entry which already is referencing
* the oplog to be compacted, then the compactor thread will skip compaction that entry & the
* switching thread will roll the entry explicitly.
@@ -3905,7 +3826,7 @@ public final class Oplog implements CompactableOplog, Flushable {
createKrfAsync();
}
} catch (DiskAccessException dae) {
- // Asif: Remove the Oplog which was added in the DiskStoreImpl
+ // Remove the Oplog which was added in the DiskStoreImpl
// for compaction as compaction cannot be done.
// However, it is also possible that compactor
// may have done the compaction of the Oplog but the switching thread
@@ -3919,7 +3840,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* Schedule a task to create a krf asynchronously
- *
*/
protected void createKrfAsync() {
getParent().executeDiskStoreTask(new Runnable() {
@@ -4313,10 +4233,10 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif:This function retrieves the value for an entry being compacted subject to entry
- * referencing the oplog being compacted. Attempt is made to retrieve the value from in memory ,
- * if available, else from asynch buffers ( if asynch mode is enabled), else from the Oplog being
- * compacted. It is invoked from switchOplog as well as OplogCompactor's compact function.
+ * This function retrieves the value for an entry being compacted subject to entry referencing the
+ * oplog being compacted. Attempt is made to retrieve the value from in memory , if available,
+ * else from asynch buffers ( if asynch mode is enabled), else from the Oplog being compacted. It
+ * is invoked from switchOplog as well as OplogCompactor's compact function.
*
* @param entry DiskEntry being compacted referencing the Oplog being compacted
* @param wrapper Object of type BytesAndBitsForCompactor. The data if found is set in the wrapper
@@ -4335,10 +4255,9 @@ public final class Oplog implements CompactableOplog, Flushable {
@Released
Object value = entry._getValueRetain(dr, true);
ReferenceCountHelper.unskipRefCountTracking();
- // TODO:KIRK:OK Object value = entry.getValueWithContext(dr);
boolean foundData = false;
if (value == null) {
- // Asif: If the mode is synch it is guaranteed to be present in the disk
+ // If the mode is synch it is guaranteed to be present in the disk
foundData = basicGetForCompactor(dr, oplogOffset, false, did.getValueLength(),
did.getUserBits(), wrapper);
// after we have done the get do one more check to see if the
@@ -4423,7 +4342,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
} else if (value instanceof byte[]) {
byte[] valueBytes = (byte[]) value;
- // Asif: If the value is already a byte array then the user bit
+ // If the value is already a byte array then the user bit
// is 0, which is the default value of the userBits variable,
// indicating that it is non serialized data. Thus it is
// to be used as it is & not to be deserialized to
@@ -4469,20 +4388,16 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* Modifies a key/value pair from a region entry on disk. Updates all of the necessary
* {@linkplain DiskStoreStats statistics} and invokes basicModify
+ * <p>
+ * Modified the code so as to reuse the already created ByteBuffer during transition. Minimizing
+ * the synchronization allowing multiple put operations for different entries to proceed
+ * concurrently for asynch mode
*
* @param entry DiskEntry object representing the current Entry
*
* @param value byte array representing the value
- * @throws DiskAccessException
- * @throws IllegalStateException
- */
- /*
- * Asif: Modified the code so as to reuse the already created ByteBuffer during transition.
- * Minimizing the synchronization allowing multiple put operations for different entries to
- * proceed concurrently for asynch mode
*/
- public final void modify(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) {
-
+ public void modify(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async) {
if (getOplogSet().getChild() != this) {
getOplogSet().getChild().modify(region, entry, value, async);
} else {
@@ -4559,10 +4474,9 @@ public final class Oplog implements CompactableOplog, Flushable {
.toLocalizedString(this.diskFile.getPath()),
ie, drv.getName());
}
-
}
- public final void saveConflictVersionTag(LocalRegion region, VersionTag tag, boolean async) {
+ public void saveConflictVersionTag(LocalRegion region, VersionTag tag, boolean async) {
if (getOplogSet().getChild() != this) {
getOplogSet().getChild().saveConflictVersionTag(region, tag, async);
} else {
@@ -4581,8 +4495,8 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private final void copyForwardForOfflineCompact(long oplogKeyId, byte[] keyBytes,
- byte[] valueBytes, byte userBits, long drId, VersionTag tag) {
+ private void copyForwardForOfflineCompact(long oplogKeyId, byte[] keyBytes, byte[] valueBytes,
+ byte userBits, long drId, VersionTag tag) {
try {
basicCopyForwardForOfflineCompact(oplogKeyId, keyBytes, valueBytes, userBits, drId, tag);
} catch (IOException ex) {
@@ -4600,7 +4514,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private final void copyForwardModifyForCompact(DiskRegionView dr, DiskEntry entry,
+ private void copyForwardModifyForCompact(DiskRegionView dr, DiskEntry entry,
BytesAndBitsForCompactor wrapper) {
if (getOplogSet().getChild() != this) {
getOplogSet().getChild().copyForwardModifyForCompact(dr, entry, wrapper);
@@ -4646,14 +4560,12 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: A helper function which identifies whether to modify the entry in the current oplog or to
- * make the switch to the next oplog. This function enables us to reuse the byte buffer which got
+ * A helper function which identifies whether to modify the entry in the current oplog or to make
+ * the switch to the next oplog. This function enables us to reuse the byte buffer which got
* created for an oplog which no longer permits us to use itself. It will also take acre of
* compaction if required
*
* @param entry DiskEntry object representing the current Entry
- * @throws IOException
- * @throws InterruptedException
*/
private void basicModify(DiskRegionView dr, DiskEntry entry, ValueWrapper value, byte userBits,
boolean async, boolean calledByCompactor) throws IOException, InterruptedException {
@@ -4813,7 +4725,7 @@ public final class Oplog implements CompactableOplog, Flushable {
this.crf.currSize = temp;
if (logger.isTraceEnabled(LogMarker.PERSIST_WRITES)) {
logger.trace(LogMarker.PERSIST_WRITES,
- "basicSaveConflictVersionTag: drId={} versionStamp={} oplog#", dr.getId(), tag,
+ "basicSaveConflictVersionTag: drId={} versionStamp={} oplog#{}", dr.getId(), tag,
getOplogId());
}
this.dirHolder.incrementTotalOplogSize(adjustment);
@@ -4870,7 +4782,7 @@ public final class Oplog implements CompactableOplog, Flushable {
logger.trace(LogMarker.PERSIST_WRITES,
"basicCopyForwardForOfflineCompact: id=<{}> keyBytes=<{}> valueOffset={} userBits={} valueLen={} valueBytes=<{}> drId={} oplog#{}",
oplogKeyId, baToString(keyBytes), startPosForSynchOp, userBits, valueBytes.length,
- baToString(valueBytes), getOplogId());
+ baToString(valueBytes), drId, getOplogId());
}
this.dirHolder.incrementTotalOplogSize(adjustment);
@@ -4878,7 +4790,6 @@ public final class Oplog implements CompactableOplog, Flushable {
}
clearOpState();
}
- // }
}
if (useNextOplog) {
if (LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER) {
@@ -4958,7 +4869,7 @@ public final class Oplog implements CompactableOplog, Flushable {
*
* @param entry DiskEntry object on which remove operation is called
*/
- public final void remove(LocalRegion region, DiskEntry entry, boolean async, boolean isClear) {
+ public void remove(LocalRegion region, DiskEntry entry, boolean async, boolean isClear) {
DiskRegion dr = region.getDiskRegion();
if (getOplogSet().getChild() != this) {
getOplogSet().getChild().remove(region, entry, async, isClear);
@@ -4987,16 +4898,14 @@ public final class Oplog implements CompactableOplog, Flushable {
did.setValueLength(len);
did.setUserBits(prevUsrBit);
}
-
}
-
}
}
/**
* Write the GC RVV for a single region to disk
*/
- public final void writeGCRVV(DiskRegion dr) {
+ public void writeGCRVV(DiskRegion dr) {
boolean useNextOplog = false;
synchronized (this.lock) {
if (getOplogSet().getChild() != this) {
@@ -5081,15 +4990,12 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- *
- * Asif: A helper function which identifies whether to record a removal of entry in the current
- * oplog or to make the switch to the next oplog. This function enables us to reuse the byte
- * buffer which got created for an oplog which no longer permits us to use itself. It will also
- * take acre of compaction if required
+ * A helper function which identifies whether to record a removal of entry in the current oplog or
+ * to make the switch to the next oplog. This function enables us to reuse the byte buffer which
+ * got created for an oplog which no longer permits us to use itself. It will also take acre of
+ * compaction if required
*
* @param entry DiskEntry object representing the current Entry
- * @throws IOException
- * @throws InterruptedException
*/
private void basicRemove(DiskRegionView dr, DiskEntry entry, boolean async, boolean isClear)
throws IOException, InterruptedException {
@@ -5133,7 +5039,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
// Write the data to the opLog for the synch mode
- // @todo if we don't sync write destroys what will happen if
+ // TODO: if we don't sync write destroys what will happen if
// we do 1. create k1 2. destroy k1 3. create k1?
// It would be possible for the crf to be flushed but not the drf.
// Then during recovery we will find identical keys with different
@@ -5145,13 +5051,11 @@ public final class Oplog implements CompactableOplog, Flushable {
// because we might be killed right after we do this write.
startPosForSynchOp = writeOpLogBytes(this.drf, async, true);
setHasDeletes(true);
- if (logger.isTraceEnabled(LogMarker.PERSIST_WRITES)) {
+ if (logger.isDebugEnabled(LogMarker.PERSIST_WRITES)) {
logger.debug("basicRemove: id=<{}> key=<{}> drId={} oplog#{}", abs(id.getKeyId()),
entry.getKey(), dr.getId(), getOplogId());
}
- // new RuntimeException("STACK"));
-
if (logger.isTraceEnabled()) {
logger.trace("Oplog::basicRemove:Released ByteBuffer for Disk ID = {}", id);
}
@@ -5161,17 +5065,15 @@ public final class Oplog implements CompactableOplog, Flushable {
id.setOffsetInOplog(-1);
EntryLogger.logPersistDestroy(dr.getName(), entry.getKey(), dr.getDiskStoreID());
- {
- Oplog rmOplog = null;
- if (oldOplogId == getOplogId()) {
- rmOplog = this;
- } else {
- rmOplog = getOplogSet().getChild(oldOplogId);
- }
- if (rmOplog != null) {
- rmOplog.rmLive(dr, entry);
- emptyOplog = rmOplog;
- }
+ Oplog rmOplog = null;
+ if (oldOplogId == getOplogId()) {
+ rmOplog = this;
+ } else {
+ rmOplog = getOplogSet().getChild(oldOplogId);
+ }
+ if (rmOplog != null) {
+ rmOplog.rmLive(dr, entry);
+ emptyOplog = rmOplog;
}
clearOpState();
}
@@ -5193,21 +5095,15 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- // /**
- // * This is only used for an assertion check.
- // */
- // private long lastWritePos = -1;
-
/**
* test hook
*/
- public final ByteBuffer getWriteBuf() {
+ ByteBuffer getWriteBuf() {
return this.crf.writeBuf;
}
- private final void flushNoSync(OplogFile olf) throws IOException {
+ private void flushNoSync(OplogFile olf) throws IOException {
flushAllNoSync(false); // @todo
- // flush(olf, false);
}
@Override
@@ -5226,14 +5122,13 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private final void flushAndSync(OplogFile olf) throws IOException {
- flushAll(false); // @todo
- // flush(olf, true);
+ private void flushAndSync(OplogFile olf) throws IOException {
+ flushAll(false);
}
private static final int MAX_CHANNEL_RETRIES = 5;
- private final void flush(OplogFile olf, boolean doSync) throws IOException {
+ private void flush(OplogFile olf, boolean doSync) throws IOException {
try {
synchronized (this.lock/* olf */) {
if (olf.RAFClosed) {
@@ -5290,7 +5185,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private final void flush(OplogFile olf, ByteBuffer b1, ByteBuffer b2) throws IOException {
+ private void flush(OplogFile olf, ByteBuffer b1, ByteBuffer b2) throws IOException {
try {
synchronized (this.lock/* olf */) {
if (olf.RAFClosed) {
@@ -5318,24 +5213,22 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- public final void flushAll() {
+ public void flushAll() {
flushAll(false);
}
- public final void flushAllNoSync(boolean skipDrf) {
+ public void flushAllNoSync(boolean skipDrf) {
flushAll(skipDrf, false);
}
- public final void flushAll(boolean skipDrf) {
+ public void flushAll(boolean skipDrf) {
flushAll(skipDrf, true/* doSync */);
}
- public final void flushAll(boolean skipDrf, boolean doSync) {
+ public void flushAll(boolean skipDrf, boolean doSync) {
try {
- // if (!skipDrf) {
- // @todo if skipDrf then only need to do drf if crf has flushable data
+ // TODO: if skipDrf then only need to do drf if crf has flushable data
flush(this.drf, doSync);
- // }
flush(this.crf, doSync);
} catch (IOException ex) {
getParent().getCancelCriterion().checkCancelInProgress(ex);
@@ -5346,13 +5239,13 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Since the ByteBuffer being writen to can have additional bytes which are used for
- * extending the size of the file, it is necessary that the ByteBuffer provided should have limit
- * which is set to the position till which it contains the actual bytes. If the mode is synched
- * write then only we will write up to the capacity & opLogSpace variable have any meaning. For
- * asynch mode it will be zero. Also this method must be synchronized on the file , whether we use
- * synch or asynch write because the fault in operations can clash with the asynch writing. Write
- * the specified bytes to the oplog. Note that since extending a file is expensive this code will
+ * Since the ByteBuffer being writen to can have additional bytes which are used for extending the
+ * size of the file, it is necessary that the ByteBuffer provided should have limit which is set
+ * to the position till which it contains the actual bytes. If the mode is synched write then only
+ * we will write up to the capacity & opLogSpace variable have any meaning. For asynch mode it
+ * will be zero. Also this method must be synchronized on the file , whether we use synch or
+ * asynch write because the fault in operations can clash with the asynch writing. Write the
+ * specified bytes to the oplog. Note that since extending a file is expensive this code will
* possibly write OPLOG_EXTEND_SIZE zero bytes to reduce the number of times the file is extended.
*
*
@@ -5368,7 +5261,7 @@ public final class Oplog implements CompactableOplog, Flushable {
Assert.assertTrue(false, "The Oplog " + this.oplogId + " for store " + getParent().getName()
+ " has been closed for synch mode while writing is going on. This should not happen");
}
- // Asif : It is assumed that the file pointer is already at the
+ // It is assumed that the file pointer is already at the
// appropriate position in the file so as to allow writing at the end.
// Any fault in operations will set the pointer back to the write
// location.
@@ -5457,10 +5350,9 @@ public final class Oplog implements CompactableOplog, Flushable {
// + " oplog #" + getOplogId(), this.owner);
// }
this.beingRead = true;
- final long readPosition = offsetInOplog;
if (/*
* !getParent().isSync() since compactor groups writes &&
- */(readPosition + valueLength) > this.crf.bytesFlushed && !this.closed) {
+ */(offsetInOplog + valueLength) > this.crf.bytesFlushed && !this.closed) {
flushAllNoSync(true); // fix for bug 41205
}
try {
@@ -5482,20 +5374,19 @@ public final class Oplog implements CompactableOplog, Flushable {
try {
final long writePosition =
(this.doneAppending) ? this.crf.bytesFlushed : myRAF.getFilePointer();
- if ((readPosition + valueLength) > writePosition) {
+ if ((offsetInOplog + valueLength) > writePosition) {
throw new DiskAccessException(
LocalizedStrings.Oplog_TRIED_TO_SEEK_TO_0_BUT_THE_FILE_LENGTH_IS_1_OPLOG_FILE_OBJECT_USED_FOR_READING_2
- .toLocalizedString(
- new Object[] {readPosition + valueLength, writePosition, this.crf.raf}),
+ .toLocalizedString(offsetInOplog + valueLength, writePosition, this.crf.raf),
dr.getName());
- } else if (readPosition < 0) {
+ } else if (offsetInOplog < 0) {
throw new DiskAccessException(
- LocalizedStrings.Oplog_CANNOT_FIND_RECORD_0_WHEN_READING_FROM_1.toLocalizedString(
- new Object[] {offsetInOplog, this.diskFile.getPath()}),
+ LocalizedStrings.Oplog_CANNOT_FIND_RECORD_0_WHEN_READING_FROM_1
+ .toLocalizedString(offsetInOplog, this.diskFile.getPath()),
dr.getName());
}
try {
- myRAF.seek(readPosition);
+ myRAF.seek(offsetInOplog);
this.stats.incOplogSeeks();
byte[] valueBytes = new byte[valueLength];
myRAF.readFully(valueBytes);
@@ -5543,7 +5434,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Extracts the Value byte array & UserBit from the OpLog
+ * Extracts the Value byte array & UserBit from the OpLog
*
* @param offsetInOplog The starting position from which to read the data in the opLog
* @param bitOnly boolean indicating whether the value needs to be extracted along with the
@@ -5574,7 +5465,7 @@ public final class Oplog implements CompactableOplog, Flushable {
try {
bb = attemptGet(dr, offsetInOplog, bitOnly, valueLength, userBits);
break;
- } catch (InterruptedIOException e) { // bug 39756
+ } catch (InterruptedIOException ignore) { // bug 39756
// ignore, we'll clear and retry.
} finally {
if (interrupted) {
@@ -5586,10 +5477,8 @@ public final class Oplog implements CompactableOplog, Flushable {
getParent().getCancelCriterion().checkCancelInProgress(ex);
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FROM_0_OPLOGID_1_OFFSET_BEING_READ_2_CURRENT_OPLOG_SIZE_3_ACTUAL_FILE_SIZE_4_IS_ASYNCH_MODE_5_IS_ASYNCH_WRITER_ALIVE_6
- .toLocalizedString(new Object[] {this.diskFile.getPath(),
- Long.valueOf(this.oplogId), Long.valueOf(offsetInOplog),
- Long.valueOf(this.crf.currSize), Long.valueOf(this.crf.bytesFlushed),
- Boolean.valueOf(!dr.isSync()), Boolean.valueOf(false)}),
+ .toLocalizedString(this.diskFile.getPath(), this.oplogId, offsetInOplog,
+ this.crf.currSize, this.crf.bytesFlushed, !dr.isSync(), Boolean.FALSE),
ex, dr.getName());
} catch (IllegalStateException ex) {
checkClosed();
@@ -5600,8 +5489,8 @@ public final class Oplog implements CompactableOplog, Flushable {
}
/**
- * Asif: Extracts the Value byte array & UserBit from the OpLog and inserts it in the wrapper
- * Object of type BytesAndBitsForCompactor which is passed
+ * Extracts the Value byte array & UserBit from the OpLog and inserts it in the wrapper Object of
+ * type BytesAndBitsForCompactor which is passed
*
* @param offsetInOplog The starting position from which to read the data in the opLog
* @param bitOnly boolean indicating whether the value needs to be extracted along with the
@@ -5635,10 +5524,9 @@ public final class Oplog implements CompactableOplog, Flushable {
} else {
try {
synchronized (this.lock/* crf */) {
- final long readPosition = offsetInOplog;
if (/*
* !getParent().isSync() since compactor groups writes &&
- */(readPosition + valueLength) > this.crf.bytesFlushed && !this.closed) {
+ */(offsetInOplog + valueLength) > this.crf.bytesFlushed && !this.closed) {
flushAllNoSync(true); // fix for bug 41205
}
if (!reopenFileIfClosed()) {
@@ -5646,25 +5534,19 @@ public final class Oplog implements CompactableOplog, Flushable {
}
final long writePosition =
(this.doneAppending) ? this.crf.bytesFlushed : this.crf.raf.getFilePointer();
- if ((readPosition + valueLength) > writePosition) {
+ if ((offsetInOplog + valueLength) > writePosition) {
throw new DiskAccessException(
LocalizedStrings.Oplog_TRIED_TO_SEEK_TO_0_BUT_THE_FILE_LENGTH_IS_1_OPLOG_FILE_OBJECT_USED_FOR_READING_2
- .toLocalizedString(
- new Object[] {readPosition + valueLength, writePosition, this.crf.raf}),
+ .toLocalizedString(offsetInOplog + valueLength, writePosition, this.crf.raf),
dr.getName());
- } else if (readPosition < 0) {
+ } else if (offsetInOplog < 0) {
throw new DiskAccessException(
- LocalizedStrings.Oplog_CANNOT_FIND_RECORD_0_WHEN_READING_FROM_1.toLocalizedString(
- new Object[] {Long.valueOf(offsetInOplog), this.diskFile.getPath()}),
+ LocalizedStrings.Oplog_CANNOT_FIND_RECORD_0_WHEN_READING_FROM_1
+ .toLocalizedString(offsetInOplog, this.diskFile.getPath()),
dr.getName());
}
- // if (this.closed || this.deleted.get()) {
- // throw new DiskAccessException("attempting get on "
- // + (this.deleted.get() ? "destroyed" : "closed")
- // + " oplog #" + getOplogId(), this.owner);
- // }
try {
- this.crf.raf.seek(readPosition);
+ this.crf.raf.seek(offsetInOplog);
this.stats.incOplogSeeks();
byte[] valueBytes = null;
if (wrapper.getBytes().length < valueLength) {
@@ -5694,14 +5576,8 @@ public final class Oplog implements CompactableOplog, Flushable {
getParent().getCancelCriterion().checkCancelInProgress(ex);
throw new DiskAccessException(
LocalizedStrings.Oplog_FAILED_READING_FROM_0_OPLOG_DETAILS_1_2_3_4_5_6
- .toLocalizedString(new Object[] {this.diskFile.getPath(),
- Long.valueOf(this.oplogId), Long.valueOf(offsetInOplog),
- Long.valueOf(this.crf.currSize), Long.valueOf(this.crf.bytesFlushed),
- Boolean.valueOf(/*
- * ! dr . isSync ( )
- *
- * @ todo
- */false), Boolean.valueOf(false)}),
+ .toLocalizedString(this.diskFile.getPath(), this.oplogId, offsetInOplog,
+ this.crf.currSize, this.crf.bytesFlushed, Boolean.FALSE, Boolean.FALSE),
ex, dr.getName());
} catch (IllegalStateException ex) {
@@ -5955,8 +5831,7 @@ public final class Oplog implements CompactableOplog, Flushable {
tlc = 0;
}
double rv = tlc;
- double rvHWM = rvHWMtmp;
- if (((rv / rvHWM) * 100) <= parent.getCompactionThreshold()) {
+ if (((rv / (double) rvHWMtmp) * 100) <= parent.getCompactionThreshold()) {
return true;
}
} else {
@@ -6057,7 +5932,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private GemFireCacheImpl getGemFireCache() {
+ private InternalCache getInternalCache() {
return getParent().getCache();
}
@@ -6135,7 +6010,7 @@ public final class Oplog implements CompactableOplog, Flushable {
return 0; // do this while holding compactorLock
}
- // Asif:Start with a fresh wrapper on every compaction so that
+ // Start with a fresh wrapper on every compaction so that
// if previous run used some high memory byte array which was
// exceptional, it gets garbage collected.
long opStart = getStats().getStatTime();
@@ -6198,7 +6073,7 @@ public final class Oplog implements CompactableOplog, Flushable {
totalCount++;
getStats().endCompactionUpdate(opStart);
opStart = getStats().getStatTime();
- // Asif: Check if the value byte array happens to be any of the
+ // Check if the value byte array happens to be any of the
// constant
// static byte arrays or references the value byte array of
// underlying RegionEntry.
@@ -6258,8 +6133,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* This method is called by the async value recovery task to recover the values from the crf if
* the keys were recovered from the krf.
- *
- * @param diskRecoveryStores
*/
public void recoverValuesIfNeeded(Map<Long, DiskRecoveryStore> diskRecoveryStores) {
// Early out if we start closing the parent.
@@ -6358,7 +6231,7 @@ public final class Oplog implements CompactableOplog, Flushable {
try {
DiskEntry.Helper.recoverValue(diskEntry, getOplogId(), diskRecoveryStore, in);
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// This region has been destroyed, stop recovering from it.
diskRecoveryStores.remove(diskRegionId);
}
@@ -6416,7 +6289,7 @@ public final class Oplog implements CompactableOplog, Flushable {
InternalDataSerializer.writeUnsignedVL(gcVersion, out);
}
} else {
- InternalDataSerializer.writeBoolean(dr.getRVVTrusted(), out);
+ DataSerializer.writeBoolean(dr.getRVVTrusted(), out);
// Otherwise, we will write the version and exception list for each
// member
Map<VersionSource, RegionVersionHolder> memberToVersion = rvv.getMemberToVersion();
@@ -6436,27 +6309,12 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
}
- byte[] rvvBytes = out.toByteArray();
- return rvvBytes;
+ return out.toByteArray();
}
- // // Comparable code //
- // public int compareTo(Oplog o) {
- // return getOplogId() - o.getOplogId();
- // }
- // public boolean equals(Object o) {
- // if (o instanceof Oplog) {
- // return compareTo((Oplog)o) == 0;
- // } else {
- // return false;
- // }
- // }
- // public int hashCode() {
- // return getOplogId();
- // }
@Override
public String toString() {
- return "oplog#" + getOplogId() /* + "DEBUG" + System.identityHashCode(this) */;
+ return "oplog#" + getOplogId();
}
/**
@@ -6471,10 +6329,6 @@ public final class Oplog implements CompactableOplog, Flushable {
return chPrev;
}
- // //////// Methods used during recovery //////////////
-
- // ////////////////////Inner Classes //////////////////////
-
private static class OplogFile {
public File f;
public UninterruptibleRandomAccessFile raf;
@@ -6500,25 +6354,16 @@ public final class Oplog implements CompactableOplog, Flushable {
}
private static String baToString(byte[] ba, int len) {
- if (ba == null)
+ if (ba == null) {
return "null";
- StringBuffer sb = new StringBuffer();
+ }
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++) {
sb.append(ba[i]).append(", ");
}
return sb.toString();
}
- private static String laToString(long[] la) {
- if (la == null)
- return "null";
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < la.length; i++) {
- sb.append(la[i]).append(", ");
- }
- return sb.toString();
- }
-
void serializeVersionTag(VersionHolder tag, DataOutput out) throws IOException {
int entryVersion = tag.getEntryVersion();
long regionVersion = tag.getRegionVersion();
@@ -6550,8 +6395,7 @@ public final class Oplog implements CompactableOplog, Flushable {
VersionSource versionMember, long timestamp, int dsId) throws IOException {
HeapDataOutputStream out = new HeapDataOutputStream(4 + 8 + 4 + 8 + 4, Version.CURRENT);
serializeVersionTag(entryVersion, regionVersion, versionMember, timestamp, dsId, out);
- byte[] versionsBytes = out.toByteArray();
- return versionsBytes;
+ return out.toByteArray();
}
private void serializeVersionTag(int entryVersion, long regionVersion,
@@ -6591,11 +6435,7 @@ public final class Oplog implements CompactableOplog, Flushable {
private byte[] versionsBytes;
private short gfversion;
- // private int entryVersion;
- // private long regionVersion;
- // private int memberId; // canonicalId of memberID
-
- public final int getSize() {
+ public int getSize() {
return this.size;
}
@@ -6606,17 +6446,16 @@ public final class Oplog implements CompactableOplog, Flushable {
return sb.toString();
}
- private final void write(OplogFile olf, ValueWrapper vw) throws IOException {
+ private void write(OplogFile olf, ValueWrapper vw) throws IOException {
vw.sendTo(olf.writeBuf, Oplog.this);
}
- private final void write(OplogFile olf, byte[] bytes, int byteLength) throws IOException {
+ private void write(OplogFile olf, byte[] bytes, int byteLength) throws IOException {
int offset = 0;
- final int maxOffset = byteLength;
ByteBuffer bb = olf.writeBuf;
- while (offset < maxOffset) {
+ while (offset < byteLength) {
- int bytesThisTime = maxOffset - offset;
+ int bytesThisTime = byteLength - offset;
boolean needsFlush = false;
if (bytesThisTime > bb.remaining()) {
needsFlush = true;
@@ -6630,7 +6469,7 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- private final void writeByte(OplogFile olf, byte v) throws IOException {
+ private void writeByte(OplogFile olf, byte v) throws IOException {
ByteBuffer bb = olf.writeBuf;
if (1 > bb.remaining()) {
flushNoSync(olf);
@@ -6638,7 +6477,7 @@ public final class Oplog implements CompactableOplog, Flushable {
bb.put(v);
}
- private final void writeOrdinal(OplogFile olf, short ordinal) throws IOException {
+ private void writeOrdinal(OplogFile olf, short ordinal) throws IOException {
ByteBuffer bb = olf.writeBuf;
if (3 > bb.remaining()) {
flushNoSync(olf);
@@ -6647,7 +6486,7 @@ public final class Oplog implements CompactableOplog, Flushable {
Version.writeOrdinal(bb, ordinal, false);
}
- private final void writeInt(OplogFile olf, int v) throws IOException {
+ private void writeInt(OplogFile olf, int v) throws IOException {
ByteBuffer bb = olf.writeBuf;
if (4 > bb.remaining()) {
flushNoSync(olf);
@@ -6655,7 +6494,7 @@ public final class Oplog implements CompactableOplog, Flushable {
bb.putInt(v);
}
- private final void writeLong(OplogFile olf, long v) throws IOException {
+ private void writeLong(OplogFile olf, long v) throws IOException {
ByteBuffer bb = olf.writeBuf;
if (8 > bb.remaining()) {
flushNoSync(olf);
@@ -7000,9 +6839,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* returns the number of entries cleared
- *
- * @param rvv
- * @param pendingKrfTags
*/
public synchronized int clear(RegionVersionVector rvv,
Map<DiskEntry, VersionHolder> pendingKrfTags) {
@@ -7022,8 +6858,6 @@ public final class Oplog implements CompactableOplog, Flushable {
/**
* Clear using an RVV. Remove live entries that are contained within the clear RVV.
- *
- * @param pendingKrfTags
*/
private int clearWithRVV(RegionVersionVector rvv, Map<DiskEntry, VersionTag> pendingKrfTags) {
// TODO this doesn't work, because we can end up removing entries from
@@ -7032,35 +6866,6 @@ public final class Oplog implements CompactableOplog, Flushable {
// behavior
// until I fix the region map code.
return 0;
- // int result = 0;
- // DiskEntry n = getNext();
- // while (n != this) {
- // DiskEntry nextEntry = n.getNext();
- // VersionSource member = null;
- // long version = -1;
- // if(pendingKrfTags != null) {
- // VersionTag tag = pendingKrfTags.get(n);
- // if(tag != null) {
- // member = tag.getMemberID();
- // version = tag.getRegionVersion();
- // }
- // }
- // if(member == null) {
- // VersionStamp stamp = n.getVersionStamp();
- // member = stamp.getMemberID();
- // version = stamp.getRegionVersion();
- // }
- //
- // if(rvv.contains(member, version)) {
- // result++;
- // remove(n);
- // if(pendingKrfTags != null) {
- // pendingKrfTags.remove(n);
- // }
- // }
- // n = nextEntry;
- // }
- // return result;
}
/**
@@ -7126,23 +6931,6 @@ public final class Oplog implements CompactableOplog, Flushable {
}
}
- // private synchronized void checkForDuplicate(DiskEntry v) {
- // DiskEntry de = getPrev();
- // final long newKeyId = v.getDiskId().getKeyId();
- // while (de != this) {
- // if (de.getDiskId().getKeyId() == newKeyId) {
- // throw new IllegalStateException(
- // "DEBUG: found duplicate for oplogKeyId=" + newKeyId + " de="
- // + System.identityHashCode(v) + " ode="
- // + System.identityHashCode(de) + " deKey=" + v.getKey()
- // + " odeKey=" + de.getKey() + " deOffset="
- // + v.getDiskId().getOffsetInOplog() + " odeOffset="
- // + de.getDiskId().getOffsetInOplog());
- // }
- // de = de.getPrev();
- // }
- // }
-
@Override
public Object getKey() {
throw new IllegalStateException();
@@ -7213,7 +7001,6 @@ public final class Oplog implements CompactableOplog, Flushable {
* @param liveEntries the array to fill with the live entries
* @param idx the first free slot in liveEntries
* @param drv the disk region these entries are on
- * @param pendingKrfTags
* @return the next free slot in liveEntries
*/
public synchronized int addLiveEntriesToList(KRFEntry[] liveEntries, int idx,
@@ -7596,11 +7383,11 @@ public final class Oplog implements CompactableOplog, Flushable {
public abstract long clear(RegionVersionVector rvv);
- final public DiskRegionView getDiskRegion() {
+ public DiskRegionView getDiskRegion() {
return this.dr;
}
- final public void setDiskRegion(DiskRegionView dr) {
+ public void setDiskRegion(DiskRegionView dr) {
this.dr = dr;
}
@@ -7613,11 +7400,11 @@ public final class Oplog implements CompactableOplog, Flushable {
return result;
}
- final synchronized public boolean getUnrecovered() {
+ synchronized public boolean getUnrecovered() {
return this.unrecovered;
}
- final synchronized public boolean testAndSetRecovered(DiskRegionView dr) {
+ synchronized public boolean testAndSetRecovered(DiskRegionView dr) {
boolean result = this.unrecovered;
if (result) {
this.unrecovered = false;
@@ -7772,9 +7559,8 @@ public final class Oplog implements CompactableOplog, Flushable {
public int addLiveEntriesToList(KRFEntry[] liveEntries, int idx) {
synchronized (liveEntries) {
- int result = this.liveEntries.addLiveEntriesToList(liveEntries, idx, getDiskRegion(),
+ return this.liveEntries.addLiveEntriesToList(liveEntries, idx, getDiskRegion(),
pendingKrfTags);
- return result;
}
}
@@ -7815,8 +7601,10 @@ public final class Oplog implements CompactableOplog, Flushable {
* range.
*/
static class OplogEntryIdMap {
+
private final Int2ObjectOpenHashMap ints =
new Int2ObjectOpenHashMap((int) DiskStoreImpl.INVALID_ID);
+
private final Long2ObjectOpenHashMap longs =
new Long2ObjectOpenHashMap((int) DiskStoreImpl.INVALID_ID);
[32/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIn.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIn.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIn.java
index 0aa1efb..db2c65b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIn.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIn.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.query.internal;
import java.lang.reflect.Array;
@@ -50,13 +49,6 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.pdx.internal.PdxString;
-/**
- * Class Description
- *
- * @version $Revision: 1.1 $
- */
-
-
public class CompiledIn extends AbstractCompiledValue implements Indexable {
private static final Logger logger = LogService.getLogger();
@@ -80,7 +72,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
return LITERAL_in;
}
- /*
+ /**
* We retrieve the collection from the context cache if it exists This allows us to not have to
* reevaluate the sub query on every iteration. This improves performance for queries such as
* "select * from /receipts r where r.type = 'large' and r.id in (select c.id from /customers c
@@ -118,7 +110,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
}
if (evalColln instanceof Collection) {
- Iterator iterator = ((Collection) evalColln).iterator();
+ Iterator iterator = ((Iterable) evalColln).iterator();
while (iterator.hasNext()) {
Object evalObj = evalElm;
Object collnObj = iterator.next();
@@ -158,15 +150,16 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
return Boolean.FALSE;
}
- // Asif: If the size of aray is two this implies that it is
- // a relation ship index & so the key field will be null in both the indexes
- // as key is not a meaningful entity. The 0th element will refer to LHS
- // operand
- // and 1th element will refer to RHS operannd
+ /**
+ * If the size of aray is two this implies that it is a relation ship index & so the key field
+ * will be null in both the indexes as key is not a meaningful entity. The 0th element will refer
+ * to LHS operand and 1th element will refer to RHS operannd
+ */
public IndexInfo[] getIndexInfo(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException {
IndexInfo[] indexInfo = privGetIndexInfo(context);
if (indexInfo != null) {
+ // TODO: == check is identity only
if (indexInfo == NO_INDEXES_IDENTIFIER) {
return null;
} else {
@@ -189,7 +182,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
if (index != null && index.isValid()) {
newIndexInfo = new IndexInfo[1];
newIndexInfo[0] = new IndexInfo(indexKey, path, index, indexData.getMatchLevel(),
- indexData.getMapping(), this.TOK_EQ);
+ indexData.getMapping(), TOK_EQ);
}
}
if (newIndexInfo != null) {
@@ -200,9 +193,9 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
return newIndexInfo;
}
-
- // _indexInfo is a transient field
- // if this is just faulted in then can be null
+ /**
+ * _indexInfo is a transient field if this is just faulted in then can be null
+ */
private IndexInfo[] privGetIndexInfo(ExecutionContext context) {
return (IndexInfo[]) context.cacheGet(this);
}
@@ -211,7 +204,9 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
context.cachePut(this, indexInfo);
}
- // Invariant: the receiver is dependent on the current iterator.
+ /**
+ * Invariant: the receiver is dependent on the current iterator.
+ */
protected PlanInfo protGetPlanInfo(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException {
PlanInfo result = new PlanInfo();
@@ -342,8 +337,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
*/
private PathAndKey getPathAndKey(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException {
- // RuntimeIterator lIter = context.findRuntimeIterator(_left);
- // RuntimeIterator rIter = context.findRuntimeIterator(_right);
+
boolean isLeftDependent = context.isDependentOnCurrentScope(this.elm);
boolean isRightDependent = context.isDependentOnCurrentScope(this.colln);
if (!isLeftDependent || isRightDependent)
@@ -352,15 +346,14 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
CompiledValue path;
path = this.elm;
indexKey = this.colln;
- // Asif Do not worry about the nature of the collection. As long as it
+ // Do not worry about the nature of the collection. As long as it
// is not dependent on the current scope we should be fine
return new PathAndKey(path, indexKey);
}
-
/**
- * Asif : Evaluates as a filter taking advantage of indexes if appropriate. This function has a
+ * Evaluates as a filter taking advantage of indexes if appropriate. This function has a
* meaningful implementation only in CompiledComparison & CompiledUndefined . It is unsupported in
* other classes. The additional parameters which it takes are a boolean which is used to indicate
* whether the index result set needs to be expanded to the top level or not. The second is a
@@ -378,10 +371,9 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
QueryInvocationTargetException {
// see if we're dependent on the current iterator
// if not let super handle it
- // RuntimeIterator itr = context.getCurrentIterator();
- // Support.Assert(itr != null);
- if (!isDependentOnCurrentScope(context))
+ if (!isDependentOnCurrentScope(context)) {
return super.filterEvaluate(context, intermediateResults);
+ }
IndexInfo[] idxInfo = getIndexInfo(context);
Support.Assert(idxInfo != null,
"a comparison that is dependent, not indexed, and filter evaluated is not possible");
@@ -396,15 +388,6 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
return TOK_EQ;
}
- /**
- * **************** PRIVATE METHODS **************************
- *
- * @throws QueryInvocationTargetException
- * @throws NameResolutionException
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- */
-
private void queryIndex(Object key, IndexInfo indexInfo, SelectResults results,
CompiledValue iterOperands, RuntimeIterator[] indpndntItrs, ExecutionContext context,
List projAttrib, boolean conditioningNeeded) throws TypeMismatchException,
@@ -419,17 +402,14 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
indexInfo._getIndex(), 0, null, indexInfo._operator());
context.cachePut(CompiledValue.INDEX_INFO, contextIndexInfo);
indexInfo._index.query(key, TOK_EQ, results, !conditioningNeeded ? iterOperands : null,
- indpndntItrs == null ? null : indpndntItrs[0], context, projAttrib, null, false); // is
- // Intersection
-
-
-
+ indpndntItrs == null ? null : indpndntItrs[0], context, projAttrib, null, false);
}
/**
* evaluate as a filter, involving a single iterator. Use an index if possible.
+ *
+ * Invariant: the receiver is dependent on the current iterator.
*/
- // Invariant: the receiver is dependent on the current iterator.
private SelectResults singleBaseCollectionFilterEvaluate(ExecutionContext context,
SelectResults intermediateResults, boolean completeExpansionNeeded,
CompiledValue iterOperands, IndexInfo indexInfo, RuntimeIterator[] indpndntItr,
@@ -447,14 +427,14 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
boolean useLinkedDataStructure = false;
boolean nullValuesAtStart = true;
Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
- if (orderByClause != null && orderByClause.booleanValue()) {
+ if (orderByClause != null && orderByClause) {
List orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
useLinkedDataStructure = orderByAttrs.size() == 1;
nullValuesAtStart = !((CompiledSortCriterion) orderByAttrs.get(0)).getCriterion();
}
List projAttrib = null;
- // ////////////////////////////////////////////////////////////////
+
ObjectType projResultType = null;
if (!conditioningNeeded) {
projResultType = evalProj ? (ObjectType) context.cacheGet(RESULT_TYPE) : null;
@@ -537,7 +517,6 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
}
}
-
QueryObserver observer = QueryObserverHolder.getInstance();
try {
Object evalColln = evaluateColln(context);
@@ -568,7 +547,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
// key in the [1]
// and the evalColln in the [0] position
if (key instanceof Object[]) {
- Iterator iterator = ((ResultsSet) ((Object[]) key)[0]).iterator();
+ Iterator iterator = ((Iterable) ((Object[]) key)[0]).iterator();
while (iterator.hasNext()) {
this.queryIndex(new Object[] {iterator.next(), ((Object[]) key)[1]}, indexInfo, results,
iterOperands, indpndntItr, context, projAttrib, conditioningNeeded);
@@ -597,48 +576,48 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
} else if (evalColln instanceof long[]) {
long[] a = (long[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(Long.valueOf(a[i]), indexInfo, results, iterOperands, indpndntItr,
- context, projAttrib, conditioningNeeded);
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
+ projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof double[]) {
double[] a = (double[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(Double.valueOf(a[i]), indexInfo, results, iterOperands, indpndntItr,
- context, projAttrib, conditioningNeeded);
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
+ projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof float[]) {
float[] a = (float[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(new Float(a[i]), indexInfo, results, iterOperands, indpndntItr, context,
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof int[]) {
int[] a = (int[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(Integer.valueOf(a[i]), indexInfo, results, iterOperands, indpndntItr,
- context, projAttrib, conditioningNeeded);
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
+ projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof short[]) {
short[] a = (short[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(new Short(a[i]), indexInfo, results, iterOperands, indpndntItr, context,
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof char[]) {
char[] a = (char[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(new Character(a[i]), indexInfo, results, iterOperands, indpndntItr,
- context, projAttrib, conditioningNeeded);
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
+ projAttrib, conditioningNeeded);
}
} else if (evalColln instanceof byte[]) {
byte[] a = (byte[]) evalColln;
for (int i = 0; i < a.length; i++) {
- this.queryIndex(new Byte(a[i]), indexInfo, results, iterOperands, indpndntItr, context,
+ this.queryIndex(a[i], indexInfo, results, iterOperands, indpndntItr, context,
projAttrib, conditioningNeeded);
}
@@ -646,12 +625,11 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
throw new TypeMismatchException(
"Operand of IN cannot be interpreted as a Comparable Object. Operand is of type ="
+ evalColln.getClass());
-
}
}
if (conditioningNeeded) {
- results = QueryUtils.getconditionedIndexResults(results, indexInfo, context,
+ results = QueryUtils.getConditionedIndexResults(results, indexInfo, context,
indexFieldsSize, completeExpansionNeeded, iterOperands, indpndntItr);
} else {
if (isIntersection && intermediateResults != null) {
@@ -662,7 +640,6 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
} finally {
observer.afterIndexLookup(results);
}
-
}
public boolean isProjectionEvaluationAPossibility(ExecutionContext context) {
@@ -702,15 +679,13 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
}
conditioningNeeded = ich == null || ich.shufflingNeeded;
return conditioningNeeded;
-
}
-
/**
* evaluate as a filter, producing an intermediate result set. This may require iteration if there
- * is no index available. Asif :The booelan true implies that CompiledComparsion when existing on
- * its own always requires a Completeexpansion to top level iterators. This flag can get toggled
- * to false only from inside a GroupJunction
+ * is no index available. The boolean true implies that CompiledComparison when existing on its
+ * own always requires a CompleteExpansion to top level iterators. This flag can get toggled to
+ * false only from inside a GroupJunction
*
* @param intermediateResults if this parameter is provided, and we have to iterate, then iterate
* over this result set instead of the entire base collection.
@@ -718,7 +693,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
public SelectResults filterEvaluate(ExecutionContext context, SelectResults intermediateResults)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- // Asif : This function can be invoked only if the where clause contains
+ // This function can be invoked only if the where clause contains
// a single condition which is CompiledComparison.
// If a CompiledComparison exists inside a GroupJunction, then it will
// always
@@ -738,25 +713,22 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
indpndntItr = (RuntimeIterator) rntmItrs.iterator().next();
}
- return filterEvaluate(context, intermediateResults, true/*
- * Complete Expansion needed
- */, null,
- indpndntItr != null ? new RuntimeIterator[] {indpndntItr}
- : null/*
- * Asif :It is safe to pass null as the independent iterator to which the
- * condition belongs is required only if boolean complete expansion turns out to
- * be false, which can happen only in case of CompiledComparison/CompiledUndefined
- * called from roupJunction or CompositeGroupJunction
- */,
- true /* is intersection */, this.isConditioningNeededForIndex(indpndntItr, context, true),
- true);
+ /*
+ * It is safe to pass null as the independent iterator to which the condition belongs is
+ * required only if boolean complete expansion turns out to be false, which can happen only in
+ * case of CompiledComparison/CompiledUndefined called from GroupJunction or
+ * CompositeGroupJunction
+ */
+ return filterEvaluate(context, intermediateResults, true, null,
+ indpndntItr != null ? new RuntimeIterator[] {indpndntItr} : null, true,
+ this.isConditioningNeededForIndex(indpndntItr, context, true), true);
}
- /*
- * Asif : This function should never get invoked as now if a CompiledJunction or GroupJunction
- * contains a single filterable CompiledComparison it should directly call filterEvaluate rather
- * than auxFilterEvalutae. Overriding this function just for ensuring that auxFilterEvaluate is
- * not being called by mistake.
+ /**
+ * This function should never get invoked as now if a CompiledJunction or GroupJunction contains a
+ * single filterable CompiledComparison it should directly call filterEvaluate rather than
+ * auxFilterEvalutae. Overriding this function just for ensuring that auxFilterEvaluate is not
+ * being called by mistake.
*/
public SelectResults auxFilterEvaluate(ExecutionContext context,
SelectResults intermediateResults) throws FunctionDomainException, TypeMismatchException,
@@ -787,7 +759,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
isThisBetter = thisSize < thatSize;
break;
case LITERAL_and:
- // Asif: Give preference to IN . Is this right? It does not appear . Ideally we need to get
+ // Give preference to IN . Is this right? It does not appear . Ideally we need to get
// some estimate on Range. This case is possible only in case of RangeJunction
break;
case TOK_LE:
@@ -807,15 +779,15 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
IndexInfo[] idxInfo = getIndexInfo(context);
if (idxInfo == null) {
- // Asif: This implies it is an independent condition. So evaluate it first
- // in filter operand
+ // This implies it is an independent condition. So evaluate it first in filter operand
return 0;
}
assert idxInfo.length == 1;
Object key = idxInfo[0].evaluateIndexKey(context);
- if (key != null && key.equals(QueryService.UNDEFINED))
+ if (key != null && key.equals(QueryService.UNDEFINED)) {
return 0;
+ }
if (context instanceof QueryExecutionContext) {
QueryExecutionContext qcontext = (QueryExecutionContext) context;
@@ -862,67 +834,58 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
} else if (evalColln instanceof long[]) {
long[] a = (long[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size +=
- idxInfo[0]._index.getSizeEstimate(Long.valueOf(a[i]), TOK_EQ, idxInfo[0]._matchLevel);
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof double[]) {
double[] a = (double[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size += idxInfo[0]._index.getSizeEstimate(Double.valueOf(a[i]), TOK_EQ,
- idxInfo[0]._matchLevel);
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof float[]) {
float[] a = (float[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size +=
- idxInfo[0]._index.getSizeEstimate(new Float(a[i]), TOK_EQ, idxInfo[0]._matchLevel);
-
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof int[]) {
int[] a = (int[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size += idxInfo[0]._index.getSizeEstimate(Integer.valueOf(a[i]), TOK_EQ,
- idxInfo[0]._matchLevel);
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof short[]) {
short[] a = (short[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size +=
- idxInfo[0]._index.getSizeEstimate(new Short(a[i]), TOK_EQ, idxInfo[0]._matchLevel);
-
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof char[]) {
char[] a = (char[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size += idxInfo[0]._index.getSizeEstimate(new Character(a[i]), TOK_EQ,
- idxInfo[0]._matchLevel);
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else if (evalColln instanceof byte[]) {
byte[] a = (byte[]) evalColln;
for (int i = 0; i < a.length; i++) {
- size += idxInfo[0]._index.getSizeEstimate(new Byte(a[i]), TOK_EQ, idxInfo[0]._matchLevel);
-
+ size += idxInfo[0]._index.getSizeEstimate(a[i], TOK_EQ, idxInfo[0]._matchLevel);
}
} else {
throw new TypeMismatchException(
"Operand of IN cannot be interpreted as a Comparable Object. Operand is of type ="
+ evalColln.getClass());
-
}
}
return size;
-
}
+ public boolean isRangeEvaluatable() {
+ return false;
+ }
- /* Inner classes for passing stuff around */
- class PathAndKey {
+ static class PathAndKey {
CompiledValue _path;
CompiledValue _key;
@@ -932,10 +895,4 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
_key = indexKey;
}
}
-
-
- public boolean isRangeEvaluatable() {
- return false;
- }
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIndexOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIndexOperation.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIndexOperation.java
index e06937a..f480ebf 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIndexOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIndexOperation.java
@@ -142,7 +142,7 @@ public class CompiledIndexOperation extends AbstractCompiledValue implements Map
// Asif :Function for generating canonicalized expression
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// Asif: The canonicalization of Index operator will be of
// the form IterX.getPositions[IterY.a.b.c]
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIteratorDef.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIteratorDef.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIteratorDef.java
index c19bab3..872614d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIteratorDef.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledIteratorDef.java
@@ -14,20 +14,34 @@
*/
package org.apache.geode.cache.query.internal;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.cache.*;
-import org.apache.geode.cache.query.*;
-import org.apache.geode.cache.query.internal.parse.*;
-import org.apache.geode.cache.query.types.*;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.AmbiguousNameException;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.QueryExecutionTimeoutException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.RegionNotFoundException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
import org.apache.geode.cache.query.internal.types.TypeUtils;
+import org.apache.geode.cache.query.types.CollectionType;
+import org.apache.geode.cache.query.types.MapType;
+import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-/**
- */
public class CompiledIteratorDef extends AbstractCompiledValue {
private static final Logger logger = LogService.getLogger();
@@ -83,17 +97,16 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
}
}
rIter = new RuntimeIterator(this, type);
- // Rahul : generate from clause should take care of bucket region substitution if
+ // generate from clause should take care of bucket region substitution if
// necessary and then set the definition.
String fromClause = genFromClause(context);
rIter.setDefinition(fromClause);
- /**
- * Asif : If the type of RunTimeIterator is still ObjectType & if the RuneTimeIterator is
- * independent of any iterator of the scopes less than or equal to its own scope, we can
- * evaluate the collection via RuntimeIterator. This will initialize the Collection of
- * RuntimeIterator , which is OK. The code in RuntimeIterator will be rectified such that the
- * ElementType of that RuntimeIterator is taken from the collection
- *
+ /*
+ * If the type of RunTimeIterator is still ObjectType & if the RuneTimeIterator is independent
+ * of any iterator of the scopes less than or equal to its own scope, we can evaluate the
+ * collection via RuntimeIterator. This will initialize the Collection of RuntimeIterator ,
+ * which is OK. The code in RuntimeIterator will be rectified such that the ElementType of that
+ * RuntimeIterator is taken from the collection
*/
if (type.equals(TypeUtils.OBJECT_TYPE)
&& !this.isDependentOnAnyIteratorOfScopeLessThanItsOwn(context)) {
@@ -174,8 +187,7 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
// PR bucketRegion substitution should have already happened
// at the expression evaluation level
- SelectResults sr = prepareIteratorDef(coll, this.elementType, context);
- return sr;
+ return prepareIteratorDef(coll, this.elementType, context);
}
public int getType() {
@@ -200,22 +212,11 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
}
/**
- * TODO:Asif : We need to implement the belwo method of computeDependencies Once we come to
- * implement changes for partitioned region querying, as in that case if first iterator itself is
- * a Select Query , then ideally we cannot call that CompiledIteratorDef independent ( which will
- * be the case at present). When we use this commented function we will also need to take care of
+ * TODO: We need to implement the belwo method of computeDependencies Once we come to implement
+ * changes for partitioned region querying, as in that case if first iterator itself is a Select
+ * Query , then ideally we cannot call that CompiledIteratorDef independent ( which will be the
+ * case at present). When we use this commented function we will also need to take care of
* correctly implementing the function isDependentOnCurrentScope etc functions.
- *
- * public Set computeDependencies(ExecutionContext context) throws TypeMismatchException,
- * AmbiguousNameException { //Asif : If a CompiledIteratorDef has a collection expression which
- * boils down to //a CompiledRegion or CompiledBindArgumnet , then its dependency is empty . In
- * such cases // we will assume that the current CompiledIteratorDef has a dependency on itself.
- * // This will be required once we start the changes for partitionedRegion Querying //But when we
- * are doing check of whether the CompiledIteratorDef is dependent on its // own RuntimeIterator
- * we will still return false. Set set = this.collectionExpr.computeDependencies(context); Set
- * retSet = null; if(set.isEmpty()){ retSet =
- * context.addDependency(this,this.getRuntimeIterator(context)); }else { retSet =
- * context.addDependencies(this, set); } return retSet; }
*/
@Override
public Set computeDependencies(ExecutionContext context)
@@ -223,7 +224,7 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
return context.addDependencies(this, this.collectionExpr.computeDependencies(context));
}
- // @todo ericz this method is overly complex, duplicating logic already
+ // TODO: this method is overly complex, duplicating logic already
// in query evaluation itself. It is overly complex ==> It will not be
// necessary once we have full typing support.
// There is a limitation here that it assumes that the collectionExpr is some
@@ -296,7 +297,7 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
res.setModifiable(false);
return res;
}
- // @todo primitive arrays?
+ // TODO: primitive arrays?
if (obj instanceof Map) {
if (elementType.equals(TypeUtils.OBJECT_TYPE)) { // if we don't have more
// specific type info,
@@ -325,29 +326,22 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
String genFromClause(ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
- StringBuffer sbuff = new StringBuffer();
+ StringBuilder sbuff = new StringBuilder();
collectionExpr.generateCanonicalizedExpression(sbuff, context);
return sbuff.toString();
}
- boolean isDependentOnAnyIterator(ExecutionContext context) {
- return context.isDependentOnAnyIterator(this);
- }
-
/**
* Checks if the iterator in question is dependent on any other RuntimeIterator of its own or
* lesser scope.
- *
- * @param context
*/
boolean isDependentOnAnyIteratorOfScopeLessThanItsOwn(ExecutionContext context) {
- // Asif : Get the list of all iterators on which the colelction expression
+ // Get the list of all iterators on which the colelction expression
// is ultimately dependent on
- // Set indpRitrs = new HashSet();
- // context.computeUtlimateDependencies(this, indpRitrs);
- // Asif:If dependent on self then also assume it to be dependent
+
+ // If dependent on self then also assume it to be dependent
boolean isDep = false;
- // Asif : Get the list of all iterators on which the colelction expression
+ // Get the list of all iterators on which the colelction expression
// is dependent on
Set dependencySet = context.getDependencySet(this, true);
Iterator itr = dependencySet.iterator();
@@ -360,6 +354,5 @@ public class CompiledIteratorDef extends AbstractCompiledValue {
}
}
return isDep;
-
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
index fc4a843..4930aed 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
@@ -16,6 +16,8 @@ package org.apache.geode.cache.query.internal;
import java.util.regex.Pattern;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.query.AmbiguousNameException;
import org.apache.geode.cache.query.FunctionDomainException;
import org.apache.geode.cache.query.NameResolutionException;
@@ -27,43 +29,40 @@ import org.apache.geode.cache.query.internal.index.IndexManager;
import org.apache.geode.cache.query.internal.index.IndexProtocol;
import org.apache.geode.cache.query.internal.index.PrimaryKeyIndex;
import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.pdx.internal.PdxString;
-/**
- *
- *
- */
public class CompiledLike extends CompiledComparison {
- final static int WILDCARD_PERCENT = 0;
+ private static final Logger logger = LogService.getLogger();
- final static int WILDCARD_UNDERSCORE = 1;
+ private static final int WILDCARD_PERCENT = 0;
- private Object wildcardTypeKey = new Object();
+ private static final int WILDCARD_UNDERSCORE = 1;
- private Object wildcardPositionKey = new Object();
+ private final Object wildcardTypeKey = new Object();
- private Object patternLengthKey = new Object();
+ private final Object wildcardPositionKey = new Object();
- final static String LOWEST_STRING = "";
+ private final Object patternLengthKey = new Object();
- final static char BOUNDARY_CHAR = (char) 255;
+ static final String LOWEST_STRING = "";
- final static char UNDERSCORE = '_';
+ private static final char BOUNDARY_CHAR = (char) 255;
- final static char PERCENT = '%';
+ private static final char UNDERSCORE = '_';
- final static char BACKSLASH = '\\';
+ private static final char PERCENT = '%';
+
+ private static final char BACKSLASH = '\\';
private final CompiledValue var;
- private Object isIndexEvaluatedKey = new Object();
+ private final Object isIndexEvaluatedKey = new Object();
- // private final CompiledBindArgument bindArg;
private final CompiledValue bindArg;
- public CompiledLike(CompiledValue var, CompiledValue pattern) {
+ CompiledLike(CompiledValue var, CompiledValue pattern) {
super(var, pattern, OQLLexerTokenTypes.TOK_EQ);
this.var = var;
this.bindArg = pattern;
@@ -122,13 +121,7 @@ public class CompiledLike extends CompiledComparison {
/**
* Expands the CompiledLike operands based on sargability into multiple CompiledComparisons
*
- * @param context
* @return The generated CompiledComparisons
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws FunctionDomainException
- * @throws QueryInvocationTargetException
*/
CompiledComparison[] getExpandedOperandsWithIndexInfoSetIfAny(ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException,
@@ -159,9 +152,8 @@ public class CompiledLike extends CompiledComparison {
}
}
if (IndexManager.testHook != null) {
- if (GemFireCacheImpl.getInstance().getLogger().fineEnabled()) {
- GemFireCacheImpl.getInstance().getLogger()
- .fine("IndexManager TestHook is set in getExpandedOperandsWithIndexInfoSetIfAny.");
+ if (logger.isDebugEnabled()) {
+ logger.debug("IndexManager TestHook is set in getExpandedOperandsWithIndexInfoSetIfAny.");
}
IndexManager.testHook.hook(12);
}
@@ -199,13 +191,10 @@ public class CompiledLike extends CompiledComparison {
return result;
}
-
/**
* Breaks down the like predicate (if sargable) into 2 or 3 CompiledComparisons based on the
* presence of wildcard
*
- * @param var
- * @param pattern
* @return The generated CompiledComparisons
*/
CompiledComparison[] getRangeIfSargable(ExecutionContext context, CompiledValue var,
@@ -285,7 +274,7 @@ public class CompiledLike extends CompiledComparison {
}
private String getRegexPattern(String pattern) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean prevMetaChar = false;
int len = pattern.length();
@@ -376,7 +365,6 @@ public class CompiledLike extends CompiledComparison {
* Checks if index can be used for Strings with wildcards. Two wild cards are supported % and _.
* The wildcard could be at any index position of the string.
*
- * @param buffer
* @return position of wildcard if sargable otherwise -1
*/
int checkIfSargableAndRemoveEscapeChars(ExecutionContext context, StringBuffer buffer) {
@@ -405,22 +393,6 @@ public class CompiledLike extends CompiledComparison {
return wildcardPosition;
}
- /*
- * @Override public Object evaluate(ExecutionContext context) throws FunctionDomainException,
- * TypeMismatchException, NameResolutionException, QueryInvocationTargetException { CompiledValue
- * iterEvaluator = (CompiledValue)context.cacheGet(this.bindArg); if(iterEvaluator == null) {
- * String pattern = (String)this.bindArg.evaluate(context); CompiledComparison[] cvs =
- * getRangeIfSargable(this.var, pattern);
- *
- * for (CompiledComparison cp : cvs) { cp.computeDependencies(context);
- *
- * } if(cvs.length ==2 ) { iterEvaluator = new CompiledJunction(cvs,
- * OQLLexerTokenTypes.LITERAL_and); }else { iterEvaluator = cvs[0]; }
- * context.cachePut(this.bindArg, iterEvaluator);
- *
- * } return iterEvaluator.evaluate(context); }
- */
-
@Override
public Object evaluate(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
@@ -436,8 +408,6 @@ public class CompiledLike extends CompiledComparison {
"Null values are not supported with LIKE predicate.");
}
pattern = Pattern.compile(getRegexPattern(strPattern), Pattern.MULTILINE | Pattern.DOTALL);
- // GemFireCacheImpl.getInstance().getLogger().fine("### DEBUG : string :" + strPattern + "
- // pattern :" + pattern.toString());
context.cachePut(this.bindArg, pattern);
}
Object value = this.var.evaluate(context);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLiteral.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLiteral.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLiteral.java
index 673660c..32c5c4d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLiteral.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLiteral.java
@@ -57,7 +57,7 @@ public class CompiledLiteral extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException {
if (_obj == null) {
clauseBuffer.insert(0, "null");
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledNegation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledNegation.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledNegation.java
index 3673b9f..0bb8673 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledNegation.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledNegation.java
@@ -65,7 +65,7 @@ public class CompiledNegation extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
clauseBuffer.insert(0, ')');
_value.generateCanonicalizedExpression(clauseBuffer, context);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledOperation.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledOperation.java
index f556f2f..e544d8c 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledOperation.java
@@ -289,7 +289,7 @@ public class CompiledOperation extends AbstractCompiledValue {
// Asif :Function for generating from clause
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// Asif: if the method name starts with getABC & argument list is empty
// then canonicalize it to aBC
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledPath.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledPath.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledPath.java
index 2c2bc4a..ec7a84a 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledPath.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledPath.java
@@ -156,7 +156,7 @@ public class CompiledPath extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
// Asif: Canonicalize the tail ID. If the tail ID contains
// something like getX ,convert it into x.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledRegion.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledRegion.java
index d463d28..83228f3 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledRegion.java
@@ -19,7 +19,6 @@ import org.apache.geode.cache.*;
import org.apache.geode.cache.query.*;
import org.apache.geode.cache.Region;
import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.LocalDataSet;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -94,7 +93,7 @@ public class CompiledRegion extends AbstractCompiledValue {
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws NameResolutionException {
clauseBuffer.insert(0, regionPath);
// rahul : changed for running queries on partitioned region.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java
index 9b77557..b6d6842 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java
@@ -45,15 +45,11 @@ import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.cache.query.types.CollectionType;
import org.apache.geode.cache.query.types.ObjectType;
import org.apache.geode.cache.query.types.StructType;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.internal.PdxString;
-/**
- * Class Description
- *
- * @version $Revision: 1.2 $
- */
public class CompiledSelect extends AbstractCompiledValue {
protected List<CompiledSortCriterion> orderByAttrs; // order by attributes: list of CompiledValue
@@ -63,9 +59,9 @@ public class CompiledSelect extends AbstractCompiledValue {
// 0 is projection name, 1 is the CompiledValue for the expression
private boolean distinct;
private boolean count;
- // Asif: limits the SelectResults by the number specified.
+ // limits the SelectResults by the number specified.
private CompiledValue limit;
- // Shobhit: counts the no of results satisfying where condition for
+ // counts the no of results satisfying where condition for
// count(*) non-distinct queries where no indexes are used.
private int countStartQueryResult = 0;
@@ -177,7 +173,7 @@ public class CompiledSelect extends AbstractCompiledValue {
public Set computeDependencies(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException {
// bind iterators in new scope in order to determine dependencies
- context.cachePut(scopeID, context.assosciateScopeID());
+ context.cachePut(scopeID, context.associateScopeID());
context.newScope((Integer) context.cacheGet(scopeID));
context.pushExecCache((Integer) context.cacheGet(scopeID));
try {
@@ -240,11 +236,6 @@ public class CompiledSelect extends AbstractCompiledValue {
/**
* Transforms the group by clause into distinct order by clause, if possible
- *
- * @param context
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
- * @throws NameResolutionException
*/
private void transformGroupByIfPossible(ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
@@ -268,8 +259,8 @@ public class CompiledSelect extends AbstractCompiledValue {
}
boolean shouldTransform = true;
- StringBuffer lhsBuffer = new StringBuffer();
- StringBuffer rhsBuffer = new StringBuffer();
+ StringBuilder lhsBuffer = new StringBuilder();
+ StringBuilder rhsBuffer = new StringBuilder();
outer: for (int i = 0; i < projAttribs.size(); ++i) {
Object[] prj = (Object[]) TypeUtils.checkCast(projAttribs.get(i), Object[].class);
@@ -336,7 +327,7 @@ public class CompiledSelect extends AbstractCompiledValue {
while (iter.hasNext()) {
CompiledSortCriterion csc = iter.next();
- // Asif: Ideally for replicated regions, the requirement that
+ // Ideally for replicated regions, the requirement that
// projected columns should
// contain order by fields ( directly or derivable on it),
// is not needed. But for PR , the query gathers only projected
@@ -354,9 +345,8 @@ public class CompiledSelect extends AbstractCompiledValue {
}
}
-
private void evalCanonicalizedExpressionForCSC(CompiledSortCriterion csc,
- ExecutionContext context, StringBuffer buffer)
+ ExecutionContext context, StringBuilder buffer)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
csc.getExpr().generateCanonicalizedExpression(buffer, context);
}
@@ -370,7 +360,7 @@ public class CompiledSelect extends AbstractCompiledValue {
*
* @return the empty result set of the appropriate type
*/
- public SelectResults getEmptyResultSet(Object[] parameters, Cache cache, Query query)
+ public SelectResults getEmptyResultSet(Object[] parameters, InternalCache cache, Query query)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
ExecutionContext context = new QueryExecutionContext(parameters, cache, query);
@@ -420,7 +410,7 @@ public class CompiledSelect extends AbstractCompiledValue {
CompiledIteratorDef iterDef = (CompiledIteratorDef) iter.next();
RuntimeIterator rIter = iterDef.getRuntimeIterator(context);
context.bindIterator(rIter);
- // Asif . Ideally the function below should always be called after binding has occured
+ // Ideally the function below should always be called after binding has occured
// So that the interal ID gets set during binding to the scope. If not so then chances
// are that internal_id is still null causing index_interanl_id to be null.
// Though in our case it may not be an issue as the compute depedency phase must have
@@ -453,7 +443,7 @@ public class CompiledSelect extends AbstractCompiledValue {
throw new TypeMismatchException(
LocalizedStrings.CompiledSelect_THE_WHERE_CLAUSE_WAS_TYPE_0_INSTEAD_OF_BOOLEAN
.toLocalizedString(b.getClass().getName()));
- } else if (((Boolean) b).booleanValue()) {
+ } else if ((Boolean) b) {
result = doIterationEvaluate(context, false);
} else {
result = prepareEmptyResultSet(context, false);
@@ -466,7 +456,7 @@ public class CompiledSelect extends AbstractCompiledValue {
// If order by clause is defined, then the first column should be the preferred index
if (this.orderByAttrs != null && numInd == 1) {
CompiledSortCriterion csc = (CompiledSortCriterion) orderByAttrs.get(0);
- StringBuffer preferredIndexCondn = new StringBuffer();
+ StringBuilder preferredIndexCondn = new StringBuilder();
this.evalCanonicalizedExpressionForCSC(csc, context, preferredIndexCondn);
context.cachePut(PREF_INDEX_COND, preferredIndexCondn.toString());
}
@@ -497,9 +487,9 @@ public class CompiledSelect extends AbstractCompiledValue {
&& ((Filter) this.whereClause).isLimitApplicableAtIndexLevel(context)) {
context.cachePut(CAN_APPLY_LIMIT_AT_INDEX, Boolean.TRUE);
}
- StringBuffer temp = null;
+ StringBuilder temp = null;
if (this.orderByAttrs != null) {
- temp = new StringBuffer();
+ temp = new StringBuilder();
CompiledSortCriterion csc = (CompiledSortCriterion) this.orderByAttrs.get(0);
this.evalCanonicalizedExpressionForCSC(csc, context, temp);
}
@@ -562,7 +552,7 @@ public class CompiledSelect extends AbstractCompiledValue {
}
}
}
- // TODO:Asif: It does not appear that results would be null ever.
+ // TODO: It does not appear that results would be null ever.
// if (result == null) { return QueryService.UNDEFINED; }
assert result != null;
// drop duplicates if this is DISTINCT
@@ -617,7 +607,7 @@ public class CompiledSelect extends AbstractCompiledValue {
result = countResult;
} else {
- ((ResultsBag) res).addAndGetOccurence(countStartQueryResult);
+ ((Bag) res).addAndGetOccurence(countStartQueryResult);
}
}
}
@@ -632,9 +622,6 @@ public class CompiledSelect extends AbstractCompiledValue {
* The index is locked during query to prevent it from being removed by another thread. So we have
* to release the lock only after whole query is finished as one query can use an index multiple
* times.
- *
- *
- * @param planInfo
*/
private void releaseReadLockOnUsedIndex(PlanInfo planInfo) {
List inds = planInfo.indexes;
@@ -649,12 +636,9 @@ public class CompiledSelect extends AbstractCompiledValue {
}
}
-
/**
- * Retruns the size of region iterator for count(*) on a region without whereclause.
+ * Returns the size of region iterator for count(*) on a region without whereclause.
*
- * @param collExpr
- * @throws RegionNotFoundException
* @since GemFire 6.6.2
*/
private int getRegionIteratorSize(ExecutionContext context, CompiledValue collExpr)
@@ -693,7 +677,7 @@ public class CompiledSelect extends AbstractCompiledValue {
SelectResults results = prepareEmptyResultSet(context, false);
- // TODO:Asif: SELF : Work on limit implementation on bulk get
+ // TODO: SELF : Work on limit implementation on bulk get
// check for bulk get optimization
if (evaluateWhereClause) {
List tmpResults = optimizeBulkGet(context);
@@ -713,13 +697,13 @@ public class CompiledSelect extends AbstractCompiledValue {
int numElementsInResult = 0;
try {
doNestedIterations(0, results, context, evaluateWhereClause, numElementsInResult);
- } catch (CompiledSelect.NullIteratorException cnie) {
+ } catch (CompiledSelect.NullIteratorException ignore) {
return null;
}
return results;
}
- // @todo make this more general to work for any kind of map, not just regions
+ // TODO: make this more general to work for any kind of map, not just regions
/**
* Check for the bulk-get pattern and if it applies do an optimized execution. The pattern is:
* SELECT ?? FROM <Region>.entrySet e WHERE e.key IN <Collection>.
@@ -790,11 +774,11 @@ public class CompiledSelect extends AbstractCompiledValue {
if (result == null) {
addToResults = false;
} else if (result instanceof Boolean) {
- addToResults = ((Boolean) result).booleanValue();
+ addToResults = (Boolean) result;
} else if (result == QueryService.UNDEFINED) {
// add UNDEFINED to results only for NOT EQUALS queries
if (this.whereClause.getType() == COMPARISON) {
- int operator = ((CompiledComparison) this.whereClause).getOperator();
+ int operator = ((Filter) this.whereClause).getOperator();
if ((operator != TOK_NE && operator != TOK_NE_ALT)) {
addToResults = false;
}
@@ -810,12 +794,12 @@ public class CompiledSelect extends AbstractCompiledValue {
if (addToResults) {
int occurence =
applyProjectionAndAddToResultSet(context, results, this.orderByAttrs == null);
- // Asif: If the occurence is greater than 1, then only in case of
+ // If the occurence is greater than 1, then only in case of
// non distinct query should it be treated as contributing to size
// else duplication will be eliminated when making it distinct using
// ResultsCollectionWrapper and we will fall short of limit
if (occurence == 1 || (occurence > 1 && !this.distinct)) {
- // Asif: (Unique i.e first time occurence) or subsequent occurence
+ // (Unique i.e first time occurence) or subsequent occurence
// for non distinct query
++numElementsInResult;
}
@@ -871,7 +855,7 @@ public class CompiledSelect extends AbstractCompiledValue {
NameResolutionException, QueryInvocationTargetException {
List iterators = context.getCurrentIterators();
if (projAttrs == null && (this.orderByAttrs == null || ignoreOrderBy)) {
- // Asif : If the projection attribute is null( ie.e specified as *) &
+ // If the projection attribute is null( ie.e specified as *) &
// there is only one
// Runtime Iteratir we can return the set as it is.But if the proejction
// attribute is null & multiple Iterators are defined we need to rectify
@@ -909,7 +893,7 @@ public class CompiledSelect extends AbstractCompiledValue {
}
int occurence = applyProjectionAndAddToResultSet(context, pResultSet, ignoreOrderBy);
if (occurence == 1 || (occurence > 1 && !this.distinct)) {
- // Asif: (Unique i.e first time occurence) or subsequent occurence
+ // (Unique i.e first time occurence) or subsequent occurence
// for non distinct query
++numElementsAdded;
}
@@ -925,7 +909,7 @@ public class CompiledSelect extends AbstractCompiledValue {
rIter.setCurrent(resultsIter.next());
int occurence = applyProjectionAndAddToResultSet(context, pResultSet, ignoreOrderBy);
if (occurence == 1 || (occurence > 1 && !this.distinct)) {
- // Asif: (Unique i.e first time occurence) or subsequent occurence
+ // (Unique i.e first time occurence) or subsequent occurence
// for non distinct query
++numElementsAdded;
}
@@ -941,7 +925,7 @@ public class CompiledSelect extends AbstractCompiledValue {
private SelectResults prepareEmptyResultSet(ExecutionContext context, boolean ignoreOrderBy)
throws TypeMismatchException, AmbiguousNameException {
- // Asif:if no projection attributes or '*'as projection attribute
+ // if no projection attributes or '*'as projection attribute
// & more than one/RunTimeIterator then create a StrcutSet.
// If attribute is null or '*' & only one RuntimeIterator then create a
// ResultSet.
@@ -969,7 +953,7 @@ public class CompiledSelect extends AbstractCompiledValue {
context)
: new OrderByComparator(this.orderByAttrs, (StructTypeImpl) elementType, context);
results = this.distinct ? new SortedStructSet(comparator, (StructTypeImpl) elementType)
- : new SortedStructBag(comparator, (StructTypeImpl) elementType, nullValuesAtStart);
+ : new SortedStructBag(comparator, (StructType) elementType, nullValuesAtStart);
}
} else {
@@ -1018,7 +1002,7 @@ public class CompiledSelect extends AbstractCompiledValue {
protected ObjectType prepareResultType(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException {
- // Asif:if no projection attributes or '*'as projection attribute
+ // if no projection attributes or '*'as projection attribute
// & more than one/RunTimeIterator then create a StrcutSet.
// If attribute is null or '*' & only one RuntimeIterator then create a
// ResultSet.
@@ -1069,22 +1053,9 @@ public class CompiledSelect extends AbstractCompiledValue {
return elementType;
}
- /*
- * private SelectResults prepareEmptySelectResults(ObjectType elementType, boolean isSorted,
- * ExecutionContext context) { if (elementType.isStructType()) { if (isSorted) { // sorted struct
- * return prepareEmptySortedStructSet((StructTypeImpl)elementType); } else { // unsorted struct
- * return new StructBag((StructType)elementType, context.getCachePerfStats()); } } else { //
- * non-struct if (isSorted) { // sorted non-struct return
- * prepareEmptySortedResultSet(elementType); } else { // unsorted non-struct return new
- * ResultsBag(elementType, context.getCachePerfStats()); } } }
- */
-
-
-
/**
- * Asif: This function should be used to create a StructType for those queries which have * as
+ * This function should be used to create a StructType for those queries which have * as
* projection attribute (implying null projection attribute) & multiple from clauses
- *
*/
private StructTypeImpl createStructTypeForNullProjection(List currentIterators,
ExecutionContext context) {
@@ -1112,23 +1083,22 @@ public class CompiledSelect extends AbstractCompiledValue {
RuntimeIterator rit = context.findRuntimeIterator(cv);
List pathOnItr = cv.getPathOnIterator(rit, context);
if (pathOnItr != null) {
- String path[] = (String[]) pathOnItr.toArray(new String[0]);
+ String path[] = (String[]) pathOnItr.toArray(new String[pathOnItr.size()]);
ObjectType ot[] = PathUtils.calculateTypesAlongPath(rit.getElementType(), path);
retType = ot[ot.length - 1];
}
- } catch (NameNotFoundException e) {
+ } catch (NameNotFoundException ignore) {
// Unable to determine the type Of attribute.It will default to
// ObjectType
}
return retType;
}
-
// resultSet could be a set or a bag (we have set constructor, or there
// could be a distinct subquery)
// in future, it would be good to simplify this to always work with a bag
// (converting all sets to bags) until the end when we enforce distinct
- // Asif: The number returned indicates the occurence of the data in the SelectResults
+ // The number returned indicates the occurence of the data in the SelectResults
// Thus if the SelectResults is of type ResultsSet or StructSet
// then 1 will indicate that data was added to the results & that was the
// first occurence. For this 0 will indicate that the data was not added
@@ -1138,8 +1108,6 @@ public class CompiledSelect extends AbstractCompiledValue {
// Currently orderBy is present only for StructSet & ResultSet which are
// unique object holders. So the occurence for them can be either 0 or 1 only
-
-
private int applyProjectionAndAddToResultSet(ExecutionContext context, SelectResults resultSet,
boolean ignoreOrderBy) throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
@@ -1149,7 +1117,7 @@ public class CompiledSelect extends AbstractCompiledValue {
ObjectType elementType = resultSet.getCollectionType().getElementType();
boolean isStruct = elementType != null && elementType.isStructType();
- // TODO : Asif : Optimize this condition in some clean way
+ // TODO: Optimize this condition in some clean way
boolean isLinkedStructure =
resultSet instanceof Ordered && ((Ordered) resultSet).dataPreordered();
@@ -1209,7 +1177,7 @@ public class CompiledSelect extends AbstractCompiledValue {
comparator.addEvaluatedSortCriteria(values, context);
occurence = ((StructFields) resultSet).addFieldValues(values) ? 1 : 0;
}
- // Asif: TODO:Instead of a normal Map containing which holds
+ // TODO:Instead of a normal Map containing which holds
// StructImpl object
// use a THashObject with Object[] array hashing stragtegy as we
// are unnnecessarily
@@ -1274,11 +1242,9 @@ public class CompiledSelect extends AbstractCompiledValue {
if (!e.isDestroyed()) {
try {
values[0] = new CqEntry(e.getKey(), e.getValue());
- } catch (EntryDestroyedException ede) {
- // Even though isDestory() check is made, the entry
- // could
- // throw EntryDestroyedException if the value becomes
- // null.
+ } catch (EntryDestroyedException ignore) {
+ // Even though isDestory() check is made, the entry could throw
+ // EntryDestroyedException if the value becomes null.
add = false;
}
} else {
@@ -1321,7 +1287,7 @@ public class CompiledSelect extends AbstractCompiledValue {
if (distinct) {
if (isStruct) {
comparator.addEvaluatedSortCriteria(values, context);
- // Asif: Occurence field is used to identify the corrcet number of
+ // Occurence field is used to identify the corrcet number of
// iterations
// required to implement the limit based on the presence or absence
// of distinct clause
@@ -1401,23 +1367,15 @@ public class CompiledSelect extends AbstractCompiledValue {
} else if (type == METHOD_INV) {
name = ((CompiledOperation) projExpr).getMethodName();
} else {
- name = new StringBuffer("field$").append(context.nextFieldNum()).toString();
+ name = new StringBuilder("field$").append(context.nextFieldNum()).toString();
// name = projExpr.toString();
}
}
return name;
}
-
/**
* Optimized evaluate for CQ execution.
- *
- * @param context
- * @return boolean
- * @throws FunctionDomainException
- * @throws TypeMismatchException
- * @throws NameResolutionException
- * @throws QueryInvocationTargetException
*/
public boolean evaluateCq(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
@@ -1456,7 +1414,7 @@ public class CompiledSelect extends AbstractCompiledValue {
} else if (b == QueryService.UNDEFINED) {
// add UNDEFINED to results only for NOT EQUALS queries
if (this.whereClause.getType() == COMPARISON) {
- int operator = ((CompiledComparison) this.whereClause).getOperator();
+ int operator = ((Filter) this.whereClause).getOperator();
if ((operator != TOK_NE && operator != TOK_NE_ALT)) {
return false;
} else {
@@ -1466,7 +1424,7 @@ public class CompiledSelect extends AbstractCompiledValue {
return false;
}
} else {
- return (((Boolean) b).booleanValue());
+ return (Boolean) b;
}
} finally {
context.popExecCache();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSortCriterion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSortCriterion.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSortCriterion.java
index 5268b1c..d49b4a5 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSortCriterion.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSortCriterion.java
@@ -12,10 +12,13 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.query.internal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.query.AmbiguousNameException;
@@ -28,14 +31,16 @@ import org.apache.geode.cache.query.internal.types.TypeUtils;
/**
* This class represents a compiled form of sort criterian present in order by clause
- *
*/
public class CompiledSortCriterion extends AbstractCompiledValue {
- // Asif: criterion true indicates descending order
+
+ // criterion true indicates descending order
private boolean criterion = false;
+
private CompiledValue expr = null;
+
int columnIndex = -1;
- // private String correctedCanonicalizedExpression = null;
+
private CompiledValue originalCorrectedExpression = null;
@Override
@@ -43,20 +48,13 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
return Collections.singletonList(this.originalCorrectedExpression);
}
- /**
- * @return int
- */
public int getType() {
return SORT_CRITERION;
}
/**
* evaluates sort criteria in order by clause
- *
- * @param context
- * @return Object
*/
-
public Object evaluate(Object data, ExecutionContext context) {
Object value = null;
if (this.columnIndex > 0) {
@@ -74,17 +72,11 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
try {
return this.expr.evaluate(context);
} catch (Exception e) {
+ // TODO: never throw an anonymous inner class
throw new CacheException(e) {};
}
-
}
- /**
- * concstructor
- *
- * @param criterion
- * @param cv
- */
CompiledSortCriterion(boolean criterion, CompiledValue cv) {
this.expr = cv;
this.criterion = criterion;
@@ -103,11 +95,6 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
return this.columnIndex;
}
- /*
- * public String getCorrectedCanonicalizedExpression() { return
- * this.correctedCanonicalizedExpression; }
- */
-
@Override
public Object evaluate(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
@@ -128,7 +115,7 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
private CompiledValue getReconstructedExpression(String projAttribStr, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
List<CompiledValue> expressions = PathUtils.collectCompiledValuesInThePath(expr, context);
- StringBuffer tempBuff = new StringBuffer();
+ StringBuilder tempBuff = new StringBuilder();
ListIterator<CompiledValue> listIter = expressions.listIterator(expressions.size());
while (listIter.hasPrevious()) {
listIter.previous().generateCanonicalizedExpression(tempBuff, context);
@@ -152,20 +139,20 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
prevCV = cv;
switch (cv.getType()) {
- case CompiledOperation.METHOD_INV:
+ case OQLLexerTokenTypes.METHOD_INV:
reconstruct.add(0, ((CompiledOperation) cv).getArguments());
reconstruct.add(0, ((CompiledOperation) cv).getMethodName());
break;
- case CompiledPath.PATH:
+ case CompiledValue.PATH:
reconstruct.add(0, ((CompiledPath) cv).getTailID());
break;
- case CompiledIndexOperation.TOK_LBRACK:
+ case OQLLexerTokenTypes.TOK_LBRACK:
reconstruct.add(0, ((CompiledIndexOperation) cv).getExpression());
break;
default:
throw new IllegalStateException("Unexpected CompiledValue in order by clause");
}
- reconstruct.add(0, Integer.valueOf(prevCV.getType()));
+ reconstruct.add(0, prevCV.getType());
cv = expressions.get(++index);
} while (prevCV != cvToRetainTill);
@@ -173,7 +160,7 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
Iterator<Object> iter = reconstruct.iterator();
CompiledValue currentValue = ProjectionField.getProjectionField();
while (iter.hasNext()) {
- int type = ((Integer) iter.next()).intValue();
+ int type = (Integer) iter.next();
switch (type) {
case CompiledValue.PATH:
currentValue = new CompiledPath(currentValue, (String) iter.next());
@@ -214,7 +201,8 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
}
if (!mappedColumn) {
// the order by expr is not an alias check for path
- StringBuffer orderByExprBuffer = new StringBuffer(), projAttribBuffer = new StringBuffer();
+ StringBuilder orderByExprBuffer = new StringBuilder(),
+ projAttribBuffer = new StringBuilder();
expr.generateCanonicalizedExpression(orderByExprBuffer, context);
final String orderByExprStr = orderByExprBuffer.toString();
for (int i = 0; i < projAttrs.size(); ++i) {
@@ -243,12 +231,12 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
RuntimeIterator runtimeIter = (RuntimeIterator) currentIters.get(i);
if (runtimeIter == rIter) {
/* this.substituteExpressionWithProjectionField( i); */
- StringBuffer temp = new StringBuffer();
+ StringBuilder temp = new StringBuilder();
rIter.generateCanonicalizedExpression(temp, context);
// this.correctedCanonicalizedExpression = temp.toString();
/* mappedColumn = true; */
String projAttribStr = temp.toString();
- temp = new StringBuffer();
+ temp = new StringBuilder();
expr.generateCanonicalizedExpression(temp, context);
String orderbyStr = temp.toString();
if (projAttribStr.equals(orderbyStr)) {
@@ -277,7 +265,6 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
public Object evaluate(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
return context.getCurrentProjectionField();
-
}
@Override
@@ -288,7 +275,5 @@ public class CompiledSortCriterion extends AbstractCompiledValue {
public static ProjectionField getProjectionField() {
return singleton;
}
-
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java
index 9cce2f2..0a8b129 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java
@@ -17,7 +17,6 @@ package org.apache.geode.cache.query.internal;
import java.util.*;
import org.apache.geode.cache.query.*;
-import org.apache.geode.cache.query.internal.IndexInfo;
import org.apache.geode.cache.query.internal.index.IndexData;
import org.apache.geode.cache.query.internal.index.IndexProtocol;
import org.apache.geode.cache.query.internal.index.IndexUtils;
@@ -100,7 +99,7 @@ public class CompiledUndefined extends AbstractCompiledValue implements Negatabl
} finally {
observer.afterIndexLookup(set);
}
- return QueryUtils.getconditionedIndexResults(set, idxInfo[0], context, indexFieldsSize,
+ return QueryUtils.getConditionedIndexResults(set, idxInfo[0], context, indexFieldsSize,
completeExpansionNeeded, iterOperands, indpndntItrs);
}
@@ -224,7 +223,7 @@ public class CompiledUndefined extends AbstractCompiledValue implements Negatabl
}
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
clauseBuffer.insert(0, ')');
_value.generateCanonicalizedExpression(clauseBuffer, context);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledValue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledValue.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledValue.java
index 9da575d..4747980 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledValue.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledValue.java
@@ -27,56 +27,51 @@ import org.apache.geode.distributed.internal.DistributionConfig;
import java.util.List;
import java.util.Set;
-/**
- * Class Description
- *
- * @version $Revision: 1.1 $
- */
public interface CompiledValue {
- // extra node types: use negative numbers so they don't collide with token
- // types
- public final static int COMPARISON = -1;
- public final static int FUNCTION = -2;
- public final static int JUNCTION = -3;
- public final static int LITERAL = -4;
- public final static int PATH = -5;
- public final static int CONSTRUCTION = -6;
- public final static int GROUPJUNCTION = -7;
- public final static int ALLGROUPJUNCTION = -8;
- public final static int COMPOSITEGROUPJUNCTION = -10;
- public final static int RANGEJUNCTION = -11;
- public final static int NOTEQUALCONDITIONEVALUATOR = -12;
- public final static int SINGLECONDNEVALUATOR = -13;
- public final static int DOUBLECONDNRANGEJUNCTIONEVALUATOR = -14;
- public final static int LIKE = -15;
- public final static int FIELD = -16;
- public final static int GROUP_BY_SELECT = -17;
- public static final int INDEX_RESULT_THRESHOLD_DEFAULT = 100;
- public static final String INDX_THRESHOLD_PROP_STR =
- DistributionConfig.GEMFIRE_PREFIX + "Query.INDEX_THRESHOLD_SIZE";
- public static final String INDEX_INFO = "index_info";
- public static final int indexThresholdSize =
- Integer.getInteger(INDX_THRESHOLD_PROP_STR, INDEX_RESULT_THRESHOLD_DEFAULT).intValue();
- public static final String RESULT_TYPE = "result_type";
- public static final String PROJ_ATTRIB = "projection";
- public static final String ORDERBY_ATTRIB = "orderby";
- public static final IndexInfo[] NO_INDEXES_IDENTIFIER = new IndexInfo[0];
- public static final String RESULT_LIMIT = "limit";
- public static final String CAN_APPLY_LIMIT_AT_INDEX = "can_apply_limit_at_index";
- public static final String CAN_APPLY_ORDER_BY_AT_INDEX = "can_apply_orderby_at_index";
- public static final String PREF_INDEX_COND = "preferred_index_condition";
- public static final String QUERY_INDEX_HINTS = "query_index_hints";
- public static final CompiledValue MAP_INDEX_ALL_KEYS = new AbstractCompiledValue() {
-
+ // extra node types: use negative numbers so they don't collide with token types
+ int COMPARISON = -1;
+ int FUNCTION = -2;
+ int JUNCTION = -3;
+ int LITERAL = -4;
+ int PATH = -5;
+ int CONSTRUCTION = -6;
+ int GROUPJUNCTION = -7;
+ int ALLGROUPJUNCTION = -8;
+ int COMPOSITEGROUPJUNCTION = -10;
+ int RANGEJUNCTION = -11;
+ int NOTEQUALCONDITIONEVALUATOR = -12;
+ int SINGLECONDNEVALUATOR = -13;
+ int DOUBLECONDNRANGEJUNCTIONEVALUATOR = -14;
+ int LIKE = -15;
+ int FIELD = -16;
+ int GROUP_BY_SELECT = -17;
+ int INDEX_RESULT_THRESHOLD_DEFAULT = 100;
+ String INDX_THRESHOLD_PROP_STR = DistributionConfig.GEMFIRE_PREFIX + "Query.INDEX_THRESHOLD_SIZE";
+ String INDEX_INFO = "index_info";
+ int indexThresholdSize =
+ Integer.getInteger(INDX_THRESHOLD_PROP_STR, INDEX_RESULT_THRESHOLD_DEFAULT);
+ String RESULT_TYPE = "result_type";
+ String PROJ_ATTRIB = "projection";
+ String ORDERBY_ATTRIB = "orderby";
+ IndexInfo[] NO_INDEXES_IDENTIFIER = new IndexInfo[0];
+ String RESULT_LIMIT = "limit";
+ String CAN_APPLY_LIMIT_AT_INDEX = "can_apply_limit_at_index";
+ String CAN_APPLY_ORDER_BY_AT_INDEX = "can_apply_orderby_at_index";
+ String PREF_INDEX_COND = "preferred_index_condition";
+ String QUERY_INDEX_HINTS = "query_index_hints";
+
+ CompiledValue MAP_INDEX_ALL_KEYS = new AbstractCompiledValue() {
@Override
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ public void generateCanonicalizedExpression(StringBuilder clauseBuffer,
+ ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
throw new QueryInvalidException(
"* cannot be used with index operator. To use as key for map lookup, "
+ "it should be enclosed in ' '");
}
+ @Override
public Object evaluate(ExecutionContext context) {
throw new QueryInvalidException(
"* cannot be used with index operator. To use as key for map lookup, "
@@ -88,39 +83,39 @@ public interface CompiledValue {
return super.getReceiver();
}
+ @Override
public int getType() {
return OQLLexerTokenTypes.TOK_STAR;
}
-
};
- public int getType();
+ int getType();
- public ObjectType getTypecast();
+ ObjectType getTypecast();
- public Object evaluate(ExecutionContext context) throws FunctionDomainException,
- TypeMismatchException, NameResolutionException, QueryInvocationTargetException;
+ Object evaluate(ExecutionContext context) throws FunctionDomainException, TypeMismatchException,
+ NameResolutionException, QueryInvocationTargetException;
- // returns null if N/A
- public List getPathOnIterator(RuntimeIterator itr, ExecutionContext context)
+ /**
+ * returns null if N/A
+ */
+ List getPathOnIterator(RuntimeIterator itr, ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException;
- public PlanInfo getPlanInfo(ExecutionContext context) throws FunctionDomainException,
+ PlanInfo getPlanInfo(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException;
- public Set computeDependencies(ExecutionContext context)
+ Set computeDependencies(ExecutionContext context)
throws TypeMismatchException, AmbiguousNameException, NameResolutionException;
- public boolean isDependentOnIterator(RuntimeIterator itr, ExecutionContext context);
+ boolean isDependentOnIterator(RuntimeIterator itr, ExecutionContext context);
- public boolean isDependentOnCurrentScope(ExecutionContext context);
+ boolean isDependentOnCurrentScope(ExecutionContext context);
/**
* general-purpose visitor (will be used for extracting region path)
*/
- // public boolean visit(QVisitor visitor);
- // Asif :Function for generating from clause
- public void generateCanonicalizedExpression(StringBuffer clauseBuffer, ExecutionContext context)
+ void generateCanonicalizedExpression(StringBuilder clauseBuffer, ExecutionContext context)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException;
/**
@@ -128,18 +123,17 @@ public interface CompiledValue {
* object (CompiledRegion). The default implementation is provided in the AbstractCompiledValue &
* overridden in the CompiledSelect as it can contain multiple iterators
*/
- public void getRegionsInQuery(Set regionNames, Object[] parameters);
+ void getRegionsInQuery(Set regionNames, Object[] parameters);
/** Get the CompiledValues that this owns */
- public List getChildren();
+ List getChildren();
- public void visitNodes(NodeVisitor visitor);
+ void visitNodes(NodeVisitor visitor);
- public static interface NodeVisitor {
+ interface NodeVisitor {
/** @return true to continue or false to stop */
- public boolean visit(CompiledValue node);
+ boolean visit(CompiledValue node);
}
- public CompiledValue getReceiver();
-
+ CompiledValue getReceiver();
}
[04/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index b07ccba..52030af 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -24,11 +24,11 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -56,15 +56,16 @@ import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.TransactionListener;
import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolFactory;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.internal.ClientMetadataService;
import org.apache.geode.cache.client.internal.PoolImpl;
-import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.query.CqAttributes;
import org.apache.geode.cache.query.CqException;
import org.apache.geode.cache.query.CqExistsException;
@@ -80,6 +81,7 @@ import org.apache.geode.cache.query.Query;
import org.apache.geode.cache.query.QueryInvalidException;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.RegionNotFoundException;
+import org.apache.geode.cache.query.internal.QueryMonitor;
import org.apache.geode.cache.query.internal.cq.CqService;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.snapshot.CacheSnapshotService;
@@ -93,7 +95,9 @@ import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.i18n.LogWriterI18n;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.SystemTimer;
@@ -102,9 +106,12 @@ import org.apache.geode.internal.cache.CacheServerImpl;
import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.cache.CacheServerLauncher;
import org.apache.geode.internal.cache.CacheService;
+import org.apache.geode.internal.cache.DiskStoreAttributes;
import org.apache.geode.internal.cache.DiskStoreFactoryImpl;
import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.DiskStoreMonitor;
import org.apache.geode.internal.cache.DistributedRegion;
+import org.apache.geode.internal.cache.EventTracker.ExpiryTask;
import org.apache.geode.internal.cache.ExpirationScheduler;
import org.apache.geode.internal.cache.FilterProfile;
import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -115,6 +122,7 @@ import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PoolFactoryImpl;
import org.apache.geode.internal.cache.PoolManagerImpl;
import org.apache.geode.internal.cache.RegionListener;
+import org.apache.geode.internal.cache.TXEntryStateFactory;
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.cache.TombstoneService;
import org.apache.geode.internal.cache.control.InternalResourceManager;
@@ -123,6 +131,7 @@ import org.apache.geode.internal.cache.extension.Extensible;
import org.apache.geode.internal.cache.extension.ExtensionPoint;
import org.apache.geode.internal.cache.extension.SimpleExtensionPoint;
import org.apache.geode.internal.cache.ha.HARegionQueue;
+import org.apache.geode.internal.cache.persistence.BackupManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
@@ -135,6 +144,7 @@ import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.logging.LocalLogWriter;
import org.apache.geode.internal.logging.LogWriterFactory;
import org.apache.geode.internal.offheap.MemoryAllocator;
+import org.apache.geode.management.internal.JmxManagerAdvisor;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxInstanceFactory;
import org.apache.geode.pdx.PdxSerializer;
@@ -157,14 +167,14 @@ public class CacheCreation implements InternalCache {
private int lockLease = GemFireCacheImpl.DEFAULT_LOCK_LEASE;
private boolean hasLockLease = false;
- /** The amount of time to wait for a <code>netSearch</code> */
+ /** The amount of time to wait for a {@code netSearch} */
private int searchTimeout = GemFireCacheImpl.DEFAULT_SEARCH_TIMEOUT;
private boolean hasSearchTimeout = false;
private boolean hasMessageSyncInterval = false;
/** This cache's roots keyed on name */
- protected final Map roots = new LinkedHashMap();
+ protected final Map<String, Region<?, ?>> roots = new LinkedHashMap<>();
/** Are dynamic regions enabled in this cache? */
private DynamicRegionFactory.Config dynamicRegionFactoryConfig = null;
@@ -175,17 +185,16 @@ public class CacheCreation implements InternalCache {
private boolean hasServer = false;
/** The bridge servers configured for this cache */
- private final List bridgeServers = new ArrayList();
+ private final List<CacheServer> bridgeServers = new ArrayList<>();
// Stores the properties used to initialize declarables.
- private final Map<Declarable, Properties> declarablePropertiesMap =
- new HashMap<Declarable, Properties>();
+ private final Map<Declarable, Properties> declarablePropertiesMap = new HashMap<>();
- private Set<GatewaySender> gatewaySenders = new HashSet<GatewaySender>();
+ private final Set<GatewaySender> gatewaySenders = new HashSet<>();
- private Set<GatewayReceiver> gatewayReceivers = new HashSet<GatewayReceiver>();
+ private final Set<GatewayReceiver> gatewayReceivers = new HashSet<>();
- private Set<AsyncEventQueue> asyncEventQueues = new HashSet<AsyncEventQueue>();
+ private final Set<AsyncEventQueue> asyncEventQueues = new HashSet<>();
private GatewayConflictResolver gatewayConflictResolver;
@@ -194,47 +203,44 @@ public class CacheCreation implements InternalCache {
private boolean hasCopyOnRead = false;
/** The CacheTransactionManager representative for this Cache */
- protected CacheTransactionManagerCreation txMgrCreation = null;
-
- /** JNDI Context associated with the Gemfire */
- // private static Context ctx;
+ CacheTransactionManagerCreation txMgrCreation = null;
/** The named region attributes associated with this cache */
- private final Map namedRegionAttributes = new HashMap();
+ private final Map<String, RegionAttributes<?, ?>> namedRegionAttributes = new HashMap<>();
/**
* The names of the region attributes in the order in which they were added. Keeping track of this
* ensures that named region attributes are processed in the correct order. That is, "parent"
* named region attributes will be processed before "children" named region attributes.
*/
- protected final List regionAttributesNames = new ArrayList();
+ final List<String> regionAttributesNames = new ArrayList<>();
/**
* The named disk store attributes associated with this cache. Made this linked so its iteration
* would be in insert order. This is important for unit testing 44914.
*/
- protected final Map diskStores = new LinkedHashMap();
+ protected final Map<String, DiskStore> diskStores = new LinkedHashMap<>();
- private final List<File> backups = new ArrayList<File>();
+ private final List<File> backups = new ArrayList<>();
- private CacheConfig cacheConfig = new CacheConfig();
+ private final CacheConfig cacheConfig = new CacheConfig();
/** A logger that is used in debugging */
- private InternalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, System.out);
+ private final InternalLogWriter logWriter =
+ new LocalLogWriter(InternalLogWriter.ALL_LEVEL, System.out);
- private InternalLogWriter securityLogWriter = LogWriterFactory.toSecurityLogWriter(logWriter);
+ private final InternalLogWriter securityLogWriter =
+ LogWriterFactory.toSecurityLogWriter(this.logWriter);
/**
* {@link ExtensionPoint} support.
*
* @since GemFire 8.1
*/
- private SimpleExtensionPoint<Cache> extensionPoint = new SimpleExtensionPoint<Cache>(this, this);
-
- //////////////////////// Constructors ////////////////////////
+ private final SimpleExtensionPoint<Cache> extensionPoint = new SimpleExtensionPoint<>(this, this);
/**
- * Creates a new <code>CacheCreation</code> with no root regions
+ * Creates a new {@code CacheCreation} with no root regions
*/
public CacheCreation() {
this(false);
@@ -242,7 +248,7 @@ public class CacheCreation implements InternalCache {
/** clear thread locals that may have been set by previous uses of CacheCreation */
public static void clearThreadLocals() {
- createInProgress = new ThreadLocal<>();
+ createInProgress.remove();
}
/**
@@ -253,20 +259,18 @@ public class CacheCreation implements InternalCache {
public CacheCreation(boolean forParsing) {
initializeRegionShortcuts();
if (!forParsing) {
- createInProgress.set(this.pm);
+ createInProgress.set(this.poolManager);
}
}
/**
* @since GemFire 5.7
*/
- public void startingGenerate() {
+ void startingGenerate() {
createInProgress.set(null);
}
- ////////////////////// Instance Methods //////////////////////
-
- static final private RegionAttributes defaults = new AttributesFactory().create();
+ private static final RegionAttributes defaults = new AttributesFactory().create();
RegionAttributes getDefaultAttributes() {
return defaults;
@@ -280,7 +284,7 @@ public class CacheCreation implements InternalCache {
* Sets the attributes of the root region
*
* @throws RegionExistsException If this cache already contains a region with the same name as
- * <code>root</code>.
+ * {@code root}.
*/
void addRootRegion(RegionCreation root) throws RegionExistsException {
@@ -294,10 +298,12 @@ public class CacheCreation implements InternalCache {
}
}
+ @Override
public int getLockTimeout() {
return this.lockTimeout;
}
+ @Override
public void setLockTimeout(int seconds) {
this.lockTimeout = seconds;
this.hasLockTimeout = true;
@@ -307,10 +313,12 @@ public class CacheCreation implements InternalCache {
return this.hasLockTimeout;
}
+ @Override
public int getLockLease() {
return this.lockLease;
}
+ @Override
public void setLockLease(int seconds) {
this.lockLease = seconds;
this.hasLockLease = true;
@@ -320,10 +328,12 @@ public class CacheCreation implements InternalCache {
return this.hasLockLease;
}
+ @Override
public int getSearchTimeout() {
return this.searchTimeout;
}
+ @Override
public void setSearchTimeout(int seconds) {
this.searchTimeout = seconds;
this.hasSearchTimeout = true;
@@ -333,10 +343,12 @@ public class CacheCreation implements InternalCache {
return this.hasSearchTimeout;
}
+ @Override
public int getMessageSyncInterval() {
return HARegionQueue.getMessageSyncInterval();
}
+ @Override
public void setMessageSyncInterval(int seconds) {
if (seconds < 0) {
throw new IllegalArgumentException(
@@ -351,11 +363,9 @@ public class CacheCreation implements InternalCache {
return this.hasMessageSyncInterval;
}
- public Set rootRegions() {
- Set regions = new LinkedHashSet();
- for (Iterator itr = this.roots.values().iterator(); itr.hasNext();) {
- regions.add(itr.next());
- }
+ @Override
+ public Set<Region<?, ?>> rootRegions() {
+ Set<Region<?, ?>> regions = new LinkedHashSet<>(this.roots.values());
return Collections.unmodifiableSet(regions);
}
@@ -364,6 +374,7 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire prPersistSprint2
*/
+ @Override
public DiskStoreFactory createDiskStoreFactory() {
return new DiskStoreFactoryImpl(this);
}
@@ -374,7 +385,7 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire 5.7
*/
- private static ThreadLocal createInProgress = new ThreadLocal();
+ private static final ThreadLocal<PoolManagerImpl> createInProgress = new ThreadLocal<>();
/**
* Returns null if the current thread is not doing a CacheCreation create. Otherwise returns the
@@ -382,23 +393,18 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire 5.7
*/
- public static final PoolManagerImpl getCurrentPoolManager() {
- return (PoolManagerImpl) createInProgress.get();
+ public static PoolManagerImpl getCurrentPoolManager() {
+ return createInProgress.get();
}
/**
* Fills in the contents of a {@link Cache} based on this creation object's state.
- *
- * @throws TimeoutException
- * @throws CacheWriterException
- * @throws RegionExistsException
- * @throws GatewayException
*/
- void create(GemFireCacheImpl cache)
+ void create(InternalCache cache)
throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
- extensionPoint.beforeCreate(cache);
+ this.extensionPoint.beforeCreate(cache);
- cache.setDeclarativeCacheConfig(cacheConfig);
+ cache.setDeclarativeCacheConfig(this.cacheConfig);
if (cache.isClient()) {
throw new IllegalStateException(
@@ -419,20 +425,13 @@ public class CacheCreation implements InternalCache {
if (this.gatewayConflictResolver != null) {
cache.setGatewayConflictResolver(this.gatewayConflictResolver);
}
- // if (this.hasCopyOnRead()) {
- // cache.setCopyOnRead(this.copyOnRead);
- // }
- { // create connection pools
- Map m = getPools();
- if (!m.isEmpty()) {
- Iterator it = m.values().iterator();
- while (it.hasNext()) {
- Pool cp = (Pool) it.next();
- PoolFactoryImpl f;
- f = (PoolFactoryImpl) PoolManager.createFactory();
- f.init(cp);
- PoolImpl p = (PoolImpl) f.create(cp.getName());
- }
+ // create connection pools
+ Map<String, Pool> pools = getPools();
+ if (!pools.isEmpty()) {
+ for (Pool pool : pools.values()) {
+ PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory();
+ poolFactory.init(pool);
+ poolFactory.create(pool.getName());
}
}
@@ -445,8 +444,8 @@ public class CacheCreation implements InternalCache {
cache.initializePdxRegistry();
- for (Iterator iter = this.diskStores.values().iterator(); iter.hasNext();) {
- DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) iter.next();
+ for (DiskStore diskStore : this.diskStores.values()) {
+ DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;
if (creation != pdxRegDSC) {
createDiskStore(creation, cache);
}
@@ -472,7 +471,7 @@ public class CacheCreation implements InternalCache {
}
for (GatewaySender senderCreation : this.getGatewaySenders()) {
- GatewaySenderFactory factory = (GatewaySenderFactory) cache.createGatewaySenderFactory();
+ GatewaySenderFactory factory = cache.createGatewaySenderFactory();
((InternalGatewaySenderFactory) factory).configureGatewaySender(senderCreation);
GatewaySender gatewaySender =
factory.create(senderCreation.getId(), senderCreation.getRemoteDSId());
@@ -490,9 +489,6 @@ public class CacheCreation implements InternalCache {
asyncQueueFactory.configureAsyncEventQueue(asyncEventQueueCreation);
AsyncEventQueue asyncEventQueue = cache.getAsyncEventQueue(asyncEventQueueCreation.getId());
- // AsyncEventQueue asyncEventQueue =
- // asyncQueueFactory.create(asyncEventQueueCreation.getId(),
- // asyncEventQueueCreation.getAsyncEventListener());
if (asyncEventQueue == null) {
asyncQueueFactory.create(asyncEventQueueCreation.getId(),
asyncEventQueueCreation.getAsyncEventListener());
@@ -501,16 +497,13 @@ public class CacheCreation implements InternalCache {
cache.initializePdxRegistry();
-
- for (Iterator iter = this.regionAttributesNames.iterator(); iter.hasNext();) {
- String id = (String) iter.next();
+ for (String id : this.regionAttributesNames) {
RegionAttributesCreation creation = (RegionAttributesCreation) getRegionAttributes(id);
creation.inheritAttributes(cache, false);
- RegionAttributes attrs;
// Don't let the RegionAttributesCreation escape to the user
- AttributesFactory factory = new AttributesFactory(creation);
- attrs = factory.create();
+ AttributesFactory<?, ?> factory = new AttributesFactory<>(creation);
+ RegionAttributes<?, ?> attrs = factory.create();
cache.setRegionAttributes(id, attrs);
}
@@ -521,14 +514,13 @@ public class CacheCreation implements InternalCache {
// Create and start the BridgeServers. This code was moved from
// before region initialization to after it to fix bug 33587.
- // Create and start the CacheServers after the gateways have been intialized
+ // Create and start the CacheServers after the gateways have been initialized
// to fix bug 39736.
Integer serverPort = CacheServerLauncher.getServerPort();
String serverBindAdd = CacheServerLauncher.getServerBindAddress();
Boolean disableDefaultServer = CacheServerLauncher.getDisableDefaultServer();
- startCacheServers(this.getCacheServers(), cache, serverPort, serverBindAdd,
- disableDefaultServer);
+ startCacheServers(getCacheServers(), cache, serverPort, serverBindAdd, disableDefaultServer);
for (GatewayReceiver receiverCreation : this.getGatewayReceivers()) {
GatewayReceiverFactory factory = cache.createGatewayReceiverFactory();
@@ -555,16 +547,14 @@ public class CacheCreation implements InternalCache {
runInitializer();
cache.setInitializer(getInitializer(), getInitializerProps());
- // UnitTest CacheXml81Test.testCacheExtension
// Create all extensions
- extensionPoint.fireCreate(cache);
+ this.extensionPoint.fireCreate(cache);
}
- protected void initializeRegions(Map declarativeRegions, Cache cache) {
- Iterator it = declarativeRegions.values().iterator();
- while (it.hasNext()) {
- RegionCreation r = (RegionCreation) it.next();
- r.createRoot(cache);
+ void initializeRegions(Map<String, Region<?, ?>> declarativeRegions, Cache cache) {
+ for (Region region : declarativeRegions.values()) {
+ RegionCreation regionCreation = (RegionCreation) region;
+ regionCreation.createRoot(cache);
}
}
@@ -572,9 +562,8 @@ public class CacheCreation implements InternalCache {
* starts declarative cache servers if a server is not running on the port already. Also adds a
* default server to the param declarativeCacheServers if a serverPort is specified.
*/
- protected void startCacheServers(List declarativeCacheServers, Cache cache, Integer serverPort,
+ void startCacheServers(List<CacheServer> declarativeCacheServers, Cache cache, Integer serverPort,
String serverBindAdd, Boolean disableDefaultServer) {
- CacheServerCreation defaultServer = null;
if (declarativeCacheServers.size() > 1 && (serverPort != null || serverBindAdd != null)) {
throw new RuntimeException(
@@ -582,8 +571,11 @@ public class CacheCreation implements InternalCache {
.toLocalizedString());
}
- if (declarativeCacheServers.isEmpty() && (serverPort != null || serverBindAdd != null)
- && (disableDefaultServer == null || !disableDefaultServer)) {
+ CacheServerCreation defaultServer = null;
+ boolean hasServerPortOrBindAddress = serverPort != null || serverBindAdd != null;
+ boolean isDefaultServerDisabled = disableDefaultServer == null || !disableDefaultServer;
+ if (declarativeCacheServers.isEmpty() && hasServerPortOrBindAddress
+ && isDefaultServerDisabled) {
boolean existingCacheServer = false;
List<CacheServer> cacheServers = cache.getCacheServers();
@@ -596,13 +588,13 @@ public class CacheCreation implements InternalCache {
}
if (!existingCacheServer) {
- defaultServer = new CacheServerCreation((GemFireCacheImpl) cache, false);
+ defaultServer = new CacheServerCreation((InternalCache) cache, false);
declarativeCacheServers.add(defaultServer);
}
}
- for (Iterator iter = declarativeCacheServers.iterator(); iter.hasNext();) {
- CacheServerCreation declaredCacheServer = (CacheServerCreation) iter.next();
+ for (CacheServer declarativeCacheServer : declarativeCacheServers) {
+ CacheServerCreation declaredCacheServer = (CacheServerCreation) declarativeCacheServer;
boolean startServer = true;
List<CacheServer> cacheServers = cache.getCacheServers();
@@ -632,8 +624,9 @@ public class CacheCreation implements InternalCache {
}
try {
- if (!impl.isRunning())
+ if (!impl.isRunning()) {
impl.start();
+ }
} catch (IOException ex) {
throw new GemFireIOException(
@@ -646,7 +639,7 @@ public class CacheCreation implements InternalCache {
/**
* Returns a description of the disk store used by the pdx registry.
*/
- protected DiskStoreAttributesCreation initializePdxDiskStore(GemFireCacheImpl cache) {
+ DiskStoreAttributesCreation initializePdxDiskStore(InternalCache cache) {
// to fix bug 44271 create the disk store used by the pdx registry first.
// If it is using the default disk store we need to create it now.
// If the cache has a pool then no need to create disk store.
@@ -670,15 +663,14 @@ public class CacheCreation implements InternalCache {
return pdxRegDSC;
}
- protected void createDiskStore(DiskStoreAttributesCreation creation, GemFireCacheImpl cache) {
+ protected void createDiskStore(DiskStoreAttributesCreation creation, InternalCache cache) {
// Don't let the DiskStoreAttributesCreation escape to the user
DiskStoreFactory factory = cache.createDiskStoreFactory(creation);
factory.create(creation.getName());
}
/**
- * Returns whether or not this <code>CacheCreation</code> is equivalent to another
- * <code>Cache</code>.
+ * Returns whether or not this {@code CacheCreation} is equivalent to another {@code Cache}.
*/
public boolean sameAs(Cache other) {
boolean sameConfig = other.getLockLease() == this.getLockLease()
@@ -720,18 +712,17 @@ public class CacheCreation implements InternalCache {
}
}
- Collection myBridges = this.getCacheServers();
- Collection otherBridges = other.getCacheServers();
+ Collection<CacheServer> myBridges = this.getCacheServers();
+ Collection<CacheServer> otherBridges = other.getCacheServers();
if (myBridges.size() != otherBridges.size()) {
throw new RuntimeException(
LocalizedStrings.CacheCreation_CACHESERVERS_SIZE.toLocalizedString());
}
- for (Iterator myIter = myBridges.iterator(); myIter.hasNext();) {
- CacheServerCreation myBridge = (CacheServerCreation) myIter.next();
+ for (CacheServer myBridge1 : myBridges) {
+ CacheServerCreation myBridge = (CacheServerCreation) myBridge1;
boolean found = false;
- for (Iterator otherIter = otherBridges.iterator(); otherIter.hasNext();) {
- CacheServer otherBridge = (CacheServer) otherIter.next();
+ for (CacheServer otherBridge : otherBridges) {
if (myBridge.sameAs(otherBridge)) {
found = true;
break;
@@ -744,60 +735,54 @@ public class CacheCreation implements InternalCache {
}
}
- { // compare connection pools
- Map m1 = getPools();
- Map m2 = (other instanceof CacheCreation) ? ((CacheCreation) other).getPools()
- : PoolManager.getAll();
- int m1Size = m1.size();
- {
- // ignore any gateway instances
- Iterator it1 = m1.values().iterator();
- while (it1.hasNext()) {
- Pool cp = (Pool) it1.next();
- if (((PoolImpl) cp).isUsedByGateway()) {
- m1Size--;
- }
- }
- }
- int m2Size = m2.size();
- {
- // ignore any gateway instances
- Iterator it2 = m2.values().iterator();
- while (it2.hasNext()) {
- Pool cp = (Pool) it2.next();
- if (((PoolImpl) cp).isUsedByGateway()) {
- m2Size--;
- }
- }
+ // compare connection pools
+ Map<String, Pool> m1 = getPools();
+ Map<String, Pool> m2 = other instanceof CacheCreation ? ((CacheCreation) other).getPools()
+ : PoolManager.getAll();
+ int m1Size = m1.size();
+
+ // ignore any gateway instances
+ for (Pool cp : m1.values()) {
+ if (((PoolImpl) cp).isUsedByGateway()) {
+ m1Size--;
}
- if (m2Size == 1) {
- // if it is just the DEFAULT pool then ignore it
- Pool p = (Pool) m2.values().iterator().next();
- if (p.getName().equals("DEFAULT")) {
- m2Size = 0;
- }
+ }
+
+ int m2Size = m2.size();
+
+ // ignore any gateway instances
+ for (Pool cp : m2.values()) {
+ if (((PoolImpl) cp).isUsedByGateway()) {
+ m2Size--;
}
+ }
- if (m1Size != m2Size) {
- throw new RuntimeException("pool sizes differ m1Size=" + m1Size + " m2Size=" + m2Size
- + " m1=" + m1.values() + " m2=" + m2.values());
+ if (m2Size == 1) {
+ // if it is just the DEFAULT pool then ignore it
+ Pool p = (Pool) m2.values().iterator().next();
+ if (p.getName().equals("DEFAULT")) {
+ m2Size = 0;
}
+ }
- if (m1Size > 0) {
- Iterator it1 = m1.values().iterator();
- while (it1.hasNext()) {
- PoolImpl cp = (PoolImpl) it1.next();
- // ignore any gateway instances
- if (!(cp).isUsedByGateway()) {
- cp.sameAs(m2.get(cp.getName()));
- }
+ if (m1Size != m2Size) {
+ throw new RuntimeException("pool sizes differ m1Size=" + m1Size + " m2Size=" + m2Size
+ + " m1=" + m1.values() + " m2=" + m2.values());
+ }
+
+ if (m1Size > 0) {
+ for (Pool pool : m1.values()) {
+ PoolImpl poolImpl = (PoolImpl) pool;
+ // ignore any gateway instances
+ if (!poolImpl.isUsedByGateway()) {
+ poolImpl.sameAs(m2.get(poolImpl.getName()));
}
}
}
// compare disk stores
- for (Iterator myIter = diskStores.values().iterator(); myIter.hasNext();) {
- DiskStoreAttributesCreation dsac = (DiskStoreAttributesCreation) myIter.next();
+ for (DiskStore diskStore : this.diskStores.values()) {
+ DiskStoreAttributesCreation dsac = (DiskStoreAttributesCreation) diskStore;
String name = dsac.getName();
DiskStore ds = other.findDiskStore(name);
if (ds == null) {
@@ -814,20 +799,21 @@ public class CacheCreation implements InternalCache {
}
}
- Map myNamedAttributes = this.listRegionAttributes();
- Map otherNamedAttributes = other.listRegionAttributes();
+ Map<String, RegionAttributes<?, ?>> myNamedAttributes = this.listRegionAttributes();
+ Map<String, RegionAttributes<Object, Object>> otherNamedAttributes =
+ other.listRegionAttributes();
if (myNamedAttributes.size() != otherNamedAttributes.size()) {
throw new RuntimeException(
LocalizedStrings.CacheCreation_NAMEDATTRIBUTES_SIZE.toLocalizedString());
}
- for (Iterator myIter = myNamedAttributes.entrySet().iterator(); myIter.hasNext();) {
- Map.Entry myEntry = (Map.Entry) myIter.next();
+ for (Object object : myNamedAttributes.entrySet()) {
+ Entry myEntry = (Entry) object;
String myId = (String) myEntry.getKey();
Assert.assertTrue(myEntry.getValue() instanceof RegionAttributesCreation,
"Entry value is a " + myEntry.getValue().getClass().getName());
RegionAttributesCreation myAttrs = (RegionAttributesCreation) myEntry.getValue();
- RegionAttributes otherAttrs = other.getRegionAttributes(myId);
+ RegionAttributes<Object, Object> otherAttrs = other.getRegionAttributes(myId);
if (otherAttrs == null) {
getLogger().fine("No attributes for " + myId);
throw new RuntimeException(
@@ -842,19 +828,19 @@ public class CacheCreation implements InternalCache {
}
}
- Collection myRoots = this.roots.values();
- Collection otherRoots = other.rootRegions();
+ Collection<Region<?, ?>> myRoots = this.roots.values();
+ Collection<Region<?, ?>> otherRoots = other.rootRegions();
if (myRoots.size() != otherRoots.size()) {
throw new RuntimeException(LocalizedStrings.CacheCreation_ROOTS_SIZE.toLocalizedString());
}
- Iterator it = myRoots.iterator();
- while (it.hasNext()) {
- RegionCreation r = (RegionCreation) it.next();
- Region r2 = other.getRegion(r.getName());
- if (r2 == null) {
+
+ for (final Region<?, ?> myRoot : myRoots) {
+ RegionCreation rootRegion = (RegionCreation) myRoot;
+ Region<Object, Object> otherRegion = other.getRegion(rootRegion.getName());
+ if (otherRegion == null) {
throw new RuntimeException(
- LocalizedStrings.CacheCreation_NO_ROOT_0.toLocalizedString(r.getName()));
- } else if (!r.sameAs(r2)) {
+ LocalizedStrings.CacheCreation_NO_ROOT_0.toLocalizedString(rootRegion.getName()));
+ } else if (!rootRegion.sameAs(otherRegion)) {
throw new RuntimeException(
LocalizedStrings.CacheCreation_REGIONS_DIFFER.toLocalizedString());
}
@@ -865,8 +851,10 @@ public class CacheCreation implements InternalCache {
// Currently the GemFireCache always has a CacheTransactionManager,
// whereas that is not true for CacheTransactionManagerCreation.
- List otherTxListeners = Arrays.asList(other.getCacheTransactionManager().getListeners());
- List thisTxListeners = Arrays.asList(getCacheTransactionManager().getListeners());
+ List<TransactionListener> otherTxListeners =
+ Arrays.asList(other.getCacheTransactionManager().getListeners());
+ List<TransactionListener> thisTxListeners =
+ Arrays.asList(getCacheTransactionManager().getListeners());
if (!thisTxListeners.equals(otherTxListeners)) {
throw new RuntimeException(LocalizedStrings.CacheCreation_TXLISTENER.toLocalizedString());
@@ -881,88 +869,93 @@ public class CacheCreation implements InternalCache {
return true;
}
- ////////// Inherited methods that don't do anything //////////
-
+ @Override
public void close() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public void close(boolean keepalive) {
+ @Override
+ public void close(boolean keepAlive) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- // public Region createRootRegion(RegionAttributes aRegionAttributes)
- // throws RegionExistsException, TimeoutException {
- //
- // throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
- // }
-
- // see Cache.isReconnecting()
+ @Override
public boolean isReconnecting() {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- // see Cache.waitUntilReconnected(long, TimeUnit)
+ @Override
public boolean waitUntilReconnected(long time, TimeUnit units) throws InterruptedException {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- // see Cache.stopReconnecting()
+ @Override
public void stopReconnecting() {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- // see Cache.getReconnectedCache()
+ @Override
public Cache getReconnectedCache() {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public LogWriter getLogger() {
return this.logWriter;
}
+ @Override
public LogWriter getSecurityLogger() {
return this.securityLogWriter;
}
+ @Override
public LogWriterI18n getLoggerI18n() {
return this.logWriter.convertToLogWriterI18n();
}
+ @Override
public LogWriterI18n getSecurityLoggerI18n() {
return this.securityLogWriter.convertToLogWriterI18n();
}
+ @Override
public DistributedSystem getDistributedSystem() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public boolean isClosed() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public String getName() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public CancelCriterion getCancelCriterion() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public org.apache.geode.cache.query.QueryService getQueryService() {
- return queryService;
+ @Override
+ public QueryService getQueryService() {
+ return this.queryService;
}
/**
* @since GemFire 6.5
*/
- public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut atts) {
+ @Override
+ public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut shortcut) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
/**
* @since GemFire 6.5
*/
+ @Override
public <K, V> RegionFactory<K, V> createRegionFactory() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -970,6 +963,7 @@ public class CacheCreation implements InternalCache {
/**
* @since GemFire 6.5
*/
+ @Override
public <K, V> RegionFactory<K, V> createRegionFactory(String regionAttributesId) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -977,24 +971,27 @@ public class CacheCreation implements InternalCache {
/**
* @since GemFire 6.5
*/
+ @Override
public <K, V> RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public Region createVMRegion(String name, RegionAttributes attrs)
+ @Override
+ public Region createVMRegion(String name, RegionAttributes aRegionAttributes)
throws RegionExistsException, TimeoutException {
- return createRegion(name, attrs);
+ return createRegion(name, aRegionAttributes);
}
- public Region createRegion(String name, RegionAttributes attrs)
+ @Override
+ public Region createRegion(String name, RegionAttributes aRegionAttributes)
throws RegionExistsException, TimeoutException {
- if (attrs instanceof RegionAttributesCreation) {
- ((RegionAttributesCreation) attrs).inheritAttributes(this);
- ((RegionAttributesCreation) attrs).prepareForValidation();
+ if (aRegionAttributes instanceof RegionAttributesCreation) {
+ ((RegionAttributesCreation) aRegionAttributes).inheritAttributes(this);
+ ((RegionAttributesCreation) aRegionAttributes).prepareForValidation();
}
- AttributesFactory.validateAttributes(attrs);
+ AttributesFactory.validateAttributes(aRegionAttributes);
RegionCreation region = new RegionCreation(this, name, null);
- region.setAttributes(attrs);
+ region.setAttributes(aRegionAttributes);
this.addRootRegion(region);
return region;
}
@@ -1006,13 +1003,15 @@ public class CacheCreation implements InternalCache {
return region;
}
+ @Override
public Region getRegion(String path) {
- if (path.indexOf('/') != -1) {
- throw new UnsupportedOperationException();
+ if (!path.contains("/")) {
+ throw new UnsupportedOperationException("Region path must contain '/'");
}
- return (Region) this.roots.get(path);
+ return this.roots.get(path);
}
+ @Override
public CacheServer addCacheServer() {
return addCacheServer(false);
}
@@ -1023,31 +1022,132 @@ public class CacheCreation implements InternalCache {
return bridge;
}
- public void addDeclarableProperties(final Declarable declarable, final Properties properties) {
+ void addDeclarableProperties(final Declarable declarable, final Properties properties) {
this.declarablePropertiesMap.put(declarable, properties);
}
- public List getCacheServers() {
+ @Override
+ public List<CacheServer> getCacheServers() {
return this.bridgeServers;
}
- public GatewaySender addGatewaySender(GatewaySender sender) {
+ @Override
+ public void addGatewaySender(GatewaySender sender) {
this.gatewaySenders.add(sender);
- return sender;
}
- public GatewayReceiver addGatewayReceiver(GatewayReceiver receiver) {
+ @Override
+ public void addAsyncEventQueue(final AsyncEventQueueImpl asyncQueue) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void removeAsyncEventQueue(final AsyncEventQueue asyncQueue) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public QueryMonitor getQueryMonitor() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void close(final String reason, final Throwable systemFailureCause,
+ final boolean keepAlive, final boolean keepDS) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public JmxManagerAdvisor getJmxManagerAdvisor() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public List<Properties> getDeclarableProperties(final String className) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public int getUpTime() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public Set<Region<?, ?>> rootRegions(final boolean includePRAdminRegions) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public Set<LocalRegion> getAllRegions() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public DistributedRegion getRegionInDestroy(final String path) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void addRegionOwnedDiskStore(final DiskStoreImpl dsi) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public DiskStoreMonitor getDiskStoreMonitor() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void close(final String reason, final Throwable optionalCause) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public LocalRegion getRegionByPathForProcessing(final String path) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public List getCacheServersAndGatewayReceiver() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public boolean isGlobalRegionInitializing(final String fullPath) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public DistributionAdvisor getDistributionAdvisor() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void setQueryMonitorRequiredForResourceManager(final boolean required) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public boolean isQueryMonitorDisabledForLowMemory() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public boolean isRESTServiceRunning() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ public void addGatewayReceiver(GatewayReceiver receiver) {
this.gatewayReceivers.add(receiver);
- return receiver;
}
- public AsyncEventQueue addAsyncEventQueue(AsyncEventQueue asyncEventQueue) {
+ public void addAsyncEventQueue(AsyncEventQueue asyncEventQueue) {
this.asyncEventQueues.add(asyncEventQueue);
- return asyncEventQueue;
}
+ @Override
public Set<GatewaySender> getGatewaySenders() {
- Set<GatewaySender> tempSet = new HashSet<GatewaySender>();
+ Set<GatewaySender> tempSet = new HashSet<>();
for (GatewaySender sender : this.gatewaySenders) {
if (!((AbstractGatewaySender) sender).isForInternalUse()) {
tempSet.add(sender);
@@ -1056,23 +1156,27 @@ public class CacheCreation implements InternalCache {
return tempSet;
}
- public GatewaySender getGatewaySender(String Id) {
+ @Override
+ public GatewaySender getGatewaySender(String id) {
for (GatewaySender sender : this.gatewaySenders) {
- if (sender.getId().equals(Id)) {
+ if (sender.getId().equals(id)) {
return sender;
}
}
return null;
}
+ @Override
public Set<GatewayReceiver> getGatewayReceivers() {
return this.gatewayReceivers;
}
+ @Override
public Set<AsyncEventQueue> getAsyncEventQueues() {
return this.asyncEventQueues;
}
+ @Override
public AsyncEventQueue getAsyncEventQueue(String id) {
for (AsyncEventQueue asyncEventQueue : this.asyncEventQueues) {
if (asyncEventQueue.getId().equals(id)) {
@@ -1082,17 +1186,15 @@ public class CacheCreation implements InternalCache {
return null;
}
+ @Override
public void setIsServer(boolean isServer) {
this.isServer = isServer;
this.hasServer = true;
}
+ @Override
public boolean isServer() {
- if (!this.isServer) {
- return (this.bridgeServers.size() > 0);
- } else {
- return true;
- }
+ return this.isServer || !this.bridgeServers.isEmpty();
}
boolean hasServer() {
@@ -1108,10 +1210,11 @@ public class CacheCreation implements InternalCache {
return this.hasDynamicRegionFactory;
}
- public DynamicRegionFactory.Config getDynamicRegionFactoryConfig() {
+ DynamicRegionFactory.Config getDynamicRegionFactoryConfig() {
return this.dynamicRegionFactoryConfig;
}
+ @Override
public CacheTransactionManager getCacheTransactionManager() {
return this.txMgrCreation;
}
@@ -1121,6 +1224,7 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire 4.0
*/
+ @Override
public void setCopyOnRead(boolean copyOnRead) {
this.copyOnRead = copyOnRead;
this.hasCopyOnRead = true;
@@ -1131,6 +1235,7 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire 4.0
*/
+ @Override
public boolean getCopyOnRead() {
return this.copyOnRead;
}
@@ -1153,17 +1258,17 @@ public class CacheCreation implements InternalCache {
/**
* @return Context jndi context associated with the Cache.
*/
+ @Override
public Context getJNDIContext() {
return JNDIInvoker.getJNDIContext();
}
- // It's not used
- public DiskStore findDiskStore(String storeName) {
- String s = storeName;
- if (s == null) {
- s = GemFireCacheImpl.getDefaultDiskStoreName();
+ @Override
+ public DiskStore findDiskStore(String name) {
+ if (name == null) {
+ name = GemFireCacheImpl.getDefaultDiskStoreName();
}
- return (DiskStore) this.diskStores.get(s);
+ return this.diskStores.get(name);
}
public void addDiskStore(DiskStore ds) {
@@ -1175,20 +1280,21 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire prPersistSprint2
*/
- public Collection<DiskStoreImpl> listDiskStores() {
+ @Override
+ public Collection<DiskStore> listDiskStores() {
return this.diskStores.values();
}
- public void setDiskStore(String name, DiskStoreAttributesCreation dsac) {
- // Assert.assertTrue(ds instanceof DiskStoreAttributesCreation,
- // "Attributes are a " + ds.getClass().getName());
+ void setDiskStore(String name, DiskStoreAttributesCreation dsac) {
this.diskStores.put(name, dsac);
}
+ @Override
public RegionAttributes getRegionAttributes(String id) {
- return (RegionAttributes) this.namedRegionAttributes.get(id);
+ return this.namedRegionAttributes.get(id);
}
+ @Override
public void setRegionAttributes(String id, RegionAttributes attrs) {
RegionAttributes a = attrs;
if (!(a instanceof RegionAttributesCreation)) {
@@ -1198,83 +1304,71 @@ public class CacheCreation implements InternalCache {
this.regionAttributesNames.add(id);
}
- public Map listRegionAttributes() {
+ @Override
+ public Map<String, RegionAttributes<?, ?>> listRegionAttributes() {
return Collections.unmodifiableMap(this.namedRegionAttributes);
}
+ @Override
public void loadCacheXml(InputStream is)
throws TimeoutException, CacheWriterException, RegionExistsException {
-
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public void readyForEvents() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- private final PoolManagerImpl pm = new PoolManagerImpl(false);
+ private final PoolManagerImpl poolManager = new PoolManagerImpl(false);
+
private volatile FunctionServiceCreation functionServiceCreation;
- public Map getPools() {
- return this.pm.getMap();
+ public Map<String, Pool> getPools() {
+ return this.poolManager.getMap();
}
public PoolFactory createPoolFactory() {
- return (new PoolFactoryImpl(this.pm)).setStartDisabled(true);
+ return new PoolFactoryImpl(this.poolManager).setStartDisabled(true);
}
- public Pool findPool(String name) {
- return this.pm.find(name);
- }
-
- public void setFunctionServiceCreation(FunctionServiceCreation f) {
- this.functionServiceCreation = f;
- }
-
- public FunctionServiceCreation getFunctionServiceCreation() {
- return this.functionServiceCreation;
+ public void setFunctionServiceCreation(FunctionServiceCreation functionServiceCreation) {
+ this.functionServiceCreation = functionServiceCreation;
}
private volatile boolean hasResourceManager = false;
+
private volatile ResourceManagerCreation resourceManagerCreation;
- public void setResourceManagerCreation(ResourceManagerCreation rmc) {
+ public void setResourceManagerCreation(ResourceManagerCreation resourceManagerCreation) {
this.hasResourceManager = true;
- this.resourceManagerCreation = rmc;
+ this.resourceManagerCreation = resourceManagerCreation;
}
+ @Override
public ResourceManagerCreation getResourceManager() {
return this.resourceManagerCreation;
}
- public boolean hasResourceManager() {
+ boolean hasResourceManager() {
return this.hasResourceManager;
}
- private volatile boolean hasSerializerRegistration = false;
private volatile SerializerCreation serializerCreation;
- public void setSerializerCreation(SerializerCreation sc) {
- this.hasSerializerRegistration = true;
- this.serializerCreation = sc;
+ public void setSerializerCreation(SerializerCreation serializerCreation) {
+ this.serializerCreation = serializerCreation;
}
- public SerializerCreation getSerializerCreation() {
+ SerializerCreation getSerializerCreation() {
return this.serializerCreation;
}
- public boolean hasSerializerCreation() {
- return this.hasSerializerRegistration;
- }
-
- public FunctionService getFunctionService() {
- throw new UnsupportedOperationException();
- }
-
public void addBackup(File backup) {
this.backups.add(backup);
}
+ @Override
public List<File> getBackupFiles() {
return Collections.unmodifiableList(this.backups);
}
@@ -1300,12 +1394,12 @@ public class CacheCreation implements InternalCache {
}
@Override
- public void addRegionListener(final RegionListener l) {
+ public void addRegionListener(final RegionListener regionListener) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@Override
- public void removeRegionListener(final RegionListener l) {
+ public void removeRegionListener(final RegionListener regionListener) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -1314,36 +1408,39 @@ public class CacheCreation implements InternalCache {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public GatewaySenderFactory createGatewaySenderFactory() {
return WANServiceProvider.createGatewaySenderFactory(this);
}
+ @Override
public GatewayReceiverFactory createGatewayReceiverFactory() {
return WANServiceProvider.createGatewayReceiverFactory(this);
}
+ @Override
public AsyncEventQueueFactory createAsyncEventQueueFactory() {
return new AsyncEventQueueFactoryImpl(this);
}
public void setPdxReadSerialized(boolean readSerialized) {
- cacheConfig.setPdxReadSerialized(readSerialized);
+ this.cacheConfig.setPdxReadSerialized(readSerialized);
}
public void setPdxIgnoreUnreadFields(boolean ignore) {
- cacheConfig.setPdxIgnoreUnreadFields(ignore);
+ this.cacheConfig.setPdxIgnoreUnreadFields(ignore);
}
public void setPdxSerializer(PdxSerializer serializer) {
- cacheConfig.setPdxSerializer(serializer);
+ this.cacheConfig.setPdxSerializer(serializer);
}
public void setPdxDiskStore(String diskStore) {
- cacheConfig.setPdxDiskStore(diskStore);
+ this.cacheConfig.setPdxDiskStore(diskStore);
}
public void setPdxPersistent(boolean persistent) {
- cacheConfig.setPdxPersistent(persistent);
+ this.cacheConfig.setPdxPersistent(persistent);
}
/**
@@ -1353,102 +1450,196 @@ public class CacheCreation implements InternalCache {
*
* @since GemFire 6.6
*/
+ @Override
public boolean getPdxReadSerialized() {
- return cacheConfig.isPdxReadSerialized();
+ return this.cacheConfig.isPdxReadSerialized();
}
+ @Override
public PdxSerializer getPdxSerializer() {
- return cacheConfig.getPdxSerializer();
+ return this.cacheConfig.getPdxSerializer();
}
+ @Override
public String getPdxDiskStore() {
- return cacheConfig.getPdxDiskStore();
+ return this.cacheConfig.getPdxDiskStore();
}
+ @Override
public boolean getPdxPersistent() {
- return cacheConfig.isPdxPersistent();
+ return this.cacheConfig.isPdxPersistent();
}
+ @Override
public boolean getPdxIgnoreUnreadFields() {
- return cacheConfig.getPdxIgnoreUnreadFields();
+ return this.cacheConfig.getPdxIgnoreUnreadFields();
}
-
+ @Override
public CacheConfig getCacheConfig() {
- return cacheConfig;
+ return this.cacheConfig;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.Cache#getMembers()
- */
+ @Override
+ public boolean getPdxReadSerializedByAnyGemFireServices() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public BackupManager getBackupManager() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void setDeclarativeCacheConfig(final CacheConfig cacheConfig) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void initializePdxRegistry() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void readyDynamicRegionFactory() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void setBackupFiles(final List<File> backups) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void addDeclarableProperties(final Map<Declarable, Properties> mapOfNewDeclarableProps) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
public Set<DistributedMember> getMembers() {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.Cache#getAdminMembers()
- */
+ @Override
public Set<DistributedMember> getAdminMembers() {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.Cache#getMembers(org.apache.geode.cache.Region)
- */
+ @Override
public Set<DistributedMember> getMembers(Region region) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
private Declarable initializer = null;
+
private Properties initializerProps = null;
+ @Override
public Declarable getInitializer() {
return this.initializer;
}
+ @Override
public Properties getInitializerProps() {
return this.initializerProps;
}
- public void setInitializer(Declarable d, Properties props) {
- this.initializer = d;
+ @Override
+ public void setInitializer(Declarable declarable, Properties props) {
+ this.initializer = declarable;
this.initializerProps = props;
}
- protected void runInitializer() {
+ @Override
+ public boolean hasPool() {
+ return false;
+ }
+
+ @Override
+ public DiskStoreFactory createDiskStoreFactory(final DiskStoreAttributes attrs) {
+ return null;
+ }
+
+ @Override
+ public void determineDefaultPool() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public <K, V> Region<K, V> basicCreateRegion(final String name,
+ final RegionAttributes<K, V> attrs) throws RegionExistsException, TimeoutException {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public BackupManager startBackup(final InternalDistributedMember sender) throws IOException {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public Throwable getDisconnectCause() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void addPartitionedRegion(final PartitionedRegion region) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void removePartitionedRegion(final PartitionedRegion region) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void addDiskStore(final DiskStoreImpl dsi) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public TXEntryStateFactory getTXEntryStateFactory() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public ExpiryTask getEventTrackerTask() {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public void removeDiskStore(final DiskStoreImpl diskStore) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ void runInitializer() {
if (getInitializer() != null) {
getInitializer().init(getInitializerProps());
}
}
- public void setGatewayConflictResolver(GatewayConflictResolver g) {
- this.gatewayConflictResolver = g;
+ @Override
+ public void setGatewayConflictResolver(GatewayConflictResolver resolver) {
+ this.gatewayConflictResolver = resolver;
}
+ @Override
public GatewayConflictResolver getGatewayConflictResolver() {
return this.gatewayConflictResolver;
}
+ @Override
public PdxInstanceFactory createPdxInstanceFactory(String className) {
- throw new UnsupportedOperationException();
- }
-
- public PdxInstanceFactory createPdxInstanceFactory(String className, boolean b) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public PdxInstance createPdxEnum(String className, String enumName, int enumOrdinal) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public CacheSnapshotService getSnapshotService() {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
/**
@@ -1457,16 +1648,16 @@ public class CacheCreation implements InternalCache {
*/
@Override
public ExtensionPoint<Cache> getExtensionPoint() {
- return extensionPoint;
+ return this.extensionPoint;
}
@Override
- public DistributedMember getMyId() {
+ public InternalDistributedMember getMyId() {
return null;
}
@Override
- public Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned() {
+ public Collection<DiskStore> listDiskStoresIncludingRegionOwned() {
return null;
}
@@ -1475,9 +1666,9 @@ public class CacheCreation implements InternalCache {
return null;
}
- public QueryService queryService = new org.apache.geode.cache.query.QueryService() {
+ private final QueryService queryService = new QueryService() {
- private Map<String, List> indexes = new HashMap<String, List>();
+ private final Map<String, List<Index>> indexes = new HashMap<>();
@Override
public Query newQuery(String queryString) {
@@ -1505,21 +1696,21 @@ public class CacheCreation implements InternalCache {
return createIndex(indexName, indexType, indexedExpression, fromClause, "");
}
- @Override
/**
* Due to not having the full implementation to determine region names etc this implementation
* will only match a single region with no alias at this time
*/
+ @Override
public Index createIndex(String indexName, IndexType indexType, String indexedExpression,
String fromClause, String imports) throws IndexInvalidException, IndexNameConflictException,
IndexExistsException, RegionNotFoundException, UnsupportedOperationException {
IndexCreationData indexData = new IndexCreationData(indexName);
indexData.setFunctionalIndexData(fromClause, indexedExpression, imports);
indexData.setIndexType(indexType.toString());
- List indexesForRegion = indexes.get(fromClause);
+ List<Index> indexesForRegion = this.indexes.get(fromClause);
if (indexesForRegion == null) {
- indexesForRegion = new ArrayList();
- indexes.put(fromClause, indexesForRegion);
+ indexesForRegion = new ArrayList<>();
+ this.indexes.put(fromClause, indexesForRegion);
}
indexesForRegion.add(indexData);
return indexData;
@@ -1560,7 +1751,7 @@ public class CacheCreation implements InternalCache {
@Override
public Collection<Index> getIndexes(Region<?, ?> region) {
- return indexes.get(region.getFullPath());
+ return this.indexes.get(region.getFullPath());
}
@Override
@@ -1659,7 +1850,7 @@ public class CacheCreation implements InternalCache {
@Override
- public void defineKeyIndex(String indexName, String indexedExpression, String fromClause)
+ public void defineKeyIndex(String indexName, String indexedExpression, String regionPath)
throws RegionNotFoundException {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -1702,7 +1893,7 @@ public class CacheCreation implements InternalCache {
@Override
public <T extends CacheService> T getService(Class<T> clazz) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@Override
@@ -1799,8 +1990,9 @@ public class CacheCreation implements InternalCache {
}
@Override
- public RegionAttributes invokeRegionBefore(final LocalRegion parent, final String name,
- final RegionAttributes attrs, final InternalRegionArguments internalRegionArgs) {
+ public <K, V> RegionAttributes<K, V> invokeRegionBefore(final LocalRegion parent,
+ final String name, final RegionAttributes<K, V> attrs,
+ final InternalRegionArguments internalRegionArgs) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java
index fbb82e8..667ae0c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java
@@ -14,6 +14,13 @@
*/
package org.apache.geode.internal.cache.xmlcache;
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheWriterException;
@@ -22,6 +29,7 @@ import org.apache.geode.cache.DiskStoreFactory;
import org.apache.geode.cache.DynamicRegionFactory;
import org.apache.geode.cache.GatewayException;
import org.apache.geode.cache.InterestPolicy;
+import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.RegionService;
@@ -33,36 +41,25 @@ import org.apache.geode.cache.client.ClientRegionFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
-import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PoolFactoryImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.pdx.internal.TypeRegistry;
-
-import java.io.File;
-import java.net.InetSocketAddress;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
/**
* Represents a {@link ClientCache} that is created declaratively. Notice that it implements the
* {@link ClientCache} interface so that this class must be updated when {@link ClientCache} is
* modified. This class is public for testing purposes.
*
- *
* @since GemFire 6.5
*/
@SuppressWarnings("deprecation")
public class ClientCacheCreation extends CacheCreation implements ClientCache {
- //////////////////////// Constructors ////////////////////////
-
/**
- * Creates a new <code>ClientCacheCreation</code> with no root regions
+ * Creates a new {@code ClientCacheCreation} with no root regions
*/
public ClientCacheCreation() {
this(false);
@@ -73,19 +70,18 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
* for generating xml.
* @since GemFire 5.7
*/
- public ClientCacheCreation(boolean forParsing) {
+ ClientCacheCreation(boolean forParsing) {
super(forParsing);
}
- ////////////////////// Instance Methods //////////////////////
+ private static final RegionAttributes clientDefaults = createClientDefaults();
- static final private RegionAttributes clientDefaults;
- static {
+ private static RegionAttributes createClientDefaults() {
AttributesFactory af = new AttributesFactory();
af.setScope(Scope.LOCAL);
// af.setIgnoreJTA(true); In 6.6 and later releases client regions support JTA
af.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));
- clientDefaults = af.create();
+ return af.create();
}
@Override
@@ -98,17 +94,25 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
GemFireCacheImpl.initializeClientRegionShortcuts(this);
}
- public org.apache.geode.cache.query.QueryService getQueryService(String poolName) {
+ @Override
+ public QueryService getQueryService(String poolName) {
+ throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+ }
+
+ @Override
+ public QueryService getLocalQueryService() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public org.apache.geode.cache.query.QueryService getLocalQueryService() {
+ @Override
+ public void determineDefaultPool() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
/**
* @since GemFire 6.5
*/
+ @Override
public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(ClientRegionShortcut atts) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -116,14 +120,17 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
/**
* @since GemFire 6.5
*/
+ @Override
public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(String regionAttributesId) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public RegionService createAuthenticatedView(Properties properties, String poolName) {
+ @Override
+ public RegionService createAuthenticatedView(Properties userSecurityProperties, String poolName) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
+ @Override
public RegionService createAuthenticatedView(Properties userSecurityProperties) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -165,32 +172,22 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
/**
* Fills in the contents of a {@link Cache} based on this creation object's state.
- *
- * @throws TimeoutException
- * @throws CacheWriterException
- * @throws RegionExistsException
- * @throws GatewayException
*/
@Override
- void create(GemFireCacheImpl cache)
+ void create(InternalCache cache)
throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
cache.setDeclarativeCacheConfig(this.getCacheConfig());
if (!cache.isClient()) {
throw new IllegalStateException(
"You must use ClientCacheFactory when the cache.xml uses client-cache.");
}
- { // create connection pools
- Map m = getPools();
- if (!m.isEmpty()) {
- boolean setDefault = m.size() == 1;
- Iterator it = m.values().iterator();
- while (it.hasNext()) {
- Pool cp = (Pool) it.next();
- PoolFactoryImpl f;
- f = (PoolFactoryImpl) PoolManager.createFactory();
- f.init(cp);
- PoolImpl p = (PoolImpl) f.create(cp.getName());
- }
+ // create connection pools
+ Map<String, Pool> pools = getPools();
+ if (!pools.isEmpty()) {
+ for (final Pool cp : pools.values()) {
+ PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory();
+ poolFactory.init(cp);
+ poolFactory.create(cp.getName());
}
}
@@ -205,20 +202,18 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
cache.initializePdxRegistry();
- for (Iterator iter = listDiskStores().iterator(); iter.hasNext();) {
- DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) iter.next();
+ for (DiskStore diskStore : listDiskStores()) {
+ DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;
if (creation != pdxRegDSC) {
createDiskStore(creation, cache);
}
}
- for (Iterator iter = listDiskStores().iterator(); iter.hasNext();) {
- DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) iter.next();
+ for (DiskStore diskStore : listDiskStores()) {
+ DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;
- // It's GemFireCache
- GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
// Don't let the DiskStoreAttributesCreation escape to the user
- DiskStoreFactory factory = gfc.createDiskStoreFactory(creation);
- DiskStore ds = factory.create(creation.getName());
+ DiskStoreFactory factory = cache.createDiskStoreFactory(creation);
+ factory.create(creation.getName());
}
if (hasDynamicRegionFactory()) {
@@ -241,23 +236,20 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
cache.initializePdxRegistry();
- for (Iterator iter = this.regionAttributesNames.iterator(); iter.hasNext();) {
- String id = (String) iter.next();
+ for (String id : this.regionAttributesNames) {
RegionAttributesCreation creation = (RegionAttributesCreation) getRegionAttributes(id);
creation.inheritAttributes(cache, false);
- RegionAttributes attrs;
// Don't let the RegionAttributesCreation escape to the user
AttributesFactory factory = new AttributesFactory(creation);
- attrs = factory.createRegionAttributes();
+ RegionAttributes attrs = factory.createRegionAttributes();
cache.setRegionAttributes(id, attrs);
}
- Iterator it = this.roots.values().iterator();
- while (it.hasNext()) {
- RegionCreation r = (RegionCreation) it.next();
- r.createRoot(cache);
+ for (final Region<?, ?> region : this.roots.values()) {
+ RegionCreation regionCreation = (RegionCreation) region;
+ regionCreation.createRoot(cache);
}
cache.readyDynamicRegionFactory();
@@ -266,39 +258,29 @@ public class ClientCacheCreation extends CacheCreation implements ClientCache {
public String getDefaultPoolName() {
String result = null;
- Map m = getPools();
- if (m.size() == 1) {
- Pool p = (Pool) m.values().iterator().next();
- result = p.getName();
- } else if (m.isEmpty()) {
+ Map<String, Pool> pools = getPools();
+ if (pools.size() == 1) {
+ Pool pool = pools.values().iterator().next();
+ result = pool.getName();
+ } else if (pools.isEmpty()) {
result = "DEFAULT";
}
return result;
}
+ @Override
public Pool getDefaultPool() {
- return (Pool) getPools().get(getDefaultPoolName());
+ return getPools().get(getDefaultPoolName());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.client.CacheCreation#getPdxReadSerialized()
- */
@Override
public boolean getPdxReadSerialized() {
return false;
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.cache.client.ClientCache#getCurrentServers()
- */
+ @Override
public Set<InetSocketAddress> getCurrentServers() {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation.java
index 3425c89..2316666 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation.java
@@ -33,7 +33,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* @since GemFire prPersistSprint2
*/
public class DiskStoreAttributesCreation extends UserSpecifiedDiskStoreAttributes
- implements Serializable {
+ implements Serializable, DiskStore {
/**
* An <code>AttributesFactory</code> for creating default <code>RegionAttribute</code>s
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/RegionCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/RegionCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/RegionCreation.java
index 712bbfb..9e18a3a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/RegionCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/RegionCreation.java
@@ -47,6 +47,7 @@ import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.internal.index.IndexCreationData;
import org.apache.geode.cache.snapshot.RegionSnapshotService;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.extension.Extensible;
import org.apache.geode.internal.cache.extension.ExtensionPoint;
@@ -252,7 +253,7 @@ public class RegionCreation implements Region, Extensible<Region<?, ?>> {
extensionPoint.beforeCreate(cache);
try {
- root = ((GemFireCacheImpl) cache).basicCreateRegion(this.name,
+ root = ((InternalCache) cache).basicCreateRegion(this.name,
new AttributesFactory(this.attrs).create());
} catch (RegionExistsException ex) {
root = ex.getRegion();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
index 28f37ef..3485ede 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.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.internal.lang;
import java.io.File;
@@ -49,6 +48,8 @@ public class SystemUtils {
public static final String WINDOWS_OS_NAME = "Windows";
public static final String SOLARIS_OS_NAME = "SunOS";
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
/**
* Utility method to determine whether the installed Java Runtime Environment (JRE) is minimally
* at the specified, expected version. Typically, Java versions are of the form "1.6.0_31"... In
@@ -83,7 +84,7 @@ public class SystemUtils {
'0', actualVersionDigits.length());
try {
- return (Long.parseLong(actualVersionDigits) >= Long.parseLong(expectedVersionDigits));
+ return Long.parseLong(actualVersionDigits) >= Long.parseLong(expectedVersionDigits);
} catch (NumberFormatException ignore) {
return false;
}
@@ -126,7 +127,7 @@ public class SystemUtils {
// @see java.lang.System#getProperty(String) with 'java.vm.vendor'.
private static boolean isJvmVendor(final String expectedJvmVendorName) {
String jvmVendor = System.getProperty("java.vm.vendor");
- return (jvmVendor != null && jvmVendor.contains(expectedJvmVendorName));
+ return jvmVendor != null && jvmVendor.contains(expectedJvmVendorName);
}
/**
@@ -164,10 +165,12 @@ public class SystemUtils {
return isJVM(ORACLE_JROCKIT_JVM_NAME);
}
- // @see java.lang.System#getProperty(String) with "java.vm.name".
+ /**
+ * Returns true if the expectedJvmName matches {@code System.getProperty("java.vm.name")}.
+ */
private static boolean isJVM(final String expectedJvmName) {
String jvmName = System.getProperty("java.vm.name");
- return (jvmName != null && jvmName.contains(expectedJvmName));
+ return jvmName != null && jvmName.contains(expectedJvmName);
}
/**
@@ -220,11 +223,10 @@ public class SystemUtils {
/**
* Returns true if the specified location is in the JVM classpath. This may ignore additions to
* the classpath that are not reflected by the value in
- * <code>System.getProperty("java.class.path")</code>.
+ * {@code System.getProperty("java.class.path")}.
*
* @param location the directory or jar name to test for
* @return true if location is in the JVM classpath
- * @throws MalformedURLException
*/
public static boolean isInClassPath(String location) throws MalformedURLException {
return isInClassPath(new File(location).toURI().toURL());
@@ -233,11 +235,10 @@ public class SystemUtils {
/**
* Returns true if the specified location is in the JVM classpath. This may ignore additions to
* the classpath that are not reflected by the value in
- * <code>System.getProperty("java.class.path")</code>.
+ * {@code System.getProperty("java.class.path")}.
*
* @param location the directory or jar URL to test for
* @return true if location is in the JVM classpath
- * @throws MalformedURLException
*/
public static boolean isInClassPath(URL location) throws MalformedURLException {
String classPath = getClassPath();
@@ -252,44 +253,52 @@ public class SystemUtils {
}
/**
- * Returns the value of {code System.getProperty("os.name")}.
+ * Returns the value of {@code System.getProperty("os.name")}.
*/
public static String getOsName() {
return System.getProperty("os.name");
}
/**
- * Returns the value of {code System.getProperty("os.version")}.
+ * Returns the value of {@code System.getProperty("os.version")}.
*/
public static String getOsVersion() {
return System.getProperty("os.version");
}
/**
- * Returns the value of {code System.getProperty("os.arch")}.
+ * Returns the value of {@code System.getProperty("os.arch")}.
*/
public static String getOsArchitecture() {
return System.getProperty("os.arch");
}
/**
- * Returns the value of {code System.getProperty("java.class.path")}.
+ * Returns the value of {@code System.getProperty("java.class.path")}.
*/
public static String getClassPath() {
return System.getProperty("java.class.path");
}
/**
- * Returns the value of {code System.getProperty("sun.boot.class.path")}.
+ * Returns the value of {@code System.getProperty("sun.boot.class.path")}.
*/
public static String getBootClassPath() {
return System.getProperty("sun.boot.class.path");
}
- // @see java.lang.System#getProperty(String) with "os.name".
+ /**
+ * Returns true if expectedOsName matches {@code System.getProperty("os.name")}.
+ */
private static boolean isOS(final String expectedOsName) {
String osName = getOsName();
- return (osName != null && osName.contains(expectedOsName));
+ return osName != null && osName.contains(expectedOsName);
}
+ /**
+ * Returns the value of {@code System.getProperty("line.separator")}.
+ */
+ public static String getLineSeparator() {
+ return LINE_SEPARATOR;
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerLocator.java b/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerLocator.java
index 6417d57..1a5b531 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerLocator.java
@@ -15,10 +15,8 @@
package org.apache.geode.management.internal;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
-import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
@@ -30,11 +28,12 @@ import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.tcpserver.TcpHandler;
import org.apache.geode.distributed.internal.tcpserver.TcpServer;
import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.management.AlreadyRunningException;
import org.apache.geode.management.ManagementService;
@@ -43,10 +42,10 @@ import org.apache.geode.management.internal.JmxManagerAdvisor.JmxManagerProfile;
public class JmxManagerLocator implements TcpHandler {
private static final Logger logger = LogService.getLogger();
- private GemFireCacheImpl cache;
+ private InternalCache cache;
- public JmxManagerLocator(GemFireCacheImpl gfc) {
- this.cache = gfc;
+ public JmxManagerLocator(InternalCache internalCache) {
+ this.cache = internalCache;
}
@Override
@@ -70,9 +69,10 @@ public class JmxManagerLocator implements TcpHandler {
// nothing needed
}
+ @Override
public void restarting(DistributedSystem ds, GemFireCache cache,
ClusterConfigurationService sharedConfig) {
- this.cache = (GemFireCacheImpl) cache;
+ this.cache = (InternalCache) cache;
}
@Override
@@ -81,7 +81,6 @@ public class JmxManagerLocator implements TcpHandler {
}
private JmxManagerLocatorResponse findJmxManager(JmxManagerLocatorRequest request) {
- JmxManagerLocatorResponse result = null;
if (logger.isDebugEnabled()) {
logger.debug("Locator requested to find or start jmx manager");
}
@@ -132,8 +131,9 @@ public class JmxManagerLocator implements TcpHandler {
.contains(p.getDistributedMember())) {
sleepCount++;
try {
+ // TODO: call to sleep while synchronized
Thread.sleep(100);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
alreadyManaging = this.cache.getJmxManagerAdvisor().adviseAlreadyManaging();
@@ -147,6 +147,7 @@ public class JmxManagerLocator implements TcpHandler {
} // sync
}
}
+ JmxManagerLocatorResponse result = null;
if (!alreadyManaging.isEmpty()) {
JmxManagerProfile p = alreadyManaging.get(0);
result = new JmxManagerLocatorResponse(p.getHost(), p.getPort(), p.getSsl(), null);
@@ -173,11 +174,11 @@ public class JmxManagerLocator implements TcpHandler {
private boolean sendStartJmxManager(InternalDistributedMember distributedMember) {
try {
- ArrayList<Object> resultContainer = (ArrayList<Object>) FunctionService
- .onMember(distributedMember).execute(new StartJmxManagerFunction()).getResult();
+ List<Object> resultContainer = (List<Object>) FunctionService.onMember(distributedMember)
+ .execute(new StartJmxManagerFunction()).getResult();
Object result = resultContainer.get(0);
if (result instanceof Boolean) {
- return ((Boolean) result).booleanValue();
+ return (Boolean) result;
} else {
logger.info("Could not start jmx manager on {} because {}", distributedMember, result);
return false;
@@ -197,11 +198,11 @@ public class JmxManagerLocator implements TcpHandler {
public static class StartJmxManagerFunction implements Function, InternalEntity {
private static final long serialVersionUID = -2860286061903069789L;
+
public static final String ID = StartJmxManagerFunction.class.getName();
@Override
public void execute(FunctionContext context) {
-
try {
Cache cache = CacheFactory.getAnyInstance();
if (cache != null) {
@@ -214,7 +215,7 @@ public class JmxManagerLocator implements TcpHandler {
}
}
context.getResultSender().lastResult(Boolean.FALSE);
- } catch (AlreadyRunningException ok) {
+ } catch (AlreadyRunningException ignored) {
context.getResultSender().lastResult(Boolean.TRUE);
} catch (Exception e) {
context.getResultSender().lastResult("Exception in StartJmxManager =" + e.getMessage());
[08/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapUUIDKey.java
index c572d2d..2ec42e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeapUUIDKey.java
@@ -126,7 +126,7 @@ public class VMThinLRURegionEntryOffHeapUUIDKey extends VMThinLRURegionEntryOffH
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapIntKey.java
index 29e86b8..d633bc7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapIntKey.java
@@ -62,7 +62,7 @@ public class VMThinRegionEntryHeapIntKey extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapLongKey.java
index 37e61e1..1032dbb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapLongKey.java
@@ -62,7 +62,7 @@ public class VMThinRegionEntryHeapLongKey extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapObjectKey.java
index 76f724d..616b368 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapObjectKey.java
@@ -62,7 +62,7 @@ public class VMThinRegionEntryHeapObjectKey extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey1.java
index cfddee9..e2657d2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey1.java
@@ -80,7 +80,7 @@ public class VMThinRegionEntryHeapStringKey1 extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey2.java
index 963c78c..4183ffb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapStringKey2.java
@@ -92,7 +92,7 @@ public class VMThinRegionEntryHeapStringKey2 extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapUUIDKey.java
index 8d18eef..5fe22a7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeapUUIDKey.java
@@ -64,7 +64,7 @@ public class VMThinRegionEntryHeapUUIDKey extends VMThinRegionEntryHeap {
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapIntKey.java
index 89afccc..3987eb6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapIntKey.java
@@ -120,7 +120,7 @@ public class VMThinRegionEntryOffHeapIntKey extends VMThinRegionEntryOffHeap {
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapLongKey.java
index 71c2ce7..7b519c5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapLongKey.java
@@ -120,7 +120,7 @@ public class VMThinRegionEntryOffHeapLongKey extends VMThinRegionEntryOffHeap {
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapObjectKey.java
index ad60bb1..01a6e2d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapObjectKey.java
@@ -120,7 +120,7 @@ public class VMThinRegionEntryOffHeapObjectKey extends VMThinRegionEntryOffHeap
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey1.java
index 95e448e..b19fe07 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey1.java
@@ -137,7 +137,7 @@ public class VMThinRegionEntryOffHeapStringKey1 extends VMThinRegionEntryOffHeap
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey2.java
index bf0670f..a33f2da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapStringKey2.java
@@ -149,7 +149,7 @@ public class VMThinRegionEntryOffHeapStringKey2 extends VMThinRegionEntryOffHeap
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapUUIDKey.java
index 4e740c0..ecdb0e4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeapUUIDKey.java
@@ -122,7 +122,7 @@ public class VMThinRegionEntryOffHeapUUIDKey extends VMThinRegionEntryOffHeap {
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapIntKey.java
index 1f0fc75..d73d12d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapIntKey.java
@@ -76,7 +76,7 @@ public class VersionedStatsDiskLRURegionEntryHeapIntKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapLongKey.java
index 5c50d76..7deed98 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapLongKey.java
@@ -76,7 +76,7 @@ public class VersionedStatsDiskLRURegionEntryHeapLongKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapObjectKey.java
index b07e2dd..a403f0f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapObjectKey.java
@@ -76,7 +76,7 @@ public class VersionedStatsDiskLRURegionEntryHeapObjectKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey1.java
index 165980a..8ffe7ab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey1.java
@@ -93,7 +93,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey1
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java
index 79108f3..503dbd4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java
@@ -105,7 +105,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java
index 1e8d1ca..fcf00ac 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java
@@ -78,7 +78,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java
index e27ce67..76fe0df 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java
@@ -134,7 +134,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java
index 909a885..63987be 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java
@@ -134,7 +134,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java
index b4bd8d3..ab0ceac 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java
@@ -134,7 +134,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java
index ada4de1..ad6c901 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java
@@ -151,7 +151,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey2.java
index fd63154..d305b55 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey2.java
@@ -163,7 +163,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java
index a57570b..e5508cb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java
@@ -136,7 +136,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapUUIDKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapIntKey.java
index ed51506..340cac7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapIntKey.java
@@ -74,7 +74,7 @@ public class VersionedStatsDiskRegionEntryHeapIntKey extends VersionedStatsDiskR
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapLongKey.java
index 32f0528..6a5842f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapLongKey.java
@@ -74,7 +74,7 @@ public class VersionedStatsDiskRegionEntryHeapLongKey extends VersionedStatsDisk
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapObjectKey.java
index 0a31af4..599fd62 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapObjectKey.java
@@ -74,7 +74,7 @@ public class VersionedStatsDiskRegionEntryHeapObjectKey extends VersionedStatsDi
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey1.java
index 2606d20..518ee29 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey1.java
@@ -91,7 +91,7 @@ public class VersionedStatsDiskRegionEntryHeapStringKey1 extends VersionedStatsD
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey2.java
index a3e3948..de19cc0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapStringKey2.java
@@ -103,7 +103,7 @@ public class VersionedStatsDiskRegionEntryHeapStringKey2 extends VersionedStatsD
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapUUIDKey.java
index 34b4eaf..f35b5c0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeapUUIDKey.java
@@ -76,7 +76,7 @@ public class VersionedStatsDiskRegionEntryHeapUUIDKey extends VersionedStatsDisk
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapIntKey.java
index 7b50ebc..eb4160b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapIntKey.java
@@ -133,7 +133,7 @@ public class VersionedStatsDiskRegionEntryOffHeapIntKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapLongKey.java
index dba3d74..87211a7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapLongKey.java
@@ -133,7 +133,7 @@ public class VersionedStatsDiskRegionEntryOffHeapLongKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapObjectKey.java
index 6afcd0d..db76b43 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapObjectKey.java
@@ -133,7 +133,7 @@ public class VersionedStatsDiskRegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey1.java
index 3f5e15d..981689d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey1.java
@@ -150,7 +150,7 @@ public class VersionedStatsDiskRegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey2.java
index 8030f4a..f09293f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapStringKey2.java
@@ -162,7 +162,7 @@ public class VersionedStatsDiskRegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapUUIDKey.java
index e03215d..4ddd0ad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeapUUIDKey.java
@@ -135,7 +135,7 @@ public class VersionedStatsDiskRegionEntryOffHeapUUIDKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapIntKey.java
index 69fd454..c4d7ced 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapIntKey.java
@@ -72,7 +72,7 @@ public class VersionedStatsLRURegionEntryHeapIntKey extends VersionedStatsLRUReg
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapLongKey.java
index 1e9bc0e..339bf8f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapLongKey.java
@@ -73,7 +73,7 @@ public class VersionedStatsLRURegionEntryHeapLongKey extends VersionedStatsLRURe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapObjectKey.java
index be5f38a..f3a8465 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapObjectKey.java
@@ -73,7 +73,7 @@ public class VersionedStatsLRURegionEntryHeapObjectKey extends VersionedStatsLRU
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey1.java
index 0167a34..f339bb8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey1.java
@@ -90,7 +90,7 @@ public class VersionedStatsLRURegionEntryHeapStringKey1 extends VersionedStatsLR
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey2.java
index 8b9beec..6457998 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapStringKey2.java
@@ -102,7 +102,7 @@ public class VersionedStatsLRURegionEntryHeapStringKey2 extends VersionedStatsLR
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapUUIDKey.java
index f332f92..e852aad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeapUUIDKey.java
@@ -75,7 +75,7 @@ public class VersionedStatsLRURegionEntryHeapUUIDKey extends VersionedStatsLRURe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
index 11f6abf..91ee0ca 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
@@ -131,7 +131,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
index 369d5a7..693c9c5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
@@ -132,7 +132,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
index dabcb92..387c7b3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
@@ -132,7 +132,7 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
index be0e7ee..68dd77c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
@@ -149,7 +149,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey2.java
index c5d601b..9e3b81a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey2.java
@@ -161,7 +161,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapUUIDKey.java
index 7dcd10c..fc9e8ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapUUIDKey.java
@@ -134,7 +134,7 @@ public class VersionedStatsLRURegionEntryOffHeapUUIDKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapIntKey.java
index 5c93e8e..f04210e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapIntKey.java
@@ -69,7 +69,7 @@ public class VersionedStatsRegionEntryHeapIntKey extends VersionedStatsRegionEnt
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapLongKey.java
index 5d169f4..59657b0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapLongKey.java
@@ -69,7 +69,7 @@ public class VersionedStatsRegionEntryHeapLongKey extends VersionedStatsRegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapObjectKey.java
index 418b1f0..a603b94 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapObjectKey.java
@@ -71,7 +71,7 @@ public class VersionedStatsRegionEntryHeapObjectKey extends VersionedStatsRegion
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey1.java
index 8090642..00eb20e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey1.java
@@ -88,7 +88,7 @@ public class VersionedStatsRegionEntryHeapStringKey1 extends VersionedStatsRegio
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey2.java
index 335a354..a92b2b1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapStringKey2.java
@@ -100,7 +100,7 @@ public class VersionedStatsRegionEntryHeapStringKey2 extends VersionedStatsRegio
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapUUIDKey.java
index 236121d..f9d280e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeapUUIDKey.java
@@ -71,7 +71,7 @@ public class VersionedStatsRegionEntryHeapUUIDKey extends VersionedStatsRegionEn
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapIntKey.java
index 22e2f00..dc7124d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapIntKey.java
@@ -128,7 +128,7 @@ public class VersionedStatsRegionEntryOffHeapIntKey extends VersionedStatsRegion
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapLongKey.java
index b180e60..8acd7a7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapLongKey.java
@@ -128,7 +128,7 @@ public class VersionedStatsRegionEntryOffHeapLongKey extends VersionedStatsRegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapObjectKey.java
index 49083ae..c0c6705 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapObjectKey.java
@@ -129,7 +129,7 @@ public class VersionedStatsRegionEntryOffHeapObjectKey extends VersionedStatsReg
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey1.java
index b7017a1..66e8b8b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey1.java
@@ -146,7 +146,7 @@ public class VersionedStatsRegionEntryOffHeapStringKey1 extends VersionedStatsRe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey2.java
index e2c7d00..af2e1a0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapStringKey2.java
@@ -158,7 +158,7 @@ public class VersionedStatsRegionEntryOffHeapStringKey2 extends VersionedStatsRe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapUUIDKey.java
index 831941c..6985727 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeapUUIDKey.java
@@ -130,7 +130,7 @@ public class VersionedStatsRegionEntryOffHeapUUIDKey extends VersionedStatsRegio
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapIntKey.java
index 6a0039e..84e49ea 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapIntKey.java
@@ -73,7 +73,7 @@ public class VersionedThinDiskLRURegionEntryHeapIntKey extends VersionedThinDisk
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapLongKey.java
index 7755b24..610bb8c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapLongKey.java
@@ -74,7 +74,7 @@ public class VersionedThinDiskLRURegionEntryHeapLongKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapObjectKey.java
index 72375de..9149cab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapObjectKey.java
@@ -74,7 +74,7 @@ public class VersionedThinDiskLRURegionEntryHeapObjectKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey1.java
index d7d5de2..4e840aa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey1.java
@@ -91,7 +91,7 @@ public class VersionedThinDiskLRURegionEntryHeapStringKey1
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey2.java
index 5007c44..9c0eff4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapStringKey2.java
@@ -103,7 +103,7 @@ public class VersionedThinDiskLRURegionEntryHeapStringKey2
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapUUIDKey.java
index 3896858..166649e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeapUUIDKey.java
@@ -76,7 +76,7 @@ public class VersionedThinDiskLRURegionEntryHeapUUIDKey
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapIntKey.java
index 95e356e..908ccf7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapIntKey.java
@@ -132,7 +132,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapIntKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapLongKey.java
index 0e0e0a7..f2f23ca 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapLongKey.java
@@ -132,7 +132,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapLongKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapObjectKey.java
index 7a07548..25f6198 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapObjectKey.java
@@ -132,7 +132,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey1.java
index 80ed965..08a8be7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey1.java
@@ -149,7 +149,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey2.java
index 329c9fc..f146313 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapStringKey2.java
@@ -161,7 +161,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapUUIDKey.java
index 61a632f..0d2e98f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeapUUIDKey.java
@@ -134,7 +134,7 @@ public class VersionedThinDiskLRURegionEntryOffHeapUUIDKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapIntKey.java
index bda1c73..96e97f1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapIntKey.java
@@ -71,7 +71,7 @@ public class VersionedThinDiskRegionEntryHeapIntKey extends VersionedThinDiskReg
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapLongKey.java
index 52a6d43..5d3199c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapLongKey.java
@@ -72,7 +72,7 @@ public class VersionedThinDiskRegionEntryHeapLongKey extends VersionedThinDiskRe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapObjectKey.java
index 43399da..8eb828b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapObjectKey.java
@@ -72,7 +72,7 @@ public class VersionedThinDiskRegionEntryHeapObjectKey extends VersionedThinDisk
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey1.java
index e9c626f..d4f5563 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey1.java
@@ -89,7 +89,7 @@ public class VersionedThinDiskRegionEntryHeapStringKey1 extends VersionedThinDis
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey2.java
index 954f0ee..8f0dc99 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapStringKey2.java
@@ -101,7 +101,7 @@ public class VersionedThinDiskRegionEntryHeapStringKey2 extends VersionedThinDis
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapUUIDKey.java
index 6af09ee..7ab81f8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeapUUIDKey.java
@@ -74,7 +74,7 @@ public class VersionedThinDiskRegionEntryHeapUUIDKey extends VersionedThinDiskRe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapIntKey.java
index 97b8f15..1d0bdc9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapIntKey.java
@@ -130,7 +130,7 @@ public class VersionedThinDiskRegionEntryOffHeapIntKey extends VersionedThinDisk
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapLongKey.java
index 7591113..324134a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapLongKey.java
@@ -131,7 +131,7 @@ public class VersionedThinDiskRegionEntryOffHeapLongKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapObjectKey.java
index 9b4f75c..77048f7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapObjectKey.java
@@ -131,7 +131,7 @@ public class VersionedThinDiskRegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey1.java
index 3e83564..c2b9845 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey1.java
@@ -148,7 +148,7 @@ public class VersionedThinDiskRegionEntryOffHeapStringKey1
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey2.java
index 99d45b8..0e3a75c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapStringKey2.java
@@ -160,7 +160,7 @@ public class VersionedThinDiskRegionEntryOffHeapStringKey2
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapUUIDKey.java
index fb8ea46..751e8dd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeapUUIDKey.java
@@ -133,7 +133,7 @@ public class VersionedThinDiskRegionEntryOffHeapUUIDKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapIntKey.java
index 5a959ed..bc9e9b5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapIntKey.java
@@ -70,7 +70,7 @@ public class VersionedThinLRURegionEntryHeapIntKey extends VersionedThinLRURegio
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapLongKey.java
index 3c073a4..a278fa3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapLongKey.java
@@ -71,7 +71,7 @@ public class VersionedThinLRURegionEntryHeapLongKey extends VersionedThinLRURegi
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapObjectKey.java
index 0f73c2f..1fbcf41 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapObjectKey.java
@@ -71,7 +71,7 @@ public class VersionedThinLRURegionEntryHeapObjectKey extends VersionedThinLRURe
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey1.java
index 672f5b3..cf74cbd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey1.java
@@ -88,7 +88,7 @@ public class VersionedThinLRURegionEntryHeapStringKey1 extends VersionedThinLRUR
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey2.java
index 10ee64d..5c91f92 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapStringKey2.java
@@ -100,7 +100,7 @@ public class VersionedThinLRURegionEntryHeapStringKey2 extends VersionedThinLRUR
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapUUIDKey.java
index 9140cc7..215dec5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeapUUIDKey.java
@@ -73,7 +73,7 @@ public class VersionedThinLRURegionEntryHeapUUIDKey extends VersionedThinLRURegi
this.value = v;
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapIntKey.java
index 00d143d..f817675 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapIntKey.java
@@ -129,7 +129,7 @@ public class VersionedThinLRURegionEntryOffHeapIntKey extends VersionedThinLRURe
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapLongKey.java
index 8fe2fae..9208021 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapLongKey.java
@@ -129,7 +129,7 @@ public class VersionedThinLRURegionEntryOffHeapLongKey extends VersionedThinLRUR
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapObjectKey.java
index cd8c1c6..b8be954 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeapObjectKey.java
@@ -130,7 +130,7 @@ public class VersionedThinLRURegionEntryOffHeapObjectKey
// }
}
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
[20/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java
index daa31fd..1bc31b3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java
@@ -12,13 +12,23 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.*;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.InvalidDeltaException;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.query.IndexMaintenanceException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.cache.query.internal.index.IndexManager;
@@ -28,18 +38,32 @@ import org.apache.geode.cache.util.GatewayConflictResolver;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.ByteArrayDataInput;
+import org.apache.geode.internal.HeapDataOutputStream;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.InternalStatisticsDisabledException;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
import org.apache.geode.internal.cache.persistence.DiskStoreID;
-import org.apache.geode.internal.cache.versions.*;
+import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
+import org.apache.geode.internal.cache.versions.RegionVersionVector;
+import org.apache.geode.internal.cache.versions.VersionSource;
+import org.apache.geode.internal.cache.versions.VersionStamp;
+import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.geode.internal.offheap.*;
+import org.apache.geode.internal.offheap.MemoryAllocator;
+import org.apache.geode.internal.offheap.MemoryAllocatorImpl;
+import org.apache.geode.internal.offheap.OffHeapHelper;
+import org.apache.geode.internal.offheap.ReferenceCountHelper;
+import org.apache.geode.internal.offheap.Releasable;
+import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
@@ -53,24 +77,14 @@ import org.apache.geode.pdx.PdxSerializationException;
import org.apache.geode.pdx.PdxSerializer;
import org.apache.geode.pdx.internal.ConvertableToBytes;
import org.apache.geode.pdx.internal.PdxInstanceImpl;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ABSTRACT_REGION_ENTRY_FILL_IN_VALUE;
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ABSTRACT_REGION_ENTRY_PREPARE_VALUE_FOR_CACHE;
/**
* Abstract implementation class of RegionEntry interface. This is the topmost implementation class
* so common behavior lives here.
*
* @since GemFire 3.5.1
- *
- *
*/
public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Object, Object> {
-
private static final Logger logger = LogService.getLogger();
/**
@@ -83,39 +97,37 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
/*
* Flags for a Region Entry. These flags are stored in the msb of the long used to also store the
- * lastModicationTime.
+ * lastModificationTime.
*/
private static final long VALUE_RESULT_OF_SEARCH = 0x01L << 56;
+
private static final long UPDATE_IN_PROGRESS = 0x02L << 56;
- private static final long TOMBSTONE_SCHEDULED = 0x04L << 56;
+
private static final long LISTENER_INVOCATION_IN_PROGRESS = 0x08L << 56;
+
/** used for LRUEntry instances. */
protected static final long RECENTLY_USED = 0x10L << 56;
+
/** used for LRUEntry instances. */
protected static final long EVICTED = 0x20L << 56;
+
/**
* Set if the entry is being used by a transactions. Some features (eviction and expiration) will
* not modify an entry when a tx is using it to prevent the tx to fail do to conflict.
*/
- protected static final long IN_USE_BY_TX = 0x40L << 56;
-
-
- protected static final long MARKED_FOR_EVICTION = 0x80L << 56;
- // public Exception removeTrace; // debugging hot loop in AbstractRegionMap.basicPut()
+ private static final long IN_USE_BY_TX = 0x40L << 56;
protected AbstractRegionEntry(RegionEntryContext context,
@Retained(ABSTRACT_REGION_ENTRY_PREPARE_VALUE_FOR_CACHE) Object value) {
- setValue(context, this.prepareValueForCache(context, value, false), false);
- // setLastModified(System.currentTimeMillis()); [bruce] this must be set later so we can use ==0
+ setValue(context, prepareValueForCache(context, value, false), false);
+
+ // setLastModified(System.currentTimeMillis()); this must be set later so we can use ==0
// to know this is a new entry in checkForConflicts
}
- /////////////////////////////////////////////////////////////////////
- ////////////////////////// instance methods /////////////////////////
- /////////////////////////////////////////////////////////////////////
-
- @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "IMSE_DONT_CATCH_IMSE")
+ @Override
+ @SuppressWarnings("IMSE_DONT_CATCH_IMSE")
public boolean dispatchListenerEvents(final EntryEventImpl event) throws InterruptedException {
final LocalRegion rgn = event.getRegion();
@@ -151,14 +163,17 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
+ @Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
throw new InternalStatisticsDisabledException();
}
+ @Override
public long getHitCount() throws InternalStatisticsDisabledException {
throw new InternalStatisticsDisabledException();
}
+ @Override
public long getMissCount() throws InternalStatisticsDisabledException {
throw new InternalStatisticsDisabledException();
}
@@ -185,41 +200,46 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
_setLastModified(lastModified);
}
+ @Override
public void txDidDestroy(long currTime) {
setLastModifiedAndAccessedTimes(currTime, currTime);
}
- public final void updateStatsForPut(long lastModifiedTime, long lastAccessedTime) {
+ @Override
+ public void updateStatsForPut(long lastModifiedTime, long lastAccessedTime) {
setLastModifiedAndAccessedTimes(lastModifiedTime, lastAccessedTime);
}
+ @Override
public void setRecentlyUsed() {
// do nothing by default; only needed for LRU
}
+ @Override
public void updateStatsForGet(boolean hit, long time) {
// nothing needed
}
+ @Override
public void resetCounts() throws InternalStatisticsDisabledException {
throw new InternalStatisticsDisabledException();
}
- public void _removePhase1() {
+ void _removePhase1() {
_setValue(Token.REMOVED_PHASE1);
- // debugging for 38467 (hot thread in ARM.basicUpdate)
- // this.removeTrace = new Exception("stack trace for thread " + Thread.currentThread());
}
- public void removePhase1(LocalRegion r, boolean isClear) throws RegionClearedException {
+ @Override
+ public void removePhase1(LocalRegion r, boolean clear) throws RegionClearedException {
_removePhase1();
}
+ @Override
public void removePhase2() {
_setValue(Token.REMOVED_PHASE2);
- // this.removeTrace = new Exception("stack trace for thread " + Thread.currentThread());
}
+ @Override
public void makeTombstone(LocalRegion r, VersionTag version) throws RegionClearedException {
assert r.getVersionVector() != null;
assert version != null;
@@ -237,7 +257,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
r.unscheduleTombstone(this);
}
setRecentlyUsed();
- boolean newEntry = (getValueAsToken() == Token.REMOVED_PHASE1);
+ boolean newEntry = getValueAsToken() == Token.REMOVED_PHASE1;
basicMakeTombstone(r);
r.scheduleTombstone(this, version);
if (newEntry) {
@@ -259,14 +279,13 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
-
@Override
public void setValueWithTombstoneCheck(@Unretained Object v, EntryEvent e)
throws RegionClearedException {
if (v == Token.TOMBSTONE) {
- makeTombstone((LocalRegion) e.getRegion(), ((EntryEventImpl) e).getVersionTag());
+ makeTombstone((LocalRegion) e.getRegion(), ((InternalCacheEvent) e).getVersionTag());
} else {
- setValue((LocalRegion) e.getRegion(), v, (EntryEventImpl) e);
+ setValue((RegionEntryContext) e.getRegion(), v, (EntryEventImpl) e);
}
}
@@ -278,81 +297,86 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
* this method calls Token.isRemoved, and places that don't want a destroyed Token can explicitly
* check for a DESTROY token.
*/
- public final boolean isRemoved() {
+ @Override
+ public boolean isRemoved() {
Token o = getValueAsToken();
- return (o == Token.REMOVED_PHASE1) || (o == Token.REMOVED_PHASE2) || (o == Token.TOMBSTONE);
+ return o == Token.REMOVED_PHASE1 || o == Token.REMOVED_PHASE2 || o == Token.TOMBSTONE;
}
- public final boolean isDestroyedOrRemoved() {
+ @Override
+ public boolean isDestroyedOrRemoved() {
return Token.isRemoved(getValueAsToken());
}
- public final boolean isDestroyedOrRemovedButNotTombstone() {
+ @Override
+ public boolean isDestroyedOrRemovedButNotTombstone() {
Token o = getValueAsToken();
return o == Token.DESTROYED || o == Token.REMOVED_PHASE1 || o == Token.REMOVED_PHASE2;
}
- public final boolean isTombstone() {
+ @Override
+ public boolean isTombstone() {
return getValueAsToken() == Token.TOMBSTONE;
}
- public final boolean isRemovedPhase2() {
+ @Override
+ public boolean isRemovedPhase2() {
return getValueAsToken() == Token.REMOVED_PHASE2;
}
+ @Override
public boolean fillInValue(LocalRegion region,
- @Retained(ABSTRACT_REGION_ENTRY_FILL_IN_VALUE) InitialImageOperation.Entry dst,
+ @Retained(ABSTRACT_REGION_ENTRY_FILL_IN_VALUE) InitialImageOperation.Entry entry,
ByteArrayDataInput in, DM mgr) {
- dst.setSerialized(false); // starting default value
+
+ // starting default value
+ entry.setSerialized(false);
@Retained(ABSTRACT_REGION_ENTRY_FILL_IN_VALUE)
final Object v;
if (isTombstone()) {
v = Token.TOMBSTONE;
} else {
- v = getValue(region); // OFFHEAP: need to incrc, copy bytes, decrc
+ // OFFHEAP: need to incrc, copy bytes, decrc
+ v = getValue(region);
if (v == null) {
return false;
}
}
- dst.setLastModified(mgr, getLastModified()); // fix for bug 31059
+ entry.setLastModified(mgr, getLastModified()); // fix for bug 31059
if (v == Token.INVALID) {
- dst.setInvalid();
+ entry.setInvalid();
} else if (v == Token.LOCAL_INVALID) {
- dst.setLocalInvalid();
+ entry.setLocalInvalid();
} else if (v == Token.TOMBSTONE) {
- dst.setTombstone();
+ entry.setTombstone();
} else if (v instanceof CachedDeserializable) {
// don't serialize here if it is not already serialized
CachedDeserializable cd = (CachedDeserializable) v;
if (!cd.isSerialized()) {
- dst.value = cd.getDeserializedForReading();
+ entry.value = cd.getDeserializedForReading();
} else {
- {
- Object tmp = cd.getValue();
- if (tmp instanceof byte[]) {
- byte[] bb = (byte[]) tmp;
- dst.value = bb;
- } else {
- try {
- HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
- BlobHelper.serializeTo(tmp, hdos);
- hdos.trim();
- dst.value = hdos;
- } catch (IOException e) {
- RuntimeException e2 = new IllegalArgumentException(
- LocalizedStrings.AbstractRegionEntry_AN_IOEXCEPTION_WAS_THROWN_WHILE_SERIALIZING
- .toLocalizedString());
- e2.initCause(e);
- throw e2;
- }
+ Object tmp = cd.getValue();
+ if (tmp instanceof byte[]) {
+ entry.value = tmp;
+ } else {
+ try {
+ HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
+ BlobHelper.serializeTo(tmp, hdos);
+ hdos.trim();
+ entry.value = hdos;
+ } catch (IOException e) {
+ throw new IllegalArgumentException(
+ LocalizedStrings.AbstractRegionEntry_AN_IOEXCEPTION_WAS_THROWN_WHILE_SERIALIZING
+ .toLocalizedString(),
+ e);
}
- dst.setSerialized(true);
}
+ entry.setSerialized(true);
}
} else if (v instanceof byte[]) {
- dst.value = v;
+ entry.value = v;
} else {
Object preparedValue = v;
if (preparedValue != null) {
@@ -361,20 +385,17 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return false;
}
}
- {
- try {
- HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
- BlobHelper.serializeTo(preparedValue, hdos);
- hdos.trim();
- dst.value = hdos;
- dst.setSerialized(true);
- } catch (IOException e) {
- RuntimeException e2 = new IllegalArgumentException(
- LocalizedStrings.AbstractRegionEntry_AN_IOEXCEPTION_WAS_THROWN_WHILE_SERIALIZING
- .toLocalizedString());
- e2.initCause(e);
- throw e2;
- }
+ try {
+ HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
+ BlobHelper.serializeTo(preparedValue, hdos);
+ hdos.trim();
+ entry.value = hdos;
+ entry.setSerialized(true);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(
+ LocalizedStrings.AbstractRegionEntry_AN_IOEXCEPTION_WAS_THROWN_WHILE_SERIALIZING
+ .toLocalizedString(),
+ e);
}
}
return true;
@@ -385,7 +406,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
*
* @return the value to provide to the gii request; null if no value should be provided.
*/
- public static Object prepareValueForGII(Object v) {
+ static Object prepareValueForGII(Object v) {
assert v != null;
if (v instanceof GatewaySenderEventImpl) {
return ((GatewaySenderEventImpl) v).makeHeapCopyIfOffHeap();
@@ -394,6 +415,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
+ @Override
public boolean isOverflowedToDisk(LocalRegion r, DistributedRegion.DiskPosition dp) {
return false;
}
@@ -403,19 +425,14 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
ReferenceCountHelper.createReferenceCountOwner();
@Retained
Object result = _getValueRetain(context, true);
- // Asif: If the thread is an Index Creation Thread & the value obtained is
+
+ // If the thread is an Index Creation Thread & the value obtained is
// Token.REMOVED , we can skip synchronization block. This is required to prevent
// the dead lock caused if an Index Update Thread has gone into a wait holding the
// lock of the Entry object. There should not be an issue if the Index creation thread
// gets the temporary value of token.REMOVED as the correct value will get indexed
// by the Index Update Thread , once the index creation thread has exited.
// Part of Bugfix # 33336
- // if ((result == Token.REMOVED_PHASE1 || result == Token.REMOVED_PHASE2) &&
- // !r.isIndexCreationThread()) {
- // synchronized (this) {
- // result = _getValue();
- // }
- // }
if (Token.isRemoved(result)) {
ReferenceCountHelper.setReferenceCountOwner(null);
@@ -445,7 +462,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
@Released
public void setValue(RegionEntryContext context, @Unretained Object value)
throws RegionClearedException {
- // @todo darrel: This will mark new entries as being recently used
+ // TODO: This will mark new entries as being recently used
// It might be better to only mark them when they are modified.
// Or should we only mark them on reads?
setValue(context, value, true);
@@ -467,10 +484,9 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
- public void releaseOffHeapRefIfRegionBeingClosedOrDestroyed(RegionEntryContext context,
- Object ref) {
+ void releaseOffHeapRefIfRegionBeingClosedOrDestroyed(RegionEntryContext context, Object ref) {
if (isOffHeapReference(ref) && isThisRegionBeingClosedOrDestroyed(context)) {
- ((OffHeapRegionEntry) this).release();
+ ((Releasable) this).release();
}
}
@@ -503,7 +519,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return value;
}
- static protected Object compress(RegionEntryContext context, Object value) {
+ protected static Object compress(RegionEntryContext context, Object value) {
return compress(context, value, null);
}
@@ -515,7 +531,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
*
* @return the compressed form of the value parameter.
*/
- static protected Object compress(RegionEntryContext context, Object value, EntryEventImpl event) {
+ protected static Object compress(RegionEntryContext context, Object value, EntryEventImpl event) {
if (isCompressible(context, value)) {
long time = context.getCachePerfStats().startCompression();
byte[] serializedValue;
@@ -569,12 +585,14 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
- public final Object getValueInVM(RegionEntryContext context) {
+ @Override
+ public Object getValueInVM(RegionEntryContext context) {
ReferenceCountHelper.createReferenceCountOwner();
@Released
Object v = _getValueRetain(context, true);
- if (v == null) { // should only be possible if disk entry
+ if (v == null) {
+ // should only be possible if disk entry
v = Token.NOT_AVAILABLE;
}
Object result = OffHeapHelper.copyAndReleaseIfNeeded(v);
@@ -582,6 +600,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return result;
}
+ @Override
public Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
return getValueInVM(owner);
}
@@ -591,56 +610,56 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
public Object getValueOffHeapOrDiskWithoutFaultIn(LocalRegion owner) {
@Retained
Object result = _getValueRetain(owner, true);
- // if (result instanceof ByteSource) {
- // // If the ByteSource contains a Delta or ListOfDelta then we want to deserialize it
- // Object deserVal = ((CachedDeserializable)result).getDeserializedForReading();
- // if (deserVal != result) {
- // OffHeapHelper.release(result);
- // result = deserVal;
- // }
- // }
return result;
}
+ @Override
public Object getValueOnDisk(LocalRegion r) throws EntryNotFoundException {
throw new IllegalStateException(
LocalizedStrings.AbstractRegionEntry_CANNOT_GET_VALUE_ON_DISK_FOR_A_REGION_THAT_DOES_NOT_ACCESS_THE_DISK
.toLocalizedString());
}
- public Object getSerializedValueOnDisk(final LocalRegion r) throws EntryNotFoundException {
+ @Override
+ public Object getSerializedValueOnDisk(final LocalRegion localRegion)
+ throws EntryNotFoundException {
throw new IllegalStateException(
LocalizedStrings.AbstractRegionEntry_CANNOT_GET_VALUE_ON_DISK_FOR_A_REGION_THAT_DOES_NOT_ACCESS_THE_DISK
.toLocalizedString());
}
+ @Override
public Object getValueOnDiskOrBuffer(LocalRegion r) throws EntryNotFoundException {
throw new IllegalStateException(
LocalizedStrings.AbstractRegionEntry_CANNOT_GET_VALUE_ON_DISK_FOR_A_REGION_THAT_DOES_NOT_ACCESS_THE_DISK
.toLocalizedString());
- // @todo darrel if value is Token.REMOVED || Token.DESTROYED throw EntryNotFoundException
+ // TODO: if value is Token.REMOVED || Token.DESTROYED throw EntryNotFoundException
}
- public final boolean initialImagePut(final LocalRegion region, final long lastModifiedTime,
- Object newValue, boolean wasRecovered, boolean versionTagAccepted)
- throws RegionClearedException {
+ @Override
+ public boolean initialImagePut(final LocalRegion region, final long lastModified, Object newValue,
+ boolean wasRecovered, boolean acceptedVersionTag) throws RegionClearedException {
// note that the caller has already write synced this RegionEntry
- return initialImageInit(region, lastModifiedTime, newValue, this.isTombstone(), wasRecovered,
- versionTagAccepted);
+ return initialImageInit(region, lastModified, newValue, this.isTombstone(), wasRecovered,
+ acceptedVersionTag);
}
- public boolean initialImageInit(final LocalRegion region, final long lastModifiedTime,
+ @Override
+ public boolean initialImageInit(final LocalRegion region, final long lastModified,
final Object newValue, final boolean create, final boolean wasRecovered,
- final boolean versionTagAccepted) throws RegionClearedException {
+ final boolean acceptedVersionTag) throws RegionClearedException {
+
// note that the caller has already write synced this RegionEntry
boolean result = false;
+
// if it has been destroyed then don't do anything
Token vTok = getValueAsToken();
- if (versionTagAccepted || create || (vTok != Token.DESTROYED || vTok != Token.TOMBSTONE)) { // OFFHEAP
- // noop
+ if (acceptedVersionTag || create || (vTok != Token.DESTROYED || vTok != Token.TOMBSTONE)) {
+ // OFFHEAP noop
Object newValueToWrite = newValue;
- boolean putValue = versionTagAccepted || create || (newValueToWrite != Token.LOCAL_INVALID
- && (wasRecovered || (vTok == Token.LOCAL_INVALID))); // OFFHEAP noop
+ // OFFHEAP noop
+ boolean putValue = acceptedVersionTag || create || (newValueToWrite != Token.LOCAL_INVALID
+ && (wasRecovered || (vTok == Token.LOCAL_INVALID)));
if (region.isUsedForPartitionedRegionAdmin()
&& newValueToWrite instanceof CachedDeserializable) {
@@ -650,9 +669,9 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
newValueToWrite =
((CachedDeserializable) newValueToWrite).getDeserializedValue(region, null);
if (!create && newValueToWrite instanceof Versionable) {
- final Object oldValue = getValueInVM(region); // Heap value should always be deserialized
- // at this point // OFFHEAP will not be
- // deserialized
+ // Heap value should always be deserialized at this point // OFFHEAP will not be
+ // deserialized
+ final Object oldValue = getValueInVM(region);
// BUGFIX for 35029. If oldValue is null the newValue should be put.
if (oldValue == null) {
putValue = true;
@@ -667,7 +686,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
if (putValue) {
// change to INVALID if region itself has been invalidated,
// and current value is recovered
- if (create || versionTagAccepted) {
+ if (create || acceptedVersionTag) {
// At this point, since we now always recover from disk first,
// we only care about "isCreate" since "isRecovered" is impossible
// if we had a regionInvalidate or regionClear
@@ -690,12 +709,12 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
if (!entryOK) {
- // Asif: If the region has been issued cleared during
+ // If the region has been issued cleared during
// the GII , then those entries loaded before this one would have
// been cleared from the Map due to clear operation & for the
// currententry whose key may have escaped the clearance , will be
// cleansed by the destroy token.
- newValueToWrite = Token.DESTROYED;
+ newValueToWrite = Token.DESTROYED; // TODO: never used
imageState.addDestroyedEntry(this.getKey());
throw new RegionClearedException(
LocalizedStrings.AbstractRegionEntry_DURING_THE_GII_PUT_OF_ENTRY_THE_REGION_GOT_CLEARED_SO_ABORTING_THE_OPERATION
@@ -710,7 +729,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
if (create) {
region.getCachePerfStats().incCreates();
}
- region.updateStatsForPut(this, lastModifiedTime, false);
+ region.updateStatsForPut(this, lastModified, false);
}
if (logger.isTraceEnabled()) {
@@ -732,84 +751,77 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
* @throws EntryNotFoundException if expectedOldValue is not null and is not equal to current
* value
*/
+ @Override
@Released
- public final boolean destroy(LocalRegion region, EntryEventImpl event, boolean inTokenMode,
+ public boolean destroy(LocalRegion region, EntryEventImpl event, boolean inTokenMode,
boolean cacheWrite, @Unretained Object expectedOldValue, boolean forceDestroy,
boolean removeRecoveredEntry) throws CacheWriterException, EntryNotFoundException,
TimeoutException, RegionClearedException {
- boolean proceed = false;
- {
- // A design decision was made to not retrieve the old value from the disk
- // if the entry has been evicted to only have the CacheListener afterDestroy
- // method ignore it. We don't want to pay the performance penalty. The
- // getValueInVM method does not retrieve the value from disk if it has been
- // evicted. Instead, it uses the NotAvailable token.
- //
- // If the region is a WAN queue region, the old value is actually used by the
- // afterDestroy callback on a secondary. It is not needed on a primary.
- // Since the destroy that sets WAN_QUEUE_TOKEN always originates on the primary
- // we only pay attention to WAN_QUEUE_TOKEN if the event is originRemote.
- //
- // :ezoerner:20080814 We also read old value from disk or buffer
- // in the case where there is a non-null expectedOldValue
- // see PartitionedRegion#remove(Object key, Object value)
- ReferenceCountHelper.skipRefCountTracking();
- @Retained
- @Released
- Object curValue = _getValueRetain(region, true);
- ReferenceCountHelper.unskipRefCountTracking();
- try {
- if (curValue == null)
- curValue = Token.NOT_AVAILABLE;
-
- if (curValue == Token.NOT_AVAILABLE) {
- // In some cases we need to get the current value off of disk.
-
- // if the event is transmitted during GII and has an old value, it was
- // the state of the transmitting cache's entry & should be used here
- if (event.getCallbackArgument() != null
- && event.getCallbackArgument().equals(RegionQueue.WAN_QUEUE_TOKEN)
- && event.isOriginRemote()) { // check originRemote for bug 40508
- // curValue = getValue(region); can cause deadlock if GII is occurring
+
+ // A design decision was made to not retrieve the old value from the disk
+ // if the entry has been evicted to only have the CacheListener afterDestroy
+ // method ignore it. We don't want to pay the performance penalty. The
+ // getValueInVM method does not retrieve the value from disk if it has been
+ // evicted. Instead, it uses the NotAvailable token.
+ //
+ // If the region is a WAN queue region, the old value is actually used by the
+ // afterDestroy callback on a secondary. It is not needed on a primary.
+ // Since the destroy that sets WAN_QUEUE_TOKEN always originates on the primary
+ // we only pay attention to WAN_QUEUE_TOKEN if the event is originRemote.
+ //
+ // We also read old value from disk or buffer
+ // in the case where there is a non-null expectedOldValue
+ // see PartitionedRegion#remove(Object key, Object value)
+ ReferenceCountHelper.skipRefCountTracking();
+ @Retained
+ @Released
+ Object curValue = _getValueRetain(region, true);
+ ReferenceCountHelper.unskipRefCountTracking();
+ boolean proceed;
+ try {
+ if (curValue == null) {
+ curValue = Token.NOT_AVAILABLE;
+ }
+
+ if (curValue == Token.NOT_AVAILABLE) {
+ // In some cases we need to get the current value off of disk.
+
+ // if the event is transmitted during GII and has an old value, it was
+ // the state of the transmitting cache's entry & should be used here
+ if (event.getCallbackArgument() != null
+ && event.getCallbackArgument().equals(RegionQueue.WAN_QUEUE_TOKEN)
+ && event.isOriginRemote()) { // check originRemote for bug 40508
+ // curValue = getValue(region); can cause deadlock if GII is occurring
+ curValue = getValueOnDiskOrBuffer(region);
+ } else {
+ FilterProfile fp = region.getFilterProfile();
+ if (fp != null && (fp.getCqCount() > 0 || expectedOldValue != null)) {
+ // curValue = getValue(region); can cause deadlock will fault in the value
+ // and will confuse LRU.
curValue = getValueOnDiskOrBuffer(region);
- } else {
- FilterProfile fp = region.getFilterProfile();
- if (fp != null && ((fp.getCqCount() > 0) || expectedOldValue != null)) {
- // curValue = getValue(region); can cause deadlock will fault in the value
- // and will confuse LRU. rdubey.
- curValue = getValueOnDiskOrBuffer(region);
- }
}
}
+ }
- if (expectedOldValue != null) {
- if (!checkExpectedOldValue(expectedOldValue, curValue, region)) {
- throw new EntryNotFoundException(
- LocalizedStrings.AbstractRegionEntry_THE_CURRENT_VALUE_WAS_NOT_EQUAL_TO_EXPECTED_VALUE
- .toLocalizedString());
- }
+ if (expectedOldValue != null) {
+ if (!checkExpectedOldValue(expectedOldValue, curValue, region)) {
+ throw new EntryNotFoundException(
+ LocalizedStrings.AbstractRegionEntry_THE_CURRENT_VALUE_WAS_NOT_EQUAL_TO_EXPECTED_VALUE
+ .toLocalizedString());
}
+ }
- if (inTokenMode && event.hasOldValue()) {
- proceed = true;
- } else {
- proceed = event.setOldValue(curValue, curValue instanceof GatewaySenderEventImpl)
- || removeRecoveredEntry || forceDestroy || region.getConcurrencyChecksEnabled() // fix
- // for
- // bug
- // #47868
- // -
- // create
- // a
- // tombstone
- || (event.getOperation() == Operation.REMOVE // fix for bug #42242
- && (curValue == null || curValue == Token.LOCAL_INVALID
- || curValue == Token.INVALID));
- }
- } finally {
- OffHeapHelper.releaseWithNoTracking(curValue);
+ if (inTokenMode && event.hasOldValue()) {
+ proceed = true;
+ } else {
+ proceed = event.setOldValue(curValue, curValue instanceof GatewaySenderEventImpl)
+ || removeRecoveredEntry || forceDestroy || region.getConcurrencyChecksEnabled()
+ || (event.getOperation() == Operation.REMOVE && (curValue == null
+ || curValue == Token.LOCAL_INVALID || curValue == Token.INVALID));
}
- } // end curValue block
+ } finally {
+ OffHeapHelper.releaseWithNoTracking(curValue);
+ }
if (proceed) {
// Generate the version tag if needed. This method should only be
@@ -820,7 +832,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
if (cacheWrite) {
region.cacheWriteBeforeDestroy(event, expectedOldValue);
- if (event.getRegion().getServerProxy() != null) { // server will return a version tag
+ if (event.getRegion().getServerProxy() != null) {
+ // server will return a version tag
// update version information (may throw ConcurrentCacheModificationException)
VersionStamp stamp = getVersionStamp();
if (stamp != null) {
@@ -856,8 +869,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
boolean removeEntry = false;
VersionTag v = event.getVersionTag();
if (region.concurrencyChecksEnabled && !removeRecoveredEntry
- && !event.isFromRILocalDestroy()) { // bug #46780, don't retain tombstones for entries
- // destroyed for register-interest
+ && !event.isFromRILocalDestroy()) {
+ // bug #46780, don't retain tombstones for entries destroyed for register-interest
// Destroy will write a tombstone instead
if (v == null || !v.hasValidVersion()) {
// localDestroy and eviction and ops received with no version tag
@@ -869,7 +882,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
event.setVersionTag(v);
}
}
- removeEntry = (v == null) || !v.hasValidVersion();
+ removeEntry = v == null || !v.hasValidVersion();
} else {
removeEntry = true;
}
@@ -894,12 +907,11 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
-
-
static boolean checkExpectedOldValue(@Unretained Object expectedOldValue,
@Unretained Object actualValue, LocalRegion lr) {
+
if (Token.isInvalid(expectedOldValue)) {
- return (actualValue == null) || Token.isInvalid(actualValue);
+ return actualValue == null || Token.isInvalid(actualValue);
} else {
boolean isCompressedOffHeap =
lr.getAttributes().getOffHeap() && lr.getAttributes().getCompressor() != null;
@@ -974,7 +986,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
- static boolean checkEquals(@Unretained Object v1, @Unretained Object v2,
+ private static boolean checkEquals(@Unretained Object v1, @Unretained Object v2,
boolean isCompressedOffHeap) {
// need to give PdxInstance#equals priority
if (v1 instanceof PdxInstance) {
@@ -1057,7 +1069,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
if (pi != null) {
return checkPdxEquals(pi, obj);
}
- if (isCompressedOffHeap) { // fix for bug 52248
+ if (isCompressedOffHeap) {
+ // fix for bug 52248
byte[] serializedObj;
if (obj instanceof CachedDeserializable) {
serializedObj = ((CachedDeserializable) obj).getSerializedValue();
@@ -1066,7 +1079,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
return Arrays.equals(cdValBytes, serializedObj);
} else {
- /**
+ /*
* To be more compatible with previous releases do not compare the serialized forms here.
* Instead deserialize and call the equals method.
*/
@@ -1124,28 +1137,27 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
if (obj != null && obj.getClass().getName().equals(pdx.getClassName())) {
- GemFireCacheImpl gfc = GemFireCacheImpl.getForPdx("Could not access Pdx registry");
- if (gfc != null) {
+ InternalCache internalCache = GemFireCacheImpl.getForPdx("Could not access Pdx registry");
+ if (internalCache != null) {
PdxSerializer pdxSerializer;
if (obj instanceof PdxSerializable) {
pdxSerializer = null;
} else {
- pdxSerializer = gfc.getPdxSerializer();
+ pdxSerializer = internalCache.getPdxSerializer();
}
if (pdxSerializer != null || obj instanceof PdxSerializable) {
// try to convert obj to a PdxInstance
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
try {
if (InternalDataSerializer.autoSerialized(obj, hdos)
- || InternalDataSerializer.writePdx(hdos, gfc, obj, pdxSerializer)) {
- PdxInstance pi = InternalDataSerializer.readPdxInstance(hdos.toByteArray(), gfc);
+ || InternalDataSerializer.writePdx(hdos, internalCache, obj, pdxSerializer)) {
+ PdxInstance pi =
+ InternalDataSerializer.readPdxInstance(hdos.toByteArray(), internalCache);
if (pi != null) {
obj = pi;
}
}
- } catch (IOException ignore) {
- // we are not able to convert it so just fall through
- } catch (PdxSerializationException ignore) {
+ } catch (IOException | PdxSerializationException ignore) {
// we are not able to convert it so just fall through
}
}
@@ -1155,16 +1167,13 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return basicEquals(obj, pdx);
}
-
- /////////////////////////////////////////////////////////////
- /////////////////////////// fields //////////////////////////
- /////////////////////////////////////////////////////////////
// Do not add any instance fields to this class.
// Instead add them to LeafRegionEntry.cpp
public static class HashRegionEntryCreator
implements CustomEntryConcurrentHashMap.HashEntryCreator<Object, Object> {
+ @Override
public HashEntry<Object, Object> newEntry(final Object key, final int hash,
final HashEntry<Object, Object> next, final Object value) {
final AbstractRegionEntry entry = (AbstractRegionEntry) value;
@@ -1181,14 +1190,16 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return entry;
}
+ @Override
public int keyHashCode(final Object key, final boolean compareValues) {
return CustomEntryConcurrentHashMap.keyHash(key, compareValues);
}
- };
+ }
+ @Override
public abstract Object getKey();
- protected static boolean okToStoreOffHeap(Object v, AbstractRegionEntry e) {
+ private static boolean okToStoreOffHeap(Object v, AbstractRegionEntry e) {
if (v == null)
return false;
if (Token.isInvalidOrRemoved(v))
@@ -1215,7 +1226,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
private static final long LAST_MODIFIED_MASK = 0x00FFFFFFFFFFFFFFL;
- protected final void _setLastModified(long lastModifiedTime) {
+ protected void _setLastModified(long lastModifiedTime) {
if (lastModifiedTime < 0 || lastModifiedTime > LAST_MODIFIED_MASK) {
throw new IllegalStateException("Expected lastModifiedTime " + lastModifiedTime
+ " to be >= 0 and <= " + LAST_MODIFIED_MASK);
@@ -1223,31 +1234,32 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
long storedValue;
long newValue;
do {
- storedValue = getlastModifiedField();
+ storedValue = getLastModifiedField();
newValue = storedValue & ~LAST_MODIFIED_MASK;
newValue |= lastModifiedTime;
} while (!compareAndSetLastModifiedField(storedValue, newValue));
}
- protected abstract long getlastModifiedField();
+ protected abstract long getLastModifiedField();
protected abstract boolean compareAndSetLastModifiedField(long expectedValue, long newValue);
- public final long getLastModified() {
- return getlastModifiedField() & LAST_MODIFIED_MASK;
+ @Override
+ public long getLastModified() {
+ return getLastModifiedField() & LAST_MODIFIED_MASK;
}
- protected final boolean areAnyBitsSet(long bitMask) {
- return (getlastModifiedField() & bitMask) != 0L;
+ protected boolean areAnyBitsSet(long bitMask) {
+ return (getLastModifiedField() & bitMask) != 0L;
}
/**
* Any bits in "bitMask" that are 1 will be set.
*/
- protected final void setBits(long bitMask) {
- boolean done = false;
+ protected void setBits(long bitMask) {
+ boolean done;
do {
- long bits = getlastModifiedField();
+ long bits = getLastModifiedField();
long newBits = bits | bitMask;
if (bits == newBits)
return;
@@ -1258,10 +1270,10 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
/**
* Any bits in "bitMask" that are 0 will be cleared.
*/
- protected final void clearBits(long bitMask) {
- boolean done = false;
+ protected void clearBits(long bitMask) {
+ boolean done;
do {
- long bits = getlastModifiedField();
+ long bits = getLastModifiedField();
long newBits = bits & bitMask;
if (bits == newBits)
return;
@@ -1329,6 +1341,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
data = (byte[]) val;
}
byte[] compressedData = compressBytes(r, data);
+ // TODO: array comparison is broken
boolean isCompressed = compressedData != data;
ReferenceCountHelper.setReferenceCountOwner(this);
MemoryAllocator ma = MemoryAllocatorImpl.getAllocator(); // fix for bug 47875
@@ -1350,6 +1363,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
try {
byte[] data = ((ConvertableToBytes) nv).toBytes();
byte[] compressedData = compressBytes(r, data);
+ // TODO: array comparison is broken
if (data == compressedData) {
nv = CachedDeserializableFactory.create(data);
} else {
@@ -1366,15 +1380,17 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
@Override
@Unretained
- public final Object _getValue() {
+ public Object _getValue() {
return getValueField();
}
- public final boolean isUpdateInProgress() {
+ @Override
+ public boolean isUpdateInProgress() {
return areAnyBitsSet(UPDATE_IN_PROGRESS);
}
- public final void setUpdateInProgress(final boolean underUpdate) {
+ @Override
+ public void setUpdateInProgress(final boolean underUpdate) {
if (underUpdate) {
setBits(UPDATE_IN_PROGRESS);
} else {
@@ -1382,13 +1398,14 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
-
- public final boolean isCacheListenerInvocationInProgress() {
+ @Override
+ public boolean isCacheListenerInvocationInProgress() {
return areAnyBitsSet(LISTENER_INVOCATION_IN_PROGRESS);
}
- public final void setCacheListenerInvocationInProgress(final boolean listenerInvoked) {
- if (listenerInvoked) {
+ @Override
+ public void setCacheListenerInvocationInProgress(final boolean isListenerInvoked) {
+ if (isListenerInvoked) {
setBits(LISTENER_INVOCATION_IN_PROGRESS);
} else {
clearBits(~LISTENER_INVOCATION_IN_PROGRESS);
@@ -1396,12 +1413,12 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
@Override
- public final boolean isInUseByTransaction() {
+ public boolean isInUseByTransaction() {
return areAnyBitsSet(IN_USE_BY_TX);
}
@Override
- public final void setInUseByTransaction(final boolean v) {
+ public void setInUseByTransaction(final boolean v) {
if (v) {
setBits(IN_USE_BY_TX);
} else {
@@ -1410,17 +1427,13 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
@Override
- public final synchronized void incRefCount() {
+ public synchronized void incRefCount() {
TXManagerImpl.incRefCount(this);
setInUseByTransaction(true);
}
- /**
- * {@inheritDoc}
- */
-
@Override
- public final synchronized void decRefCount(NewLRUClockHand lruList, LocalRegion lr) {
+ public synchronized void decRefCount(NewLRUClockHand lruList, LocalRegion lr) {
if (TXManagerImpl.decRefCount(this)) {
if (isInUseByTransaction()) {
setInUseByTransaction(false);
@@ -1436,7 +1449,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
@Override
- public final synchronized void resetRefCount(NewLRUClockHand lruList) {
+ public synchronized void resetRefCount(NewLRUClockHand lruList) {
if (isInUseByTransaction()) {
setInUseByTransaction(false);
if (lruList != null) {
@@ -1445,7 +1458,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
- protected final void _setValue(Object val) {
+ void _setValue(Object val) {
setValueField(val);
}
@@ -1474,16 +1487,19 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
*/
protected abstract void setValueField(@Unretained Object v);
+ @Override
@Retained
public Object getTransformedValue() {
return _getValueRetain(null, false);
}
- public final boolean getValueWasResultOfSearch() {
+ @Override
+ public boolean getValueWasResultOfSearch() {
return areAnyBitsSet(VALUE_RESULT_OF_SEARCH);
}
- public final void setValueResultOfSearch(boolean v) {
+ @Override
+ public void setValueResultOfSearch(boolean v) {
if (v) {
setBits(VALUE_RESULT_OF_SEARCH);
} else {
@@ -1493,26 +1509,22 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
public boolean hasValidVersion() {
VersionStamp stamp = (VersionStamp) this;
- boolean has = stamp.getRegionVersion() != 0 || stamp.getEntryVersion() != 0;
- return has;
+ return stamp.getRegionVersion() != 0 || stamp.getEntryVersion() != 0;
}
+ @Override
public boolean hasStats() {
// override this in implementations that have stats
return false;
}
- /**
- * @see HashEntry#getMapValue()
- */
- public final Object getMapValue() {
+ @Override
+ public Object getMapValue() {
return this;
}
- /**
- * @see HashEntry#setMapValue(Object)
- */
- public final void setMapValue(final Object newValue) {
+ @Override
+ public void setMapValue(final Object newValue) {
if (this != newValue) {
Assert.fail("AbstractRegionEntry#setMapValue: unexpected setMapValue " + "with newValue="
+ newValue + ", this=" + this);
@@ -1522,47 +1534,40 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
protected abstract void setEntryHash(int v);
@Override
- public final String toString() {
+ public String toString() {
final StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()).append('@')
.append(Integer.toHexString(System.identityHashCode(this))).append(" (");
return appendFieldsToString(sb).append(')').toString();
}
protected StringBuilder appendFieldsToString(final StringBuilder sb) {
- sb.append("key=").append(getKey()).append("; rawValue=").append(_getValue()); // OFFHEAP
- // _getValue ok:
- // the current
- // toString on
- // ObjectChunk is
- // safe to use
- // without incing
- // refcount.
+ // OFFHEAP _getValue ok: the current toString on ObjectChunk is safe to use without incing
+ // refcount.
+ sb.append("key=").append(getKey()).append("; rawValue=").append(_getValue());
VersionStamp stamp = getVersionStamp();
if (stamp != null) {
- sb.append("; version=").append(stamp.asVersionTag() + ";member=" + stamp.getMemberID());
+ sb.append("; version=").append(stamp.asVersionTag()).append(";member=")
+ .append(stamp.getMemberID());
}
return sb;
}
- /*
- * (non-Javadoc) This generates version tags for outgoing messages for all subclasses supporting
- * concurrency versioning. It also sets the entry's version stamp to the tag's values.
- *
- * @see
- * org.apache.geode.internal.cache.RegionEntry#generateVersionTag(org.apache.geode.distributed.
- * DistributedMember, boolean)
+ /**
+ * This generates version tags for outgoing messages for all subclasses supporting concurrency
+ * versioning. It also sets the entry's version stamp to the tag's values.
*/
- public VersionTag generateVersionTag(VersionSource mbr, boolean withDelta, LocalRegion region,
+ @Override
+ public VersionTag generateVersionTag(VersionSource member, boolean withDelta, LocalRegion region,
EntryEventImpl event) {
VersionStamp stamp = this.getVersionStamp();
- if (stamp != null && region.getServerProxy() == null) { // clients do not generate versions
+ if (stamp != null && region.getServerProxy() == null) {
+ // clients do not generate versions
int v = stamp.getEntryVersion() + 1;
if (v > 0xFFFFFF) {
v -= 0x1000000; // roll-over
}
VersionSource previous = stamp.getMemberID();
-
// For non persistent regions, we allow the member to be null and
// when we send a message and the remote side can determine the member
// from the sender. For persistent regions, we need to send
@@ -1570,14 +1575,14 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
//
// TODO - RVV - optimize the way we send the persistent id to save
// space.
- if (mbr == null) {
+ if (member == null) {
VersionSource regionMember = region.getVersionMember();
if (regionMember instanceof DiskStoreID) {
- mbr = regionMember;
+ member = regionMember;
}
}
- VersionTag tag = VersionTag.create(mbr);
+ VersionTag tag = VersionTag.create(member);
tag.setEntryVersion(v);
if (region.getVersionVector() != null) {
// Use region version if already provided, else generate
@@ -1617,14 +1622,14 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
tag.setDistributedSystemId(dsid);
}
stamp.setVersions(tag);
- stamp.setMemberID(mbr);
+ stamp.setMemberID(member);
event.setVersionTag(tag);
if (logger.isDebugEnabled()) {
logger.debug(
"generated tag {}; key={}; oldvalue={} newvalue={} client={} region={}; rvv={}", tag,
event.getKey(), event.getOldValueStringForm(), event.getNewValueStringForm(),
- (event.getContext() == null ? "none"
- : event.getContext().getDistributedMember().getName()),
+ event.getContext() == null ? "none"
+ : event.getContext().getDistributedMember().getName(),
region.getFullPath(), region.getVersionVector());
}
return tag;
@@ -1632,32 +1637,16 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
return null;
}
- /** set/unset the flag noting that a tombstone has been scheduled for this entry */
- public void setTombstoneScheduled(boolean scheduled) {
- if (scheduled) {
- setBits(TOMBSTONE_SCHEDULED);
- } else {
- clearBits(~TOMBSTONE_SCHEDULED);
- }
- }
-
/**
- * return the flag noting whether a tombstone has been scheduled for this entry. This should be
- * called under synchronization on the region entry if you want an accurate result.
- */
- public boolean isTombstoneScheduled() {
- return areAnyBitsSet(TOMBSTONE_SCHEDULED);
- }
-
- /*
- * (non-Javadoc) This performs a concurrency check.
+ * This performs a concurrency check.
*
* This check compares the version number first, followed by the member ID.
*
* Wraparound of the version number is detected and handled by extending the range of versions by
* one bit.
*
- * The normal membership ID comparison method is used.<p>
+ * The normal membership ID comparison method is used.
+ * <p>
*
* Note that a tag from a remote (WAN) system may be in the event. If this is the case this method
* will either invoke a user plugin that allows/disallows the event (and may modify the value) or
@@ -1665,16 +1654,12 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
* distributedSystemIDs.
*
* @throws ConcurrentCacheModificationException if the event conflicts with an event that has
- * already been applied to the entry.
- *
- * @see
- * org.apache.geode.internal.cache.RegionEntry#concurrencyCheck(org.apache.geode.cache.EntryEvent)
+ * already been applied to the entry.
*/
public void processVersionTag(EntryEvent cacheEvent) {
processVersionTag(cacheEvent, true);
}
-
protected void processVersionTag(EntryEvent cacheEvent, boolean conflictCheck) {
EntryEventImpl event = (EntryEventImpl) cacheEvent;
VersionTag tag = event.getVersionTag();
@@ -1746,10 +1731,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
if (r.getVersionVector() != null && r.getServerProxy() == null
- && (r.getDataPolicy().withPersistence() || !r.getScope().isLocal())) { // bug #45258 -
- // perf degradation
- // for local
- // regions and RVV
+ && (r.getDataPolicy().withPersistence() || !r.getScope().isLocal())) {
+ // bug #45258 - perf degradation for local regions and RVV
VersionSource who = tag.getMemberID();
if (who == null) {
who = originator;
@@ -1760,29 +1743,22 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
assert !tag.isFromOtherMember()
|| tag.getMemberID() != null : "remote tag is missing memberID";
-
- // [bruce] for a long time I had conflict checks turned off in clients when
+ // for a long time I had conflict checks turned off in clients when
// receiving a response from a server and applying it to the cache. This lowered
// the CPU cost of versioning but eventually had to be pulled for bug #45453
- // if (r.getServerProxy() != null && conflictCheck) {
- // // events coming from servers while a local sync is held on the entry
- // // do not require a conflict check. Conflict checks were already
- // // performed on the server and here we just consume whatever was sent back.
- // // Event.isFromServer() returns true for client-update messages and
- // // for putAll/getAll, which do not hold syncs during the server operation.
- // conflictCheck = event.isFromServer();
- // }
- // else
-
- // [bruce] for a very long time we had conflict checks turned off for PR buckets.
+
+ // events coming from servers while a local sync is held on the entry
+ // do not require a conflict check. Conflict checks were already
+ // performed on the server and here we just consume whatever was sent back.
+ // Event.isFromServer() returns true for client-update messages and
+ // for putAll/getAll, which do not hold syncs during the server operation.
+
+ // for a very long time we had conflict checks turned off for PR buckets.
// Bug 45669 showed a primary dying in the middle of distribution. This caused
// one backup bucket to have a v2. The other bucket was promoted to primary and
// generated a conflicting v2. We need to do the check so that if this second
// v2 loses to the original one in the delta-GII operation that the original v2
// will be the winner in both buckets.
- // if (r.isUsedForPartitionedRegionBucket()) {
- // conflictCheck = false; // primary/secondary model
- // }
// The new value in event is not from GII, even it could be tombstone
basicProcessVersionTag(r, tag, false, eventHasDelta, dmId, originator, conflictCheck);
@@ -1792,26 +1768,22 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
- protected final void basicProcessVersionTag(LocalRegion region, VersionTag tag,
+ protected void basicProcessVersionTag(LocalRegion region, VersionTag tag,
boolean isTombstoneFromGII, boolean deltaCheck, VersionSource dmId,
InternalDistributedMember sender, boolean checkForConflict) {
- StringBuilder verbose = null;
-
if (tag != null) {
VersionStamp stamp = getVersionStamp();
+ StringBuilder verbose = null;
if (logger.isTraceEnabled(LogMarker.TOMBSTONE)) {
VersionTag stampTag = stamp.asVersionTag();
- if (stampTag.hasValidVersion() && checkForConflict) { // only be verbose here if there's a
- // possibility we might reject the
- // operation
+ if (stampTag.hasValidVersion() && checkForConflict) {
+ // only be verbose here if there's a possibility we might reject the operation
verbose = new StringBuilder();
- verbose.append(
- "processing tag for key " + getKey() + ", stamp=" + stamp.asVersionTag() + ", tag=")
- .append(tag).append(", checkForConflict=").append(checkForConflict); // .append(",
- // current
- // value=").append(_getValue());
+ verbose.append("processing tag for key ").append(getKey()).append(", stamp=")
+ .append(stamp.asVersionTag()).append(", tag=").append(tag)
+ .append(", checkForConflict=").append(checkForConflict);
}
}
@@ -1854,10 +1826,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
}
-
private void applyVersionTag(LocalRegion region, VersionStamp stamp, VersionTag tag,
InternalDistributedMember sender) {
- // stamp.setPreviousMemberID(stamp.getMemberID());
VersionSource mbr = tag.getMemberID();
if (mbr == null) {
mbr = sender;
@@ -1876,23 +1846,20 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
/** perform conflict checking for a stamp/tag */
- protected boolean checkForConflict(LocalRegion region, VersionStamp stamp, VersionTag tag,
+ private boolean checkForConflict(LocalRegion region, VersionStamp stamp, VersionTag tag,
boolean isTombstoneFromGII, boolean deltaCheck, VersionSource dmId,
InternalDistributedMember sender, StringBuilder verbose) {
int stampVersion = stamp.getEntryVersion();
int tagVersion = tag.getEntryVersion();
- boolean throwex = false;
- boolean apply = false;
-
if (stamp.getVersionTimeStamp() != 0) { // new entries have no timestamp
// check for wrap-around on the version number
long difference = tagVersion - stampVersion;
if (0x10000 < difference || difference < -0x10000) {
if (verbose != null) {
- verbose
- .append("\nversion rollover detected: tag=" + tagVersion + " stamp=" + stampVersion);
+ verbose.append("\nversion rollover detected: tag=").append(tagVersion).append(" stamp=")
+ .append(stampVersion);
}
if (difference < 0) {
tagVersion += 0x1000000L;
@@ -1909,6 +1876,8 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
checkForDeltaConflict(region, stampVersion, tagVersion, stamp, tag, dmId, sender, verbose);
}
+ boolean throwex = false;
+ boolean apply = false;
if (stampVersion == 0 || stampVersion < tagVersion) {
if (verbose != null) {
verbose.append(" - applying change");
@@ -1968,11 +1937,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
verbose.append(" - disallowing duplicate marked with posdup");
}
throwex = true;
- } else /*
- * if (isTombstoneFromGII && isTombstone()) { if (verbose != null) {
- * verbose.append(" - disallowing duplicate tombstone from GII"); } return false; //
- * bug #49601 don't schedule tombstones from GII if there's already one here } else
- */ {
+ } else {
if (verbose != null) {
verbose.append(" - allowing duplicate");
}
@@ -1991,7 +1956,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
private boolean isExpiredTombstone(LocalRegion region, long timestamp, boolean isTombstone) {
return isTombstone
- && (timestamp + TombstoneService.REPLICATE_TOMBSTONE_TIMEOUT) <= region.cacheTimeMillis();
+ && timestamp + TombstoneService.REPLICATE_TOMBSTONE_TIMEOUT <= region.cacheTimeMillis();
}
private boolean overwritingOldTombstone(LocalRegion region, VersionStamp stamp, VersionTag tag,
@@ -2022,8 +1987,6 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
* for an event containing a delta we must check to see if the tag's previous member id is the
* stamp's member id and ensure that the version is only incremented by 1. Otherwise the delta is
* being applied to a value that does not match the source of the delta.
- *
- * @throws InvalidDeltaException
*/
private void checkForDeltaConflict(LocalRegion region, long stampVersion, long tagVersion,
VersionStamp stamp, VersionTag tag, VersionSource dmId, InternalDistributedMember sender,
@@ -2102,21 +2065,19 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
@Override
- public void changeEventValue(Object v) {
- newValue[0] = v;
+ public void changeEventValue(Object value) {
+ newValue[0] = value;
}
};
+
@Released
TimestampedEntryEventImpl timestampedEvent = (TimestampedEntryEventImpl) event
.getTimestampedEvent(tagDsid, stampDsid, tagTime, stampTime);
// gateway conflict resolvers will usually want to see the old value
if (!timestampedEvent.hasOldValue() && isRemoved()) {
- timestampedEvent.setOldValue(getValue(timestampedEvent.getRegion())); // OFFHEAP: since
- // isRemoved I think
- // getValue will never
- // be stored off heap
- // in this case
+ // OFFHEAP: since isRemoved I think getValue will never be stored off heap in this case
+ timestampedEvent.setOldValue(getValue(timestampedEvent.getRegion()));
}
Throwable thr = null;
@@ -2144,7 +2105,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
}
if (isDebugEnabled) {
- logger.debug("done invoking resolver {}", thr);
+ logger.debug("done invoking resolver", thr);
}
if (thr == null) {
if (disallow[0]) {
@@ -2174,58 +2135,55 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry<Obje
if (isDebugEnabled) {
logger.debug("performing normal WAN conflict check");
}
- if (tagTime > stampTime || (tagTime == stampTime && tagDsid >= stampDsid)) {
+ if (tagTime > stampTime || tagTime == stampTime && tagDsid >= stampDsid) {
if (isDebugEnabled) {
logger.debug("allowing event");
}
return true;
}
if (isDebugEnabled) {
- logger.debug("disallowing event for " + event.getKey());
+ logger.debug("disallowing event for {}", event.getKey());
}
throw new ConcurrentCacheModificationException("conflicting WAN event detected");
}
static boolean isCompressible(RegionEntryContext context, Object value) {
- return ((value != null) && (context != null) && (context.getCompressor() != null)
- && !Token.isInvalidOrRemoved(value));
+ return value != null && context != null && context.getCompressor() != null
+ && !Token.isInvalidOrRemoved(value);
}
/* subclasses supporting versions must override this */
+ @Override
public VersionStamp getVersionStamp() {
return null;
}
+ @Override
public boolean isValueNull() {
- return (null == getValueAsToken());
+ return null == getValueAsToken();
}
+ @Override
public boolean isInvalid() {
return Token.isInvalid(getValueAsToken());
}
+ @Override
public boolean isDestroyed() {
return Token.isDestroyed(getValueAsToken());
}
+ @Override
public void setValueToNull() {
_setValue(null);
}
+ @Override
public boolean isInvalidOrRemoved() {
return Token.isInvalidOrRemoved(getValueAsToken());
}
/**
- * Maximum size of a string that can be encoded as char.
- */
- public static final int MAX_INLINE_STRING_KEY_CHAR_ENCODING = 7;
- /**
- * Maximum size of a string that can be encoded as byte.
- */
- public static final int MAX_INLINE_STRING_KEY_BYTE_ENCODING = 15;
-
- /**
* This is only retained in off-heap subclasses. However, it's marked as Retained here so that
* callers are aware that the value may be retained.
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index bc9fcdf..e0fc27c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -12,12 +12,29 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.GemFireIOException;
import org.apache.geode.InvalidDeltaException;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheEvent;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.DiskAccessException;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.TransactionId;
import org.apache.geode.cache.query.IndexMaintenanceException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.cache.query.internal.index.IndexManager;
@@ -37,7 +54,12 @@ import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import org.apache.geode.internal.cache.tier.sockets.HAEventWrapper;
-import org.apache.geode.internal.cache.versions.*;
+import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
+import org.apache.geode.internal.cache.versions.RegionVersionVector;
+import org.apache.geode.internal.cache.versions.VersionHolder;
+import org.apache.geode.internal.cache.versions.VersionSource;
+import org.apache.geode.internal.cache.versions.VersionStamp;
+import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
import org.apache.geode.internal.concurrent.MapCallbackAdapter;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -54,21 +76,12 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.sequencelog.EntryLogger;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
* Abstract implementation of {@link RegionMap}that has all the common behavior.
*
* @since GemFire 3.5.1
- *
- *
*/
-
public abstract class AbstractRegionMap implements RegionMap {
-
private static final Logger logger = LogService.getLogger();
/** The underlying map for this region. */
@@ -81,10 +94,15 @@ public abstract class AbstractRegionMap implements RegionMap {
static Runnable testHookRunnableFor48182 = null;
private RegionEntryFactory entryFactory;
+
private Attributes attr;
- private transient Object owner; // the region that owns this map
- protected AbstractRegionMap(InternalRegionArguments internalRegionArgs) {}
+ // the region that owns this map
+ private Object owner;
+
+ protected AbstractRegionMap(InternalRegionArguments internalRegionArgs) {
+ // do nothing
+ }
protected void initialize(Object owner, Attributes attr,
InternalRegionArguments internalRegionArgs, boolean isLRU) {
@@ -93,22 +111,19 @@ public abstract class AbstractRegionMap implements RegionMap {
_setMap(createConcurrentMap(attr.initialCapacity, attr.loadFactor, attr.concurrencyLevel, false,
new AbstractRegionEntry.HashRegionEntryCreator()));
- final GemFireCacheImpl cache;
boolean isDisk;
- boolean withVersioning = false;
- boolean offHeap = false;
+ boolean withVersioning;
+ boolean offHeap;
if (owner instanceof LocalRegion) {
LocalRegion region = (LocalRegion) owner;
isDisk = region.getDiskRegion() != null;
- cache = region.getGemFireCache();
withVersioning = region.getConcurrencyChecksEnabled();
offHeap = region.getOffHeap();
} else if (owner instanceof PlaceHolderDiskRegion) {
- offHeap = ((PlaceHolderDiskRegion) owner).getOffHeap();
+ offHeap = ((RegionEntryContext) owner).getOffHeap();
isDisk = true;
withVersioning =
- ((PlaceHolderDiskRegion) owner).getFlags().contains(DiskRegionFlag.IS_WITH_VERSIONING);
- cache = GemFireCacheImpl.getInstance();
+ ((DiskRegionView) owner).getFlags().contains(DiskRegionFlag.IS_WITH_VERSIONING);
} else {
throw new IllegalStateException("expected LocalRegion or PlaceHolderDiskRegion");
}
@@ -117,15 +132,15 @@ public abstract class AbstractRegionMap implements RegionMap {
attr.statisticsEnabled, isLRU, isDisk, withVersioning, offHeap));
}
- protected CustomEntryConcurrentHashMap<Object, Object> createConcurrentMap(int initialCapacity,
+ private CustomEntryConcurrentHashMap<Object, Object> createConcurrentMap(int initialCapacity,
float loadFactor, int concurrencyLevel, boolean isIdentityMap,
CustomEntryConcurrentHashMap.HashEntryCreator<Object, Object> entryCreator) {
if (entryCreator != null) {
- return new CustomEntryConcurrentHashMap<Object, Object>(initialCapacity, loadFactor,
- concurrencyLevel, isIdentityMap, entryCreator);
+ return new CustomEntryConcurrentHashMap<>(initialCapacity, loadFactor, concurrencyLevel,
+ isIdentityMap, entryCreator);
} else {
- return new CustomEntryConcurrentHashMap<Object, Object>(initialCapacity, loadFactor,
- concurrencyLevel, isIdentityMap);
+ return new CustomEntryConcurrentHashMap<>(initialCapacity, loadFactor, concurrencyLevel,
+ isIdentityMap);
}
}
@@ -1548,7 +1563,6 @@ public abstract class AbstractRegionMap implements RegionMap {
final boolean isDebugEnabled = logger.isDebugEnabled();
final LocalRegion owner = _getOwner();
- owner.checkBeforeEntrySync(txEvent);
final boolean isRegionReady = !inTokenMode;
final boolean hasRemoteOrigin = !((TXId) txId).getMemberId().equals(owner.getMyId());
@@ -2337,7 +2351,6 @@ public abstract class AbstractRegionMap implements RegionMap {
TXEntryState txEntryState, VersionTag versionTag, long tailKey) {
// boolean didInvalidate = false;
final LocalRegion owner = _getOwner();
- owner.checkBeforeEntrySync(txEvent);
@Released
EntryEventImpl cbEvent = null;
@@ -2408,8 +2421,7 @@ public abstract class AbstractRegionMap implements RegionMap {
} catch (RegionClearedException rce) {
clearOccured = true;
}
- owner.txApplyInvalidatePart2(oldRe, oldRe.getKey(), didDestroy, true,
- clearOccured);
+ owner.txApplyInvalidatePart2(oldRe, oldRe.getKey(), didDestroy, true);
// didInvalidate = true;
if (invokeCallbacks) {
switchEventOwnerAndOriginRemote(cbEvent, hasRemoteOrigin);
@@ -2455,7 +2467,7 @@ public abstract class AbstractRegionMap implements RegionMap {
} catch (RegionClearedException rce) {
clearOccured = true;
}
- owner.txApplyInvalidatePart2(newRe, newRe.getKey(), didDestroy, true, clearOccured);
+ owner.txApplyInvalidatePart2(newRe, newRe.getKey(), didDestroy, true);
if (invokeCallbacks) {
switchEventOwnerAndOriginRemote(cbEvent, hasRemoteOrigin);
@@ -2527,7 +2539,7 @@ public abstract class AbstractRegionMap implements RegionMap {
} catch (RegionClearedException rce) {
clearOccured = true;
}
- owner.txApplyInvalidatePart2(re, re.getKey(), didDestroy, true, clearOccured);
+ owner.txApplyInvalidatePart2(re, re.getKey(), didDestroy, true);
// didInvalidate = true;
if (invokeCallbacks) {
switchEventOwnerAndOriginRemote(cbEvent, hasRemoteOrigin);
@@ -3080,7 +3092,6 @@ public abstract class AbstractRegionMap implements RegionMap {
Operation putOp = p_putOp;
- owner.checkBeforeEntrySync(txEvent);
Object newValue = nv;
final boolean hasRemoteOrigin = !((TXId) txId).getMemberId().equals(owner.getMyId());
@@ -3175,7 +3186,7 @@ public abstract class AbstractRegionMap implements RegionMap {
long lastMod = owner.cacheTimeMillis();
EntryLogger.logTXPut(_getOwnerObject(), key, nv);
re.updateStatsForPut(lastMod, lastMod);
- owner.txApplyPutPart2(re, re.getKey(), newValue, lastMod, false, didDestroy,
+ owner.txApplyPutPart2(re, re.getKey(), lastMod, false, didDestroy,
clearOccured);
}
} finally {
@@ -3200,7 +3211,7 @@ public abstract class AbstractRegionMap implements RegionMap {
}
}
if (didDestroy && !opCompleted) {
- owner.txApplyInvalidatePart2(re, re.getKey(), true, false, false /* clear */);
+ owner.txApplyInvalidatePart2(re, re.getKey(), true, false /* clear */);
}
}
if (owner.concurrencyChecksEnabled && txEntryState != null && cbEvent != null) {
@@ -3275,8 +3286,8 @@ public abstract class AbstractRegionMap implements RegionMap {
long lastMod = owner.cacheTimeMillis();
EntryLogger.logTXPut(_getOwnerObject(), key, nv);
oldRe.updateStatsForPut(lastMod, lastMod);
- owner.txApplyPutPart2(oldRe, oldRe.getKey(), newValue, lastMod, false,
- didDestroy, clearOccured);
+ owner.txApplyPutPart2(oldRe, oldRe.getKey(), lastMod, false, didDestroy,
+ clearOccured);
}
} finally {
if (oldRe != null && owner.indexMaintenanceSynchronous) {
@@ -3341,7 +3352,7 @@ public abstract class AbstractRegionMap implements RegionMap {
long lastMod = owner.cacheTimeMillis();
EntryLogger.logTXPut(_getOwnerObject(), key, nv);
newRe.updateStatsForPut(lastMod, lastMod);
- owner.txApplyPutPart2(newRe, newRe.getKey(), newValue, lastMod, true, didDestroy,
+ owner.txApplyPutPart2(newRe, newRe.getKey(), lastMod, true, didDestroy,
clearOccured);
}
} finally {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/AddCacheServerProfileMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AddCacheServerProfileMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AddCacheServerProfileMessage.java
index 6928ad2..ff0101b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AddCacheServerProfileMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AddCacheServerProfileMessage.java
@@ -44,8 +44,9 @@ public class AddCacheServerProfileMessage extends SerialDistributionMessage
protected void process(DistributionManager dm) {
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- if (cache != null && !cache.isClosed()) { // will be null if not initialized
+ InternalCache cache = GemFireCacheImpl.getInstance();
+ // will be null if not initialized
+ if (cache != null && !cache.isClosed()) {
operateOnCache(cache);
}
} finally {
@@ -55,16 +56,16 @@ public class AddCacheServerProfileMessage extends SerialDistributionMessage
reply.setRecipient(getSender());
try {
dm.putOutgoing(reply);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// can't send a reply, so ignore the exception
}
}
}
- private void operateOnCache(GemFireCacheImpl cache) {
+ private void operateOnCache(InternalCache cache) {
final boolean isDebugEnabled = logger.isDebugEnabled();
- for (DistributedRegion r : this.getDistributedRegions(cache)) {
+ for (DistributedRegion r : getDistributedRegions(cache)) {
CacheDistributionAdvisor cda = (CacheDistributionAdvisor) r.getDistributionAdvisor();
CacheDistributionAdvisor.CacheProfile cp =
(CacheDistributionAdvisor.CacheProfile) cda.getProfile(getSender());
@@ -91,16 +92,16 @@ public class AddCacheServerProfileMessage extends SerialDistributionMessage
}
/** set the hasCacheServer flags for all regions in this cache */
- public void operateOnLocalCache(GemFireCacheImpl cache) {
+ public void operateOnLocalCache(InternalCache cache) {
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- for (LocalRegion r : this.getAllRegions(cache)) {
+ for (LocalRegion r : getAllRegions(cache)) {
FilterProfile fp = r.getFilterProfile();
if (fp != null) {
fp.getLocalProfile().hasCacheServer = true;
}
}
- for (PartitionedRegion r : this.getPartitionedRegions(cache)) {
+ for (PartitionedRegion r : getPartitionedRegions(cache)) {
FilterProfile fp = r.getFilterProfile();
if (fp != null) {
fp.getLocalProfile().hasCacheServer = true;
@@ -112,13 +113,13 @@ public class AddCacheServerProfileMessage extends SerialDistributionMessage
}
- private Set<LocalRegion> getAllRegions(GemFireCacheImpl gfc) {
- return gfc.getAllRegions();
+ private Set<LocalRegion> getAllRegions(InternalCache internalCache) {
+ return internalCache.getAllRegions();
}
- private Set<DistributedRegion> getDistributedRegions(GemFireCacheImpl gfc) {
- Set<DistributedRegion> result = new HashSet();
- for (LocalRegion r : gfc.getAllRegions()) {
+ private Set<DistributedRegion> getDistributedRegions(InternalCache internalCache) {
+ Set<DistributedRegion> result = new HashSet<>();
+ for (LocalRegion r : internalCache.getAllRegions()) {
if (r instanceof DistributedRegion) {
result.add((DistributedRegion) r);
}
@@ -126,14 +127,14 @@ public class AddCacheServerProfileMessage extends SerialDistributionMessage
return result;
}
- private Set<PartitionedRegion> getPartitionedRegions(GemFireCacheImpl gfc) {
- Set<PartitionedRegion> result = new HashSet(gfc.getPartitionedRegions());
- return result;
+ private Set<PartitionedRegion> getPartitionedRegions(InternalCache internalCache) {
+ return (Set<PartitionedRegion>) new HashSet(internalCache.getPartitionedRegions());
}
/** for deserialization only */
public AddCacheServerProfileMessage() {}
+ @Override
public int getDSFID() {
return ADD_CACHESERVER_PROFILE_UPDATE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 8b8705a..7b35cb5 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -14,6 +14,30 @@
*/
package org.apache.geode.internal.cache;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheClosedException;
@@ -42,16 +66,6 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.util.StopWatch;
-import org.apache.logging.log4j.Logger;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* Specialized {@link CacheDistributionAdvisor} for {@link BucketRegion BucketRegions}. The
@@ -1452,7 +1466,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
for (;;) {
// bail out if the system starts closing
this.getAdvisee().getCancelCriterion().checkCancelInProgress(null);
- final GemFireCacheImpl cache = (GemFireCacheImpl) getBucket().getCache();
+ final InternalCache cache = getBucket().getCache();
if (cache != null && cache.isCacheAtShutdownAll()) {
throw new CacheClosedException("Cache is shutting down");
}
@@ -1727,9 +1741,9 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
@Override
protected Profile instantiateProfile(InternalDistributedMember memberId, int version) {
if (!this.pRegion.isShadowPR()) {
- GemFireCacheImpl c = getProxyBucketRegion().getCache();
+ InternalCache cache = getProxyBucketRegion().getCache();
List servers = null;
- servers = c.getCacheServers();
+ servers = cache.getCacheServers();
HashSet<BucketServerLocation66> serverLocations = new HashSet<BucketServerLocation66>();
for (Object object : servers) {
[19/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
index 136d7b9..25d3c1d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
@@ -185,7 +185,6 @@ public class BucketRegion extends DistributedRegion implements Bucket {
static final boolean FORCE_LOCAL_LISTENERS_INVOCATION = Boolean
.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "BucketRegion.alwaysFireLocalListeners");
- // gemfire.BucktRegion.alwaysFireLocalListeners=true
private volatile AtomicLong5 eventSeqNum = null;
@@ -194,7 +193,7 @@ public class BucketRegion extends DistributedRegion implements Bucket {
}
public BucketRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
- GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs) {
+ InternalCache cache, InternalRegionArguments internalRegionArgs) {
super(regionName, attrs, parentRegion, cache, internalRegionArgs);
if (PartitionedRegion.DISABLE_SECONDARY_BUCKET_ACK) {
Assert.assertTrue(attrs.getScope().isDistributedNoAck());
@@ -270,7 +269,7 @@ public class BucketRegion extends DistributedRegion implements Bucket {
}
@Override
- protected DiskStoreImpl findDiskStore(RegionAttributes ra,
+ protected DiskStoreImpl findDiskStore(RegionAttributes regionAttributes,
InternalRegionArguments internalRegionArgs) {
return internalRegionArgs.getPartitionedRegion().getDiskStore();
}
@@ -927,8 +926,8 @@ public class BucketRegion extends DistributedRegion implements Bucket {
}
@Override
- void basicInvalidatePart2(final RegionEntry re, final EntryEventImpl event, boolean clearConflict,
- boolean invokeCallbacks) {
+ void basicInvalidatePart2(final RegionEntry regionEntry, final EntryEventImpl event,
+ boolean conflictWithClear, boolean invokeCallbacks) {
// Assumed this is called with the entry synchronized
long token = -1;
InvalidateOperation op = null;
@@ -936,7 +935,7 @@ public class BucketRegion extends DistributedRegion implements Bucket {
try {
if (!event.isOriginRemote()) {
if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
- VersionTag v = re.generateVersionTag(null, false, this, event);
+ VersionTag v = regionEntry.generateVersionTag(null, false, this, event);
if (logger.isDebugEnabled() && v != null) {
logger.debug("generated version tag {} in region {}", v, this.getName());
}
@@ -954,8 +953,8 @@ public class BucketRegion extends DistributedRegion implements Bucket {
op = new InvalidateOperation(event);
token = op.startOperation();
}
- super.basicInvalidatePart2(re, event, clearConflict /* Clear conflict occurred */,
- invokeCallbacks);
+ super.basicInvalidatePart2(regionEntry, event,
+ conflictWithClear /* Clear conflict occurred */, invokeCallbacks);
} finally {
if (op != null) {
op.endOperation(token);
@@ -1018,8 +1017,8 @@ public class BucketRegion extends DistributedRegion implements Bucket {
}
@Override
- final void performExpiryTimeout(ExpiryTask p_task) throws CacheException {
- ExpiryTask task = p_task;
+ final void performExpiryTimeout(ExpiryTask expiryTask) throws CacheException {
+ ExpiryTask task = expiryTask;
boolean isEvictDestroy = isEntryEvictDestroyEnabled();
// Fix for bug 43805 - get the primary lock before
// synchronizing on pendingSecondaryExpires, to match the lock
@@ -2110,10 +2109,8 @@ public class BucketRegion extends DistributedRegion implements Bucket {
// counters to 0.
oldMemValue = this.bytesInMemory.getAndSet(0);
}
- // Gemfire PRs don't support clear. allowing it via a hack for tests
- else if (LocalRegion.simulateClearForTests) {
- oldMemValue = this.bytesInMemory.getAndSet(0);
- } else {
+
+ else {
throw new InternalGemFireError(
"Trying to clear a bucket region that was not destroyed or in initialization.");
}
@@ -2124,14 +2121,14 @@ public class BucketRegion extends DistributedRegion implements Bucket {
}
@Override
- public int calculateValueSize(Object val) {
+ public int calculateValueSize(Object value) {
// Only needed by BucketRegion
- return calcMemSize(val);
+ return calcMemSize(value);
}
@Override
- public int calculateRegionEntryValueSize(RegionEntry re) {
- return calcMemSize(re._getValue()); // OFFHEAP _getValue ok
+ public int calculateRegionEntryValueSize(RegionEntry regionEntry) {
+ return calcMemSize(regionEntry._getValue()); // OFFHEAP _getValue ok
}
@Override
@@ -2181,7 +2178,7 @@ public class BucketRegion extends DistributedRegion implements Bucket {
@Override
public void initialCriticalMembers(boolean localHeapIsCritical,
- Set<InternalDistributedMember> critialMembers) {
+ Set<InternalDistributedMember> criticalMembers) {
// The owner Partitioned Region handles critical threshold events
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
index 7a21d12..fe63abd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
@@ -76,29 +76,20 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
*/
private final BlockingQueue<Object> eventSeqNumQueue = new LinkedBlockingQueue<Object>();
- // private final BlockingQueue<EventID> eventSeqNumQueueWithEventId = new
- // LinkedBlockingQueue<EventID>();
-
private long lastKeyRecovered;
- private AtomicLong latestQueuedKey = new AtomicLong();
+ private final AtomicLong latestQueuedKey = new AtomicLong();
- private AtomicLong latestAcknowledgedKey = new AtomicLong();
+ private final AtomicLong latestAcknowledgedKey = new AtomicLong();
- /**
- * @param regionName
- * @param attrs
- * @param parentRegion
- * @param cache
- * @param internalRegionArgs
- */
public BucketRegionQueue(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
- GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs) {
+ InternalCache cache, InternalRegionArguments internalRegionArgs) {
super(regionName, attrs, parentRegion, cache, internalRegionArgs);
this.keySet();
- indexes = new ConcurrentHashMap<Object, Long>();
+ this.indexes = new ConcurrentHashMap<Object, Long>();
}
+ @Override
protected void cleanUpDestroyedTokensAndMarkGIIComplete(
InitialImageOperation.GIIStatus giiStatus) {
// Load events from temp queued events
@@ -555,7 +546,7 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
@Released
EntryEventImpl event = getPartitionedRegion().newDestroyEntryEvent(key, null);
try {
- event.setEventId(new EventID(cache.getSystem()));
+ event.setEventId(new EventID(cache.getInternalDistributedSystem()));
event.setRegion(this);
basicDestroy(event, true, null);
setLatestAcknowledgedKey((Long) key);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheConfig.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheConfig.java
index 45b6a6c..b97cc46 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheConfig.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.internal.cache.xmlcache.CacheServerCreation;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.pdx.PdxSerializer;
@@ -167,7 +168,7 @@ public class CacheConfig {
this.cacheServerCreation = servers;
}
- public void validateCacheConfig(GemFireCacheImpl cacheInstance) {
+ public void validateCacheConfig(InternalClientCache cacheInstance) {
// To fix bug 44961 only validate our attributes against the existing cache
// if they have been explicitly set by the set.
// So all the following "ifs" check that "*UserSet" is true.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisee.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisee.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisee.java
index b4bb00f..e4a7957 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisee.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisee.java
@@ -14,7 +14,6 @@
*/
package org.apache.geode.internal.cache;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.distributed.internal.DistributionAdvisee;
import org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile;
@@ -39,7 +38,7 @@ public interface CacheDistributionAdvisee extends DistributionAdvisee {
*
* @return the Cache
*/
- public Cache getCache();
+ public InternalCache getCache();
/**
* Returns the <code>RegionAttributes</code> associated with this advisee.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheLifecycleListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheLifecycleListener.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheLifecycleListener.java
index c7e6a37..e0f1d99 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheLifecycleListener.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheLifecycleListener.java
@@ -15,7 +15,7 @@
package org.apache.geode.internal.cache;
/**
- * Defines callbacks that are invoked when a <code>GemFireCache</code> is created or closed.
+ * Defines callbacks that are invoked when an {@code InternalCache} is created or closed.
*
* @see GemFireCacheImpl#addCacheLifecycleListener(CacheLifecycleListener)
* @see GemFireCacheImpl#removeCacheLifecycleListener(CacheLifecycleListener)
@@ -23,12 +23,12 @@ package org.apache.geode.internal.cache;
public interface CacheLifecycleListener {
/**
- * Invoked when a new <code>GemFireCache</code> is created
+ * Invoked when a new {@code InternalCache} is created
*/
- public void cacheCreated(GemFireCacheImpl cache);
+ void cacheCreated(InternalCache cache);
/**
- * Invoked when a <code>GemFireCache</code> is closed
+ * Invoked when a {@code InternalCache} is closed
*/
- public void cacheClosed(GemFireCacheImpl cache);
+ void cacheClosed(InternalCache cache);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
index 67e04f1..59fa5dd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
@@ -1283,11 +1283,10 @@ public class CachePerfStats {
public void incDeltaFullValuesRequested() {
stats.incInt(deltaFullValuesRequestedId, 1);
}
- ////// Special Instance Methods /////
/**
- * Closes these stats so that they can not longer be used. The stats are closed when the
- * {@linkplain GemFireCacheImpl#close cache} is closed.
+ * Closes these stats so that they can not longer be used. The stats are closed when the cache is
+ * closed.
*
* @since GemFire 3.5
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
index 367b6f4..c8d1954 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
@@ -14,19 +14,51 @@
*/
package org.apache.geode.internal.cache;
+import static java.lang.Integer.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.GemFireIOException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.InvalidValueException;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.ClientSession;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.cache.DiskStoreFactory;
+import org.apache.geode.cache.DynamicRegionFactory;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.EvictionAttributes;
+import org.apache.geode.cache.InterestRegistrationListener;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionExistsException;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.server.ClientSubscriptionConfig;
import org.apache.geode.cache.server.ServerLoadProbe;
import org.apache.geode.cache.server.internal.LoadMonitor;
import org.apache.geode.cache.wan.GatewayTransportFilter;
import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionAdvisee;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.ResourceEvent;
+import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.distributed.internal.membership.MemberAttributes;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.OSProcess;
@@ -42,16 +74,10 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.management.membership.ClientMembership;
import org.apache.geode.management.membership.ClientMembershipListener;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
/**
- * An implementation of the <code>CacheServer</code> interface that delegates most of the heavy
- * lifting to an {@link Acceptor}.
+ * An implementation of the{@code CacheServer} interface that delegates most of the heavy lifting to
+ * an {@link Acceptor}.
*
* @since GemFire 4.0
*/
@@ -60,11 +86,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
private static final Logger logger = LogService.getLogger();
- private static final int FORCE_LOAD_UPDATE_FREQUENCY =
- Integer
- .getInteger(
- DistributionConfig.GEMFIRE_PREFIX + "BridgeServer.FORCE_LOAD_UPDATE_FREQUENCY", 10)
- .intValue();
+ private static final int FORCE_LOAD_UPDATE_FREQUENCY = getInteger(
+ DistributionConfig.GEMFIRE_PREFIX + "BridgeServer.FORCE_LOAD_UPDATE_FREQUENCY", 10);
/** The acceptor that does the actual serving */
private volatile AcceptorImpl acceptor;
@@ -88,7 +111,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
*/
private boolean isGatewayReceiver;
- private List<GatewayTransportFilter> gatewayTransportFilters = Collections.EMPTY_LIST;
+ private List<GatewayTransportFilter> gatewayTransportFilters = Collections.emptyList();
/** is this a server created by a launcher as opposed to by an application or XML? */
private boolean isDefaultServer;
@@ -107,10 +130,10 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
// ////////////////////// Constructors //////////////////////
/**
- * Creates a new <code>BridgeServerImpl</code> that serves the contents of the give
- * <code>Cache</code>. It has the default configuration.
+ * Creates a new{@code BridgeServerImpl} that serves the contents of the give {@code Cache}. It
+ * has the default configuration.
*/
- public CacheServerImpl(GemFireCacheImpl cache, boolean isGatewayReceiver) {
+ public CacheServerImpl(InternalCache cache, boolean isGatewayReceiver) {
super(cache);
this.isGatewayReceiver = isGatewayReceiver;
}
@@ -251,8 +274,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
/**
- * Sets the configuration of <b>this</b> <code>CacheServer</code> based on the configuration of
- * <b>another</b> <code>CacheServer</code>.
+ * Sets the configuration of <b>this</b>{@code CacheServer} based on the configuration of
+ * <b>another</b>{@code CacheServer}.
*/
public void configureFrom(CacheServer other) {
setPort(other.getPort());
@@ -302,8 +325,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
List overflowAttributesList = new LinkedList();
ClientSubscriptionConfig csc = this.getClientSubscriptionConfig();
overflowAttributesList.add(0, csc.getEvictionPolicy());
- overflowAttributesList.add(1, Integer.valueOf(csc.getCapacity()));
- overflowAttributesList.add(2, Integer.valueOf(this.port));
+ overflowAttributesList.add(1, valueOf(csc.getCapacity()));
+ overflowAttributesList.add(2, valueOf(this.port));
String diskStoreName = csc.getDiskStoreName();
if (diskStoreName != null) {
overflowAttributesList.add(3, diskStoreName);
@@ -327,9 +350,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
// TODO : Need to provide facility to enable/disable client health monitoring.
// Creating ClientHealthMonitoring region.
// Force initialization on current cache
- if (cache instanceof GemFireCacheImpl) {
- ClientHealthMonitoringRegion.getInstance((GemFireCacheImpl) cache);
- }
+ ClientHealthMonitoringRegion.getInstance(this.cache);
this.cache.getLoggerI18n()
.config(LocalizedStrings.CacheServerImpl_CACHESERVER_CONFIGURATION___0, getConfig());
@@ -379,7 +400,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
throw new IllegalStateException(s);
}
}
- if (this.hostnameForClients == null || this.hostnameForClients.equals("")) {
+ if (this.hostnameForClients == null || this.hostnameForClients.isEmpty()) {
if (this.acceptor != null) {
return this.acceptor.getExternalAddress();
} else {
@@ -518,16 +539,10 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
/**
* create client subscription
*
- * @param cache
- * @param ePolicy
- * @param capacity
- * @param port
- * @param overFlowDir
- * @param isDiskStore
* @return client subscription name
* @since GemFire 5.7
*/
- public static String clientMessagesRegion(GemFireCacheImpl cache, String ePolicy, int capacity,
+ public static String clientMessagesRegion(InternalCache cache, String ePolicy, int capacity,
int port, String overFlowDir, boolean isDiskStore) {
AttributesFactory factory =
getAttribFactoryForClientMessagesRegion(cache, ePolicy, capacity, overFlowDir, isDiskStore);
@@ -536,7 +551,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return createClientMessagesRegion(attr, cache, capacity, port);
}
- public static AttributesFactory getAttribFactoryForClientMessagesRegion(GemFireCacheImpl cache,
+ public static AttributesFactory getAttribFactoryForClientMessagesRegion(InternalCache cache,
String ePolicy, int capacity, String overflowDir, boolean isDiskStore)
throws InvalidValueException, GemFireIOException {
AttributesFactory factory = new AttributesFactory();
@@ -565,8 +580,8 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
File[] dirs = {dir};
DiskStoreFactory dsf = cache.createDiskStoreFactory();
- DiskStore bsi = dsf.setAutoCompact(true)
- .setDiskDirsAndSizes(dirs, new int[] {Integer.MAX_VALUE}).create("bsi");
+ DiskStore bsi =
+ dsf.setAutoCompact(true).setDiskDirsAndSizes(dirs, new int[] {MAX_VALUE}).create("bsi");
factory.setDiskStoreName("bsi");
// backward compatibility, it was sync
factory.setDiskSynchronous(true);
@@ -576,11 +591,12 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
factory.setStatisticsEnabled(true);
/* setting LIFO related eviction attributes */
if (HARegionQueue.HA_EVICTION_POLICY_ENTRY.equals(ePolicy)) {
- factory.setEvictionAttributes(EvictionAttributesImpl.createLIFOEntryAttributes(capacity,
- EvictionAction.OVERFLOW_TO_DISK));
- } else if (HARegionQueue.HA_EVICTION_POLICY_MEMORY.equals(ePolicy)) { // condition refinement
- factory.setEvictionAttributes(EvictionAttributesImpl.createLIFOMemoryAttributes(capacity,
- EvictionAction.OVERFLOW_TO_DISK));
+ factory.setEvictionAttributes(
+ EvictionAttributes.createLIFOEntryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
+ } else if (HARegionQueue.HA_EVICTION_POLICY_MEMORY.equals(ePolicy)) {
+ // condition refinement
+ factory.setEvictionAttributes(
+ EvictionAttributes.createLIFOMemoryAttributes(capacity, EvictionAction.OVERFLOW_TO_DISK));
} else {
// throw invalid eviction policy exception
throw new InvalidValueException(
@@ -589,7 +605,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return factory;
}
- public static String createClientMessagesRegion(RegionAttributes attr, GemFireCacheImpl cache,
+ private static String createClientMessagesRegion(RegionAttributes attr, InternalCache cache,
int capacity, int port) {
// generating unique name in VM for ClientMessagesRegion
String regionName = generateNameForClientMsgsRegion(port);
@@ -615,22 +631,9 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
return regionName;
}
- public static String createClientMessagesRegionForTesting(GemFireCacheImpl cache, String ePolicy,
- int capacity, int port, int expiryTime, String overFlowDir, boolean isDiskStore) {
- AttributesFactory factory =
- getAttribFactoryForClientMessagesRegion(cache, ePolicy, capacity, overFlowDir, isDiskStore);
- ExpirationAttributes ea =
- new ExpirationAttributes(expiryTime, ExpirationAction.LOCAL_INVALIDATE);
- factory.setEntryTimeToLive(ea);
- RegionAttributes attr = factory.create();
-
- return createClientMessagesRegion(attr, cache, capacity, port);
- }
-
/**
* Generates the name for the client subscription using the given id.
*
- * @param id
* @return String
* @since GemFire 5.7
*/
@@ -662,9 +665,9 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
/**
- * Returns the underlying <code>InternalDistributedSystem</code> connection.
+ * Returns the underlying{@code InternalDistributedSystem} connection.
*
- * @return the underlying <code>InternalDistributedSystem</code>
+ * @return the underlying{@code InternalDistributedSystem}
*/
public InternalDistributedSystem getSystem() {
return (InternalDistributedSystem) this.cache.getDistributedSystem();
@@ -729,10 +732,10 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
/**
- * Registers a new <code>InterestRegistrationListener</code> with the set of
- * <code>InterestRegistrationListener</code>s.
+ * Registers a new{@code InterestRegistrationListener} with the set of
+ * {@code InterestRegistrationListener}s.
*
- * @param listener The <code>InterestRegistrationListener</code> to register
+ * @param listener The{@code InterestRegistrationListener} to register
* @throws IllegalStateException if the BridgeServer has not been started
* @since GemFire 5.8Beta
*/
@@ -745,10 +748,10 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
/**
- * Unregisters an existing <code>InterestRegistrationListener</code> from the set of
- * <code>InterestRegistrationListener</code>s.
+ * Unregisters an existing{@code InterestRegistrationListener} from the set of
+ * {@code InterestRegistrationListener}s.
*
- * @param listener The <code>InterestRegistrationListener</code> to unregister
+ * @param listener The{@code InterestRegistrationListener} to unregister
*
* @since GemFire 5.8Beta
*/
@@ -757,11 +760,9 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
}
/**
- * Returns a read-only set of <code>InterestRegistrationListener</code>s registered with this
- * notifier.
+ * Returns a read-only set of{@code InterestRegistrationListener}s registered with this notifier.
*
- * @return a read-only set of <code>InterestRegistrationListener</code>s registered with this
- * notifier
+ * @return a read-only set of{@code InterestRegistrationListener}s registered with this notifier
*
* @since GemFire 5.8Beta
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerLauncher.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerLauncher.java
index 9a544d2..6bfb0f3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerLauncher.java
@@ -15,6 +15,26 @@
package org.apache.geode.internal.cache;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
@@ -28,26 +48,17 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.i18n.LogWriterI18n;
import org.apache.geode.internal.OSProcess;
import org.apache.geode.internal.PureJavaMode;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.cache.tier.sockets.CacheServerHelper;
import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.process.StartupStatus;
import org.apache.geode.internal.process.StartupStatusListener;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.internal.util.JavaCommandBuilder;
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.distributed.ConfigurationProperties.SERVER_BIND_ADDRESS;
-
/**
* Launcher program to start a cache server.
*
- *
* @since GemFire 2.0.2
*/
public class CacheServerLauncher {
@@ -669,7 +680,7 @@ public class CacheServerLauncher {
// redirect output to the log file
OSProcess.redirectOutput(system.getConfig().getLogFile());
- Cache cache = this.createCache(system, options);
+ InternalCache cache = createCache(system, options);
cache.setIsServer(true);
startAdditionalServices(cache, options);
@@ -678,7 +689,7 @@ public class CacheServerLauncher {
clearLogListener();
if (ASSIGN_BUCKETS) {
- for (PartitionedRegion region : ((GemFireCacheImpl) cache).getPartitionedRegions()) {
+ for (PartitionedRegion region : cache.getPartitionedRegions()) {
PartitionRegionHelper.assignBucketsToPartitions(region);
}
}
@@ -823,9 +834,9 @@ public class CacheServerLauncher {
return -1.0f;
}
- protected Cache createCache(InternalDistributedSystem system, Map<String, Object> options)
+ protected InternalCache createCache(InternalDistributedSystem system, Map<String, Object> options)
throws IOException {
- Cache cache = CacheFactory.create(system);
+ InternalCache cache = (InternalCache) CacheFactory.create(system);
float threshold = getCriticalHeapPercent(options);
if (threshold > 0.0f) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
index 037e589..c332db3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
@@ -84,11 +84,8 @@ public class CachedDeserializableFactory {
}
private static boolean cachePrefersPdx() {
- GemFireCacheImpl gfc = GemFireCacheImpl.getInstance();
- if (gfc != null) {
- return gfc.getPdxReadSerialized();
- }
- return false;
+ InternalCache internalCache = GemFireCacheImpl.getInstance();
+ return internalCache != null && internalCache.getPdxReadSerialized();
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java
index d0f3ec4..c471021 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java
@@ -15,6 +15,9 @@
package org.apache.geode.internal.cache;
+import static org.apache.geode.internal.lang.SystemUtils.getLineSeparator;
+
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.EntryDestroyedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionDestroyedException;
@@ -58,7 +61,6 @@ public class ColocationHelper {
/**
* An utility method to retrieve colocated region of a given partitioned region
*
- * @param partitionedRegion
* @return colocated PartitionedRegion
* @throws IllegalStateException for missing colocated region
* @since GemFire 5.8Beta
@@ -124,7 +126,7 @@ public class ColocationHelper {
String prName = (String) itr.next();
try {
prConf = (PartitionRegionConfig) prRoot.get(prName);
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignore) {
continue;
}
if (prConf == null) {
@@ -134,7 +136,8 @@ public class ColocationHelper {
}
if (prConf.getColocatedWith() != null) {
if (prConf.getColocatedWith().equals(tempToBeColocatedWith.getFullPath())
- || ("/" + prConf.getColocatedWith()).equals(tempToBeColocatedWith.getFullPath())) {
+ || (getLineSeparator() + prConf.getColocatedWith())
+ .equals(tempToBeColocatedWith.getFullPath())) {
colocatedRegions.add(prConf);
tempcolocatedRegions.add(prConf);
}
@@ -149,11 +152,7 @@ public class ColocationHelper {
if (colocatedWithRegionName == null)
break;
else {
- try {
- prConf = (PartitionRegionConfig) prRoot.get(getRegionIdentifier(colocatedWithRegionName));
- } catch (EntryDestroyedException ede) {
- throw ede;
- }
+ prConf = (PartitionRegionConfig) prRoot.get(getRegionIdentifier(colocatedWithRegionName));
if (prConf == null) {
break;
}
@@ -193,12 +192,13 @@ public class ColocationHelper {
boolean hasOfflineChildren = false;
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
- GemFireCacheImpl cache = region.getCache();
- Collection<DiskStoreImpl> stores = cache.listDiskStores();
+ InternalCache cache = region.getCache();
+ Collection<DiskStore> stores = cache.listDiskStores();
// Look through all of the disk stores for offline colocated child regions
- for (DiskStoreImpl diskStore : stores) {
+ for (DiskStore diskStore : stores) {
// Look at all of the partitioned regions.
- for (Map.Entry<String, PRPersistentConfig> entry : diskStore.getAllPRs().entrySet()) {
+ for (Map.Entry<String, PRPersistentConfig> entry : ((DiskStoreImpl) diskStore).getAllPRs()
+ .entrySet()) {
PRPersistentConfig config = entry.getValue();
String childName = entry.getKey();
@@ -275,7 +275,6 @@ public class ColocationHelper {
* getAllColocationRegions(orderPR) --> List{customerPR, shipmentPR}<br>
* getAllColocationRegions(shipmentPR) --> List{customerPR, orderPR}<br>
*
- * @param partitionedRegion
* @return List of all partitioned regions (excluding self) in a colocated chain
* @since GemFire 5.8Beta
*/
@@ -309,7 +308,6 @@ public class ColocationHelper {
/**
* gets local data of colocated regions on a particular data store
*
- * @param partitionedRegion
* @return map of region name to local colocated regions
* @since GemFire 5.8Beta
*/
@@ -367,7 +365,6 @@ public class ColocationHelper {
* getColocatedChildRegions(orderPR) will return List{shipmentPR}<br>
* getColocatedChildRegions(shipmentPR) will return empty List{}<br>
*
- * @param partitionedRegion
* @return list of all child partitioned regions colocated with the region
* @since GemFire 5.8Beta
*/
@@ -387,7 +384,7 @@ public class ColocationHelper {
}
try {
prConf = (PartitionRegionConfig) prRoot.get(prName);
- } catch (EntryDestroyedException ede) {
+ } catch (EntryDestroyedException ignore) {
continue;
}
if (prConf == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
index b1dd003..815b526 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.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.internal.cache;
import java.io.DataInput;
@@ -29,6 +28,7 @@ import org.apache.geode.CancelException;
import org.apache.geode.DataSerializer;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DynamicRegionFactory;
import org.apache.geode.cache.PartitionAttributes;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.Scope;
@@ -48,6 +48,7 @@ import org.apache.geode.internal.Assert;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile;
import org.apache.geode.internal.cache.CacheDistributionAdvisor.InitialImageAdvice;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException;
import org.apache.geode.internal.cache.partitioned.RegionAdvisor;
import org.apache.geode.internal.cache.partitioned.RegionAdvisor.PartitionProfile;
@@ -96,7 +97,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
CreateRegionReplyProcessor replyProc = new CreateRegionReplyProcessor(recps);
-
boolean useMcast = false; // multicast is disabled for this message for now
CreateRegionMessage msg = getCreateRegionMessage(recps, replyProc, useMcast);
@@ -118,10 +118,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
// This isn't right. We should disable region creation in general, not just
// the remote case here...
// // Similarly, don't allow new regions to be created if the cache is closing
- // GemFireCache cache = (GemFireCache)this.newRegion.getCache();
- // if (cache.isClosing()) {
- // throw new CacheClosedException("Cannot create a region when the cache is closing");
- // }
try {
replyProc.waitForRepliesUninterruptibly();
if (!replyProc.needRetry()) {
@@ -166,15 +162,13 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
return recps;
}
-
-
public InitialImageAdvice getInitialImageAdvice(InitialImageAdvice previousAdvice) {
return newRegion.getCacheDistributionAdvisor().adviseInitialImage(previousAdvice);
}
private Set getAdvice() {
if (this.newRegion instanceof BucketRegion) {
- return ((BucketRegion) this.newRegion).getBucketAdvisor().adviseProfileExchange();
+ return ((Bucket) this.newRegion).getBucketAdvisor().adviseProfileExchange();
} else {
DistributionAdvisee rgn = this.newRegion.getParentAdvisee();
DistributionAdvisor advisor = rgn.getDistributionAdvisor();
@@ -195,7 +189,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
}
public void setOnline(InternalDistributedMember target) {
-
+ // nothing
}
class CreateRegionReplyProcessor extends ReplyProcessor21 {
@@ -319,6 +313,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
protected String regionPath;
protected CacheProfile profile;
protected int processorId;
+
private transient boolean incompatible = false;
private transient ReplyException replyException;
private transient CacheProfile replyProfile;
@@ -327,7 +322,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
protected transient boolean severeAlertCompatible;
private transient boolean skippedCompatibilityChecks;
-
@Override
public int getProcessorId() {
return this.processorId;
@@ -354,7 +348,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
// get the region from the path, but do NOT wait on initialization,
// otherwise we could have a distributed deadlock
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
// Fix for bug 42051 - Discover any regions that are in the process
// of being destroyed
@@ -389,15 +383,15 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
}
}
}
- } catch (PRLocallyDestroyedException fre) {
+ } catch (PRLocallyDestroyedException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("<Region Locally Destroyed> {}", this);
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("<RegionDestroyed> {}", this);
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("<CancelException> {}", this);
}
@@ -445,8 +439,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
dm.putOutgoing(replyMsg);
if (lclRgn instanceof PartitionedRegion)
((PartitionedRegion) lclRgn).sendIndexCreationMsg(this.getSender());
-
-
}
}
@@ -549,15 +541,13 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
&& this.concurrencyChecksEnabled != otherCCEnabled) {
result =
LocalizedStrings.CreateRegionProcessor_CANNOT_CREATE_REGION_0_CCENABLED_1_BECAUSE_ANOTHER_CACHE_HAS_THE_SAME_REGION_CCENABLED_2
- .toLocalizedString(
- new Object[] {regionPath, Boolean.valueOf(this.concurrencyChecksEnabled), myId,
- Boolean.valueOf(otherCCEnabled)});
+ .toLocalizedString(regionPath, this.concurrencyChecksEnabled, myId, otherCCEnabled);
}
Set<String> otherGatewaySenderIds = ((LocalRegion) rgn).getGatewaySenderIds();
Set<String> myGatewaySenderIds = profile.gatewaySenderIds;
if (!otherGatewaySenderIds.equals(myGatewaySenderIds)) {
- if (!rgn.getFullPath().contains(DynamicRegionFactoryImpl.dynamicRegionListName)) {
+ if (!rgn.getFullPath().contains(DynamicRegionFactory.dynamicRegionListName)) {
result =
LocalizedStrings.CreateRegionProcessor_CANNOT_CREATE_REGION_0_WITH_1_GATEWAY_SENDER_IDS_BECAUSE_ANOTHER_CACHE_HAS_THE_SAME_REGION_WITH_2_GATEWAY_SENDER_IDS
.toLocalizedString(this.regionPath, myGatewaySenderIds, otherGatewaySenderIds);
@@ -588,8 +578,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
if (profile.scope != otherScope) {
result =
LocalizedStrings.CreateRegionProcessor_CANNOT_CREATE_REGION_0_WITH_1_SCOPE_BECAUSE_ANOTHER_CACHE_HAS_SAME_REGION_WITH_2_SCOPE
- .toLocalizedString(
- new Object[] {this.regionPath, profile.scope, myId, otherScope});
+ .toLocalizedString(this.regionPath, profile.scope, myId, otherScope);
}
}
@@ -605,8 +594,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
&& profile.isOffHeap != otherIsOffHeap) {
result =
LocalizedStrings.CreateRegionProcessor_CANNOT_CREATE_REGION_0_WITH_OFF_HEAP_EQUALS_1_BECAUSE_ANOTHER_CACHE_2_HAS_SAME_THE_REGION_WITH_OFF_HEAP_EQUALS_3
- .toLocalizedString(
- new Object[] {this.regionPath, profile.isOffHeap, myId, otherIsOffHeap});
+ .toLocalizedString(this.regionPath, profile.isOffHeap, myId, otherIsOffHeap);
}
String cspResult = null;
@@ -652,47 +640,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
profile, result);
}
- // if (profile.membershipAttributes != null) {
- // // check to see if:
- // // 1. we do not have DataPolicy that will take queued msgs
- // // 2. the profile has queuing turned on
- // // 3. we are playing one of the queued roles
- // if (!rgn.getAttributes().getDataPolicy().withQueuedMessages()) {
- // if (profile.membershipAttributes.getLossAction().isAllAccessWithQueuing()) {
- // Set myRoles = rgn.getSystem().getDistributedMember().getRoles();
- // if (!myRoles.isEmpty()) {
- // Set intersection = new HashSet(myRoles);
- // intersection.retainAll(profile.membershipAttributes.getRequiredRoles());
- // if (!intersection.isEmpty()) {
- // result = "Cannot create region " + regionPath
- // + " with queuing because the region already exists"
- // + " with a data-policy " + rgn.getAttributes().getDataPolicy()
- // + " that does not allow queued messages with the roles "
- // + intersection;
- // }
- // }
- // }
- // }
- // } else {
- // // see if we are queuing on this region
- // MembershipAttributes ra = rgn.getMembershipAttributes();
- // if (ra != null && ra.hasRequiredRoles()
- // && ra.getLossAction().isAllAccessWithQueuing()) {
- // // we are queuing so make sure this other guy allows queued messages
- // // if he is playing a role we queue for.
- // if (!profile.dataPolicy.withQueuedMessages()) {
- // Set intersection = new HashSet(ra.getRequiredRoles());
- // intersection.retainAll(profile.getDistributedMember().getRoles());
- // if (!intersection.isEmpty()) {
- // result = "Cannot create region " + regionPath
- // + " with a data-policy " + profile.dataPolicy
- // + " that does not allow queued messages because the region"
- // + " already exists with queuing enabled for roles " + intersection;
- // }
- // }
- // }
- // }
-
return result;
}
@@ -808,16 +755,16 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
@Override
public String toString() {
- StringBuffer buff = new StringBuffer();
- buff.append("CreateRegionMessage (region='");
- buff.append(this.regionPath);
- buff.append("'; processorId=");
- buff.append(this.processorId);
- buff.append("; concurrencyChecksEnabled=").append(this.concurrencyChecksEnabled);
- buff.append("; profile=");
- buff.append(this.profile);
- buff.append(")");
- return buff.toString();
+ StringBuilder sb = new StringBuilder();
+ sb.append("CreateRegionMessage (region='");
+ sb.append(this.regionPath);
+ sb.append("'; processorId=");
+ sb.append(this.processorId);
+ sb.append("; concurrencyChecksEnabled=").append(this.concurrencyChecksEnabled);
+ sb.append("; profile=");
+ sb.append(this.profile);
+ sb.append(")");
+ return sb.toString();
}
}
@@ -848,8 +795,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
if (in.readBoolean()) {
- // this.profile = new CacheProfile();
- // this.profile.fromData(in);
this.profile = (CacheProfile) DataSerializer.readObject(in);
}
int size = in.readInt();
@@ -879,7 +824,6 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
super.toData(out);
out.writeBoolean(this.profile != null);
if (this.profile != null) {
- // this.profile.toData(out);
DataSerializer.writeObject(this.profile, out);
}
if (this.bucketProfiles == null) {
@@ -914,7 +858,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
@Override
public String toString() {
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
buff.append("CreateRegionReplyMessage");
buff.append("(sender=").append(getSender());
buff.append("; processorId=");
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyPartitionedRegionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyPartitionedRegionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyPartitionedRegionMessage.java
index b36cd2a..5914ab5 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyPartitionedRegionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyPartitionedRegionMessage.java
@@ -169,7 +169,7 @@ public final class DestroyPartitionedRegionMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; cbArg=").append(this.cbArg).append("; op=").append(this.op);
buff.append("; prSerial=" + prSerial);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
index 33cfa09..3cc988f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
@@ -140,11 +140,11 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
protected HashMap subregionSerialNumbers;
protected boolean notifyOfRegionDeparture;
+
/**
* true if need to automatically recreate region, and mark destruction as a reinitialization
*/
protected transient LocalRegion lockRoot = null; // used for early destroy
- // lock acquisition
@Override
protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException {
@@ -158,9 +158,8 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
}
protected RegionEventImpl createRegionEvent(DistributedRegion rgn) {
- RegionEventImpl event = new RegionEventImpl(rgn, getOperation(), this.callbackArg,
- true /* originRemote */, getSender());
- return event;
+ return new RegionEventImpl(rgn, getOperation(), this.callbackArg, true /* originRemote */,
+ getSender());
}
private Runnable destroyOp(final DistributionManager dm, final LocalRegion lclRgn,
@@ -183,12 +182,12 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
advisee =
PartitionedRegionHelper.getProxyBucketRegion(GemFireCacheImpl.getInstance(),
regionPath, waitForBucketInitializationToComplete);
- } catch (PRLocallyDestroyedException e) {
+ } catch (PRLocallyDestroyedException ignore) {
// region not found - it's been destroyed
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// ditto
} catch (PartitionedRegionException e) {
- if (e.getMessage().indexOf("destroyed") == -1) {
+ if (!e.getMessage().contains("destroyed")) {
throw e;
}
// region failed registration & is unusable
@@ -228,11 +227,11 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
}
doRegionDestroy(event);
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
logger.debug("{} Region destroyed: nothing to do", this);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
logger.debug("{} Cancelled: nothing to do", this);
- } catch (EntryNotFoundException e) {
+ } catch (EntryNotFoundException ignore) {
logger.debug("{} Entry not found, nothing to do", this);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
@@ -292,7 +291,7 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
// pool, the entry
// update is allowed to complete.
dm.getWaitingThreadPool().execute(destroyOp(dm, lclRgn, sendReply));
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignore) {
// rejected while trying to execute destroy thread
// must be shutting down, just quit
}
@@ -303,19 +302,19 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
// shared region, since another cache may
// have already destroyed it in shared memory, in which our listeners
// still need to be called and java region object cleaned up.
- GemFireCacheImpl c = (GemFireCacheImpl) CacheFactory.getInstance(sys);
+ InternalCache cache = (InternalCache) CacheFactory.getInstance(sys);
// only get the region while holding the appropriate destroy lock.
// this prevents us from getting a "stale" region
if (getOperation().isDistributed()) {
String rootName = GemFireCacheImpl.parsePath(path)[0];
- this.lockRoot = (LocalRegion) c.getRegion(rootName);
+ this.lockRoot = (LocalRegion) cache.getRegion(rootName);
if (this.lockRoot == null)
return null;
this.lockRoot.acquireDestroyLock();
}
- return (LocalRegion) c.getRegion(path);
+ return (LocalRegion) cache.getRegion(path);
}
private void disableRegionDepartureNotification() {
@@ -411,15 +410,15 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
rgn.basicDestroyRegion(ev, false /* cacheWrite */, false /* lock */,
true/* cacheCallbacks */);
}
- } catch (CacheWriterException e) {
+ } catch (CacheWriterException ignore) {
throw new Error(
LocalizedStrings.DestroyRegionOperation_CACHEWRITER_SHOULD_NOT_HAVE_BEEN_CALLED
.toLocalizedString());
- } catch (TimeoutException e) {
+ } catch (TimeoutException ignore) {
throw new Error(
LocalizedStrings.DestroyRegionOperation_DISTRIBUTEDLOCK_SHOULD_NOT_HAVE_BEEN_ACQUIRED
.toLocalizedString());
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignore) {
// rejected while trying to execute recreate thread
// must be shutting down, so what we were trying to do must not be
// important anymore, so just quit
@@ -468,13 +467,13 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
}
public static final class DestroyRegionWithContextMessage extends DestroyRegionMessage {
+
protected transient Object context;
@Override
final public RegionEventImpl createRegionEvent(DistributedRegion rgn) {
- ClientRegionEventImpl event = new ClientRegionEventImpl(rgn, getOperation(), this.callbackArg,
+ return new ClientRegionEventImpl(rgn, getOperation(), this.callbackArg,
true /* originRemote */, getSender(), (ClientProxyMembershipID) this.context);
- return event;
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskEntry.java
index bf7c4d2..f78a6c1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskEntry.java
@@ -27,7 +27,6 @@ import org.apache.geode.internal.ByteArrayDataInput;
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.DiskStoreImpl.AsyncDiskEntry;
-import org.apache.geode.internal.cache.Token.Tombstone;
import org.apache.geode.internal.cache.lru.EnableLRU;
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.LRUEntry;
@@ -52,18 +51,14 @@ import org.apache.geode.internal.util.BlobHelper;
* provides accessor and mutator methods for a disk entry's state. This allows us to abstract all of
* the interesting behavior into a {@linkplain DiskEntry.Helper helper class} that we only need to
* implement once.
- *
- * <P>
- *
- * Each <code>DiskEntry</code> has a unique <code>id</code> that is used by the {@link DiskRegion}
- * to identify the key/value pair. Before the disk entry is written to disk, the value of the
- * <code>id</code> is {@link DiskRegion#INVALID_ID invalid}. Once the object has been written to
- * disk, the <code>id</code> is a positive number. If the value is {@linkplain Helper#update
- * updated}, then the <code>id</code> is negated to signify that the value on disk is dirty.
+ * <p>
+ * Each {@code DiskEntry} has a unique {@code id} that is used by the {@link DiskRegion} to identify
+ * the key/value pair. Before the disk entry is written to disk, the value of the {@code id} is
+ * {@link DiskRegion#INVALID_ID invalid}. Once the object has been written to disk, the {@code id}
+ * is a positive number. If the value is {@linkplain Helper#update updated}, then the {@code id} is
+ * negated to signify that the value on disk is dirty.
*
* @see DiskRegion
- *
- *
* @since GemFire 3.2
*/
public interface DiskEntry extends RegionEntry {
@@ -78,8 +73,6 @@ public interface DiskEntry extends RegionEntry {
/**
* In some cases we need to do something just before we drop the value from a DiskEntry that is
* being moved (i.e. overflowed) to disk.
- *
- * @param context
*/
public void handleValueOverflow(RegionEntryContext context);
@@ -90,12 +83,10 @@ public interface DiskEntry extends RegionEntry {
public boolean isRemovedFromDisk();
/**
- * Returns the id of this <code>DiskEntry</code>
+ * Returns the id of this {@code DiskEntry}
*/
public DiskId getDiskId();
- public void _removePhase1();
-
public int updateAsyncEntrySize(EnableLRU capacityController);
public DiskEntry getPrev();
@@ -119,10 +110,8 @@ public interface DiskEntry extends RegionEntry {
*/
public static final byte[] TOMBSTONE_BYTES = new byte[0];
- /////////////////////// Inner Classes //////////////////////
-
/**
- * A Helper class for performing functions common to all <code>DiskEntry</code>s.
+ * A Helper class for performing functions common to all {@code DiskEntry}s.
*/
public static class Helper {
private static final Logger logger = LogService.getLogger();
@@ -185,12 +174,10 @@ public interface DiskEntry extends RegionEntry {
}
}
-
/**
* Get the value of an entry that is on disk without faulting it in . It checks for the presence
* in the buffer also. This method is used for concurrent map operations and CQ processing
*
- * @throws DiskAccessException
* @since GemFire 5.1
*/
static Object getValueOnDiskOrBuffer(DiskEntry entry, DiskRegion dr,
@@ -223,8 +210,8 @@ public interface DiskEntry extends RegionEntry {
synchronized (syncObj) {
if (did != null && did.isPendingAsync()) {
@Retained
- Object v = entry._getValueRetain(context, true); // TODO:KIRK:OK Rusty had Object v =
- // entry.getValueWithContext(context);
+ Object v = entry._getValueRetain(context, true);
+
if (Token.isRemovedFromDisk(v)) {
v = null;
}
@@ -309,9 +296,11 @@ public interface DiskEntry extends RegionEntry {
entry.setLastModified(mgr, de.getLastModified());
ReferenceCountHelper.setReferenceCountOwner(entry);
- v = de._getValueRetain(context, true); // OFFHEAP copied to heap entry; todo allow entry
- // to refer to offheap since it will be copied to
- // network.
+
+ // OFFHEAP copied to heap entry;
+ // TODO: allow entry to refer to offheap since it will be copied to network.
+ v = de._getValueRetain(context, true);
+
ReferenceCountHelper.setReferenceCountOwner(null);
if (v == null) {
if (did == null) {
@@ -331,7 +320,7 @@ public interface DiskEntry extends RegionEntry {
BytesAndBits bb = null;
try {
bb = dr.getBytesAndBits(did, false);
- } catch (DiskAccessException dae) {
+ } catch (DiskAccessException ignore) {
return false;
}
if (EntryBits.isInvalid(bb.getBits())) {
@@ -367,8 +356,7 @@ public interface DiskEntry extends RegionEntry {
Object tmp = cd.getValue();
if (tmp instanceof byte[]) {
- byte[] bb = (byte[]) tmp;
- entry.value = bb;
+ entry.value = (byte[]) tmp;
entry.setSerialized(true);
} else {
try {
@@ -378,11 +366,10 @@ public interface DiskEntry extends RegionEntry {
entry.value = hdos;
entry.setSerialized(true);
} catch (IOException e) {
- RuntimeException e2 = new IllegalArgumentException(
+ throw new IllegalArgumentException(
LocalizedStrings.DiskEntry_AN_IOEXCEPTION_WAS_THROWN_WHILE_SERIALIZING
- .toLocalizedString());
- e2.initCause(e);
- throw e2;
+ .toLocalizedString(),
+ e);
}
}
}
@@ -460,7 +447,7 @@ public interface DiskEntry extends RegionEntry {
} else {
entry.setValueWithContext(drv,
entry.prepareValueForCache((RegionEntryContext) r, re.getValue(), false));
- if (!Tombstone.isInvalidOrRemoved(re.getValue())) {
+ if (!Token.isInvalidOrRemoved(re.getValue())) {
updateStats(drv, r, 1/* InVM */, 0/* OnDisk */, 0);
}
}
@@ -574,7 +561,7 @@ public interface DiskEntry extends RegionEntry {
if (this.bytes == null) {
return "null";
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int len = getLength();
for (int i = 0; i < len; i++) {
sb.append(this.bytes[i]).append(", ");
@@ -808,8 +795,6 @@ public interface DiskEntry extends RegionEntry {
/**
* Writes the key/value object stored in the given entry to disk
*
- * @throws RegionClearedException
- *
* @see DiskRegion#put
*/
private static void writeToDisk(DiskEntry entry, LocalRegion region, boolean async,
@@ -833,8 +818,6 @@ public interface DiskEntry extends RegionEntry {
/**
* Updates the value of the disk entry with a new value. This allows us to free up disk space in
* the non-backup case.
- *
- * @throws RegionClearedException
*/
public static void update(DiskEntry entry, LocalRegion region, Object newValue,
EntryEventImpl event) throws RegionClearedException {
@@ -892,7 +875,7 @@ public interface DiskEntry extends RegionEntry {
if (caughtCacheClosed) {
// 47616: not to set the value to be removedFromDisk since it failed to persist
} else {
- // Asif Ensure that the value is rightly set despite clear so
+ // Ensure that the value is rightly set despite clear so
// that it can be distributed correctly
entry.setValueWithContext(region, newValue); // OFFHEAP newValue was already
// preparedForCache
@@ -1010,12 +993,12 @@ public interface DiskEntry extends RegionEntry {
@Retained
public static Object getValueOffHeapOrDiskWithoutFaultIn(DiskEntry entry, LocalRegion region) {
@Retained
- Object v = entry._getValueRetain(region, true); // TODO:KIRK:OK Object v =
- // entry.getValueWithContext(region);
+ Object v = entry._getValueRetain(region, true);
+
if (v == null || Token.isRemovedFromDisk(v) && !region.isIndexCreationThread()) {
synchronized (entry) {
- v = entry._getValueRetain(region, true); // TODO:KIRK:OK v =
- // entry.getValueWithContext(region);
+ v = entry._getValueRetain(region, true);
+
if (v == null) {
v = Helper.getOffHeapValueOnDiskOrBuffer(entry, region.getDiskRegion(), region);
}
@@ -1024,24 +1007,10 @@ public interface DiskEntry extends RegionEntry {
if (Token.isRemovedFromDisk(v)) {
// fix for bug 31800
v = null;
- // } else if (v instanceof ByteSource) {
- // // If the ByteSource contains a Delta or ListOfDelta then we want to deserialize it
- // Object deserVal = ((CachedDeserializable)v).getDeserializedForReading();
- // if (deserVal != v) {
- // OffHeapHelper.release(v);
- // v = deserVal;
- // }
}
return v;
}
- /**
- *
- * @param entry
- * @param region
- * @return Value
- * @throws DiskAccessException
- */
public static Object faultInValue(DiskEntry entry, LocalRegion region) {
return faultInValue(entry, region, false);
}
@@ -1058,8 +1027,8 @@ public interface DiskEntry extends RegionEntry {
private static Object faultInValue(DiskEntry entry, LocalRegion region, boolean retainResult) {
DiskRegion dr = region.getDiskRegion();
@Retained
- Object v = entry._getValueRetain(region, true); // TODO:KIRK:OK Object v =
- // entry.getValueWithContext(region);
+ Object v = entry._getValueRetain(region, true);
+
boolean lruFaultedIn = false;
boolean done = false;
try {
@@ -1071,7 +1040,7 @@ public interface DiskEntry extends RegionEntry {
// See if it is pending async because of a faultOut.
// If so then if we are not a backup then we can unschedule the pending async.
// In either case we need to do the lruFaultIn logic.
- boolean evicted = ((LRUEntry) entry).testEvicted();
+ boolean evicted = ((LRUClockNode) entry).testEvicted();
if (evicted) {
if (!dr.isBackup()) {
// @todo do we also need a bit that tells us if it is in the async queue?
@@ -1086,8 +1055,8 @@ public interface DiskEntry extends RegionEntry {
}
if (!done && (v == null || Token.isRemovedFromDisk(v) && !region.isIndexCreationThread())) {
synchronized (entry) {
- v = entry._getValueRetain(region, true); // TODO:KIRK:OK v =
- // entry.getValueWithContext(region);
+ v = entry._getValueRetain(region, true);
+
if (v == null) {
v = readValueFromDisk(entry, region);
if (entry instanceof LRUEntry) {
@@ -1126,8 +1095,7 @@ public interface DiskEntry extends RegionEntry {
DiskId did = entry.getDiskId();
if (did != null) {
Object value = null;
- DiskRecoveryStore region = recoveryStore;
- DiskRegionView dr = region.getDiskRegionView();
+ DiskRegionView dr = recoveryStore.getDiskRegionView();
dr.acquireReadLock();
try {
synchronized (did) {
@@ -1135,7 +1103,7 @@ public interface DiskEntry extends RegionEntry {
if (oplogId == did.getOplogId()) {
value = getValueFromDisk(dr, did, in);
if (value != null) {
- setValueOnFaultIn(value, did, entry, dr, region);
+ setValueOnFaultIn(value, did, entry, dr, recoveryStore);
}
}
}
@@ -1194,7 +1162,7 @@ public interface DiskEntry extends RegionEntry {
try {
if (recoveryStore.getEvictionAttributes() != null
&& recoveryStore.getEvictionAttributes().getAlgorithm().isLIFO()) {
- ((VMLRURegionMap) recoveryStore.getRegionMap()).updateStats();
+ ((AbstractLRURegionMap) recoveryStore.getRegionMap()).updateStats();
return;
}
// this must be done after releasing synchronization
@@ -1314,24 +1282,18 @@ public interface DiskEntry extends RegionEntry {
}
/**
- * Writes the value of this <code>DiskEntry</code> to disk and <code>null</code> s out the
- * reference to the value to free up VM space.
+ * Writes the value of this {@code DiskEntry} to disk and {@code null} s out the reference to
+ * the value to free up VM space.
* <p>
* Note that if the value had already been written to disk, it is not written again.
* <p>
* Caller must synchronize on entry and it is assumed the entry is evicted
- *
- * see #writeToDisk
- *
- * @throws RegionClearedException
*/
public static int overflowToDisk(DiskEntry entry, LocalRegion region, EnableLRU ccHelper)
throws RegionClearedException {
DiskRegion dr = region.getDiskRegion();
- final int oldSize = region.calculateRegionEntryValueSize(entry);;
- // Asif:Get diskID . If it is null, it implies it is
- // overflow only mode.
- // long id = entry.getDiskId().getKeyId();
+ final int oldSize = region.calculateRegionEntryValueSize(entry);
+ // Get diskID . If it is null, it implies it is overflow only mode.
DiskId did = entry.getDiskId();
if (did == null) {
((LRUEntry) entry).setDelayedDiskId(region);
@@ -1348,7 +1310,7 @@ public interface DiskEntry extends RegionEntry {
return 0;
}
- // TODO:Asif: Check if we need to overflow even when id is = 0
+ // TODO: Check if we need to overflow even when id is = 0
boolean wasAlreadyPendingAsync = did.isPendingAsync();
if (did.needsToBeWritten()) {
if (dr.isSync()) {
@@ -1474,7 +1436,7 @@ public interface DiskEntry extends RegionEntry {
// Only setValue to null if this was an evict.
// We could just be a backup that is writing async.
if (!Token.isInvalid(entryVal) && (entryVal != Token.TOMBSTONE)
- && entry instanceof LRUEntry && ((LRUEntry) entry).testEvicted()) {
+ && entry instanceof LRUEntry && ((LRUClockNode) entry).testEvicted()) {
// Moved this here to fix bug 40116.
region.updateSizeOnEvict(entry.getKey(), entryValSize);
updateStats(dr, region, -1/* InVM */, 1/* OnDisk */, did.getValueLength());
@@ -1603,11 +1565,6 @@ public interface DiskEntry extends RegionEntry {
return result;
}
- /**
- * @param entry
- * @param region
- * @param tag
- */
public static void updateVersionOnly(DiskEntry entry, LocalRegion region, VersionTag tag) {
DiskRegion dr = region.getDiskRegion();
if (!dr.isBackup()) {
@@ -1709,7 +1666,6 @@ public interface DiskEntry extends RegionEntry {
}
/**
- *
* @return byte indicating the user bits. The correct value is returned only in the specific
* case of entry recovered from oplog ( & not rolled to Htree) & the RECOVER_VALUES flag
* is false . In other cases the exact value is not needed
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskRegion.java
index 6d4b598..f8b8289 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskRegion.java
@@ -279,12 +279,12 @@ public class DiskRegion extends AbstractDiskRegion {
private void destroyOldTomstones(final DiskRecoveryStore drs) {
// iterate over all region entries in drs
drs.foreachRegionEntry(new RegionEntryCallback() {
- public void handleRegionEntry(RegionEntry re) {
- DiskEntry de = (DiskEntry) re;
+ public void handleRegionEntry(RegionEntry regionEntry) {
+ DiskEntry de = (DiskEntry) regionEntry;
synchronized (de) {
DiskId id = de.getDiskId();
- if (id != null && re.isTombstone()) {
- VersionStamp stamp = re.getVersionStamp();
+ if (id != null && regionEntry.isTombstone()) {
+ VersionStamp stamp = regionEntry.getVersionStamp();
if (getRegionVersionVector().isTombstoneTooOld(stamp.getMemberID(),
stamp.getRegionVersion())) {
drs.destroyRecoveredEntry(de.getKey());
@@ -299,8 +299,8 @@ public class DiskRegion extends AbstractDiskRegion {
private void destroyRemainingRecoveredEntries(final DiskRecoveryStore drs) {
// iterate over all region entries in drs
drs.foreachRegionEntry(new RegionEntryCallback() {
- public void handleRegionEntry(RegionEntry re) {
- DiskEntry de = (DiskEntry) re;
+ public void handleRegionEntry(RegionEntry regionEntry) {
+ DiskEntry de = (DiskEntry) regionEntry;
synchronized (de) {
DiskId id = de.getDiskId();
if (id != null) {
@@ -320,8 +320,8 @@ public class DiskRegion extends AbstractDiskRegion {
public void resetRecoveredEntries(final DiskRecoveryStore drs) {
// iterate over all region entries in drs
drs.foreachRegionEntry(new RegionEntryCallback() {
- public void handleRegionEntry(RegionEntry re) {
- DiskEntry de = (DiskEntry) re;
+ public void handleRegionEntry(RegionEntry regionEntry) {
+ DiskEntry de = (DiskEntry) regionEntry;
synchronized (de) {
DiskId id = de.getDiskId();
if (id != null) {
@@ -770,13 +770,13 @@ public class DiskRegion extends AbstractDiskRegion {
return;
}
region.foreachRegionEntry(new RegionEntryCallback() {
- public void handleRegionEntry(RegionEntry re) {
- DiskEntry de = (DiskEntry) re;
+ public void handleRegionEntry(RegionEntry regionEntry) {
+ DiskEntry de = (DiskEntry) regionEntry;
DiskId id = de.getDiskId();
if (id != null) {
synchronized (id) {
- re.setValueToNull(); // TODO why call _setValue twice in a row?
- re.removePhase2();
+ regionEntry.setValueToNull(); // TODO why call _setValue twice in a row?
+ regionEntry.removePhase2();
id.unmarkForWriting();
if (EntryBits.isNeedsValue(id.getUserBits())) {
long oplogId = id.getOplogId();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
index 6f50c9f..309dea3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
@@ -26,8 +26,6 @@ import org.apache.geode.internal.cache.persistence.BackupInspector;
* oplogs that still need to be backed up, along with the lists of oplog files that should be
* deleted when the oplog is backed up. See
* {@link DiskStoreImpl#startBackup(File, BackupInspector, org.apache.geode.internal.cache.persistence.RestoreScript)}
- *
- *
*/
public class DiskStoreBackup {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
index 000bf0d..7a7044b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
@@ -18,7 +18,6 @@ import java.io.File;
import java.util.Arrays;
import org.apache.geode.GemFireIOException;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.DiskStoreFactory;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.distributed.internal.ResourceEvent;
@@ -35,14 +34,15 @@ import org.apache.geode.pdx.internal.TypeRegistry;
* @since GemFire prPersistSprint2
*/
public class DiskStoreFactoryImpl implements DiskStoreFactory {
- private final Cache cache;
+
+ private final InternalCache cache;
private final DiskStoreAttributes attrs = new DiskStoreAttributes();
- public DiskStoreFactoryImpl(Cache cache) {
+ public DiskStoreFactoryImpl(InternalCache cache) {
this.cache = cache;
}
- public DiskStoreFactoryImpl(Cache cache, DiskStoreAttributes attrs) {
+ public DiskStoreFactoryImpl(InternalCache cache, DiskStoreAttributes attrs) {
this.attrs.name = attrs.name;
setAutoCompact(attrs.getAutoCompact());
setAllowForceCompaction(attrs.getAllowForceCompaction());
@@ -90,13 +90,13 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
if (compactionThreshold < 0) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_POSITIVE_NUMBER_AND_THE_VALUE_GIVEN_1_IS_NOT_ACCEPTABLE
- .toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD,
- Integer.valueOf(compactionThreshold)}));
+ .toLocalizedString(
+ new Object[] {CacheXml.COMPACTION_THRESHOLD, compactionThreshold}));
} else if (compactionThreshold > 100) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_LESS_THAN_2_BUT_WAS_1
- .toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD,
- Integer.valueOf(compactionThreshold), Integer.valueOf(100)}));
+ .toLocalizedString(
+ new Object[] {CacheXml.COMPACTION_THRESHOLD, compactionThreshold, 100}));
}
this.attrs.compactionThreshold = compactionThreshold;
return this;
@@ -106,7 +106,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
if (timeInterval < 0) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_TIME_INTERVAL_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE
- .toLocalizedString(Long.valueOf(timeInterval)));
+ .toLocalizedString(timeInterval));
}
this.attrs.timeInterval = timeInterval;
return this;
@@ -116,14 +116,12 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
InternalRegionArguments internalRegionArgs) {
this.attrs.name = name;
synchronized (this.cache) {
- assert this.cache instanceof GemFireCacheImpl;
- GemFireCacheImpl gfc = (GemFireCacheImpl) this.cache;
DiskStoreImpl ds =
- new DiskStoreImpl(gfc, this.attrs, true/* ownedByRegion */, internalRegionArgs);
+ new DiskStoreImpl(this.cache, this.attrs, true/* ownedByRegion */, internalRegionArgs);
if (isOwnedByPR) {
ds.doInitialRecovery();
}
- gfc.addRegionOwnedDiskStore(ds);
+ this.cache.addRegionOwnedDiskStore(ds);
return ds;
}
}
@@ -137,15 +135,14 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
result = findExisting(name);
if (result == null) {
if (this.cache instanceof GemFireCacheImpl) {
- GemFireCacheImpl gfc = (GemFireCacheImpl) this.cache;
- TypeRegistry registry = gfc.getPdxRegistry();
- DiskStoreImpl dsi = new DiskStoreImpl(gfc, this.attrs);
+ TypeRegistry registry = this.cache.getPdxRegistry();
+ DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs);
result = dsi;
- /** Added for M&M **/
- gfc.getInternalDistributedSystem().handleResourceEvent(ResourceEvent.DISKSTORE_CREATE,
- dsi);
+ // Added for M&M
+ this.cache.getInternalDistributedSystem()
+ .handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi);
dsi.doInitialRecovery();
- gfc.addDiskStore(dsi);
+ this.cache.addDiskStore(dsi);
if (registry != null) {
registry.creatingDiskStore(dsi);
}
@@ -163,8 +160,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
// member depends on state that goes into this disk store
// that isn't backed up.
if (this.cache instanceof GemFireCacheImpl) {
- GemFireCacheImpl gfc = (GemFireCacheImpl) this.cache;
- BackupManager backup = gfc.getBackupManager();
+ BackupManager backup = this.cache.getBackupManager();
if (backup != null) {
backup.waitForBackup();
}
@@ -175,8 +171,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
private DiskStore findExisting(String name) {
DiskStore existing = null;
if (this.cache instanceof GemFireCacheImpl) {
- GemFireCacheImpl gfc = (GemFireCacheImpl) this.cache;
- existing = gfc.findDiskStore(name);
+ existing = this.cache.findDiskStore(name);
if (existing != null) {
if (((DiskStoreImpl) existing).sameAs(this.attrs)) {
return existing;
@@ -192,8 +187,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
if (diskDirSizes.length != diskDirs.length) {
throw new IllegalArgumentException(
LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1
- .toLocalizedString(new Object[] {Integer.valueOf(diskDirSizes.length),
- Integer.valueOf(diskDirs.length)}));
+ .toLocalizedString(new Object[] {diskDirSizes.length, diskDirs.length}));
}
verifyNonNegativeDirSize(diskDirSizes);
checkIfDirectoriesExist(diskDirs);
@@ -207,8 +201,6 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
/**
* Checks if directories exist, if they don't then create those directories
- *
- * @param diskDirs
*/
public static void checkIfDirectoriesExist(File[] diskDirs) {
for (int i = 0; i < diskDirs.length; i++) {
@@ -225,15 +217,13 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
/**
* Verify all directory sizes are positive
- *
- * @param sizes
*/
public static void verifyNonNegativeDirSize(int[] sizes) {
for (int i = 0; i < sizes.length; i++) {
if (sizes[i] < 0) {
throw new IllegalArgumentException(
LocalizedStrings.AttributesFactory_DIR_SIZE_CANNOT_BE_NEGATIVE_0
- .toLocalizedString(Integer.valueOf(sizes[i])));
+ .toLocalizedString(sizes[i]));
}
}
}
@@ -254,7 +244,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
} else if (maxOplogSize < 0) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE
- .toLocalizedString(Long.valueOf(maxOplogSize)));
+ .toLocalizedString(maxOplogSize));
}
this.attrs.maxOplogSizeInBytes = maxOplogSize * (1024 * 1024);
return this;
@@ -267,7 +257,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
if (maxOplogSizeInBytes < 0) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE
- .toLocalizedString(Long.valueOf(maxOplogSizeInBytes)));
+ .toLocalizedString(maxOplogSizeInBytes));
}
this.attrs.maxOplogSizeInBytes = maxOplogSizeInBytes;
return this;
@@ -277,7 +267,7 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
if (queueSize < 0) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_QUEUE_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE
- .toLocalizedString(Integer.valueOf(queueSize)));
+ .toLocalizedString(queueSize));
}
this.attrs.queueSize = queueSize;
return this;
@@ -285,10 +275,10 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
public DiskStoreFactory setWriteBufferSize(int writeBufferSize) {
if (writeBufferSize < 0) {
- // TODO Gester add a message for WriteBufferSize
+ // TODO add a message for WriteBufferSize
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_QUEUE_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE
- .toLocalizedString(Integer.valueOf(writeBufferSize)));
+ .toLocalizedString(writeBufferSize));
}
this.attrs.writeBufferSize = writeBufferSize;
return this;
[16/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
index 1de8d3b..75b848a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
@@ -106,7 +106,7 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
if (this.txUniqId == TXManagerImpl.NOTX) {
return null;
} else {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// ignore and return, we are shutting down!
return null;
@@ -116,9 +116,9 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
}
}
- private void cleanupTransasction(TXStateProxy tx) {
+ private void cleanupTransaction(TXStateProxy tx) {
if (this.txUniqId != TXManagerImpl.NOTX) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// ignore and return, we are shutting down!
return;
@@ -130,7 +130,6 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
@Override
protected void process(final DistributionManager dm) {
-
Throwable thr = null;
boolean sendReply = true;
DistributedRegion dr = null;
@@ -202,7 +201,7 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
logger.trace(LogMarker.DM, "Exception caught while processing message", t);
}
} finally {
- cleanupTransasction(tx);
+ cleanupTransaction(tx);
if (sendReply && this.processorId != 0) {
ReplyException rex = null;
if (thr != null) {
@@ -275,9 +274,9 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
/**
* check to see if the cache is closing
*/
- final public boolean checkCacheClosing(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- return (cache == null || cache.getCancelCriterion().isCancelInProgress());
+ private boolean checkCacheClosing(DistributionManager dm) {
+ InternalCache cache = GemFireCacheImpl.getInstance();
+ return cache == null || cache.getCancelCriterion().isCancelInProgress();
}
/**
@@ -285,7 +284,7 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
*
* @return true if the distributed system is closing
*/
- final public boolean checkDSClosing(DistributionManager dm) {
+ private boolean checkDSClosing(DistributionManager dm) {
InternalDistributedSystem ds = dm.getSystem();
return (ds == null || ds.isDisconnecting());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DynamicRegionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DynamicRegionFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DynamicRegionFactoryImpl.java
index 130e2a8..81bb7fb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DynamicRegionFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DynamicRegionFactoryImpl.java
@@ -28,15 +28,17 @@ public class DynamicRegionFactoryImpl extends DynamicRegionFactory {
* create an instance of the factory. This is normally only done by DynamicRegionFactory's static
* initialization
*/
- public DynamicRegionFactoryImpl() {}
+ public DynamicRegionFactoryImpl() {
+ // nothing
+ }
/** close the factory. Only do this if you're closing the cache, too */
public void close() {
- _close();
+ doClose();
}
/** initialize the factory for use with a new cache */
- public void internalInit(GemFireCacheImpl c) throws CacheException {
- _internalInit(c);
+ void internalInit(InternalCache cache) throws CacheException {
+ doInternalInit(cache);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
index 02c0422..ac4954a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
@@ -12,11 +12,33 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
-import org.apache.geode.*;
-import org.apache.geode.cache.*;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.function.Function;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CopyHelper;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.DeltaSerializationException;
+import org.apache.geode.GemFireIOException;
+import org.apache.geode.InvalidDeltaException;
+import org.apache.geode.SerializationException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.EntryOperation;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.SerializedCacheValue;
+import org.apache.geode.cache.TransactionId;
import org.apache.geode.cache.query.IndexMaintenanceException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.cache.query.internal.index.IndexManager;
@@ -28,7 +50,14 @@ import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionMessage;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.ByteArrayDataInput;
+import org.apache.geode.internal.DSFIDFactory;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.HeapDataOutputStream;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.Sendable;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
import org.apache.geode.internal.cache.lru.Sizeable;
import org.apache.geode.internal.cache.partitioned.PartitionMessage;
@@ -43,46 +72,46 @@ import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.geode.internal.offheap.*;
+import org.apache.geode.internal.offheap.OffHeapHelper;
+import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
+import org.apache.geode.internal.offheap.ReferenceCountHelper;
+import org.apache.geode.internal.offheap.Releasable;
+import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
-import org.apache.logging.log4j.Logger;
-
-import java.io.*;
-import java.util.function.Function;
-
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
/**
* Implementation of an entry event
+ *
+ * must be public for DataSerializableFixedID
*/
-// must be public for DataSerializableFixedID
public class EntryEventImpl
implements EntryEvent, InternalCacheEvent, DataSerializableFixedID, EntryOperation, Releasable {
private static final Logger logger = LogService.getLogger();
// PACKAGE FIELDS //
public transient LocalRegion region;
+
private transient RegionEntry re;
protected KeyInfo keyInfo;
- // private long eventId;
/** the event's id. Scoped by distributedMember. */
protected EventID eventID;
private Object newValue = null;
+
/**
* If we ever serialize the new value then it should be stored in this field in case we need the
* serialized form again later. This was added to fix bug 43781. Note that we also have the
* "newValueBytes" field. But it is only non-null if setSerializedNewValue was called.
*/
private byte[] cachedSerializedNewValue = null;
+
@Retained(ENTRY_EVENT_OLD_VALUE)
private Object oldValue = null;
@@ -116,15 +145,11 @@ public class EntryEventImpl
*/
protected DistributedMember distributedMember;
-
/**
* transient storage for the message that caused the event
*/
transient DistributionMessage causedByMessage;
-
- // private static long eventID = 0;
-
/**
* The originating membershipId of this event.
*
@@ -138,12 +163,12 @@ public class EntryEventImpl
*/
private byte[] deltaBytes = null;
-
/** routing information for cache clients for this event */
private FilterInfo filterInfo;
/** new value stored in serialized form */
protected byte[] newValueBytes;
+
/** old value stored in serialized form */
private byte[] oldValueBytes;
@@ -157,7 +182,9 @@ public class EntryEventImpl
public final static Object SUSPECT_TOKEN = new Object();
- public EntryEventImpl() {}
+ public EntryEventImpl() {
+ // do nothing
+ }
/**
* Reads the contents of this message from the given input.
@@ -229,7 +256,7 @@ public class EntryEventImpl
}
this.txId = this.region.getTXId();
- /**
+ /*
* this might set txId for events done from a thread that has a tx even though the op is non-tx.
* For example region ops.
*/
@@ -341,9 +368,8 @@ public class EntryEventImpl
@Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
EventID eventID) {
- EntryEventImpl entryEvent = new EntryEventImpl(region, op, key, newValue, callbackArgument,
- originRemote, distributedMember, generateCallbacks, eventID);
- return entryEvent;
+ return new EntryEventImpl(region, op, key, newValue, callbackArgument, originRemote,
+ distributedMember, generateCallbacks, eventID);
}
/**
@@ -356,9 +382,8 @@ public class EntryEventImpl
public static EntryEventImpl create(LocalRegion region, Operation op, Object key,
boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
boolean fromRILocalDestroy) {
- EntryEventImpl entryEvent = new EntryEventImpl(region, op, key, originRemote, distributedMember,
- generateCallbacks, fromRILocalDestroy);
- return entryEvent;
+ return new EntryEventImpl(region, op, key, originRemote, distributedMember, generateCallbacks,
+ fromRILocalDestroy);
}
/**
@@ -374,9 +399,8 @@ public class EntryEventImpl
public static EntryEventImpl create(final LocalRegion region, Operation op, Object key,
@Retained(ENTRY_EVENT_NEW_VALUE) Object newVal, Object callbackArgument, boolean originRemote,
DistributedMember distributedMember, boolean generateCallbacks, boolean initializeId) {
- EntryEventImpl entryEvent = new EntryEventImpl(region, op, key, newVal, callbackArgument,
- originRemote, distributedMember, generateCallbacks, initializeId);
- return entryEvent;
+ return new EntryEventImpl(region, op, key, newVal, callbackArgument, originRemote,
+ distributedMember, generateCallbacks, initializeId);
}
/**
@@ -915,7 +939,7 @@ public class EntryEventImpl
public final Object getOldValueAsOffHeapDeserializedOrRaw() {
Object result = basicGetOldValue();
if (mayHaveOffHeapReferences() && result instanceof StoredObject) {
- result = ((StoredObject) result).getDeserializedForReading();
+ result = ((CachedDeserializable) result).getDeserializedForReading();
}
return AbstractRegion.handleNotAvailable(result); // fixes 49499
}
@@ -1289,7 +1313,7 @@ public class EntryEventImpl
public final Object getNewValueAsOffHeapDeserializedOrRaw() {
Object result = getRawNewValue();
if (mayHaveOffHeapReferences() && result instanceof StoredObject) {
- result = ((StoredObject) result).getDeserializedForReading();
+ result = ((CachedDeserializable) result).getDeserializedForReading();
}
return AbstractRegion.handleNotAvailable(result); // fixes 49499
}
@@ -1462,8 +1486,6 @@ public class EntryEventImpl
* hasn't been set yet.
*
* @param oldValueForDelta Used by Delta Propagation feature
- *
- * @throws RegionClearedException
*/
void putExistingEntry(final LocalRegion owner, final RegionEntry reentry, boolean requireOldValue,
Object oldValueForDelta) throws RegionClearedException {
@@ -1524,8 +1546,6 @@ public class EntryEventImpl
/**
* Put a newValue into the given, write synced, new, region entry.
- *
- * @throws RegionClearedException
*/
void putNewEntry(final LocalRegion owner, final RegionEntry reentry)
throws RegionClearedException {
@@ -1791,7 +1811,7 @@ public class EntryEventImpl
OffHeapHelper.releaseWithNoTracking(v);
}
}
- } catch (EntryNotFoundException ex) {
+ } catch (EntryNotFoundException ignore) {
return false;
}
}
@@ -2012,7 +2032,7 @@ public class EntryEventImpl
synchronized (this.offHeapLock) {
ArrayUtils.objectStringNonRecursive(basicGetOldValue(), buf);
}
- } catch (IllegalStateException ex) {
+ } catch (IllegalStateException ignore) {
buf.append("OFFHEAP_VALUE_FREED");
}
buf.append(";newValue=");
@@ -2020,7 +2040,7 @@ public class EntryEventImpl
synchronized (this.offHeapLock) {
ArrayUtils.objectStringNonRecursive(basicGetNewValue(), buf);
}
- } catch (IllegalStateException ex) {
+ } catch (IllegalStateException ignore) {
buf.append("OFFHEAP_VALUE_FREED");
}
buf.append(";callbackArg=");
@@ -2029,10 +2049,6 @@ public class EntryEventImpl
buf.append(isOriginRemote());
buf.append(";originMember=");
buf.append(getDistributedMember());
- // if (this.partitionMessage != null) {
- // buf.append("; partitionMessage=");
- // buf.append(this.partitionMessage);
- // }
if (this.isPossibleDuplicate()) {
buf.append(";posDup");
}
@@ -2054,11 +2070,8 @@ public class EntryEventImpl
buf.append(this.eventID);
}
if (this.deltaBytes != null) {
- buf.append(";[" + this.deltaBytes.length + " deltaBytes]");
+ buf.append(";[").append(this.deltaBytes.length).append(" deltaBytes]");
}
- // else {
- // buf.append(";[no deltaBytes]");
- // }
if (this.filterInfo != null) {
buf.append(";routing=");
buf.append(this.filterInfo);
@@ -2239,8 +2252,6 @@ public class EntryEventImpl
/**
* Sets the operation type.
- *
- * @param eventType
*/
public void setEventType(EnumListenerEvent eventType) {
this.eventType = eventType;
@@ -2416,8 +2427,6 @@ public class EntryEventImpl
/**
* This method sets the delta bytes used in Delta Propagation feature. <B>For internal delta, see
* setNewValue().</B>
- *
- * @param deltaBytes
*/
public void setDeltaBytes(byte[] deltaBytes) {
this.deltaBytes = deltaBytes;
@@ -2494,7 +2503,6 @@ public class EntryEventImpl
* this method joins together version tag timestamps and the "lastModified" timestamps generated
* and stored in entries. If a change does not already carry a lastModified timestamp
*
- * @param suggestedTime
* @return the timestamp to store in the entry
*/
public long getEventTime(long suggestedTime) {
@@ -2741,10 +2749,10 @@ public class EntryEventImpl
// System.identityHashCode(ov));
if (ReferenceCountHelper.trackReferenceCounts()) {
ReferenceCountHelper.setReferenceCountOwner(new OldValueOwner());
- ((StoredObject) ov).release();
+ ((Releasable) ov).release();
ReferenceCountHelper.setReferenceCountOwner(null);
} else {
- ((StoredObject) ov).release();
+ ((Releasable) ov).release();
}
}
OffHeapHelper.releaseAndTrackOwner(nv, this);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/EventTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EventTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EventTracker.java
index 2ddfdc4..164eb61 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EventTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EventTracker.java
@@ -12,11 +12,21 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.client.PoolFactory;
@@ -31,14 +41,6 @@ import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
/**
* EventTracker tracks the last sequence number for a particular memberID:threadID. It is used to
@@ -88,11 +90,10 @@ public class EventTracker {
*/
private volatile InternalDistributedMember initialImageProvider;
-
/**
* The cache associated with this tracker
*/
- GemFireCacheImpl cache;
+ InternalCache cache;
/**
* The name of this tracker
@@ -112,12 +113,12 @@ public class EventTracker {
/**
* Initialize the EventTracker's timer task. This is stored in the cache for tracking and shutdown
* purposes
- *
+ *
* @param cache the cache to schedule tasks with
*/
- public static ExpiryTask startTrackerServices(GemFireCacheImpl cache) {
+ public static ExpiryTask startTrackerServices(InternalCache cache) {
long expiryTime = Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "messageTrackingTimeout",
- PoolFactory.DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT / 3).longValue();
+ PoolFactory.DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT / 3);
ExpiryTask result = new ExpiryTask(cache, expiryTime);
cache.getCCPTimer().scheduleAtFixedRate(result, expiryTime, expiryTime);
// schedule(result, expiryTime);
@@ -126,10 +127,10 @@ public class EventTracker {
/**
* Terminate the tracker's timer task
- *
+ *
* @param cache the cache holding the tracker task
*/
- public static void stopTrackerServices(GemFireCacheImpl cache) {
+ public static void stopTrackerServices(InternalCache cache) {
cache.getEventTrackerTask().cancel();
}
@@ -506,8 +507,6 @@ public class EventTracker {
}
/**
- * @param event
- * @param eventID
* @return true if the event should not be tracked, false otherwise
*/
private boolean ignoreEvent(InternalCacheEvent event, EventID eventID) {
@@ -714,17 +713,21 @@ public class EventTracker {
* Whether this object was removed by the cleanup thread.
*/
public boolean removed;
+
/**
* public for tests only
*/
public Map<EventID, VersionTag> entryVersionTags = new HashMap<EventID, VersionTag>();
+
/** millisecond timestamp */
transient long endOfLifeTimer;
/**
* creates a new instance to save status of a putAllOperation
*/
- BulkOpHolder() {}
+ BulkOpHolder() {
+ // do nothing
+ }
public void putVersionTag(EventID eventId, VersionTag versionTag) {
entryVersionTags.put(eventId, versionTag);
@@ -738,13 +741,13 @@ public class EventTracker {
}
}
- static class ExpiryTask extends SystemTimerTask {
+ public static class ExpiryTask extends SystemTimerTask {
- GemFireCacheImpl cache;
+ InternalCache cache;
long expiryTime;
List trackers = new LinkedList();
- public ExpiryTask(GemFireCacheImpl cache, long expiryTime) {
+ public ExpiryTask(InternalCache cache, long expiryTime) {
this.cache = cache;
this.expiryTime = expiryTime;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
index d3f5987..14edad9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
@@ -12,17 +12,23 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
-/**
- * ExpiryTask represents a timeout event for expiration
- */
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheException;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.ExpirationAction;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.PooledExecutorWithDMStats;
@@ -32,13 +38,10 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.tcp.ConnectionTable;
-import org.apache.logging.log4j.Logger;
-
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
+/**
+ * ExpiryTask represents a timeout event for expiration
+ */
public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
private static final Logger logger = LogService.getLogger();
@@ -49,8 +52,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
static {
// default to inline expiry to fix bug 37115
- int nThreads =
- Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "EXPIRY_THREADS", 0).intValue();
+ int nThreads = Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "EXPIRY_THREADS", 0);
if (nThreads > 0) {
ThreadFactory tf = new ThreadFactory() {
private int nextId = 0;
@@ -396,7 +398,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
}
protected boolean isCacheClosing() {
- return ((GemFireCacheImpl) getLocalRegion().getCache()).isClosed();
+ return getLocalRegion().getCache().isClosed();
}
/**
@@ -464,7 +466,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
}
private static long calculateNow() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
// Use cache.cacheTimeMillis here. See bug 52267.
InternalDistributedSystem ids = cache.getInternalDistributedSystem();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
index e7175f3..9a4eca3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
@@ -47,6 +47,7 @@ import org.apache.geode.cache.query.internal.cq.CqService;
import org.apache.geode.cache.query.internal.cq.CqServiceProvider;
import org.apache.geode.cache.query.internal.cq.ServerCQ;
import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.DistributionAdvisee;
import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
@@ -88,7 +89,7 @@ public class FilterProfile implements DataSerializableFixedID {
private static final Logger logger = LogService.getLogger();
/** enumeration of distributed profile operations */
- static enum operationType {
+ enum operationType {
REGISTER_KEY,
REGISTER_KEYS,
REGISTER_PATTERN,
@@ -201,8 +202,6 @@ public class FilterProfile implements DataSerializableFixedID {
* used for instantiation of a profile associated with a region and not describing region filters
* in a different process. Do not use this method when instantiating profiles to store in
* distribution advisor profiles.
- *
- * @param r
*/
public FilterProfile(LocalRegion r) {
this.region = r;
@@ -499,7 +498,6 @@ public class FilterProfile implements DataSerializableFixedID {
/**
* Registers interest in a set of keys for a client
*
- * @param inputClientID
* @param keys The list of keys in which to register interest
* @param updatesAsInvalidates whether to send invalidations instead of updates
* @return the registered keys
@@ -796,7 +794,7 @@ public class FilterProfile implements DataSerializableFixedID {
public void stopCq(ServerCQ cq) {
ensureCqID(cq);
if (logger.isDebugEnabled()) {
- this.logger.debug("Stopping CQ {} on this members FilterProfile.", cq.getServerCqName());
+ logger.debug("Stopping CQ {} on this members FilterProfile.", cq.getServerCqName());
}
this.sendCQProfileOperation(operationType.STOP_CQ, cq);
}
@@ -919,7 +917,7 @@ public class FilterProfile implements DataSerializableFixedID {
if (clientId.equals(client)) {
try {
cq.close(false);
- } catch (Exception ex) {
+ } catch (Exception ignore) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to remove CQ from the base region. CqName : {}", cq.getName());
}
@@ -970,7 +968,7 @@ public class FilterProfile implements DataSerializableFixedID {
}
OperationMessage msg = new OperationMessage();
msg.regionName = this.region.getFullPath();
- msg.clientID = clientID.longValue();
+ msg.clientID = clientID;
msg.opType = opType;
msg.interest = interest;
msg.updatesAsInvalidates = updatesAsInvalidates;
@@ -980,14 +978,14 @@ public class FilterProfile implements DataSerializableFixedID {
private void sendFilterProfileOperation(OperationMessage msg) {
Set recipients =
- ((CacheDistributionAdvisee) this.region).getDistributionAdvisor().adviseProfileUpdate();
+ ((DistributionAdvisee) this.region).getDistributionAdvisor().adviseProfileUpdate();
msg.setRecipients(recipients);
ReplyProcessor21 rp = new ReplyProcessor21(this.region.getDistributionManager(), recipients);
msg.processorId = rp.getProcessorId();
this.region.getDistributionManager().putOutgoing(msg);
try {
rp.waitForReplies();
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -1014,9 +1012,10 @@ public class FilterProfile implements DataSerializableFixedID {
}
static final Profile[] NO_PROFILES = new Profile[0];
+
private final CacheProfile localProfile = new CacheProfile(this);
- private final Profile[] localProfileArray = new Profile[] {localProfile};
+ private final Profile[] localProfileArray = new Profile[] {localProfile};
/** compute local routing information */
public FilterInfo getLocalFilterRouting(CacheEvent event) {
@@ -1061,7 +1060,7 @@ public class FilterProfile implements DataSerializableFixedID {
// bug #50809 - local routing for transactional ops must be done here
// because the event isn't available later and we lose the old value for the entry
final boolean processLocalProfile =
- event.getOperation().isEntry() && ((EntryEventImpl) event).getTransactionId() != null;
+ event.getOperation().isEntry() && ((EntryEvent) event).getTransactionId() != null;
fillInCQRoutingInfo(event, processLocalProfile, peerProfiles, frInfo);
}
@@ -1106,7 +1105,7 @@ public class FilterProfile implements DataSerializableFixedID {
}
fillInCQRoutingInfo(event, true, NO_PROFILES, result);
}
- result = fillInInterestRoutingInfo(event, localProfileArray, result, Collections.EMPTY_SET);
+ result = fillInInterestRoutingInfo(event, localProfileArray, result, Collections.emptySet());
}
return result;
}
@@ -1275,8 +1274,8 @@ public class FilterProfile implements DataSerializableFixedID {
public FilterRoutingInfo fillInInterestRoutingInfo(CacheEvent event, Profile[] profiles,
FilterRoutingInfo filterRoutingInfo, Set cacheOpRecipients) {
- Set clientsInv = Collections.EMPTY_SET;
- Set clients = Collections.EMPTY_SET;
+ Set clientsInv = Collections.emptySet();
+ Set clients = Collections.emptySet();
if (logger.isTraceEnabled(LogMarker.BRIDGE_SERVER)) {
logger.trace(LogMarker.BRIDGE_SERVER, "finding interested clients for {}", event);
@@ -1310,8 +1309,8 @@ public class FilterProfile implements DataSerializableFixedID {
if (!pf.isLocalProfile() && cacheOpRecipients.contains(cf.getDistributedMember())) {
if (frInfo == null)
frInfo = new FilterRoutingInfo();
- frInfo.addInterestedClients(cf.getDistributedMember(), Collections.EMPTY_SET,
- Collections.EMPTY_SET, false);
+ frInfo.addInterestedClients(cf.getDistributedMember(), Collections.emptySet(),
+ Collections.emptySet(), false);
}
continue;
}
@@ -1567,11 +1566,10 @@ public class FilterProfile implements DataSerializableFixedID {
}
private Set<Object> getAllKeyClients() {
- Set allKeysRef = this.allKeyClients;
if (testHook != null) {
testHook.await();
}
- return allKeysRef;
+ return (Set) this.allKeyClients;
}
public int getAllKeyClientsSize() {
@@ -1627,7 +1625,7 @@ public class FilterProfile implements DataSerializableFixedID {
return "clients[]";
}
Set<Long> sorted = new TreeSet(wids.keySet());
- StringBuffer result = new StringBuffer(sorted.size() * 70);
+ StringBuilder result = new StringBuilder(sorted.size() * 70);
result.append("clients[");
Iterator<Long> it = sorted.iterator();
for (int i = 1; it.hasNext(); i++) {
@@ -1652,7 +1650,7 @@ public class FilterProfile implements DataSerializableFixedID {
return "cqs[]";
}
Set<Long> sorted = new TreeSet(wids.keySet());
- StringBuffer result = new StringBuffer(sorted.size() * 70);
+ StringBuilder result = new StringBuilder(sorted.size() * 70);
result.append("cqs[");
Iterator<Long> it = sorted.iterator();
for (int i = 1; it.hasNext(); i++) {
@@ -1666,7 +1664,6 @@ public class FilterProfile implements DataSerializableFixedID {
return result.toString();
}
-
/**
* given a collection of on-wire identifiers, this returns a set of the client/server identifiers
* for each client or durable queue
@@ -1730,7 +1727,7 @@ public class FilterProfile implements DataSerializableFixedID {
return new LinkedList(this.filterProfileMsgQueue.get(member));
}
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
/**
@@ -1746,14 +1743,11 @@ public class FilterProfile implements DataSerializableFixedID {
return new LinkedList(this.filterProfileMsgQueue.remove(member));
}
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
/**
* Adds the message to filter profile queue.
- *
- * @param member
- * @param message
*/
public void addToFilterProfileQueue(InternalDistributedMember member, OperationMessage message) {
if (logger.isDebugEnabled()) {
@@ -1771,8 +1765,6 @@ public class FilterProfile implements DataSerializableFixedID {
/**
* Process the filter profile messages.
- *
- * @param msgs
*/
public void processQueuedFilterProfileMsgs(List msgs) {
final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -1840,7 +1832,7 @@ public class FilterProfile implements DataSerializableFixedID {
"No cache profile to update, adding filter profile message to queue. Message :{}",
this);
}
- FilterProfile localFP = ((PartitionedRegion) r).getFilterProfile();
+ FilterProfile localFP = ((LocalRegion) r).getFilterProfile();
localFP.addToFilterProfileQueue(getSender(), this);
dm.getCancelCriterion().checkCancelInProgress(null);
} else {
@@ -1865,7 +1857,7 @@ public class FilterProfile implements DataSerializableFixedID {
reply.setRecipient(getSender());
try {
dm.putOutgoing(reply);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// can't send a reply, so ignore the exception
}
}
@@ -1927,7 +1919,7 @@ public class FilterProfile implements DataSerializableFixedID {
private CacheDistributionAdvisee findRegion() {
CacheDistributionAdvisee result = null;
- GemFireCacheImpl cache = null;
+ InternalCache cache;
try {
cache = GemFireCacheImpl.getInstance();
if (cache != null) {
@@ -1936,7 +1928,7 @@ public class FilterProfile implements DataSerializableFixedID {
result = (CacheDistributionAdvisee) lr;
}
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// nothing to do
}
return result;
@@ -2023,7 +2015,7 @@ public class FilterProfile implements DataSerializableFixedID {
if (nextID == Integer.MAX_VALUE) {
this.hasLongID = true;
}
- result = Long.valueOf(nextID++);
+ result = nextID++;
this.realIDs.put(realId, result);
this.wireIDs.put(result, realId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java
index 279a4d1..0dd24f6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java
@@ -14,18 +14,6 @@
*/
package org.apache.geode.internal.cache;
-import org.apache.geode.DataSerializable;
-import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.HeapDataOutputStream;
-import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataInputStream;
-import org.apache.geode.internal.VersionedDataSerializable;
-
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
@@ -38,6 +26,18 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.HeapDataOutputStream;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.ObjToByteArraySerializer;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataInputStream;
+import org.apache.geode.internal.VersionedDataSerializable;
+
/**
* This class is used to hold the information about the servers and their Filters (CQs and Interest
* List) that are satisfied by the cache update operation.
@@ -217,7 +217,7 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
/** DataSerializable methods */
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
DistributedMember myID = null;
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
myID = cache.getMyId();
}
@@ -250,7 +250,7 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
public void fromDataPre_GFE_7_1_0_0(DataInput in) throws IOException, ClassNotFoundException {
DistributedMember myID = null;
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
myID = cache.getMyId();
}
@@ -303,7 +303,7 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
public boolean longIDs;
- public static final long serialVersionUID = 0;
+ private static final long serialVersionUID = 0;
/** Map holding Cq filterID and CqEvent Type */
private HashMap<Long, Integer> cqs;
@@ -383,21 +383,20 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
Map.Entry e = (Map.Entry) it.next();
// most cq IDs and all event types are small ints, so we use an optimized
// write that serializes 7 bits at a time in a compact form
- InternalDataSerializer.writeUnsignedVL(((Long) e.getKey()).longValue(), hdos);
- InternalDataSerializer.writeUnsignedVL(((Integer) e.getValue()).intValue(), hdos);
+ InternalDataSerializer.writeUnsignedVL((Long) e.getKey(), hdos);
+ InternalDataSerializer.writeUnsignedVL((Integer) e.getValue(), hdos);
}
}
InternalDataSerializer.writeSetOfLongs(this.interestedClients, this.longIDs, hdos);
InternalDataSerializer.writeSetOfLongs(this.interestedClientsInv, this.longIDs, hdos);
if (out instanceof HeapDataOutputStream) {
- ((HeapDataOutputStream) out).writeAsSerializedByteArray(hdos);
+ ((ObjToByteArraySerializer) out).writeAsSerializedByteArray(hdos);
} else {
byte[] myData = hdos.toByteArray();
DataSerializer.writeByteArray(myData, out);
}
}
-
public void fromDataPre_GFE_8_0_0_0(DataInput in) throws IOException, ClassNotFoundException {
if (OLD_MEMBERS_OPTIMIZED) {
this.myDataVersion = InternalDataSerializer.getVersionForDataStreamOrNull(in);
@@ -422,14 +421,14 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
Map.Entry e = (Map.Entry) it.next();
// most cq IDs and all event types are small ints, so we use an optimized
// write that serializes 7 bits at a time in a compact form
- InternalDataSerializer.writeUnsignedVL(((Long) e.getKey()).longValue(), hdos);
- InternalDataSerializer.writeUnsignedVL(((Integer) e.getValue()).intValue(), hdos);
+ InternalDataSerializer.writeUnsignedVL((Long) e.getKey(), hdos);
+ InternalDataSerializer.writeUnsignedVL((Integer) e.getValue(), hdos);
}
}
InternalDataSerializer.writeSetOfLongs(this.interestedClients, this.longIDs, hdos);
InternalDataSerializer.writeSetOfLongs(this.interestedClientsInv, this.longIDs, hdos);
if (out instanceof HeapDataOutputStream) {
- ((HeapDataOutputStream) out).writeAsSerializedByteArray(hdos);
+ ((ObjToByteArraySerializer) out).writeAsSerializedByteArray(hdos);
} else {
byte[] myData = hdos.toByteArray();
DataSerializer.writeByteArray(myData, out);
@@ -494,7 +493,7 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
this.cqs = new HashMap(numEntries);
for (int i = 0; i < numEntries; i++) {
Long key = InternalDataSerializer.readUnsignedVL(dis);
- Integer value = Integer.valueOf((int) InternalDataSerializer.readUnsignedVL(dis));
+ Integer value = (int) InternalDataSerializer.readUnsignedVL(dis);
this.cqs.put(key, value);
}
}
@@ -506,10 +505,9 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
}
}
-
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (this.interestedClients != null && this.interestedClients.size() > 0) {
sb.append("interestedClients:");
sb.append(this.interestedClients);
@@ -533,4 +531,3 @@ public class FilterRoutingInfo implements VersionedDataSerializable {
}
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/FindDurableQueueProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FindDurableQueueProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FindDurableQueueProcessor.java
index 1145687..71423e3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FindDurableQueueProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FindDurableQueueProcessor.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.internal.cache;
import java.io.DataInput;
@@ -27,7 +26,6 @@ import java.util.Set;
import org.apache.logging.log4j.Logger;
import org.apache.geode.DataSerializer;
-import org.apache.geode.cache.Cache;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.DistributionMessage;
@@ -50,14 +48,11 @@ import org.apache.geode.internal.logging.LogService;
public class FindDurableQueueProcessor extends ReplyProcessor21 {
private static final Logger logger = LogService.getLogger();
- ////////// Public static entry point /////////
-
final ArrayList durableLocations = new ArrayList();
- // @todo gregp: add javadocs
public static ArrayList sendAndFind(ServerLocator locator, ClientProxyMembershipID proxyId,
DM dm) {
- Set members = ((ControllerAdvisor) locator.getDistributionAdvisor()).adviseBridgeServers();
+ Set members = ((GridAdvisor) locator.getDistributionAdvisor()).adviseBridgeServers();
if (members.contains(dm.getId())) {
// Don't send message to local server, see #50534.
Set remoteMembers = new HashSet(members);
@@ -80,9 +75,9 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
private static void findLocalDurableQueues(ClientProxyMembershipID proxyId,
ArrayList<ServerLocation> matches) {
- Cache c = GemFireCacheImpl.getInstance();
- if (c != null) {
- List l = c.getCacheServers();
+ InternalCache cache = GemFireCacheImpl.getInstance();
+ if (cache != null) {
+ List l = cache.getCacheServers();
if (l != null) {
Iterator i = l.iterator();
while (i.hasNext()) {
@@ -96,9 +91,6 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
}
}
-
- //////////// Instance methods //////////////
-
@Override
public void process(DistributionMessage msg) {
// TODO Auto-generated method stub
@@ -112,7 +104,6 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
super.process(msg);
}
-
/**
* Creates a new instance of FindDurableQueueProcessor
*/
@@ -120,9 +111,6 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
super(dm, members);
}
-
- /////////////// Inner message classes //////////////////
-
public static class FindDurableQueueMessage extends PooledDistributionMessage
implements MessageWithReply {
private int processorId;
@@ -149,14 +137,12 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
return this.proxyId;
}
-
@Override
protected void process(final DistributionManager dm) {
ArrayList<ServerLocation> matches = new ArrayList<ServerLocation>();
try {
findLocalDurableQueues(proxyId, matches);
-
} finally {
FindDurableQueueReply reply = new FindDurableQueueReply();
reply.setProcessorId(this.getProcessorId());
@@ -169,7 +155,6 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
dm.putOutgoing(reply);
}
}
-
}
public int getDSFID() {
@@ -205,7 +190,6 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
}
}
-
public static class FindDurableQueueReply extends ReplyMessage {
protected ArrayList matches = null;
@@ -239,4 +223,3 @@ public class FindDurableQueueProcessor extends ReplyProcessor21 {
}
}
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/FindRemoteTXMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FindRemoteTXMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FindRemoteTXMessage.java
index 84e3009..3b89cfc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FindRemoteTXMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FindRemoteTXMessage.java
@@ -50,9 +50,12 @@ public class FindRemoteTXMessage extends HighPriorityDistributionMessage
private static final Logger logger = LogService.getLogger();
private TXId txId;
+
private int processorId;
- public FindRemoteTXMessage() {}
+ public FindRemoteTXMessage() {
+ // do nothing
+ }
public FindRemoteTXMessage(TXId txid, int processorId, Set recipients) {
super();
@@ -93,8 +96,7 @@ public class FindRemoteTXMessage extends HighPriorityDistributionMessage
logger.debug("processing {}", this);
}
FindRemoteTXMessageReply reply = new FindRemoteTXMessageReply();
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();// .getExisting("Looking up
- // CacheTransactionManager");
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
TXManagerImpl mgr = (TXManagerImpl) cache.getCacheTransactionManager();
mgr.waitForCompletingTransaction(txId); // in case there is a lost commit going on
@@ -147,10 +149,8 @@ public class FindRemoteTXMessage extends HighPriorityDistributionMessage
@Override
public String toString() {
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
String className = getClass().getName();
- // className.substring(className.lastIndexOf('.', className.lastIndexOf('.') - 1) + 1); //
- // partition.<foo> more generic version
buff.append(className.substring(
className.indexOf(PartitionMessage.PN_TOKEN) + PartitionMessage.PN_TOKEN.length())); // partition.<foo>
buff.append("(txId=").append(this.txId).append("; sender=").append(getSender())
@@ -173,7 +173,6 @@ public class FindRemoteTXMessage extends HighPriorityDistributionMessage
this.processorId = in.readInt();
}
-
public static class FindRemoteTXMessageReplyProcessor extends ReplyProcessor21 {
private InternalDistributedMember hostingMember;
@@ -235,8 +234,6 @@ public class FindRemoteTXMessage extends HighPriorityDistributionMessage
return true;
}
-
-
/**
* Reply message for {@link FindRemoteTXMessage}. Reply is a boolean to indicate if the recipient
* hosts or has recently hosted the tx state. If the member did host the txState previously, reply
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/FindVersionTagOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FindVersionTagOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FindVersionTagOperation.java
index 544a27e..199aafc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FindVersionTagOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FindVersionTagOperation.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -38,9 +35,6 @@ import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- */
public class FindVersionTagOperation {
private static final Logger logger = LogService.getLogger();
@@ -94,7 +88,6 @@ public class FindVersionTagOperation {
public boolean stillWaiting() {
return this.versionTag == null && super.stillWaiting();
}
-
}
/**
@@ -124,12 +117,6 @@ public class FindVersionTagOperation {
/** for deserialization */
public FindVersionTagMessage() {}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.distributed.internal.DistributionMessage#process(org.apache.geode.
- * distributed.internal.DistributionManager)
- */
@Override
protected void process(DistributionManager dm) {
VersionTag result = null;
@@ -169,7 +156,7 @@ public class FindVersionTagOperation {
}
private LocalRegion findRegion() {
- GemFireCacheImpl cache = null;
+ InternalCache cache;
try {
cache = GemFireCacheImpl.getInstance();
if (cache != null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 978e863..3458eaa 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
@@ -117,7 +117,6 @@ import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientRegionFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.client.Pool;
@@ -125,6 +124,8 @@ import org.apache.geode.cache.client.PoolFactory;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.internal.ClientMetadataService;
import org.apache.geode.cache.client.internal.ClientRegionFactoryImpl;
+import org.apache.geode.cache.client.internal.ConnectionImpl;
+import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache.client.internal.PoolImpl;
import org.apache.geode.cache.control.ResourceManager;
import org.apache.geode.cache.execute.FunctionService;
@@ -237,8 +238,8 @@ import org.apache.geode.redis.GeodeRedisServer;
* GemFire's implementation of a distributed {@link Cache}.
*/
@SuppressWarnings("deprecation")
-public class GemFireCacheImpl
- implements InternalCache, ClientCache, HasCachePerfStats, DistributionAdvisee, CacheTime {
+public class GemFireCacheImpl implements InternalCache, InternalClientCache, HasCachePerfStats,
+ DistributionAdvisee, CacheTime {
private static final Logger logger = LogService.getLogger();
/** The default number of seconds to wait for a distributed lock */
@@ -285,6 +286,8 @@ public class GemFireCacheImpl
* (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.
*
+ * TODO: move or static or encapsulate with interface methods
+ *
* @since GemFire h****** 6.1.2.9
*/
static boolean DELTAS_RECALCULATE_SIZE =
@@ -578,10 +581,6 @@ public class GemFireCacheImpl
private final Map<Class<? extends CacheService>, CacheService> services = new HashMap<>();
- public static final int DEFAULT_CLIENT_FUNCTION_TIMEOUT = 0;
-
- private static int clientFunctionTimeout;
-
private final SecurityService securityService = SecurityService.getSecurityService();
static {
@@ -925,6 +924,7 @@ public class GemFireCacheImpl
} // synchronized
}
+ @Override
public boolean isRESTServiceRunning() {
return this.isRESTServiceRunning;
}
@@ -1094,6 +1094,7 @@ public class GemFireCacheImpl
*
* @return true if the cache has pools declared
*/
+ @Override
public boolean hasPool() {
return this.isClient || !getAllPools().isEmpty();
}
@@ -1210,10 +1211,6 @@ public class GemFireCacheImpl
startRestAgentServer(this);
- int time = Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "CLIENT_FUNCTION_TIMEOUT",
- DEFAULT_CLIENT_FUNCTION_TIMEOUT);
- clientFunctionTimeout = time >= 0 ? time : DEFAULT_CLIENT_FUNCTION_TIMEOUT;
-
this.isInitialized = true;
}
@@ -1934,6 +1931,7 @@ public class GemFireCacheImpl
close("Normal disconnect", null, keepAlive, false);
}
+ @Override
public void close(String reason, Throwable optionalCause) {
close(reason, optionalCause, false, false);
}
@@ -2470,22 +2468,25 @@ public class GemFireCacheImpl
private final ConcurrentMap<String, DiskStoreImpl> regionOwnedDiskStores =
new ConcurrentHashMap<>();
- void addDiskStore(DiskStoreImpl dsi) {
+ @Override
+ public void addDiskStore(DiskStoreImpl dsi) {
this.diskStores.put(dsi.getName(), dsi);
if (!dsi.isOffline()) {
this.diskMonitor.addDiskStore(dsi);
}
}
- void removeDiskStore(DiskStoreImpl dsi) {
- this.diskStores.remove(dsi.getName());
- this.regionOwnedDiskStores.remove(dsi.getName());
+ @Override
+ public void removeDiskStore(DiskStoreImpl diskStore) {
+ this.diskStores.remove(diskStore.getName());
+ this.regionOwnedDiskStores.remove(diskStore.getName());
// Added for M&M
- if (!dsi.getOwnedByRegion())
- this.system.handleResourceEvent(ResourceEvent.DISKSTORE_REMOVE, dsi);
+ if (!diskStore.getOwnedByRegion())
+ this.system.handleResourceEvent(ResourceEvent.DISKSTORE_REMOVE, diskStore);
}
- void addRegionOwnedDiskStore(DiskStoreImpl dsi) {
+ @Override
+ public void addRegionOwnedDiskStore(DiskStoreImpl dsi) {
this.regionOwnedDiskStores.put(dsi.getName(), dsi);
if (!dsi.isOffline()) {
this.diskMonitor.addDiskStore(dsi);
@@ -2522,6 +2523,7 @@ public class GemFireCacheImpl
return defaultDiskStoreName;
}
+ // TODO: remove static from defaultDiskStoreName and move methods to InternalCache
private static String defaultDiskStoreName = DiskStoreFactory.DEFAULT_DISK_STORE_NAME;
@Override
@@ -2557,13 +2559,13 @@ public class GemFireCacheImpl
* @since GemFire prPersistSprint2
*/
@Override
- public Collection<DiskStoreImpl> listDiskStores() {
+ public Collection<DiskStore> listDiskStores() {
return Collections.unmodifiableCollection(this.diskStores.values());
}
@Override
- public Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned() {
- Collection<DiskStoreImpl> allDiskStores = new HashSet<>();
+ public Collection<DiskStore> listDiskStoresIncludingRegionOwned() {
+ Collection<DiskStore> allDiskStores = new HashSet<>();
allDiskStores.addAll(this.diskStores.values());
allDiskStores.addAll(this.regionOwnedDiskStores.values());
return allDiskStores;
@@ -2740,7 +2742,8 @@ public class GemFireCacheImpl
*
* @return the sweeper task
*/
- EventTracker.ExpiryTask getEventTrackerTask() {
+ @Override
+ public EventTracker.ExpiryTask getEventTrackerTask() {
return this.recordedEventSweeper;
}
@@ -2760,6 +2763,7 @@ public class GemFireCacheImpl
* @param className Class name of the declarable
* @return List of all instances of properties found for the given declarable
*/
+ @Override
public List<Properties> getDeclarableProperties(final String className) {
List<Properties> propertiesList = new ArrayList<>();
synchronized (this.declarablePropertiesMap) {
@@ -2976,11 +2980,12 @@ public class GemFireCacheImpl
}
}
+ // TODO: createVMRegion method is too complex for IDE to analyze
@Override
public <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> p_attrs,
InternalRegionArguments internalRegionArgs)
throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException {
- // TODO: refactor overly complex method
+
if (getMyId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE) {
if (!internalRegionArgs.isUsedForMetaRegion()
&& internalRegionArgs.getInternalMetaRegion() == null) {
@@ -3233,6 +3238,7 @@ public class GemFireCacheImpl
return (LocalRegion) this.pathToRegion.get(path);
}
+ @Override
public LocalRegion getRegionByPathForProcessing(String path) {
LocalRegion result = getRegionByPath(path);
if (result == null) {
@@ -3302,7 +3308,8 @@ public class GemFireCacheImpl
}
/** Return true if this region is initializing */
- boolean isGlobalRegionInitializing(String fullPath) {
+ @Override
+ public boolean isGlobalRegionInitializing(String fullPath) {
this.stopper.checkCancelInProgress(null);
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT); // go through
// initialization latches
@@ -3614,13 +3621,13 @@ public class GemFireCacheImpl
}
@Override
- public void addRegionListener(RegionListener l) {
- this.regionListeners.add(l);
+ public void addRegionListener(RegionListener regionListener) {
+ this.regionListeners.add(regionListener);
}
@Override
- public void removeRegionListener(RegionListener l) {
- this.regionListeners.remove(l);
+ public void removeRegionListener(RegionListener regionListener) {
+ this.regionListeners.remove(regionListener);
}
@Override
@@ -3754,6 +3761,7 @@ public class GemFireCacheImpl
return cacheServer;
}
+ @Override
public void addGatewaySender(GatewaySender sender) {
if (isClient()) {
throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3837,6 +3845,7 @@ public class GemFireCacheImpl
}
}
+ @Override
public void addAsyncEventQueue(AsyncEventQueueImpl asyncQueue) {
this.allAsyncEventQueues.add(asyncQueue);
if (!asyncQueue.isMetaQueue()) {
@@ -3901,6 +3910,7 @@ public class GemFireCacheImpl
return null;
}
+ @Override
public void removeAsyncEventQueue(AsyncEventQueue asyncQueue) {
if (isClient()) {
throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3953,6 +3963,7 @@ public class GemFireCacheImpl
return cacheServersWithoutReceiver;
}
+ @Override
public List getCacheServersAndGatewayReceiver() {
return this.allCacheServers;
}
@@ -3961,7 +3972,7 @@ public class GemFireCacheImpl
* add a partitioned region to the set of tracked partitioned regions. This is used to notify the
* regions when this cache requires, or does not require notification of all region/entry events.
*/
- void addPartitionedRegion(PartitionedRegion region) {
+ public void addPartitionedRegion(PartitionedRegion region) {
synchronized (this.partitionedRegions) {
if (region.isDestroyed()) {
if (logger.isDebugEnabled()) {
@@ -4099,7 +4110,8 @@ public class GemFireCacheImpl
*
* @see #addPartitionedRegion(PartitionedRegion)
*/
- void removePartitionedRegion(PartitionedRegion region) {
+ @Override
+ public void removePartitionedRegion(PartitionedRegion region) {
synchronized (this.partitionedRegions) {
if (this.partitionedRegions.remove(region)) {
getCachePerfStats().incPartitionedRegions(-1);
@@ -4389,11 +4401,13 @@ public class GemFireCacheImpl
}
}
+ @Override
@SuppressWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
public void setQueryMonitorRequiredForResourceManager(boolean required) {
queryMonitorRequiredForResourceManager = required;
}
+ @Override
public boolean isQueryMonitorDisabledForLowMemory() {
return this.queryMonitorDisabledForLowMem;
}
@@ -4403,6 +4417,7 @@ public class GemFireCacheImpl
*
* @since GemFire 6.0
*/
+ @Override
public QueryMonitor getQueryMonitor() {
// Check to see if monitor is required if ResourceManager critical heap percentage is set
// or whether we override it with the system variable;
@@ -4912,7 +4927,8 @@ public class GemFireCacheImpl
this.regionsInDestroy.remove(path, region);
}
- DistributedRegion getRegionInDestroy(String path) {
+ @Override
+ public DistributedRegion getRegionInDestroy(String path) {
return this.regionsInDestroy.get(path);
}
@@ -5025,7 +5041,8 @@ public class GemFireCacheImpl
return this.serialNumber;
}
- TXEntryStateFactory getTXEntryStateFactory() {
+ @Override
+ public TXEntryStateFactory getTXEntryStateFactory() {
return this.txEntryStateFactory;
}
@@ -5144,7 +5161,8 @@ public class GemFireCacheImpl
return this.getSystem().getOffHeapStore();
}
- DiskStoreMonitor getDiskStoreMonitor() {
+ @Override
+ public DiskStoreMonitor getDiskStoreMonitor() {
return this.diskMonitor;
}
@@ -5157,10 +5175,6 @@ public class GemFireCacheImpl
return this.extensionPoint;
}
- public static int getClientFunctionTimeout() {
- return clientFunctionTimeout;
- }
-
@Override
public CqService getCqService() {
return this.cqService;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
index a19a958..03c14ab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
@@ -12,23 +12,26 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
-import java.util.*;
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
-import org.apache.geode.*;
+import org.apache.geode.DataSerializer;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
-import org.apache.geode.distributed.internal.membership.*;
-
+import org.apache.geode.distributed.internal.DistributionAdvisee;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
/**
* Used to share code with BridgeServerAdvisor and ControllerAdvisor
- *
*/
public abstract class GridAdvisor extends DistributionAdvisor {
@@ -38,9 +41,13 @@ public abstract class GridAdvisor extends DistributionAdvisor {
}
private final Object cacheLock = new Object();
+
private volatile List/* <BridgeServerProfile> */ cachedBridgeServerProfiles;
+
private volatile List/* <ControllerProfile> */ cachedControllerProfiles;
+
private volatile Set/* <DistributedMember> */ cachedBridgeServerAdvise;
+
private volatile Set/* <DistributedMember> */ cachedControllerAdvise;
private static final Filter CONTROLLER_FILTER = new Filter() {
@@ -90,11 +97,12 @@ public abstract class GridAdvisor extends DistributionAdvisor {
}
/**
- * Returns an unmodifiable <code>List</code> of the <code>BridgeServerProfile</code>s for all
- * known bridge servers.
+ * Returns an unmodifiable {@code List} of the {@code BridgeServerProfile}s for all known bridge
+ * servers.
*/
public List/* <BridgeServerProfile> */ fetchBridgeServers() {
- List/* <BridgeServerProfile> */ result = null; // this.cachedBridgeServerProfiles;
+ List/* <BridgeServerProfile> */ result = null;
+ // TODO: remove double-checking
if (result == null) {
synchronized (this.cacheLock) {
// result = this.cachedBridgeServerProfiles;
@@ -108,8 +116,8 @@ public abstract class GridAdvisor extends DistributionAdvisor {
}
/**
- * Returns an unmodifiable <code>List</code> of the <code>ControllerProfile</code>s for all known
- * cnx controllers.
+ * Returns an unmodifiable {@code List} of the {@code ControllerProfile}s for all known cnx
+ * controllers.
*/
public List/* <ControllerProfile> */ fetchControllers() {
List/* <ControllerProfile> */ result = this.cachedControllerProfiles;
@@ -224,8 +232,6 @@ public abstract class GridAdvisor extends DistributionAdvisor {
profilesChanged();
}
-
-
@Override
public Set adviseProfileRemove() {
// Our set of profiles includes local members. However, the update
@@ -236,12 +242,10 @@ public abstract class GridAdvisor extends DistributionAdvisor {
return results;
}
-
-
/**
* Describes profile data common for all Grid resources
*/
- public static abstract class GridProfile extends DistributionAdvisor.Profile {
+ public abstract static class GridProfile extends DistributionAdvisor.Profile {
private String host;
@@ -323,7 +327,7 @@ public abstract class GridAdvisor extends DistributionAdvisor {
*/
protected final void tellLocalBridgeServers(boolean removeProfile, boolean exchangeProfiles,
final List<Profile> replyProfiles) {
- final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
List<?> bridgeServers = cache.getCacheServersAndGatewayReceiver();
for (int i = 0; i < bridgeServers.size(); i++) {
@@ -367,8 +371,8 @@ public abstract class GridAdvisor extends DistributionAdvisor {
@Override
public void fillInToString(StringBuilder sb) {
super.fillInToString(sb);
- sb.append("; host=" + this.host);
- sb.append("; port=" + this.port);
+ sb.append("; host=").append(this.host);
+ sb.append("; port=").append(this.port);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java
index 07dd62c..f80f971 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java
@@ -89,16 +89,8 @@ public final class HARegion extends DistributedRegion {
private volatile HARegionQueue owningQueue;
- // private Map giiProviderStates;
-
- /**
- * @param regionName
- * @param attrs
- * @param parentRegion
- * @param cache
- */
private HARegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
- GemFireCacheImpl cache) {
+ InternalCache cache) {
super(regionName, attrs, parentRegion, cache,
new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
.setSnapshotInputStream(null).setImageTarget(null));
@@ -163,7 +155,7 @@ public final class HARegion extends DistributedRegion {
ExpirationAttributes oldAttrs = getEntryTimeToLive();
this.entryTimeToLive = timeToLive.getTimeout();
this.entryTimeToLiveExpirationAction = timeToLive.getAction();
- setEntryTimeToLiveAtts();
+ setEntryTimeToLiveAttributes();
updateEntryExpiryPossible();
timeToLiveChanged(oldAttrs);
return oldAttrs;
@@ -256,7 +248,7 @@ public final class HARegion extends DistributedRegion {
* @throws IOException
* @throws ClassNotFoundException
*/
- public static HARegion getInstance(String regionName, GemFireCacheImpl cache, HARegionQueue hrq,
+ public static HARegion getInstance(String regionName, InternalCache cache, HARegionQueue hrq,
RegionAttributes ra)
throws TimeoutException, RegionExistsException, IOException, ClassNotFoundException {
@@ -441,9 +433,9 @@ public final class HARegion extends DistributedRegion {
}
@Override
- public void fillInProfile(Profile p) {
- super.fillInProfile(p);
- HARegionAdvisor.HAProfile h = (HARegionAdvisor.HAProfile) p;
+ public void fillInProfile(Profile profile) {
+ super.fillInProfile(profile);
+ HARegionAdvisor.HAProfile h = (HARegionAdvisor.HAProfile) profile;
// dunit tests create HARegions without encapsulating them in queues
if (this.owningQueue != null) {
h.isPrimary = this.owningQueue.isPrimary();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
index d0ad5db..d6dc98f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
@@ -3451,7 +3451,7 @@ public class InitialImageOperation {
if (haReg == null || haReg.getName() == null) {
throw new ReplyException("HARegion for the proxy is Null.");
}
- GemFireCacheImpl cache = haReg.getCache();
+ InternalCache cache = haReg.getCache();
CacheClientNotifier ccn = CacheClientNotifier.getInstance();
if (ccn == null || ccn.getHaContainer() == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
index 33a7f52..7313f71 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.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.internal.cache;
import java.io.File;
@@ -20,6 +19,8 @@ import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -27,26 +28,36 @@ import javax.transaction.TransactionManager;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.Declarable;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.cache.DiskStoreFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
import org.apache.geode.cache.client.internal.ClientMetadataService;
import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.internal.QueryMonitor;
import org.apache.geode.cache.query.internal.cq.CqService;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.DistributedLockService;
-import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.CacheTime;
import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.SystemTimer;
import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.apache.geode.internal.cache.control.ResourceAdvisor;
import org.apache.geode.internal.cache.extension.Extensible;
+import org.apache.geode.internal.cache.persistence.BackupManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.offheap.MemoryAllocator;
+import org.apache.geode.management.internal.JmxManagerAdvisor;
import org.apache.geode.pdx.internal.TypeRegistry;
/**
@@ -56,13 +67,13 @@ import org.apache.geode.pdx.internal.TypeRegistry;
* @see org.apache.geode.cache.Cache
* @since GemFire 7.0
*/
-public interface InternalCache extends Cache, Extensible<Cache> {
+public interface InternalCache extends Cache, Extensible<Cache>, CacheTime {
- DistributedMember getMyId();
+ InternalDistributedMember getMyId();
- Collection<DiskStoreImpl> listDiskStores();
+ Collection<DiskStore> listDiskStores();
- Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned();
+ Collection<DiskStore> listDiskStoresIncludingRegionOwned();
CqService getCqService();
@@ -173,11 +184,94 @@ public interface InternalCache extends Cache, Extensible<Cache> {
Set<PartitionedRegion> getPartitionedRegions();
- void addRegionListener(RegionListener l);
+ void addRegionListener(RegionListener regionListener);
- void removeRegionListener(RegionListener l);
+ void removeRegionListener(RegionListener regionListener);
Set<RegionListener> getRegionListeners();
CacheConfig getCacheConfig();
+
+ boolean getPdxReadSerializedByAnyGemFireServices();
+
+ BackupManager getBackupManager();
+
+ void setDeclarativeCacheConfig(CacheConfig cacheConfig);
+
+ void initializePdxRegistry();
+
+ void readyDynamicRegionFactory();
+
+ void setBackupFiles(List<File> backups);
+
+ void addDeclarableProperties(final Map<Declarable, Properties> mapOfNewDeclarableProps);
+
+ void setInitializer(Declarable initializer, Properties initializerProps);
+
+ boolean hasPool();
+
+ DiskStoreFactory createDiskStoreFactory(DiskStoreAttributes attrs);
+
+ void determineDefaultPool();
+
+ <K, V> Region<K, V> basicCreateRegion(String name, RegionAttributes<K, V> attrs)
+ throws RegionExistsException, TimeoutException;
+
+ BackupManager startBackup(InternalDistributedMember sender) throws IOException;
+
+ Throwable getDisconnectCause();
+
+ void addPartitionedRegion(PartitionedRegion region);
+
+ void removePartitionedRegion(PartitionedRegion region);
+
+ void addDiskStore(DiskStoreImpl dsi);
+
+ TXEntryStateFactory getTXEntryStateFactory();
+
+ EventTracker.ExpiryTask getEventTrackerTask();
+
+ void removeDiskStore(DiskStoreImpl diskStore);
+
+ void addGatewaySender(GatewaySender sender);
+
+ void addAsyncEventQueue(AsyncEventQueueImpl asyncQueue);
+
+ void removeAsyncEventQueue(AsyncEventQueue asyncQueue);
+
+ QueryMonitor getQueryMonitor();
+
+ void close(String reason, Throwable systemFailureCause, boolean keepAlive, boolean keepDS);
+
+ JmxManagerAdvisor getJmxManagerAdvisor();
+
+ List<Properties> getDeclarableProperties(final String className);
+
+ int getUpTime();
+
+ Set<Region<?, ?>> rootRegions(boolean includePRAdminRegions);
+
+ Set<LocalRegion> getAllRegions();
+
+ DistributedRegion getRegionInDestroy(String path);
+
+ void addRegionOwnedDiskStore(DiskStoreImpl dsi);
+
+ DiskStoreMonitor getDiskStoreMonitor();
+
+ void close(String reason, Throwable optionalCause);
+
+ LocalRegion getRegionByPathForProcessing(String path);
+
+ List getCacheServersAndGatewayReceiver();
+
+ boolean isGlobalRegionInitializing(String fullPath);
+
+ DistributionAdvisor getDistributionAdvisor();
+
+ void setQueryMonitorRequiredForResourceManager(boolean required);
+
+ boolean isQueryMonitorDisabledForLowMemory();
+
+ boolean isRESTServiceRunning();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
index b919244..ce78d1f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -35,9 +32,6 @@ import org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitRespons
import org.apache.geode.internal.cache.TXRemoteCommitMessage.TXRemoteCommitReplyMessage;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- */
public class JtaAfterCompletionMessage extends TXMessage {
private static final Logger logger = LogService.getLogger();
@@ -78,12 +72,6 @@ public class JtaAfterCompletionMessage extends TXMessage {
return response;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXMessage#operateOnTx(org.apache.geode.internal.cache.TXId)
- */
@Override
protected boolean operateOnTx(TXId txId, DistributionManager dm) throws RemoteOperationException {
TXManagerImpl txMgr = GemFireCacheImpl.getInstance().getTXMgr();
@@ -99,20 +87,10 @@ public class JtaAfterCompletionMessage extends TXMessage {
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.DataSerializableFixedID#getDSFID()
- */
public int getDSFID() {
return JTA_AFTER_COMPLETION_MESSAGE;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXMessage#toData(java.io.DataOutput)
- */
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
@@ -120,11 +98,6 @@ public class JtaAfterCompletionMessage extends TXMessage {
out.writeInt(this.processorType);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TXMessage#fromData(java.io.DataInput)
- */
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaBeforeCompletionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaBeforeCompletionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaBeforeCompletionMessage.java
index 863f47d..f491261 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaBeforeCompletionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaBeforeCompletionMessage.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.util.Collections;
@@ -31,13 +28,12 @@ import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.logging.LogService;
-/**
- *
- */
public class JtaBeforeCompletionMessage extends TXMessage {
private static final Logger logger = LogService.getLogger();
- public JtaBeforeCompletionMessage() {}
+ public JtaBeforeCompletionMessage() {
+ // do nothing
+ }
public JtaBeforeCompletionMessage(int txUniqId, InternalDistributedMember onBehalfOfClientMember,
ReplyProcessor21 processor) {
@@ -58,15 +54,9 @@ public class JtaBeforeCompletionMessage extends TXMessage {
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.geode.internal.cache.TXMessage#operateOnTx(org.apache.geode.internal.cache.TXId)
- */
@Override
protected boolean operateOnTx(TXId txId, DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
TXManagerImpl txMgr = cache.getTXMgr();
if (logger.isDebugEnabled()) {
logger.debug("JTA: Calling beforeCompletion for :{}", txId);
@@ -75,11 +65,6 @@ public class JtaBeforeCompletionMessage extends TXMessage {
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.DataSerializableFixedID#getDSFID()
- */
public int getDSFID() {
return JTA_BEFORE_COMPLETION_MESSAGE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/LeafRegionEntry.cpp
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LeafRegionEntry.cpp b/geode-core/src/main/java/org/apache/geode/internal/cache/LeafRegionEntry.cpp
index 141e3a4..e503738 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LeafRegionEntry.cpp
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LeafRegionEntry.cpp
@@ -254,7 +254,7 @@ public class LEAF_CLASS extends PARENT_CLASS {
this.value = v;
}
#endif
- protected long getlastModifiedField() {
+ protected long getLastModifiedField() {
return lastModifiedUpdater.get(this);
}
protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalDataSet.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalDataSet.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalDataSet.java
index 248d655..483b044 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalDataSet.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalDataSet.java
@@ -265,7 +265,7 @@ public class LocalDataSet implements Region, QueryExecutor {
this.proxy.forceRolling();
}
- public GemFireCacheImpl getCache() {
+ public InternalCache getCache() {
return this.proxy.getCache();
}
[35/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java
index 112f2fa..7ee1f4e 100644
--- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java
+++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCALocalTransaction.java
@@ -23,62 +23,43 @@ import javax.transaction.TransactionManager;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.TransactionId;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.TXStateProxy;
-
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
-/**
- *
- *
- */
public class JCALocalTransaction implements LocalTransaction {
- private volatile GemFireCacheImpl cache;
+ private volatile InternalCache cache;
private volatile TXManagerImpl gfTxMgr;
private volatile TransactionId tid;
- private static final boolean DEBUG = false;
-
private volatile boolean initDone = false;
- JCALocalTransaction(GemFireCacheImpl cache, TXManagerImpl tm) {
+ JCALocalTransaction(InternalCache cache, TXManagerImpl tm) {
this.cache = cache;
this.gfTxMgr = tm;
this.initDone = true;
- // System.out.println("Asif:JCALocalTransaction:Param contrcutr for tx ="+
- // this );
}
JCALocalTransaction() {
this.cache = null;
this.gfTxMgr = null;
this.initDone = false;
- // System.out.println("Asif:JCALocalTransaction:Empty constructor for tx ="+
- // this );
}
+ @Override
public void begin() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCALocalTransaction:begin");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
try {
- if (!initDone || this.cache.isClosed()) {
+ if (!this.initDone || this.cache.isClosed()) {
this.init();
}
- // System.out.println("JCALocalTransaction:Asif: cache is ="+cache +
- // " for tx ="+this);
- LogWriter logger = cache.getLogger();
+ LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction::begin:");
}
- TransactionManager tm = cache.getJTATransactionManager();
+ TransactionManager tm = this.cache.getJTATransactionManager();
if (this.tid != null) {
throw new LocalTransactionException(" A transaction is already in progress");
}
@@ -106,28 +87,13 @@ public class JCALocalTransaction implements LocalTransaction {
}
}
} catch (SystemException e) {
- // this.onError();
throw new ResourceException(e);
}
- // Not to be invoked for local transactions managed by the container
- // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
- // ConnectionEvent ce = new ConnectionEvent(this,
- // ConnectionEvent.LOCAL_TRANSACTION_STARTED);
- // while (itr.hasNext()) {
- // itr.next().localTransactionStarted(ce);
- // }
-
}
+ @Override
public void commit() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCALocalTransaction:commit");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
- LogWriter logger = cache.getLogger();
+ LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction:invoked commit");
}
@@ -140,31 +106,18 @@ public class JCALocalTransaction implements LocalTransaction {
this.gfTxMgr.commit();
this.tid = null;
} catch (Exception e) {
- throw new LocalTransactionException(e.toString());
+ throw new LocalTransactionException(e.toString(), e);
}
- // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
- // ConnectionEvent ce = new
- // ConnectionEvent(this,ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
- // while( itr.hasNext()) {
- // itr.next().localTransactionCommitted(ce);
- // }
-
}
+ @Override
public void rollback() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JJCALocalTransaction:rollback");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
TXStateProxy tsp = this.gfTxMgr.getTXState();
if (tsp != null && this.tid != tsp.getTransactionId()) {
throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid
+ " attempting to commit a different transaction");
}
- LogWriter logger = cache.getLogger();
+ LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCALocalTransaction:invoked rollback");
}
@@ -175,31 +128,24 @@ public class JCALocalTransaction implements LocalTransaction {
if (ise.getMessage()
.equals(LocalizedStrings.TXManagerImpl_THREAD_DOES_NOT_HAVE_AN_ACTIVE_TRANSACTION
.toLocalizedString())) {
- // /ignore;
+ // ignore
} else {
throw new ResourceException(ise);
}
- } catch (Exception e) {
+ } catch (RuntimeException e) {
throw new ResourceException(e);
} finally {
this.tid = null;
}
- // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
- // ConnectionEvent ce = new ConnectionEvent(this,
- // ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
- // while (itr.hasNext()) {
- // itr.next().localTransactionRolledback(ce);
- // }
-
}
- private void init() throws SystemException {
- this.cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+ private void init() {
+ this.cache = (InternalCache) CacheFactory.getAnyInstance();
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:init. Inside init");
}
- gfTxMgr = cache.getTxManager();
+ this.gfTxMgr = this.cache.getTxManager();
this.initDone = true;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java
index 520f7e2..c654e64 100644
--- a/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java
+++ b/geode-core/src/jca/java/org/apache/geode/internal/ra/spi/JCAManagedConnection.java
@@ -31,239 +31,196 @@ import javax.resource.spi.LocalTransaction;
import javax.resource.spi.ManagedConnection;
import javax.resource.spi.ManagedConnectionMetaData;
import javax.security.auth.Subject;
-import javax.transaction.SystemException;
import javax.transaction.xa.XAResource;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.ra.GFConnectionImpl;
-/**
- *
- *
- */
-public class JCAManagedConnection implements ManagedConnection
+public class JCAManagedConnection implements ManagedConnection {
-{
private final List<ConnectionEventListener> listeners;
- private volatile TXManagerImpl gfTxMgr;
+ private volatile TXManagerImpl transactionManager;
- // private volatile TransactionId currentTxID;
- private volatile GemFireCacheImpl cache;
+ private volatile InternalCache cache;
- private volatile boolean initDone = false;
+ private volatile boolean initialized = false;
- private volatile PrintWriter logger;
+ private volatile PrintWriter logWriter;
- private JCAManagedConnectionFactory factory;
+ private final JCAManagedConnectionFactory connectionFactory;
- private volatile Set<GFConnectionImpl> connections;
+ private final Set<GFConnectionImpl> connections;
- private volatile JCALocalTransaction localTran;
+ private volatile JCALocalTransaction localTransaction;
- private final static boolean DEBUG = false;
-
- public JCAManagedConnection(JCAManagedConnectionFactory fact) {
- this.factory = fact;
- this.listeners = Collections
- .<ConnectionEventListener>synchronizedList(new ArrayList<ConnectionEventListener>());
- this.localTran = new JCALocalTransaction();
- this.connections =
- Collections.<GFConnectionImpl>synchronizedSet(new HashSet<GFConnectionImpl>());
+ JCAManagedConnection(JCAManagedConnectionFactory connectionFactory) {
+ this.connectionFactory = connectionFactory;
+ this.listeners = Collections.synchronizedList(new ArrayList<>());
+ this.localTransaction = new JCALocalTransaction();
+ this.connections = Collections.synchronizedSet(new HashSet<>());
}
+ @Override
public void addConnectionEventListener(ConnectionEventListener listener) {
this.listeners.add(listener);
-
}
- public void associateConnection(Object conn) throws ResourceException {
- if (!(conn instanceof GFConnectionImpl)) {
+ @Override
+ public void associateConnection(Object connection) throws ResourceException {
+ if (!(connection instanceof GFConnectionImpl)) {
throw new ResourceException("Connection is not of type GFConnection");
}
- ((GFConnectionImpl) conn).resetManagedConnection(this);
- this.connections.add((GFConnectionImpl) conn);
+ ((GFConnectionImpl) connection).resetManagedConnection(this);
+ this.connections.add((GFConnectionImpl) connection);
}
+ @Override
public void cleanup() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCAManagedConnection:cleanup");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
synchronized (this.connections) {
- Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
- while (connsItr.hasNext()) {
- GFConnectionImpl conn = connsItr.next();
- conn.invalidate();
- connsItr.remove();
+ Iterator<GFConnectionImpl> iterator = this.connections.iterator();
+ while (iterator.hasNext()) {
+ GFConnectionImpl connection = iterator.next();
+ connection.invalidate();
+ iterator.remove();
}
}
- if (this.localTran == null || this.localTran.transactionInProgress()) {
- if (this.initDone && !this.cache.isClosed()) {
- this.localTran = new JCALocalTransaction(cache, gfTxMgr);
+ if (this.localTransaction == null || this.localTransaction.transactionInProgress()) {
+ if (this.initialized && !this.cache.isClosed()) {
+ this.localTransaction = new JCALocalTransaction(this.cache, this.transactionManager);
} else {
- this.localTran = new JCALocalTransaction();
+ this.localTransaction = new JCALocalTransaction();
}
}
-
}
+ @Override
public void destroy() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCAManagedConnection:destroy");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
synchronized (this.connections) {
- Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
- while (connsItr.hasNext()) {
- GFConnectionImpl conn = connsItr.next();
- conn.invalidate();
- connsItr.remove();
+ Iterator<GFConnectionImpl> iterator = this.connections.iterator();
+ while (iterator.hasNext()) {
+ GFConnectionImpl connection = iterator.next();
+ connection.invalidate();
+ iterator.remove();
}
}
- this.gfTxMgr = null;
+ this.transactionManager = null;
this.cache = null;
- this.localTran = null;
+ this.localTransaction = null;
this.listeners.clear();
}
+ @Override
public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCAManagedConnection:getConnection");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
+ if (!this.initialized || this.cache.isClosed()) {
+ init();
}
- try {
- if (!this.initDone || this.cache.isClosed()) {
- init();
- }
- LogWriter logger = this.cache.getLogger();
- if (logger.fineEnabled()) {
- logger.fine("JCAManagedConnection:getConnection. Returning new Connection");
- }
-
- GFConnectionImpl conn = new GFConnectionImpl(this);
- this.connections.add(conn);
- return conn;
- } catch (SystemException e) {
- this.onError(e);
- throw new ResourceException("GemFire Resource unavailable", e);
+ LogWriter logger = this.cache.getLogger();
+ if (logger.fineEnabled()) {
+ logger.fine("JCAManagedConnection:getConnection. Returning new Connection");
}
+
+ GFConnectionImpl connection = new GFConnectionImpl(this);
+ this.connections.add(connection);
+ return connection;
}
- private void init() throws SystemException {
- this.cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+ private void init() {
+ this.cache = (InternalCache) CacheFactory.getAnyInstance();
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:init. Inside init");
}
- gfTxMgr = cache.getTxManager();
- this.initDone = true;
+ this.transactionManager = this.cache.getTxManager();
+ this.initialized = true;
}
+ @Override
public LocalTransaction getLocalTransaction() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCAManagedConnection:getLocalTransaction");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
-
- return this.localTran;
+ return this.localTransaction;
}
+ @Override
public PrintWriter getLogWriter() throws ResourceException {
- return this.logger;
+ return this.logWriter;
}
+ @Override
public ManagedConnectionMetaData getMetaData() throws ResourceException {
- if (DEBUG) {
- try {
- throw new NullPointerException("Asif:JCAManagedConnection:getMetaData");
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- }
- }
- if (this.initDone && !this.cache.isClosed()) {
+ if (this.initialized && !this.cache.isClosed()) {
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:getMetaData");
}
}
- return new JCAManagedConnectionMetaData(this.factory.getProductName(),
- this.factory.getVersion(), this.factory.getUserName());
+ return new JCAManagedConnectionMetaData(this.connectionFactory.getProductName(),
+ this.connectionFactory.getVersion(), this.connectionFactory.getUserName());
}
+ @Override
public XAResource getXAResource() throws ResourceException {
throw new NotSupportedException("XA Transaction not supported");
}
+ @Override
public void removeConnectionEventListener(ConnectionEventListener arg0) {
this.listeners.remove(arg0);
}
+ @Override
public void setLogWriter(PrintWriter logger) throws ResourceException {
- this.logger = logger;
+ this.logWriter = logger;
}
- private void onError(Exception e) {
-
- this.localTran = null;
+ private void onError(Exception e) { // TODO: currently unused
+ this.localTransaction = null;
synchronized (this.connections) {
- Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
- while (connsItr.hasNext()) {
- GFConnectionImpl conn = connsItr.next();
- conn.invalidate();
+ Iterator<GFConnectionImpl> iterator = this.connections.iterator();
+ while (iterator.hasNext()) {
+ GFConnectionImpl connection = iterator.next();
+ connection.invalidate();
+
synchronized (this.listeners) {
- Iterator<ConnectionEventListener> itr = this.listeners.iterator();
- ConnectionEvent ce =
+ ConnectionEvent event =
new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, e);
- ce.setConnectionHandle(conn);
- while (itr.hasNext()) {
- itr.next().connectionErrorOccurred(ce);
+ event.setConnectionHandle(connection);
+ for (ConnectionEventListener listener : this.listeners) {
+ listener.connectionErrorOccurred(event);
}
}
- connsItr.remove();
+
+ iterator.remove();
}
}
-
}
- public void onClose(GFConnectionImpl conn) throws ResourceException {
- conn.invalidate();
- this.connections.remove(conn);
+ public void onClose(GFConnectionImpl connection) {
+ connection.invalidate();
+ this.connections.remove(connection);
+
synchronized (this.listeners) {
- Iterator<ConnectionEventListener> itr = this.listeners.iterator();
- ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
- ce.setConnectionHandle(conn);
- while (itr.hasNext()) {
- itr.next().connectionClosed(ce);
+ Iterator<ConnectionEventListener> iterator = this.listeners.iterator();
+ ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+ event.setConnectionHandle(connection);
+ while (iterator.hasNext()) {
+ iterator.next().connectionClosed(event);
}
}
+
if (this.connections.isEmpty()) {
- // safe to dissociate this managedconnection so that it can go to pool
- if (this.initDone && !this.cache.isClosed()) {
- this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr);
+ // safe to dissociate this managed connection so that it can go to pool
+ if (this.initialized && !this.cache.isClosed()) {
+ this.localTransaction = new JCALocalTransaction(this.cache, this.transactionManager);
} else {
- this.localTran = new JCALocalTransaction();
+ this.localTransaction = new JCALocalTransaction();
}
}
-
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/DataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/DataSerializer.java b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
index 58518f4..fa6d6da 100644
--- a/geode-core/src/main/java/org/apache/geode/DataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
@@ -59,6 +59,7 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -1837,7 +1838,7 @@ public abstract class DataSerializer {
typeString = readString(in);
}
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
boolean lookForPdxInstance = false;
ClassNotFoundException cnfEx = null;
if (typeCode == DSCODE.CLASS && cache != null
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java b/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
index 5b4e59e..9dda7c1 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
@@ -14,6 +14,16 @@
*/
package org.apache.geode.admin;
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.PoolManager;
@@ -24,17 +34,18 @@ import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.admin.ClientHealthMonitoringRegion;
import org.apache.geode.internal.admin.remote.ClientHealthStats;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.CacheClientStatus;
+import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.PartitionedRegionStatus;
+import org.apache.geode.internal.cache.RegionStatus;
import org.apache.geode.internal.cache.tier.InternalClientMembership;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.util.*;
+import org.apache.geode.internal.net.SocketCreator;
/**
* Class <code>GemFireMemberStatus</code> provides the status of a specific GemFire member VM. This
@@ -528,7 +539,7 @@ public class GemFireMemberStatus implements Serializable {
// Get Client Health Stats
// Assert.assertTrue(cache != null); (cannot be null)
Region clientHealthMonitoringRegion =
- ClientHealthMonitoringRegion.getInstance((GemFireCacheImpl) cache);
+ ClientHealthMonitoringRegion.getInstance((InternalCache) cache);
if (clientHealthMonitoringRegion != null) {
String[] clients = (String[]) clientHealthMonitoringRegion.keySet().toArray(new String[0]);
for (int i = 0; i < clients.length; i++) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/internal/CacheHealthEvaluator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/CacheHealthEvaluator.java b/geode-core/src/main/java/org/apache/geode/admin/internal/CacheHealthEvaluator.java
index f7ff9ed..434ea5a 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/CacheHealthEvaluator.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/CacheHealthEvaluator.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.admin.internal;
+import static java.lang.Long.*;
+
import java.util.List;
import org.apache.logging.log4j.Logger;
@@ -28,13 +30,13 @@ import org.apache.geode.internal.OSProcess;
import org.apache.geode.internal.cache.CacheLifecycleListener;
import org.apache.geode.internal.cache.CachePerfStats;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
/**
- * Contains the logic for evaluating the health of a GemFire <code>Cache</code> instance according
- * to the thresholds provided in a {@link CacheHealthConfig}.
- *
+ * Contains the logic for evaluating the health of a GemFire {@code Cache} instance according to the
+ * thresholds provided in a {@link CacheHealthConfig}.
*
* @since GemFire 3.5
*/
@@ -42,15 +44,15 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
private static final Logger logger = LogService.getLogger();
- /** The config from which we get the evaulation criteria */
- private CacheHealthConfig config;
+ /** The config from which we get the evaluation criteria */
+ private final CacheHealthConfig config;
/** The description of the cache being evaluated */
private String description;
/**
- * Statistics about the <code>Cache</code> instance. If no cache has been created in this VM, this
- * field will be <code>null</code>
+ * Statistics about the {@code Cache} instance. If no cache has been created in this VM, this
+ * field will be {@code null}
*/
private CachePerfStats cacheStats;
@@ -69,21 +71,18 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
/** The previous value of the gets stat */
private long prevGets;
- ////////////////////// Constructors //////////////////////
-
/**
- * Creates a new <code>CacheHealthEvaluator</code>
+ * Creates a new {@code CacheHealthEvaluator}
*/
CacheHealthEvaluator(GemFireHealthConfig config, DM dm) {
super(config, dm);
this.config = config;
InternalDistributedSystem system = dm.getSystem();
- GemFireCacheImpl cache;
+ InternalCache cache;
try {
- cache = (GemFireCacheImpl) CacheFactory.getInstance(system);
-
- } catch (CancelException ex) {
+ cache = (InternalCache) CacheFactory.getInstance(system);
+ } catch (CancelException ignore) {
// No cache in this VM
cache = null;
}
@@ -92,8 +91,6 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
GemFireCacheImpl.addCacheLifecycleListener(this);
}
- //////////////////// Instance Methods ////////////////////
-
@Override
protected String getDescription() {
return this.description;
@@ -102,14 +99,14 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
/**
* Initializes the state of this evaluator based on the given cache instance.
*/
- private void initialize(GemFireCacheImpl cache, DM dm) {
- StringBuffer sb = new StringBuffer();
+ private void initialize(InternalCache cache, DM dm) {
+ StringBuilder sb = new StringBuilder();
if (cache != null) {
this.cacheStats = cache.getCachePerfStats();
sb.append("Cache \"");
sb.append(cache.getName());
- sb.append("\"");
+ sb.append('"');
} else {
sb.append("No Cache");
@@ -125,21 +122,22 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
this.description = sb.toString();
}
- public void cacheCreated(GemFireCacheImpl cache) {
+ @Override
+ public void cacheCreated(InternalCache cache) {
InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
DM dm = system.getDistributionManager();
initialize(cache, dm);
}
/**
- * Checks to make sure that the average <code>netSearch</code> time during the previous health
- * check interval is less than the {@linkplain CacheHealthConfig#getMaxNetSearchTime threshold}.
- * If not, the status is "okay" health.
+ * Checks to make sure that the average {@code netSearch} time during the previous health check
+ * interval is less than the {@linkplain CacheHealthConfig#getMaxNetSearchTime threshold}. If not,
+ * the status is "okay" health.
*
* @see CachePerfStats#getNetsearchTime
* @see CachePerfStats#getNetsearchesCompleted
*/
- void checkNetSearchTime(List status) {
+ private void checkNetSearchTime(List status) {
if (this.cacheStats == null || isFirstEvaluation() || this.cacheStats.isClosed()) {
return;
}
@@ -156,21 +154,21 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
if (ratio > threshold) {
String s =
LocalizedStrings.CacheHealthEvaluator_THE_AVERAGE_DURATION_OF_A_CACHE_NETSEARCH_0_MS_EXCEEDS_THE_THRESHOLD_1_MS
- .toLocalizedString(new Object[] {ratio, threshold});
+ .toLocalizedString(ratio, threshold);
status.add(okayHealth(s));
}
}
}
/**
- * Checks to make sure that the average <code>load</code> time during the previous health check
+ * Checks to make sure that the average {@code load} time during the previous health check
* interval is less than the {@linkplain CacheHealthConfig#getMaxLoadTime threshold}. If not, the
* status is "okay" health.
*
* @see CachePerfStats#getLoadTime
* @see CachePerfStats#getLoadsCompleted
*/
- void checkLoadTime(List status) {
+ private void checkLoadTime(List<HealthStatus> status) {
if (this.cacheStats == null || isFirstEvaluation() || this.cacheStats.isClosed()) {
return;
}
@@ -180,7 +178,7 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
long deltaLoadsCompleted = this.cacheStats.getLoadsCompleted() - this.prevLoadsCompleted;
if (logger.isDebugEnabled()) {
- logger.debug("Completed {} loads in {} ms", deltaLoadsCompleted, (deltaLoadTime / 1000000));
+ logger.debug("Completed {} loads in {} ms", deltaLoadsCompleted, deltaLoadTime / 1000000);
}
if (deltaLoadsCompleted != 0) {
@@ -191,7 +189,7 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
if (ratio > threshold) {
String s =
LocalizedStrings.CacheHealthEvaluator_THE_AVERAGE_DURATION_OF_A_CACHE_LOAD_0_MS_EXCEEDS_THE_THRESHOLD_1_MS
- .toLocalizedString(new Object[] {ratio, threshold});
+ .toLocalizedString(ratio, threshold);
if (logger.isDebugEnabled()) {
logger.debug(s);
}
@@ -219,7 +217,7 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
* @see CachePerfStats#getLoadsCompleted
* @see CachePerfStats#getNetsearchesCompleted
*/
- void checkHitRatio(List status) {
+ private void checkHitRatio(List<HealthStatus> status) {
if (this.cacheStats == null || isFirstEvaluation() || this.cacheStats.isClosed()) {
return;
}
@@ -230,12 +228,12 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
long deltaNetsearchesCompleted =
this.cacheStats.getNetsearchesCompleted() - this.prevNetsearchesCompleted;
- double hits = (deltaGets - (deltaLoadsCompleted + deltaNetsearchesCompleted));
+ double hits = deltaGets - (deltaLoadsCompleted + deltaNetsearchesCompleted);
double hitRatio = hits / deltaGets;
double threshold = this.config.getMinHitRatio();
if (hitRatio < threshold) {
String s = "The hit ratio of this Cache (" + hitRatio + ") is below the threshold ("
- + threshold + ")";
+ + threshold + ')';
status.add(okayHealth(s));
}
}
@@ -246,7 +244,7 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
* size} does not exceed the {@linkplain CacheHealthConfig#getMaxEventQueueSize threshold}. If it
* does, the status is "okay" health.
*/
- void checkEventQueueSize(List status) {
+ private void checkEventQueueSize(List<HealthStatus> status) {
if (this.cacheStats == null || isFirstEvaluation() || this.cacheStats.isClosed()) {
return;
}
@@ -256,13 +254,11 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
if (eventQueueSize > threshold) {
String s =
LocalizedStrings.CacheHealthEvaluator_THE_SIZE_OF_THE_CACHE_EVENT_QUEUE_0_MS_EXCEEDS_THE_THRESHOLD_1_MS
- .toLocalizedString(
- new Object[] {Long.valueOf(eventQueueSize), Long.valueOf(threshold)});
+ .toLocalizedString(valueOf(eventQueueSize), valueOf(threshold));
status.add(okayHealth(s));
}
}
-
/**
* Updates the previous values of statistics
*/
@@ -285,7 +281,6 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
@Override
protected void check(List status) {
-
checkNetSearchTime(status);
checkLoadTime(status);
checkHitRatio(status);
@@ -300,7 +295,7 @@ class CacheHealthEvaluator extends AbstractHealthEvaluator implements CacheLifec
}
@Override
- public void cacheClosed(GemFireCacheImpl cache) {
+ public void cacheClosed(InternalCache cache) {
// do nothing
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
index 25abd7e..f01666d 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
@@ -40,6 +40,7 @@ import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
import org.apache.geode.internal.admin.remote.AdminResponse;
import org.apache.geode.internal.admin.remote.CliLegacyMessage;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
@@ -92,7 +93,7 @@ public class FinishBackupRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
HashSet<PersistentID> persistentIds;
if (cache == null || cache.getBackupManager() == null) {
persistentIds = new HashSet<PersistentID>();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
index ff6dd9d..71348be 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
@@ -19,6 +19,7 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.geode.CancelException;
+import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.persistence.PersistentID;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionManager;
@@ -28,6 +29,7 @@ import org.apache.geode.internal.admin.remote.AdminResponse;
import org.apache.geode.internal.admin.remote.CliLegacyMessage;
import org.apache.geode.internal.cache.DiskStoreImpl;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
/**
* A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
@@ -65,11 +67,10 @@ public class FlushToDiskRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
- HashSet<PersistentID> persistentIds;
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
- Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned();
- for (DiskStoreImpl store : diskStores) {
+ Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
+ for (DiskStore store : diskStores) {
store.flush();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java b/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java
index 951b364..b257a17 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java
@@ -14,55 +14,45 @@
*/
package org.apache.geode.admin.internal;
+import java.util.List;
+
import org.apache.geode.CancelException;
-import org.apache.geode.admin.*;
+import org.apache.geode.admin.GemFireHealthConfig;
+import org.apache.geode.admin.MemberHealthConfig;
import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.internal.*;
-import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.OSProcess;
import org.apache.geode.internal.cache.CachePerfStats;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.statistics.GemFireStatSampler;
import org.apache.geode.internal.statistics.platform.ProcessStats;
-import java.util.*;
-
/**
* Contains the logic for evaluating the health of a GemFire distributed system member according to
* the thresholds provided in a {@link MemberHealthConfig}.
*
- * @see VMStats
- * @see ProcessStats
- * @see DMStats
- *
- *
* @since GemFire 3.5
*/
-/**
- *
- */
class MemberHealthEvaluator extends AbstractHealthEvaluator {
/** The config from which we get the evaluation criteria */
- private MemberHealthConfig config;
+ private final MemberHealthConfig config;
/** The description of the member being evaluated */
- private String description;
-
- // /** Statistics about this VM (may be null) */
- // private VMStatsContract vmStats;
+ private final String description;
/** Statistics about this process (may be null) */
private ProcessStats processStats;
/** Statistics about the distribution manager */
- private DMStats dmStats;
+ private final DMStats dmStats;
/** The previous value of the reply timeouts stat */
private long prevReplyTimeouts;
- ////////////////////// Constructors //////////////////////
-
/**
* Creates a new <code>MemberHealthEvaluator</code>
*/
@@ -81,7 +71,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
this.dmStats = dm.getStats();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("Application VM member ");
sb.append(dm.getId());
int pid = OSProcess.getId();
@@ -92,8 +82,6 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
this.description = sb.toString();
}
- //////////////////// Instance Methods ////////////////////
-
@Override
protected String getDescription() {
return this.description;
@@ -115,7 +103,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
if (vmSize > threshold) {
String s =
LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THIS_VM_0_MEGABYTES_EXCEEDS_THE_THRESHOLD_1_MEGABYTES
- .toLocalizedString(new Object[] {Long.valueOf(vmSize), Long.valueOf(threshold)});
+ .toLocalizedString(vmSize, threshold);
status.add(okayHealth(s));
}
}
@@ -126,14 +114,13 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
* {@linkplain MemberHealthConfig#getMaxMessageQueueSize threshold}. If not, the status is "okay"
* health.
*/
- void checkMessageQueueSize(List status) {
+ private void checkMessageQueueSize(List status) {
long threshold = this.config.getMaxMessageQueueSize();
long overflowSize = this.dmStats.getOverflowQueueSize();
if (overflowSize > threshold) {
String s =
LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THE_OVERFLOW_QUEUE_0_EXCEEDS_THE_THRESHOLD_1
- .toLocalizedString(
- new Object[] {Long.valueOf(overflowSize), Long.valueOf(threshold)});
+ .toLocalizedString(overflowSize, threshold);
status.add(okayHealth(s));
}
}
@@ -143,7 +130,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
* does not exceed the {@linkplain MemberHealthConfig#getMaxReplyTimeouts threshold}. If not, the
* status is "okay" health.
*/
- void checkReplyTimeouts(List status) {
+ private void checkReplyTimeouts(List status) {
if (isFirstEvaluation()) {
return;
}
@@ -153,74 +140,45 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
if (deltaReplyTimeouts > threshold) {
String s =
LocalizedStrings.MemberHealthEvaluator_THE_NUMBER_OF_MESSAGE_REPLY_TIMEOUTS_0_EXCEEDS_THE_THRESHOLD_1
- .toLocalizedString(
- new Object[] {Long.valueOf(deltaReplyTimeouts), Long.valueOf(threshold)});
+ .toLocalizedString(deltaReplyTimeouts, threshold);
status.add(okayHealth(s));
}
}
/**
- * See if the multicast retransmission ratio is okay
- */
- void checkRetransmissionRatio(List status) {
- double threshold = this.config.getMaxRetransmissionRatio();
- int mcastMessages = this.dmStats.getMcastWrites();
- if (mcastMessages > 100000) { // avoid initial state & int overflow
- // the ratio we actually use here is (retransmit requests) / (mcast datagram writes)
- // a single retransmit request may include multiple missed messages
- double ratio =
- (this.dmStats.getMcastRetransmits() * 1.0) / (this.dmStats.getMcastWrites() * 1.0);
- if (ratio > threshold) {
- String s = "The number of message retransmissions (" + ratio + ") exceeds the threshold ("
- + threshold + ")";
- status.add(okayHealth(s));
- }
- }
- }
-
- /**
* The function keeps updating the health of the cache based on roles required by the regions and
- * their reliablity policies.
- *
+ * their reliability policies.
*/
+ private void checkCacheRequiredRolesMeet(List status) {
+ // will have to call here okayHealth() or poorHealth()
- void checkCacheRequiredRolesMeet(List status) {
- // will have to call here okeyHealth() or poorHealth()
- // GemFireCache cache = (GemFireCache)CacheFactory.getAnyInstance();
-
- // CachePerfStats cPStats= null;
try {
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
- CachePerfStats cPStats = null;
- cPStats = cache.getCachePerfStats();
+ InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
+ CachePerfStats cPStats = cache.getCachePerfStats();
if (cPStats.getReliableRegionsMissingFullAccess() > 0) {
// health is okay.
int numRegions = cPStats.getReliableRegionsMissingFullAccess();
status.add(okayHealth(
LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_BUT_ARE_CONFIGURED_FOR_FULL_ACCESS
- .toLocalizedString(Integer.valueOf(numRegions))));
+ .toLocalizedString(numRegions)));
} else if (cPStats.getReliableRegionsMissingLimitedAccess() > 0) {
// health is poor
int numRegions = cPStats.getReliableRegionsMissingLimitedAccess();
status.add(poorHealth(
LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITH_LIMITED_ACCESS
- .toLocalizedString(Integer.valueOf(numRegions))));
+ .toLocalizedString(numRegions)));
} else if (cPStats.getReliableRegionsMissingNoAccess() > 0) {
// health is poor
int numRegions = cPStats.getReliableRegionsMissingNoAccess();
status.add(poorHealth(
LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITHOUT_ACCESS
- .toLocalizedString(Integer.valueOf(numRegions))));
- } // else{
- // health is good/okay
- // status.add(okayHealth("All regions have there required roles meet"));
- // }
+ .toLocalizedString(numRegions)));
+ }
} catch (CancelException ignore) {
}
}
-
/**
* Updates the previous values of statistics
*/
@@ -234,7 +192,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
checkMessageQueueSize(status);
checkReplyTimeouts(status);
// will have to add another call to check for roles
- // missing and reliablity attributed.
+ // missing and reliability attributed.
checkCacheRequiredRolesMeet(status);
updatePrevious();
@@ -242,6 +200,6 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator {
@Override
void close() {
-
+ // nothing
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
index 7025721..0c096f9 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
@@ -36,6 +36,7 @@ import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
import org.apache.geode.internal.admin.remote.AdminResponse;
import org.apache.geode.internal.admin.remote.CliLegacyMessage;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.persistence.BackupManager;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -79,10 +80,10 @@ public class PrepareBackupRequest extends CliLegacyMessage {
@Override
protected AdminResponse createResponse(DistributionManager dm) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
HashSet<PersistentID> persistentIds;
if (cache == null) {
- persistentIds = new HashSet<PersistentID>();
+ persistentIds = new HashSet<>();
} else {
try {
BackupManager manager = cache.startBackup(getSender());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java b/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java
index 1a46f24..08f7b9d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.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.io.File;
@@ -32,7 +31,6 @@ import org.apache.geode.internal.cache.AbstractRegion;
import org.apache.geode.internal.cache.DiskStoreFactoryImpl;
import org.apache.geode.internal.cache.DiskWriteAttributesImpl;
import org.apache.geode.internal.cache.EvictionAttributesImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionAttributesImpl;
import org.apache.geode.internal.cache.PartitionedRegionHelper;
import org.apache.geode.internal.cache.UserSpecifiedRegionAttributes;
@@ -40,34 +38,34 @@ import org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation;
import org.apache.geode.internal.i18n.LocalizedStrings;
/**
- * Creates instances of {@link RegionAttributes}. An <code>AttributesFactory</code> instance
- * maintains state for creating <code>RegionAttributes</code> instances. The setter methods are used
- * to change the settings that will be used for creating the next attributes instance with the
- * {@link #create} method. If you create a factory with the default constructor, then the factory is
- * set up to create attributes with all default settings. You can also create a factory by providing
- * a <code>RegionAttributes</code>, which will set up the new factory with the settings provided in
- * that attributes instance.
+ * Creates instances of {@link RegionAttributes}. An {@code AttributesFactory} instance maintains
+ * state for creating {@code RegionAttributes} instances. The setter methods are used to change the
+ * settings that will be used for creating the next attributes instance with the {@link #create}
+ * method. If you create a factory with the default constructor, then the factory is set up to
+ * create attributes with all default settings. You can also create a factory by providing a
+ * {@code RegionAttributes}, which will set up the new factory with the settings provided in that
+ * attributes instance.
*
* <p>
- * Once a <code>RegionAttributes</code> is created, it can only be modified after it has been used
- * to create a <code>Region</code>, and then only by using an {@link AttributesMutator} obtained
- * from the region.
+ * Once a {@code RegionAttributes} is created, it can only be modified after it has been used to
+ * create a {@code Region}, and then only by using an {@link AttributesMutator} obtained from the
+ * region.
*
* <h3>Attributes</h3>
* <h4>Callbacks</h4>
* <dl>
- * <dt>{@link CacheLoader} [<em>default:</em> <code>null</code>, meaning no loader]</dt>
+ * <dt>{@link CacheLoader} [<em>default:</em> {@code null}, meaning no loader]</dt>
* <dd>User-implemented plug-in for loading data on cache misses.<br>
* {@link #setCacheLoader} {@link RegionAttributes#getCacheLoader}
* {@link AttributesMutator#setCacheLoader}</dd>
*
- * <dt>{@link CacheWriter} [<em>default:</em> <code>null</code>, meaning no writer]</dt>
+ * <dt>{@link CacheWriter} [<em>default:</em> {@code null}, meaning no writer]</dt>
* <dd>User-implemented plug-in for intercepting cache modifications, e.g. for writing to an
* external data source.<br>
* {@link #setCacheWriter} {@link RegionAttributes#getCacheWriter}
* {@link AttributesMutator#setCacheWriter}</dd>
*
- * <dt>{@link CacheListener} [<em>default:</em> <code>null</code>, meaning no listener ]</dt>
+ * <dt>{@link CacheListener} [<em>default:</em> {@code null}, meaning no listener ]</dt>
* <dd>User-implemented plug-in for receiving and handling cache related events.<br>
* {@link #addCacheListener} {@link #initCacheListeners} {@link #initCacheListeners}
* {@link RegionAttributes#getCacheListeners} {@link AttributesMutator#initCacheListeners}
@@ -106,12 +104,12 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* whether acknowledgements are required, and whether distributed synchronization is required. <br>
* {@link #setScope} {@link RegionAttributes#getScope}</dd>
*
- * <dt>EarlyAck [<em>default:</em> <code>false</code>]</dt>
- * <dd>Whether or not acks required by <code>Scope.DISTRIBUTED_ACK</code> are sent after an
- * operation is processed. If <code>true</code> then remote caches will ACK before processing an
- * operation sent by the cache that has set earlyAck to <code>true</code>. Note that this attribute
- * is only meaningful on the cache that is initiating an operation; it does not matter what it is
- * set to on the cache that receives the operation.<br>
+ * <dt>EarlyAck [<em>default:</em> {@code false}]</dt>
+ * <dd>Whether or not acks required by {@code Scope.DISTRIBUTED_ACK} are sent after an operation is
+ * processed. If {@code true} then remote caches will ACK before processing an operation sent by the
+ * cache that has set earlyAck to {@code true}. Note that this attribute is only meaningful on the
+ * cache that is initiating an operation; it does not matter what it is set to on the cache that
+ * receives the operation.<br>
* {@link #setEarlyAck} {@link RegionAttributes#getEarlyAck}</dd>
*
* <dt>{@link SubscriptionAttributes} [<em>default:</em> {@link InterestPolicy#DEFAULT}]</dt>
@@ -119,44 +117,42 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* <br>
* {@link #setSubscriptionAttributes} {@link RegionAttributes#getSubscriptionAttributes}</dd>
*
- * <dt>EnableAsyncConflation [<em>default:</em> <code>false</code>]</dt>
+ * <dt>EnableAsyncConflation [<em>default:</em> {@code false}]</dt>
* <dd>Whether or not conflation is enabled for sending messages to async peers. Async peers are
- * those whose <code>async-distribution-timeout</code> gemfire.property is greater than zero.
- * AsyncConflation is ignored if the scope is <code>DISTRIBUTED_ACK</code> or <code>GLOBAL</code>.
- * Conflation is only done on entry update operations. It is done by dropping the earlier update
- * from the message queue. {@link #setEnableAsyncConflation}
+ * those whose {@code async-distribution-timeout} gemfire.property is greater than zero.
+ * AsyncConflation is ignored if the scope is {@code DISTRIBUTED_ACK} or {@code GLOBAL}. Conflation
+ * is only done on entry update operations. It is done by dropping the earlier update from the
+ * message queue. {@link #setEnableAsyncConflation}
* {@link RegionAttributes#getEnableAsyncConflation}</dd>
- * <dt>poolName [<em>default:</em> <code>null</code>, meaning no pool]</dt>
+ * <dt>poolName [<em>default:</em> {@code null}, meaning no pool]</dt>
* <dd>Whether or not this region is a client that is to use connections from the named pool to
- * communicate with servers. If <code>null</code>, then it is not a client. If
- * <code>non-null</code>, then the named pool will be used. {@link #setPoolName}
- * {@link RegionAttributes#getPoolName}</dd>
+ * communicate with servers. If {@code null}, then it is not a client. If {@code non-null}, then the
+ * named pool will be used. {@link #setPoolName} {@link RegionAttributes#getPoolName}</dd>
*
*
- * <dt>EnableSubscriptionConflation [<em>default:</em> <code>false</code>]</dt>
+ * <dt>EnableSubscriptionConflation [<em>default:</em> {@code false}]</dt>
* <dd>Whether or not conflation is enabled for sending messages from a cache server to its clients.
* Note: This parameter is only valid for cache server to client communication. It has no effect in
- * peer to peer communication. If <code>true</code>, messages will be conflated before they are sent
- * from a cache server to its clients. Only the latest value will be sent. Note that this attribute
- * is only meaningful in a client server topology. {@link #setEnableSubscriptionConflation}
+ * peer to peer communication. If {@code true}, messages will be conflated before they are sent from
+ * a cache server to its clients. Only the latest value will be sent. Note that this attribute is
+ * only meaningful in a client server topology. {@link #setEnableSubscriptionConflation}
* {@link RegionAttributes#getEnableSubscriptionConflation}</dd>
- * <dt>Publisher [<em>default:</em> <code>false</code>]</dt>
+ * <dt>Publisher [<em>default:</em> {@code false}]</dt>
* <dd>Whether or not a region is a publisher. Publishers are regions that will have distributed
* write operations done on them. If a publisher is also a replicate then it will be used as the
* preferred source for initializing other replicates. {@link #setPublisher}
* {@link RegionAttributes#getPublisher}</dd>
- * <dt>isCloningEnabled [<em>default:</em> <code>false</code>]</dt>
- * <dd>Whether or not value is cloned before appling <code>Delta</code>s If <code>false</code>,
- * value will not be cloned {@link #setCloningEnabled}
- * {@link RegionAttributes#getCloningEnabled()}</dd></dt>
+ * <dt>isCloningEnabled [<em>default:</em> {@code false}]</dt>
+ * <dd>Whether or not value is cloned before appling {@code Delta}s If {@code false}, value will not
+ * be cloned {@link #setCloningEnabled} {@link RegionAttributes#getCloningEnabled()}</dd></dt>
* </dl>
* <h4>Storage (see also <a href="package-summary.html#storage">package summary </a>)</h4>
* <dl>
- * <dt>{@link DataPolicy} [<em>default:</em> <code>DataPolicy.NORMAL</code>]</dt>
+ * <dt>{@link DataPolicy} [<em>default:</em> {@code DataPolicy.NORMAL}]</dt>
* <dd>Specifies the data storage policy.<br>
* {@link #setDataPolicy} {@link RegionAttributes#getDataPolicy}</dd>
*
- * <dt>{@link MirrorType} [<em>default:</em> <code>MirrorType.NONE</code>]</dt>
+ * <dt>{@link MirrorType} [<em>default:</em> {@code MirrorType.NONE}]</dt>
* <dd><em>Deprecated</em>, use DataPolicy instead.</dd>
*
* <dt>{@link #setEvictionAttributes(EvictionAttributes) EvictionAttributes}</dt>
@@ -164,28 +160,28 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* CapacityController interface. EvictionAttributes describe the {@link EvictionAlgorithm} and the
* {@link EvictionAction} as well as the various conditions under which the algorithm perform the
* action e.g. when the maximum number of entries has been reached or the maximum percentage of JVM
- * heap has been consumed. Setting <code>EvictionAttributes</code> installs an eviction controller
- * on the Region instantiated with the associated RegionAttributes</dd>
+ * heap has been consumed. Setting {@code EvictionAttributes} installs an eviction controller on the
+ * Region instantiated with the associated RegionAttributes</dd>
*
- * <dt>KeyConstraint [<em>default:</em> <code>null</code>, meaning no constraint]</dt>
+ * <dt>KeyConstraint [<em>default:</em> {@code null}, meaning no constraint]</dt>
* <dd>The Class to constrain the keys to in the region.<br>
* {@link #setKeyConstraint} {@link RegionAttributes#getKeyConstraint}</dd>
*
- * <dt>ValueConstraint [<em>default:</em> <code>null</code>, meaning no constraint]</dt>
+ * <dt>ValueConstraint [<em>default:</em> {@code null}, meaning no constraint]</dt>
* <dd>The Class to constrain the values to in the region. In addition to the utility of this for
- * applications in general, a <code>valueConstraint</code> is helpful for compiling queries.<br>
+ * applications in general, a {@code valueConstraint} is helpful for compiling queries.<br>
* {@link #setValueConstraint} {@link RegionAttributes#getValueConstraint}</dd>
*
- * <dt>InitialCapacity [<em>default:</em> <code>16</code>]</dt>
+ * <dt>InitialCapacity [<em>default:</em> {@code 16}]</dt>
* <dd>The initial capacity of the map used for storing the entries. <br>
* {@link java.util.HashMap} {@link #setInitialCapacity}
* {@link RegionAttributes#getInitialCapacity}</dd>
*
- * <dt>LoadFactor [<em>default:</em> <code>0.75</code>]</dt>
+ * <dt>LoadFactor [<em>default:</em> {@code 0.75}]</dt>
* <dd>The load factor of the map used for storing the entries. <br>
* {@link java.util.HashMap} {@link #setLoadFactor} {@link RegionAttributes#getLoadFactor}</dd>
*
- * <dt>ConcurrencyLevel [<em>default:</em> <code>16</code>]</dt>
+ * <dt>ConcurrencyLevel [<em>default:</em> {@code 16}]</dt>
* <dd>The allowed concurrency among updates to values in the region is guided by the
* <tt>concurrencyLevel</tt>, which is used as a hint for internal sizing. The actual concurrency
* will vary. Ideally, you should choose a value to accommodate as many threads as will ever
@@ -196,46 +192,45 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* others will only read. <br>
* {@link #setConcurrencyLevel} {@link RegionAttributes#getConcurrencyLevel}</dd>
*
- * <dt>ConcurrencyChecksEnabled [<em>default:</em> <code>false</code>]</dt>
+ * <dt>ConcurrencyChecksEnabled [<em>default:</em> {@code false}]</dt>
* <dd>Enables a distributed versioning algorithm that detects concurrency conflicts in regions and
* ensures that changes to an entry are not applied in a different order in other members. This can
* cause operations to be conflated, so that some cache listeners may see an event while others do
* not, but it guarantees that the system will be consistent.</dd>
*
- * <dt>StatisticsEnabled [<em>default:</em> <code>false</code>]</dt>
+ * <dt>StatisticsEnabled [<em>default:</em> {@code false}]</dt>
* <dd>Whether statistics are enabled for this region. The default is disabled, which conserves on
* memory. <br>
* {@link #setStatisticsEnabled} {@link RegionAttributes#getStatisticsEnabled}</dd>
*
- * <dt>IgnoreJTA [<em>default:</em> <code>false</code>]</dt>
+ * <dt>IgnoreJTA [<em>default:</em> {@code false}]</dt>
* <dd>Whether JTA transactions are ignored for this region. The default is to look for and join JTA
* transactions for operations performed on a region.
*
- * <dt>DiskStoreName [<em>default:</em> <code>null</code>, meaning no disk store]</dt>
- * <dd>If not <code>null</code> then this region will write its data to the named
- * {@link DiskStore}.<br>
+ * <dt>DiskStoreName [<em>default:</em> {@code null}, meaning no disk store]</dt>
+ * <dd>If not {@code null} then this region will write its data to the named {@link DiskStore}.<br>
* {@link #setDiskStoreName} {@link RegionAttributes#getDiskStoreName}</dd>
*
- * <dt>DiskSynchronous [<em>default:</em> <code>true</code>]</dt>
- * <dd>If <code>true</code> then any writes to disk done for this region will be done synchronously.
- * This means that they will be in the file system buffer before the operation doing the write
+ * <dt>DiskSynchronous [<em>default:</em> {@code true}]</dt>
+ * <dd>If {@code true} then any writes to disk done for this region will be done synchronously. This
+ * means that they will be in the file system buffer before the operation doing the write
* returns.<br>
- * If <code>false</code> then any writes to disk done for this region will be done asynchronously.
- * This means that they are queued up to be written and when they are actually written to the file
- * system buffer is determined by the region's {@link DiskStore} configuration. Asynchronous writes
- * will be conflated if the same entry is written while a previous operation for the same entry is
- * still in the queue.<br>
+ * If {@code false} then any writes to disk done for this region will be done asynchronously. This
+ * means that they are queued up to be written and when they are actually written to the file system
+ * buffer is determined by the region's {@link DiskStore} configuration. Asynchronous writes will be
+ * conflated if the same entry is written while a previous operation for the same entry is still in
+ * the queue.<br>
* {@link #setDiskSynchronous} {@link RegionAttributes#isDiskSynchronous}</dd>
*
- * <dt>PersistBackup [<em>default:</em> <code>false</code>]</dt>
+ * <dt>PersistBackup [<em>default:</em> {@code false}]</dt>
* <dd>Whether or not a persistent backup should be made of the region.<br>
* {@link #setPersistBackup} {@link RegionAttributes#getPersistBackup}</dd>
* <dd><em>Deprecated</em>, use {@link DataPolicy#PERSISTENT_REPLICATE} or
* {@link DataPolicy#PERSISTENT_PARTITION} instead.</dd>
*
* <dt>DiskWriteAttributes [<em>default:</em> Asynchronously write to disk every second (a
- * <code>timeInterval</code> of 1000 and a <code>byteThreshold</codE> of 0). <code>rollOplogs</code>
- * is set to true and <code>maxOplogSize</code> is set to 1024 MB]</dt>
+ * {@code timeInterval} of 1000 and a {@code byteThreshold</codE> of 0). {@code rollOplogs} is set
+ * to true and {@code maxOplogSize} is set to 1024 MB]</dt>
* <dd>How region data should be written to disk. Determines whether data should be written
* synchronously or asynchronously. Data that is written asynchronously can be written at a certain
* {@linkplain DiskWriteAttributes#getTimeInterval time interval} or once a certain number of
@@ -245,7 +240,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* <dd><em>Deprecated</em>, use {@link #setDiskStoreName} and {@link #setDiskSynchronous}
* instead.</dd>
*
- * <dt>DiskDirs [<em>default:</em> Current working directory (<code>user.dir</code>
+ * <dt>DiskDirs [<em>default:</em> Current working directory ({@code user.dir}
* {@linkplain System#getProperties system property})]</dt>
* <dd>The directories to which the region's data are written. If multiple directories are used,
* GemFire will attempt to distribute the data evenly among them. <br>
@@ -258,7 +253,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* <dd><em>Deprecated</em>, use {@link #setDiskStoreName} instead.</dd>
*
*
- * <dt>{@link PartitionAttributes} [<em>default:</em> <code>null</code>, meaning no region
+ * <dt>{@link PartitionAttributes} [<em>default:</em> {@code null}, meaning no region
* partitioning]</dt>
* <dd>How region data is partitioned among the members of the distributed system. <br>
* {@link #setPartitionAttributes} {@link RegionAttributes#getPartitionAttributes}</dd>
@@ -272,14 +267,14 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
*
* <h4>Locking</h4>
* <dl>
- * <dt>LockGrantor [<em>default:</em> <code>false</code>]</dt>
+ * <dt>LockGrantor [<em>default:</em> {@code false}]</dt>
* <dd>Should this process become lock grantor for the region?</dd><br>
* {@link #setLockGrantor} {@link RegionAttributes#isLockGrantor} {@link Region#becomeLockGrantor}
* </dl>
*
* <h4>Querying</h4>
* <dl>
- * <dt>IndexMaintenanceSynchronous [<em>default:</em> <code>false</code>]</dt>
+ * <dt>IndexMaintenanceSynchronous [<em>default:</em> {@code false}]</dt>
* <dd>Are indexes built over in this region updated synchronously when the underlying data is
* modified?</dd><br>
* {@link #setIndexMaintenanceSynchronous} {@link RegionAttributes#getIndexMaintenanceSynchronous}
@@ -291,29 +286,26 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* <a name="compatibility">
* <h3>Compatibility Rules</h3>
* <h4>RegionAttributes Creation Constraints</h4> If any of the following compatibility rules are
- * violated when {@link #create}</code> is called then an {@link IllegalStateException} is thrown.
- * See {@link #validateAttributes}.
+ * violated when {@link #create}} is called then an {@link IllegalStateException} is thrown. See
+ * {@link #validateAttributes}.
*
* <a name="creationConstraints">
* <h3>Creation Constraints</h3>
* <h4>Region Creation Constraints on RegionAttributes</h4>
*
* If any of the following rules are violated when {@link Region#createSubregion createSubregion} or
- * {@link Cache#createRegion createRegion} are called, then an <code>IllegalStateException</code> is
+ * {@link Cache#createRegion createRegion} are called, then an {@code IllegalStateException} is
* thrown.
*
* <ul>
- * <li>A region with <code>Scope.LOCAL</code> can only have subregions with
- * <code>Scope.LOCAL</code>.</li>
- * <li><code>Scope.GLOBAL</code> is illegal if there is any other cache in the distributed system
- * that has the same region with <code>Scope.DISTRIBUTED_NO_ACK</code> or
- * <code>Scope.DISTRIBUTED_ACK</code>.</li>
- * <li><code>Scope.DISTRIBUTED_ACK</code> is illegal if there is any other cache in the distributed
- * system that has the same region with <code>Scope.DISTRIBUTED_NO_ACK</code> or
- * <code>Scope.GLOBAL</code>.</li>
- * <li><code>Scope.DISTRIBUTED_NO_ACK</code> is illegal if there is any other cache in the
- * distributed system that has the same region with <code>Scope.DISTRIBUTED_ACK</code> or
- * <code>Scope.GLOBAL</code>.</li>
+ * <li>A region with {@code Scope.LOCAL} can only have subregions with {@code Scope.LOCAL}.</li>
+ * <li>{@code Scope.GLOBAL} is illegal if there is any other cache in the distributed system that
+ * has the same region with {@code Scope.DISTRIBUTED_NO_ACK} or {@code Scope.DISTRIBUTED_ACK}.</li>
+ * <li>{@code Scope.DISTRIBUTED_ACK} is illegal if there is any other cache in the distributed
+ * system that has the same region with {@code Scope.DISTRIBUTED_NO_ACK} or
+ * {@code Scope.GLOBAL}.</li>
+ * <li>{@code Scope.DISTRIBUTED_NO_ACK} is illegal if there is any other cache in the distributed
+ * system that has the same region with {@code Scope.DISTRIBUTED_ACK} or {@code Scope.GLOBAL}.</li>
* </ul>
*
* @see RegionAttributes
@@ -324,6 +316,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* @deprecated as of 6.5 use {@link Cache#createRegionFactory(RegionShortcut)} or
* {@link ClientCache#createClientRegionFactory(ClientRegionShortcut)} instead.
*/
+@Deprecated
@SuppressWarnings("synthetic-access")
public class AttributesFactory<K, V> {
private final RegionAttributesImpl<K, V> regionAttributes = new RegionAttributesImpl<K, V>();
@@ -331,24 +324,23 @@ public class AttributesFactory<K, V> {
/**
* The default disk synchronous write setting
* <p>
- * Current value: <code>true</code> each.
+ * Current value: {@code true} each.
*
* @since GemFire 6.5
*/
public static final boolean DEFAULT_DISK_SYNCHRONOUS = true;
/**
- * Creates a new instance of AttributesFactory ready to create a <code>RegionAttributes</code>
- * with default settings.
+ * Creates a new instance of AttributesFactory ready to create a {@code RegionAttributes} with
+ * default settings.
*/
public AttributesFactory() {}
/**
- * Creates a new instance of AttributesFactory ready to create a <code>RegionAttributes</code>
- * with the same settings as those in the specified <code>RegionAttributes</code>.
+ * Creates a new instance of AttributesFactory ready to create a {@code RegionAttributes} with the
+ * same settings as those in the specified {@code RegionAttributes}.
*
- * @param regionAttributes the <code>RegionAttributes</code> used to initialize this
- * AttributesFactory
+ * @param regionAttributes the {@code RegionAttributes} used to initialize this AttributesFactory
*/
@SuppressWarnings("deprecation")
public AttributesFactory(RegionAttributes<K, V> regionAttributes) {
@@ -448,7 +440,7 @@ public class AttributesFactory<K, V> {
// CALLBACKS
/**
- * Sets the cache loader for the next <code>RegionAttributes</code> created.
+ * Sets the cache loader for the next {@code RegionAttributes} created.
*
* @param cacheLoader the cache loader or null if no loader
* @throws IllegalStateException if this region has a {@link #setPoolName pool name set}
@@ -459,7 +451,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the cache writer for the next <code>RegionAttributes</code> created.
+ * Sets the cache writer for the next {@code RegionAttributes} created.
*
* @param cacheWriter the cache writer or null if no cache writer
* @throws IllegalStateException if this region has a {@link #setPoolName pool name set}
@@ -470,7 +462,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the CacheListener for the next <code>RegionAttributes</code> created. Any existing cache
+ * Sets the CacheListener for the next {@code RegionAttributes} created. Any existing cache
* listeners on this factory are removed.
*
* @param aListener a user defined CacheListener, null if no listener
@@ -495,7 +487,7 @@ public class AttributesFactory<K, V> {
* Adds a cache listener to the end of the list of cache listeners on this factory.
*
* @param aListener the cache listener to add to the factory.
- * @throws IllegalArgumentException if <code>aListener</code> is null
+ * @throws IllegalArgumentException if {@code aListener} is null
* @since GemFire 5.0
*/
public void addCacheListener(CacheListener<K, V> aListener) {
@@ -513,7 +505,7 @@ public class AttributesFactory<K, V> {
* Removes all cache listeners and then adds each listener in the specified array.
*
* @param newListeners a possibly null or empty array of listeners to add to this factory.
- * @throws IllegalArgumentException if the <code>newListeners</code> array has a null element
+ * @throws IllegalArgumentException if the {@code newListeners} array has a null element
* @since GemFire 5.0
*/
public void initCacheListeners(CacheListener<K, V>[] newListeners) {
@@ -538,7 +530,7 @@ public class AttributesFactory<K, V> {
/**
* Sets the idleTimeout expiration attributes for region entries for the next
- * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type.
+ * {@code RegionAttributes} created. Default is 0 which indicates no expiration of this type.
*
* @param idleTimeout the idleTimeout ExpirationAttributes for entries in this region
* @throws IllegalArgumentException if idleTimeout is null
@@ -554,7 +546,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the idleTimeout CustomExpiry for the next <code>RegionAttributes</code> created.
+ * Sets the idleTimeout CustomExpiry for the next {@code RegionAttributes} created.
*
* @param custom the CustomExpiry to use; null means none will be used.
*/
@@ -565,7 +557,7 @@ public class AttributesFactory<K, V> {
/**
* Sets the timeToLive expiration attributes for region entries for the next
- * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type.
+ * {@code RegionAttributes} created. Default is 0 which indicates no expiration of this type.
*
* @param timeToLive the timeToLive ExpirationAttributes for entries in this region
* @throws IllegalArgumentException if timeToLive is null
@@ -581,7 +573,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the custom timeToLive for the next <code>RegionAttributes</code> created.
+ * Sets the custom timeToLive for the next {@code RegionAttributes} created.
*
* @param custom the CustomExpiry to use, none if the default for the region is to be used.
*/
@@ -592,8 +584,8 @@ public class AttributesFactory<K, V> {
/**
* Sets the idleTimeout expiration attributes for the region itself for the next
- * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type
- * is set.
+ * {@code RegionAttributes} created. Default is 0 which indicates no expiration of this type is
+ * set.
*
* @param idleTimeout the ExpirationAttributes for this region idleTimeout
* @throws IllegalArgumentException if idleTimeout is null
@@ -611,7 +603,7 @@ public class AttributesFactory<K, V> {
/**
* Sets the timeToLive expiration attributes for the region itself for the next
- * <code>RegionAttributes</code> created. Default is 0 i.e. no expiration of this type.
+ * {@code RegionAttributes} created. Default is 0 i.e. no expiration of this type.
*
* @param timeToLive the ExpirationAttributes for this region timeToLive
* @throws IllegalArgumentException if timeToLive is null
@@ -629,7 +621,7 @@ public class AttributesFactory<K, V> {
// DISTRIBUTION ATTRIBUTES
/**
- * Sets the scope for the next <code>RegionAttributes</code> created. Default scope is
+ * Sets the scope for the next {@code RegionAttributes} created. Default scope is
* DISTRIBUTED_NO_ACK. Refer gemfire documentation for more details on this.
*
* @param scopeType the type of Scope to use for the region
@@ -646,10 +638,10 @@ public class AttributesFactory<K, V> {
// STORAGE ATTRIBUTES
/**
- * Sets the EvictionController for the next <code>RegionAttributes</code> created. Use one of the
+ * Sets the EvictionController for the next {@code RegionAttributes} created. Use one of the
* creation methods on {@link EvictionAttributes} e.g.
* {@link EvictionAttributes#createLRUHeapAttributes()} to create the desired instance for this
- * <code>AttributesFactory</code>
+ * {@code AttributesFactory}
*
* @param evictAttrs Explains how and when eviction occurs in the Region.
*/
@@ -663,7 +655,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the mirror type for the next <code>RegionAttributes</code> created.
+ * Sets the mirror type for the next {@code RegionAttributes} created.
*
* @param mirrorType The type of mirroring to use for the region
* @throws IllegalArgumentException if mirrorType is null
@@ -692,7 +684,7 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the data policy for the next <code>RegionAttributes</code> created. Default data policy is
+ * Sets the data policy for the next {@code RegionAttributes} created. Default data policy is
* 'Normal'. Please refer gemfire documentation for more details on this.
*
* @param dataPolicy The data policy to use for the region
@@ -716,13 +708,12 @@ public class AttributesFactory<K, V> {
/**
- * Sets the key constraint for the next <code>RegionAttributes</code> created. Keys in the region
- * will be constrained to this class (or subclass). Any attempt to store a key of an incompatible
- * type in the region will cause a <code>ClassCastException</code> to be thrown.
+ * Sets the key constraint for the next {@code RegionAttributes} created. Keys in the region will
+ * be constrained to this class (or subclass). Any attempt to store a key of an incompatible type
+ * in the region will cause a {@code ClassCastException} to be thrown.
*
* @param keyConstraint The Class to constrain the keys to, or null if no constraint
- * @throws IllegalArgumentException if <code>keyConstraint</code> is a class denoting a primitive
- * type
+ * @throws IllegalArgumentException if {@code keyConstraint} is a class denoting a primitive type
*/
public void setKeyConstraint(Class<K> keyConstraint) {
if (keyConstraint != null && keyConstraint.isPrimitive())
@@ -734,13 +725,13 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the value constraint for the next <code>RegionAttributes</code> created. Values in the
- * region will be constrained to this class (or subclass). Any attempt to store a value of an
- * incompatible type in the region will cause a <code>ClassCastException</code> to be thrown.
+ * Sets the value constraint for the next {@code RegionAttributes} created. Values in the region
+ * will be constrained to this class (or subclass). Any attempt to store a value of an
+ * incompatible type in the region will cause a {@code ClassCastException} to be thrown.
*
* @param valueConstraint The Class to constrain the values to, or null if no constraint
- * @throws IllegalArgumentException if <code>valueConstraint</code> is a class denoting a
- * primitive type
+ * @throws IllegalArgumentException if {@code valueConstraint} is a class denoting a primitive
+ * type
*/
public void setValueConstraint(Class<V> valueConstraint) {
if (valueConstraint != null && valueConstraint.isPrimitive())
@@ -755,8 +746,8 @@ public class AttributesFactory<K, V> {
// MAP ATTRIBUTES
/**
- * Sets the entry initial capacity for the next <code>RegionAttributes</code> created. This value
- * is used in initializing the map that holds the entries. Default is 16.
+ * Sets the entry initial capacity for the next {@code RegionAttributes} created. This value is
+ * used in initializing the map that holds the entries. Default is 16.
*
* @param initialCapacity the initial capacity of the entry map
* @throws IllegalArgumentException if initialCapacity is negative.
@@ -771,8 +762,8 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the entry load factor for the next <code>RegionAttributes</code> created. This value is
- * used in initializing the map that holds the entries. Default is 0.75.
+ * Sets the entry load factor for the next {@code RegionAttributes} created. This value is used in
+ * initializing the map that holds the entries. Default is 0.75.
*
* @param loadFactor the load factor of the entry map
* @throws IllegalArgumentException if loadFactor is nonpositive
@@ -788,8 +779,8 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the concurrency level of the next <code>RegionAttributes</code> created. This value is
- * used in initializing the map that holds the entries. Default is 16.
+ * Sets the concurrency level of the next {@code RegionAttributes} created. This value is used in
+ * initializing the map that holds the entries. Default is 16.
*
* @param concurrencyLevel the concurrency level of the entry map
* @throws IllegalArgumentException if concurrencyLevel is nonpositive
@@ -892,7 +883,7 @@ public class AttributesFactory<K, V> {
* adds a gateway sender to the end of list of gateway senders on this factory
*
* @param gatewaySenderId
- * @throws IllegalArgumentException if <code>gatewaySender</code> is null
+ * @throws IllegalArgumentException if {@code gatewaySender} is null
* @since GemFire 7.0
*/
public void addGatewaySenderId(String gatewaySenderId) {
@@ -909,7 +900,7 @@ public class AttributesFactory<K, V> {
* Adds a AsyncEventQueue to the end of list of async event queues on this factory
*
* @param asyncEventQueueId
- * @throws IllegalArgumentException if <code>gatewaySender</code> is null
+ * @throws IllegalArgumentException if {@code gatewaySender} is null
* @since GemFire 7.0
*/
public void addAsyncEventQueueId(String asyncEventQueueId) {
@@ -1078,9 +1069,9 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the <code>PartitionAttributes</code> that describe how the region is partitioned among
- * members of the distributed system. This also establishes a data policy of
- * {@link DataPolicy#PARTITION PARTITION}, if the data policy has not already been set.
+ * Sets the {@code PartitionAttributes} that describe how the region is partitioned among members
+ * of the distributed system. This also establishes a data policy of {@link DataPolicy#PARTITION
+ * PARTITION}, if the data policy has not already been set.
*
* @since GemFire 5.0
*/
@@ -1121,19 +1112,20 @@ public class AttributesFactory<K, V> {
}
/**
- * Sets the <code>MembershipAttributes</code> that describe the membership roles required for
- * reliable access to the region.
+ * Sets the {@code MembershipAttributes} that describe the membership roles required for reliable
+ * access to the region.
*
* @deprecated this API is scheduled to be removed
*/
+ @Deprecated
public void setMembershipAttributes(MembershipAttributes membership) {
this.regionAttributes.membershipAttributes = membership;
this.regionAttributes.setHasMembershipAttributes(true);
}
/**
- * Sets the <code>SubscriptionAttributes</code> that describe how the region will subscribe to
- * other distributed cache instances of the region.
+ * Sets the {@code SubscriptionAttributes} that describe how the region will subscribe to other
+ * distributed cache instances of the region.
*
* @since GemFire 5.0
*/
@@ -1199,7 +1191,6 @@ public class AttributesFactory<K, V> {
* Sets cloning on region. Default is false. Note: off-heap regions always behave as if cloning is
* enabled.
*
- * @param cloningEnable
* @since GemFire 6.1
* @see RegionAttributes#getCloningEnabled()
*/
@@ -1213,15 +1204,14 @@ public class AttributesFactory<K, V> {
* Sets the pool name attribute. This causes regions that use these attributes to be a client
* region which communicates with the servers that the connection pool communicates with.
* <p>
- * If this attribute is set to <code>null</code> or <code>""</code> then the connection pool is
- * disabled causing regions that use these attributes to be communicate with peers instead of
- * servers.
+ * If this attribute is set to {@code null} or {@code ""} then the connection pool is disabled
+ * causing regions that use these attributes to be communicate with peers instead of servers.
* <p>
* The named connection pool must exist on the cache at the time these attributes are used to
* create a region. See {@link PoolManager#createFactory} for how to create a connection pool.
*
- * @param name the name of the connection pool to use; if <code>null</code> or <code>""</code>
- * then the connection pool is disabled for regions using these attributes.
+ * @param name the name of the connection pool to use; if {@code null} or {@code ""} then the
+ * connection pool is disabled for regions using these attributes.
* @since GemFire 5.7
*/
public void setPoolName(String name) {
@@ -1268,9 +1258,9 @@ public class AttributesFactory<K, V> {
// FACTORY METHOD
/**
- * Creates a <code>RegionAttributes</code> with the current settings.
+ * Creates a {@code RegionAttributes} with the current settings.
*
- * @return the newly created <code>RegionAttributes</code>
+ * @return the newly created {@code RegionAttributes}
* @throws IllegalStateException if the current settings violate the
* <a href="#compatibility">compatibility rules</a>
* @deprecated as of GemFire 5.0, use {@link #create} instead
@@ -1281,9 +1271,9 @@ public class AttributesFactory<K, V> {
}
/**
- * Creates a <code>RegionAttributes</code> with the current settings.
+ * Creates a {@code RegionAttributes} with the current settings.
*
- * @return the newly created <code>RegionAttributes</code>
+ * @return the newly created {@code RegionAttributes}
* @throws IllegalStateException if the current settings violate the
* <a href="#compatibility">compatibility rules</a>
* @since GemFire 5.0
@@ -1612,7 +1602,7 @@ public class AttributesFactory<K, V> {
boolean offHeap = false;
/**
- * Constructs an instance of <code>RegionAttributes</code> with default settings.
+ * Constructs an instance of {@code RegionAttributes} with default settings.
*
* @see AttributesFactory
*/
@@ -1956,6 +1946,7 @@ public class AttributesFactory<K, V> {
/**
* @deprecated this API is scheduled to be removed
*/
+ @Deprecated
public MembershipAttributes getMembershipAttributes() {
return this.membershipAttributes;
}
[15/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 8c061b0..8689ae5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -12,9 +12,9 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
+import static org.apache.geode.internal.lang.SystemUtils.getLineSeparator;
import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
import org.apache.geode.CancelCriterion;
@@ -22,6 +22,7 @@ import org.apache.geode.CancelException;
import org.apache.geode.CopyHelper;
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
+import org.apache.geode.Delta;
import org.apache.geode.DeltaSerializationException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.InternalGemFireException;
@@ -63,7 +64,6 @@ import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.RegionEvent;
import org.apache.geode.cache.RegionExistsException;
-import org.apache.geode.cache.RegionMembershipListener;
import org.apache.geode.cache.RegionReinitializedException;
import org.apache.geode.cache.Scope;
import org.apache.geode.cache.StatisticsDisabledException;
@@ -117,7 +117,6 @@ import org.apache.geode.i18n.StringId;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.ClassLoadUtil;
import org.apache.geode.internal.HeapDataOutputStream;
-import org.apache.geode.internal.InternalStatisticsDisabledException;
import org.apache.geode.internal.NanoTimer;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook;
@@ -138,6 +137,7 @@ import org.apache.geode.internal.cache.execute.RegionFunctionContextImpl;
import org.apache.geode.internal.cache.execute.ServerToClientFunctionResultSender;
import org.apache.geode.internal.cache.ha.ThreadIdentifier;
import org.apache.geode.internal.cache.lru.LRUEntry;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.partitioned.RedundancyAlreadyMetException;
import org.apache.geode.internal.cache.persistence.DiskExceptionHandler;
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
@@ -167,6 +167,7 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.OffHeapHelper;
import org.apache.geode.internal.offheap.ReferenceCountHelper;
+import org.apache.geode.internal.offheap.Releasable;
import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -193,7 +194,6 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -212,17 +212,24 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
/**
* Implementation of a local scoped-region. Note that this class has a different meaning starting
* with 3.0. In previous versions, a LocalRegion was the representation of a region in the VM.
* Starting with 3.0, a LocalRegion is a non-distributed region. The subclass DistributedRegion adds
* distribution behavior.
- *
*/
@SuppressWarnings("deprecation")
public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
ResourceListener<MemoryEvent>, DiskExceptionHandler, DiskRecoveryStore {
- private static final Logger logger = LogService.getLogger();
+
+ // package-private to avoid synthetic accessor
+ static final Logger logger = LogService.getLogger();
+
private static final Pattern NAME_PATTERN = Pattern.compile("[aA-zZ0-9-_.]+");
/**
@@ -231,7 +238,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @since GemFire 5.7
*/
public interface TestCallable {
- public void call(LocalRegion r, Operation op, RegionEntry re);
+ void call(LocalRegion r, Operation op, RegionEntry re);
}
// view types for iterators
@@ -239,7 +246,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
KEYS, VALUES, ENTRIES
}
- // iniitialization level
+ // initialization level
public static final int AFTER_INITIAL_IMAGE = 0;
public static final int BEFORE_INITIAL_IMAGE = 1;
@@ -249,60 +256,70 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* thread local to indicate that this thread should bypass the initialization Latch
*/
- private static final ThreadLocal initializationThread = new ThreadLocal();
+ private static final ThreadLocal<Integer> initializationThread = new ThreadLocal();
/* thread local to indicate its for persist data convert tool */
- protected static final ThreadLocal isConversion = new ThreadLocal();
+ static final ThreadLocal isConversion = new ThreadLocal();
// user attributes //
private Object regionUserAttribute;
- protected Map entryUserAttributes; // @todo darrel: shouldn't this be an
-
- // identity map whose key is a RegionEntry?
+ // TODO: shouldn't this be an identity map whose key is a RegionEntry?
+ Map entryUserAttributes;
private final String regionName;
protected final LocalRegion parentRegion;
- // set to true only if isDestroyed is also true
- // and region is about to be recreated due to reinitialization by loading
- // of a snapshot, etc.
+ /**
+ * set to true only if isDestroyed is also true and region is about to be recreated due to
+ * reinitialization by loading of a snapshot, etc.
+ */
private volatile boolean reinitialized_old = false;
protected volatile boolean isDestroyed = false;
- // In case of parallel wan, when a destroy is called on userPR, it waits for
- // parallelQueue to drain and then destroys paralleQueue. In this time if
- // operation like put happens on userPR then it will keep on building parallel
- // queue increasing time of userPR to get destroyed.this volatile boolean will
- // block such put operation by throwing RegionDestroyedException
- protected volatile boolean isDestroyedForParallelWAN = false;
+ /**
+ * In case of parallel wan, when a destroy is called on userPR, it waits for parallelQueue to
+ * drain and then destroys parallelQueue. In this time if operation like put happens on userPR
+ * then it will keep on building parallel queue increasing time of userPR to get destroyed.this
+ * volatile boolean will block such put operation by throwing RegionDestroyedException
+ */
+ volatile boolean isDestroyedForParallelWAN = false;
- // set to true after snapshot is loaded, to help get initial image
- // make sure this is the right incarnation of this region
+ /**
+ * set to true after snapshot is loaded, to help get initial image make sure this is the right
+ * incarnation of this region
+ */
private volatile boolean reinitialized_new = false;
/** Lock used to prevent multiple concurrent destroy region operations */
private Semaphore destroyLock;
- // guarded by regionExpiryLock.
+ /** GuardedBy regionExpiryLock. */
private RegionTTLExpiryTask regionTTLExpiryTask = null;
- // guarded by regionExpiryLock.
+
+ /** GuardedBy regionExpiryLock. */
private RegionIdleExpiryTask regionIdleExpiryTask = null;
private final Object regionExpiryLock = new Object();
- // guarded by regionExpiryLock. Keeps track of how many txs are writing to this region.
+
+ /**
+ * GuardedBy regionExpiryLock. Keeps track of how many txs are writing to this region.
+ */
private int txRefCount;
private final ConcurrentHashMap<RegionEntry, EntryExpiryTask> entryExpiryTasks =
- new ConcurrentHashMap<RegionEntry, EntryExpiryTask>();
+ new ConcurrentHashMap<>();
/**
* Set to true after an invalidate region expiration so we don't get multiple expirations
*/
volatile boolean regionInvalid = false;
+ /**
+ * TODO: make this private and introduce wrappers
+ */
public final RegionMap entries;
/**
@@ -311,11 +328,10 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
private final boolean supportsTX;
/** tracks threadID->seqno information for this region */
- protected EventTracker eventTracker;
+ EventTracker eventTracker;
/**
- * tracks region-level version information for members. See
- * https://wiki.gemstone.com/display/gfe70/Consistency+in+Replicated+Regions+and+WAN
+ * tracks region-level version information for members
*/
private RegionVersionVector versionVector;
@@ -340,7 +356,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// you can't trust the assignment of a volatile (as indicated above)
// to mean that the the thing being assigned is fully formed, only
// those things *before* the assignment are fully formed. mthomas 10/02/2005
- private volatile boolean entriesInitialized;
+ private final boolean entriesInitialized;
/**
* contains Regions themselves // marked volatile to make sure it is fully initialized before
@@ -350,17 +366,14 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
private final Object subregionsLock = new Object();
- // Used for synchronizzing access to client Cqs
- // private final Object clientCqsSync = new Object();
-
/**
* Prevents access to this region until it is done initializing, except for some special
* initializing operations such as replying to create region messages In JDK 1.5 we will use
* java.util.concurrent.CountDownLatch instead of org.apache.geode.internal.util.CountDownLatch.
*/
- protected final StoppableCountDownLatch initializationLatchBeforeGetInitialImage;
+ final StoppableCountDownLatch initializationLatchBeforeGetInitialImage;
- protected final StoppableCountDownLatch initializationLatchAfterGetInitialImage;
+ final StoppableCountDownLatch initializationLatchAfterGetInitialImage;
/**
* Used to hold off cache listener events until the afterRegionCreate is called
@@ -387,10 +400,10 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* Used for serializing netSearch and netLoad on a per key basis. CM <Object, Future>
*/
- protected final ConcurrentMap getFutures = new ConcurrentHashMap();
+ private final ConcurrentMap getFutures = new ConcurrentHashMap();
- /*
- * Asif: This boolean needs to be made true if the test needs to receive a synchronous callback
+ /**
+ * TODO: This boolean needs to be made true if the test needs to receive a synchronous callback
* just after clear on map is done. Its visibility is default so that only tests present in
* org.apache.geode.internal.cache will be able to see it
*/
@@ -400,46 +413,45 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* A flag used to indicate that this Region is being used as an administrative Region, holding
* meta-data for a PartitionedRegion
*/
- final private boolean isUsedForPartitionedRegionAdmin;
+ private final boolean isUsedForPartitionedRegionAdmin;
- final private boolean isUsedForPartitionedRegionBucket;
+ private final boolean isUsedForPartitionedRegionBucket;
- final private boolean isUsedForMetaRegion;
+ private final boolean isUsedForMetaRegion;
- final private boolean isMetaRegionWithTransactions;
+ private final boolean isMetaRegionWithTransactions;
- final private boolean isUsedForSerialGatewaySenderQueue;
+ private final boolean isUsedForSerialGatewaySenderQueue;
- final private boolean isUsedForParallelGatewaySenderQueue;
+ private final boolean isUsedForParallelGatewaySenderQueue;
- final private AbstractGatewaySender serialGatewaySender;
+ private final AbstractGatewaySender serialGatewaySender;
/**
* The factory used to create the LoaderHelper when a loader is invoked
*/
- protected final LoaderHelperFactory loaderHelperFactory;
+ final LoaderHelperFactory loaderHelperFactory;
/**
- * Allow for different cacheperfstats locations... primarily for PartitionedRegions
+ * Allow for different CachePerfStats locations... primarily for PartitionedRegions
*/
private final CachePerfStats cachePerfStats;
- private final boolean hasOwnStats;
+ private final boolean hasOwnStats;
private final ImageState imageState;
+
/**
* Register interest count to track if any register interest is in progress for this region. This
* count will be incremented when register interest starts and decremented when register interest
* finishes.
- *
- * @guarded.By {@link #imageState}
+ * <p>
+ * since always written while holding an exclusive write lock and only read while holding a read
+ * lock it does not need to be atomic or protected by any other sync.
+ * <p>
+ * GuardedBy {@link #imageState}
*/
- private int riCnt =
- 0; /*
- * since always written while holding an exclusive write lock and only read while holding a
- * read lock it does not need to be atomic or protected by any other sync.
- */
-
+ private int riCnt = 0;
/**
* Map of subregion full paths to serial numbers. These are subregions that were destroyed when
@@ -453,55 +465,48 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
*/
public final AtomicBoolean memoryThresholdReached = new AtomicBoolean(false);
- // Lock for updating PR MetaData on client side
+ /**
+ * Lock for updating PR MetaData on client side
+ * <p>
+ * TODO: move this to ClientMetadataService into {@code Map<Region, Lock>}
+ */
public final Lock clientMetaDataLock = new ReentrantLock();
/**
* There seem to be cases where a region can be created and yet the distributed system is not yet
* in place...
- *
- *
*/
protected class Stopper extends CancelCriterion {
@Override
public String cancelInProgress() {
- // ---
// This grossness is necessary because there are instances where the
// region can exist without having a cache (XML creation)
checkFailure();
- Cache c = LocalRegion.this.getCache();
- if (c == null) {
+ Cache cache = LocalRegion.this.getCache();
+ if (cache == null) {
return LocalizedStrings.LocalRegion_THE_CACHE_IS_NOT_AVAILABLE.toLocalizedString();
}
- // --- end of grossness
- return c.getCancelCriterion().cancelInProgress();
+ return cache.getCancelCriterion().cancelInProgress();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.CancelCriterion#generateCancelledException(java.lang.Throwable)
- */
@Override
public RuntimeException generateCancelledException(Throwable e) {
- // ---
// This grossness is necessary because there are instances where the
// region can exist without having a cache (XML creation)
checkFailure();
- Cache c = LocalRegion.this.getCache();
- if (c == null) {
+ Cache cache = LocalRegion.this.getCache();
+ if (cache == null) {
return new CacheClosedException("No cache", e);
}
- // --- end of grossness
- return c.getCancelCriterion().generateCancelledException(e);
+ return cache.getCancelCriterion().generateCancelledException(e);
}
}
protected final CancelCriterion stopper = createStopper();
- protected CancelCriterion createStopper() {
+ private CancelCriterion createStopper() {
return new Stopper();
}
@@ -512,7 +517,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
*
* Currently used by the OpLog layer.
*/
- private final static ThreadLocal<LocalRegion> initializingRegion = new ThreadLocal<LocalRegion>();
+ private static final ThreadLocal<LocalRegion> initializingRegion = new ThreadLocal<LocalRegion>();
/**
* Get the current initializing region as set in the ThreadLocal.
@@ -520,7 +525,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* Note that this value is cleared after the initialization of LocalRegion is done so is valid
* only for the duration of region creation and initialization.
*/
- public static LocalRegion getInitializingRegion() {
+ static LocalRegion getInitializingRegion() {
return initializingRegion.get();
}
@@ -528,11 +533,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return this.stopper;
}
- protected Map<String, CacheServiceProfile> cacheServiceProfiles;
-
- ////////////////// Public Methods ///////////////////////////////////////////
+ Map<String, CacheServiceProfile> cacheServiceProfiles;
- static String calcFullPath(String regionName, LocalRegion parentRegion) {
+ private static String calcFullPath(String regionName, LocalRegion parentRegion) {
StringBuilder buf = null;
if (parentRegion == null) {
buf = new StringBuilder(regionName.length() + 1);
@@ -549,9 +552,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* Creates new region
*/
protected LocalRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
- GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs)
- throws DiskAccessException {
+ InternalCache cache, InternalRegionArguments internalRegionArgs) throws DiskAccessException {
super(cache, attrs, regionName, internalRegionArgs);
+
// Initialized here (and defers to parent) to fix GEODE-128
this.EXPIRY_UNITS_MS = parentRegion != null ? parentRegion.EXPIRY_UNITS_MS
: Boolean.getBoolean(EXPIRY_MS_PROPERTY);
@@ -598,15 +601,17 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- this.dsi = findDiskStore(attrs, internalRegionArgs);
+ this.diskStoreImpl = findDiskStore(attrs, internalRegionArgs);
this.diskRegion = createDiskRegion(internalRegionArgs);
this.entries = createRegionMap(internalRegionArgs);
this.entriesInitialized = true;
this.subregions = new ConcurrentHashMap();
+
// we only need a destroy lock if this is a root
if (parentRegion == null) {
initRoot();
}
+
if (internalRegionArgs.getLoaderHelperFactory() != null) {
this.loaderHelperFactory = internalRegionArgs.getLoaderHelperFactory();
} else {
@@ -632,8 +637,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
// initialize client to server proxy
- this.srp = (this.getPoolName() != null) ? new ServerRegionProxy(this) : null;
- this.imageState = new UnsharedImageState(this.srp != null,
+ this.serverRegionProxy = this.getPoolName() != null ? new ServerRegionProxy(this) : null;
+ this.imageState = new UnsharedImageState(this.serverRegionProxy != null,
getDataPolicy().withReplication() || getDataPolicy().isPreloaded(),
getAttributes().getDataPolicy().withPersistence(), this.stopper);
@@ -644,7 +649,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
|| isMetaRegionWithTransactions();
this.testCallable = internalRegionArgs.getTestCallable();
-
}
private RegionMap createRegionMap(InternalRegionArguments internalRegionArgs) {
@@ -669,10 +673,16 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* initialize the event tracker. Not all region implementations want or need one of these. Regions
- * that require one should reimplement this method and create one like so: <code><pre>
- * this.eventTracker = new EventTracker(this.cache);
- * this.eventTracker.start();
- * </pre></code>
+ * that require one should reimplement this method and create one like so: {@code
+ *
+ *
+
+ <pre>
+ * this.eventTracker = new EventTracker(this.cache);
+ * this.eventTracker.start();
+ </pre>
+
+ }
*/
void createEventTracker() {
// if LocalRegion is changed to have an event tracker, then the initialize()
@@ -680,14 +690,13 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// region finishes initialization
}
-
/**
* Test method for getting the event tracker.
*
* this method is for testing only. Other region classes may track events using different
* mechanisms than EventTrackers
*/
- protected EventTracker getEventTracker() {
+ EventTracker getEventTracker() {
return this.eventTracker;
}
@@ -697,7 +706,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
/** returns object used to guard the size() operation during tombstone removal */
- public Object getSizeGuard() {
+ Object getSizeGuard() {
if (!this.concurrencyChecksEnabled) {
return new Object();
} else {
@@ -707,21 +716,20 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
/** initializes a new version vector for this region */
- protected void createVersionVector() {
-
+ void createVersionVector() {
this.versionVector = RegionVersionVector.create(getVersionMember(), this);
- if (dataPolicy.withPersistence()) {
+ if (this.dataPolicy.withPersistence()) {
// copy the versions that we have recovered from disk into
// the version vector.
RegionVersionVector diskVector = this.diskRegion.getRegionVersionVector();
this.versionVector.recordVersions(diskVector.getCloneForTransmission());
- } else if (!dataPolicy.withStorage()) {
+ } else if (!this.dataPolicy.withStorage()) {
// version vectors are currently only necessary in empty regions for
// tracking canonical member IDs
this.versionVector.turnOffRecordingForEmptyRegion();
}
- if (this.srp != null) {
+ if (this.serverRegionProxy != null) {
this.versionVector.setIsClientVector();
}
this.cache.getDistributionManager().addMembershipListener(this.versionVector);
@@ -747,7 +755,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* Test hook - returns the version stamp for an entry in the form of a version tag
*
- * @param key
* @return the entry version information
*/
public VersionTag getVersionTag(Object key) {
@@ -779,16 +786,16 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* @since GemFire 5.7
*/
- protected final ServerRegionProxy srp;
+ final ServerRegionProxy serverRegionProxy;
private final InternalDataView sharedDataView;
- public final ServerRegionProxy getServerProxy() {
- return this.srp;
+ public ServerRegionProxy getServerProxy() {
+ return this.serverRegionProxy;
}
- public final boolean hasServerProxy() {
- return this.srp != null;
+ public boolean hasServerProxy() {
+ return this.serverRegionProxy != null;
}
/** Returns true if the ExpiryTask is currently allowed to expire. */
@@ -796,9 +803,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return true;
}
- void performExpiryTimeout(ExpiryTask p_task) throws CacheException {
- if (p_task != null) {
- p_task.basicPerformTimeout(false);
+ void performExpiryTimeout(ExpiryTask expiryTask) throws CacheException {
+ if (expiryTask != null) {
+ expiryTask.basicPerformTimeout(false);
}
}
@@ -807,37 +814,28 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
public void handleMarker() {
-
RegionEventImpl event = new RegionEventImpl(this, Operation.MARKER, null, false, getMyId(),
false /* generate EventID */);
dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_LIVE, event);
}
+ @Override
public AttributesMutator getAttributesMutator() {
checkReadiness();
return this;
}
- public Region createSubregion(String subregionName, RegionAttributes regionAttributes)
+ @Override
+ public Region createSubregion(String subregionName, RegionAttributes aRegionAttributes)
throws RegionExistsException, TimeoutException {
try {
- return createSubregion(subregionName, regionAttributes,
+ return createSubregion(subregionName, aRegionAttributes,
new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false));
- } catch (IOException e) {
- // only happens when loading a snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION.toLocalizedString());
- assErr.initCause(e);
- throw assErr;
-
- } catch (ClassNotFoundException e) {
+ } catch (IOException | ClassNotFoundException e) {
// only happens when loading a snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION.toLocalizedString());
- assErr.initCause(e);
- throw assErr;
-
+ throw new InternalGemFireError(
+ LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION.toLocalizedString(), e);
}
}
@@ -848,27 +846,32 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
*/
@Override
protected InternalDistributedMember getMyId() {
- return this.cache.getMyId();
+ return this.cache.getInternalDistributedSystem().getDistributedMember();
}
public VersionSource getVersionMember() {
- if (dataPolicy.withPersistence()) {
+ if (this.dataPolicy.withPersistence()) {
return getDiskStore().getDiskStoreID();
} else {
- return this.cache.getMyId();
+ return this.cache.getInternalDistributedSystem().getDistributedMember();
}
}
+ // TODO: createSubregion method is too complex for IDE to analyze
public Region createSubregion(String subregionName, RegionAttributes attrs,
InternalRegionArguments internalRegionArgs)
throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException {
+
checkReadiness();
- LocalRegion newRegion = null;
RegionAttributes regionAttributes = attrs;
- attrs = cache.invokeRegionBefore(this, subregionName, attrs, internalRegionArgs);
+ // TODO: attrs is reassigned but never used
+ attrs = this.cache.invokeRegionBefore(this, subregionName, attrs, internalRegionArgs);
+
final InputStream snapshotInputStream = internalRegionArgs.getSnapshotInputStream();
final boolean getDestroyLock = internalRegionArgs.getDestroyLockFlag();
final InternalDistributedMember imageTarget = internalRegionArgs.getImageTarget();
+
+ LocalRegion newRegion = null;
try {
if (getDestroyLock)
acquireDestroyLock();
@@ -883,7 +886,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
validateRegionName(subregionName, internalRegionArgs);
validateSubregionAttributes(regionAttributes);
- String regionPath = calcFullPath(subregionName, this);
// lock down the subregionsLock
// to prevent other threads from adding a region to it in toRegion
@@ -916,13 +918,12 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
: new DistributedRegion(subregionName, regionAttributes, this, this.cache,
internalRegionArgs);
}
- Object o = this.subregions.putIfAbsent(subregionName, newRegion);
+ Object previousValue = this.subregions.putIfAbsent(subregionName, newRegion);
- Assert.assertTrue(o == null);
+ Assert.assertTrue(previousValue == null);
Assert.assertTrue(!newRegion.isInitialized());
- //
if (logger.isDebugEnabled()) {
logger.debug("Subregion created: {}", newRegion.getFullPath());
}
@@ -934,8 +935,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
} // endif: existing == null
} // end synchronization
} finally {
- if (getDestroyLock)
+ if (getDestroyLock) {
releaseDestroyLock();
+ }
}
// Fix for bug 42127 - moved to outside of the destroy lock.
@@ -948,7 +950,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
throw new RegionExistsException(existing);
}
-
boolean success = false;
try {
newRegion.checkReadiness();
@@ -957,23 +958,26 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
internalRegionArgs
.setIndexes(((UserSpecifiedRegionAttributes) regionAttributes).getIndexes());
}
- newRegion.initialize(snapshotInputStream, imageTarget, internalRegionArgs); // releases
- // initialization
- // Latches
+
+ // releases initialization Latches
+ newRegion.initialize(snapshotInputStream, imageTarget, internalRegionArgs);
+
// register the region with resource manager to get memory events
if (!newRegion.isInternalRegion()) {
if (!newRegion.isDestroyed) {
- cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, newRegion);
+ this.cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY,
+ newRegion);
if (!newRegion.getOffHeap()) {
newRegion.initialCriticalMembers(
- cache.getInternalResourceManager().getHeapMonitor().getState().isCritical(),
- cache.getResourceAdvisor().adviseCritialMembers());
+ this.cache.getInternalResourceManager().getHeapMonitor().getState().isCritical(),
+ this.cache.getResourceAdvisor().adviseCritialMembers());
} else {
- newRegion.initialCriticalMembers(cache.getInternalResourceManager().getHeapMonitor()
- .getState().isCritical()
- || cache.getInternalResourceManager().getOffHeapMonitor().getState().isCritical(),
- cache.getResourceAdvisor().adviseCritialMembers());
+ newRegion.initialCriticalMembers(
+ this.cache.getInternalResourceManager().getHeapMonitor().getState().isCritical()
+ || this.cache.getInternalResourceManager().getOffHeapMonitor().getState()
+ .isCritical(),
+ this.cache.getResourceAdvisor().adviseCritialMembers());
}
// synchronization would be done on ManagementAdapter.regionOpLock
@@ -988,7 +992,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
} catch (CancelException | RegionDestroyedException | RedundancyAlreadyMetException e) {
// don't print a call stack
throw e;
- } catch (final RuntimeException validationException) {
+ } catch (RuntimeException validationException) {
logger
.warn(
LocalizedMessage.create(
@@ -999,7 +1003,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
if (!success) {
this.cache.setRegionByPath(newRegion.getFullPath(), null);
initializationFailed(newRegion);
- cache.getInternalResourceManager(false).removeResourceListener(newRegion);
+ this.cache.getInternalResourceManager(false).removeResourceListener(newRegion);
}
}
@@ -1016,10 +1020,11 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- cache.invokeRegionAfter(newRegion);
+ this.cache.invokeRegionAfter(newRegion);
return newRegion;
}
+ @Override
public void create(Object key, Object value, Object aCallbackArgument)
throws TimeoutException, EntryExistsException, CacheWriterException {
long startPut = CachePerfStats.getStatTime();
@@ -1032,11 +1037,11 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- public final void validatedCreate(EntryEventImpl event, long startPut)
+ private void validatedCreate(EntryEventImpl event, long startPut)
throws TimeoutException, EntryExistsException, CacheWriterException {
if (event.getEventId() == null && generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
// Fix for 42448 - Only make create with null a local invalidate for
// normal regions. Otherwise, it will become a distributed invalidate.
@@ -1059,8 +1064,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
@Retained
- public final EntryEventImpl newCreateEntryEvent(Object key, Object value,
- Object aCallbackArgument) {
+ private EntryEventImpl newCreateEntryEvent(Object key, Object value, Object aCallbackArgument) {
validateArguments(key, value, aCallbackArgument);
checkReadiness();
@@ -1077,9 +1081,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* SingleWriteSingleReadRegionQueue.SingleReadWriteMetaRegion to return false as the event
* propagation from those regions do not need EventID objects
*
- * <p>
- * author Asif
- *
* @return boolean indicating whether to generate eventID or not
*/
@Override
@@ -1087,7 +1088,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return !isUsedForPartitionedRegionAdmin();
}
- public final Object destroy(Object key, Object aCallbackArgument)
+ @Override
+ public Object destroy(Object key, Object aCallbackArgument)
throws TimeoutException, EntryNotFoundException, CacheWriterException {
@Released
EntryEventImpl event = newDestroyEntryEvent(key, aCallbackArgument);
@@ -1105,7 +1107,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
public Object validatedDestroy(Object key, EntryEventImpl event)
throws TimeoutException, EntryNotFoundException, CacheWriterException {
if (event.getEventId() == null && generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
basicDestroy(event, true, // cacheWrite
null); // expectedOldValue
@@ -1117,7 +1119,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
@Retained
- public final EntryEventImpl newDestroyEntryEvent(Object key, Object aCallbackArgument) {
+ EntryEventImpl newDestroyEntryEvent(Object key, Object aCallbackArgument) {
validateKey(key);
validateCallbackArg(aCallbackArgument);
checkReadiness();
@@ -1127,6 +1129,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
aCallbackArgument, false, getMyId());
}
+ @Override
public void destroyRegion(Object aCallbackArgument)
throws CacheWriterException, TimeoutException {
getDataView().checkSupportsRegionDestroy();
@@ -1151,36 +1154,37 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @param keyInfo to which the value is associated
* @param updateStats true if the entry stats should be updated.
* @param disableCopyOnRead if true then disable copy on read
- * @param preferCD true if the preferred result form is CachedDeserializable
+ * @param preferCachedDeserializable true if the preferred result form is CachedDeserializable
* @param clientEvent client's event, if any (for version tag retrieval)
* @param returnTombstones whether destroyed entries should be returned
* @param retainResult if true then the result may be a retained off-heap reference
* @return the value for the given key
*/
- public final Object getDeserializedValue(RegionEntry re, final KeyInfo keyInfo,
- final boolean updateStats, boolean disableCopyOnRead, boolean preferCD,
+ public Object getDeserializedValue(RegionEntry regionEntry, final KeyInfo keyInfo,
+ final boolean updateStats, boolean disableCopyOnRead, boolean preferCachedDeserializable,
EntryEventImpl clientEvent, boolean returnTombstones, boolean retainResult) {
if (this.diskRegion != null) {
this.diskRegion.setClearCountReference();
}
try {
- if (re == null) {
- re = this.entries.getEntry(keyInfo.getKey());
+ if (regionEntry == null) {
+ regionEntry = this.entries.getEntry(keyInfo.getKey());
}
// skip updating the stats if the value is null
// TODO - We need to clean up the callers of the this class so that we can
// update the statistics here, where it would make more sense.
- if (re == null) {
+ if (regionEntry == null) {
return null;
}
final Object value;
- if (clientEvent != null && re.getVersionStamp() != null) {
+ if (clientEvent != null && regionEntry.getVersionStamp() != null) {
// defer the lruUpdateCallback to prevent a deadlock (see bug 51121).
final boolean disabled = this.entries.disableLruUpdateCallback();
try {
- synchronized (re) { // bug #51059 value & version must be obtained atomically
- clientEvent.setVersionTag(re.getVersionStamp().asVersionTag());
- value = getDeserialized(re, updateStats, disableCopyOnRead, preferCD, retainResult);
+ synchronized (regionEntry) { // bug #51059 value & version must be obtained atomically
+ clientEvent.setVersionTag(regionEntry.getVersionStamp().asVersionTag());
+ value = getDeserialized(regionEntry, updateStats, disableCopyOnRead,
+ preferCachedDeserializable, retainResult);
}
} finally {
if (disabled) {
@@ -1194,13 +1198,14 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
} else {
- value = getDeserialized(re, updateStats, disableCopyOnRead, preferCD, retainResult);
+ value = getDeserialized(regionEntry, updateStats, disableCopyOnRead,
+ preferCachedDeserializable, retainResult);
}
if (logger.isTraceEnabled() && !(this instanceof HARegion)) {
logger.trace(
"getDeserializedValue for {} returning version: {} returnTombstones: {} value: {}",
- keyInfo.getKey(),
- (re.getVersionStamp() == null ? "null" : re.getVersionStamp().asVersionTag()),
+ keyInfo.getKey(), regionEntry.getVersionStamp() == null ? "null"
+ : regionEntry.getVersionStamp().asVersionTag(),
returnTombstones, value);
}
return value;
@@ -1212,11 +1217,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
/**
- *
- * @param re
- * @param updateStats
* @param disableCopyOnRead if true then do not make a copy on read
- * @param preferCD true if the preferred result form is CachedDeserializable
+ * @param preferCachedDeserializable true if the preferred result form is CachedDeserializable
* @param retainResult if true then the result may be a retained off-heap reference
* @return the value found, which can be
* <ul>
@@ -1226,18 +1228,18 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* </ul>
*/
@Retained
- protected final Object getDeserialized(RegionEntry re, boolean updateStats,
- boolean disableCopyOnRead, boolean preferCD, boolean retainResult) {
- assert !retainResult || preferCD;
+ Object getDeserialized(RegionEntry regionEntry, boolean updateStats, boolean disableCopyOnRead,
+ boolean preferCachedDeserializable, boolean retainResult) {
+ assert !retainResult || preferCachedDeserializable;
boolean disabledLRUCallback = this.entries.disableLruUpdateCallback();
try {
@Retained
- Object v = null;
+ Object value;
try {
if (retainResult) {
- v = re.getValueRetain(this);
+ value = regionEntry.getValueRetain(this);
} else {
- v = re.getValue(this);
+ value = regionEntry.getValue(this);
}
} catch (DiskAccessException dae) {
this.handleDiskAccessException(dae);
@@ -1245,34 +1247,32 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
// skip updating the stats if the value is null
- if (v == null) {
+ if (value == null) {
return null;
}
- if (v instanceof CachedDeserializable) {
- if (!preferCD) {
+ if (value instanceof CachedDeserializable) {
+ if (!preferCachedDeserializable) {
if (isCopyOnRead()) {
if (disableCopyOnRead) {
- v = ((CachedDeserializable) v).getDeserializedForReading();
+ value = ((CachedDeserializable) value).getDeserializedForReading();
} else {
- v = ((CachedDeserializable) v).getDeserializedWritableCopy(this, re);
+ value = ((CachedDeserializable) value).getDeserializedWritableCopy(this, regionEntry);
}
} else {
- v = ((CachedDeserializable) v).getDeserializedValue(this, re);
+ value = ((CachedDeserializable) value).getDeserializedValue(this, regionEntry);
}
}
} else if (!disableCopyOnRead) {
- v = conditionalCopy(v);
+ value = conditionalCopy(value);
}
if (updateStats) {
- updateStatsForGet(re, v != null && !Token.isInvalid(v));
+ updateStatsForGet(regionEntry, value != null && !Token.isInvalid(value));
}
- return v;
+ return value;
} catch (IllegalArgumentException i) {
- IllegalArgumentException iae = new IllegalArgumentException(LocalizedStrings.DONT_RELEASE
- .toLocalizedString("Error while deserializing value for key=" + re.getKey()));
- iae.initCause(i);
- throw iae;
+ throw new IllegalArgumentException(LocalizedStrings.DONT_RELEASE
+ .toLocalizedString("Error while deserializing value for key=" + regionEntry.getKey()), i);
} finally {
if (disabledLRUCallback) {
this.entries.enableLruUpdateCallback();
@@ -1292,8 +1292,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return result;
}
- /*
- * @see BucketRegion#getSerialized(KeyInfo, boolean, boolean)
+ /**
+ * @see BucketRegion#getSerialized(KeyInfo, boolean, boolean, ClientProxyMembershipID,
+ * EntryEventImpl, boolean)
*/
public Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
@@ -1322,7 +1323,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* find the value if it is not local
*/
@Retained
- public Object getRetained(Object key, Object aCallbackArgument, boolean generateCallbacks,
+ private Object getRetained(Object key, Object aCallbackArgument, boolean generateCallbacks,
boolean disableCopyOnRead, ClientProxyMembershipID requestingClient,
EntryEventImpl clientEvent, boolean returnTombstones, boolean opScopeIsLocal)
throws TimeoutException, CacheLoaderException {
@@ -1390,7 +1391,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @param re optional region entry, fetched if null
* @param key the key used to fetch the region entry
*/
- final public void recordMiss(final RegionEntry re, Object key) {
+ void recordMiss(final RegionEntry re, Object key) {
final RegionEntry e;
if (re == null && !isTX()) {
e = basicGetEntry(key);
@@ -1403,25 +1404,19 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* optimized to only allow one thread to do a search/load, other threads wait on a future
*
- * @param keyInfo
- * @param p_isCreate true if call found no entry; false if updating an existing entry
- * @param generateCallbacks
- * @param p_localValue the value retrieved from the region for this object.
+ * @param isCreate true if call found no entry; false if updating an existing entry
+ * @param localValue the value retrieved from the region for this object.
* @param disableCopyOnRead if true then do not make a copy
* @param preferCD true if the preferred result form is CachedDeserializable
* @param clientEvent the client event, if any
* @param returnTombstones whether to return tombstones
*/
@Retained
- Object nonTxnFindObject(KeyInfo keyInfo, boolean p_isCreate, boolean generateCallbacks,
- Object p_localValue, boolean disableCopyOnRead, boolean preferCD,
+ Object nonTxnFindObject(KeyInfo keyInfo, boolean isCreate, boolean generateCallbacks,
+ Object localValue, boolean disableCopyOnRead, boolean preferCD,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
boolean returnTombstones) throws TimeoutException, CacheLoaderException {
- final Object key = keyInfo.getKey();
- Object localValue = p_localValue;
- boolean isCreate = p_isCreate;
- Object[] valueAndVersion = null;
@Retained
Object result = null;
FutureResult thisFuture = new FutureResult(this.stopper);
@@ -1429,7 +1424,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// only one thread can get their future into the map for this key at a time
if (otherFuture != null) {
try {
- valueAndVersion = (Object[]) otherFuture.get();
+ Object[] valueAndVersion = (Object[]) otherFuture.get();
if (valueAndVersion != null) {
result = valueAndVersion[0];
if (clientEvent != null) {
@@ -1448,24 +1443,22 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
result = conditionalCopy(result);
}
// what was a miss is now a hit
- RegionEntry re = null;
if (isCreate) {
- re = basicGetEntry(keyInfo.getKey());
- updateStatsForGet(re, true);
+ RegionEntry regionEntry = basicGetEntry(keyInfo.getKey());
+ updateStatsForGet(regionEntry, true);
}
return result;
}
// if value == null, try our own search/load
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
// TODO check a CancelCriterion here?
return null;
} catch (ExecutionException e) {
// unexpected since there is no background thread
- InternalGemFireError err = new InternalGemFireError(
- LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION.toLocalizedString());
- err.initCause(err);
- throw err;
+ // NOTE: this was creating InternalGemFireError and initCause with itself
+ throw new InternalGemFireError(
+ LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION.toLocalizedString(), e);
}
}
// didn't find a future, do one more probe for the entry to catch a race
@@ -1487,11 +1480,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
} else {
- // This code was moved from PartitionedRegion.nonTxnFindObject(). That method has been
- // removed.
// For PRs we don't want to deserialize the value and we can't use findObjectInSystem
- // because
- // it can invoke code that is transactional.
+ // because it can invoke code that is transactional.
result =
getSharedDataView().findObject(keyInfo, this, isCreate, generateCallbacks, localValue,
disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones);
@@ -1505,7 +1495,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// findObjectInSystem does not call conditionalCopy
} finally {
if (result != null) {
- VersionTag tag = (clientEvent == null) ? null : clientEvent.getVersionTag();
+ VersionTag tag = clientEvent == null ? null : clientEvent.getVersionTag();
thisFuture.set(new Object[] {result, tag});
} else {
thisFuture.set(null);
@@ -1534,7 +1524,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
*
* @since GemFire 4.0
*/
- protected Object conditionalCopy(Object o) {
+ Object conditionalCopy(Object o) {
if (isCopyOnRead() && !Token.isInvalid(o)) {
return CopyHelper.copy(o);
} else {
@@ -1544,34 +1534,23 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
private final String fullPath;
+ @Override
public String getFullPath() {
return this.fullPath;
}
- // public String getFullPath() {
- // // work way up to root region, prepending
- // // the region names to a buffer
- // StringBuffer buf = new StringBuffer(SEPARATOR);
- // Assert.assertTrue(this.regionName != null);
- // buf.append(this.regionName);
- // LocalRegion r = this;
- // while ((r = r.parentRegion) != null) {
- // buf.insert(0, r.regionName);
- // buf.insert(0, SEPARATOR_CHAR);
- // }
- // return buf.toString();
- // }
-
+ @Override
public Region getParentRegion() {
- // checkReadiness();
return this.parentRegion;
}
+ @Override
public Region getSubregion(String path) {
checkReadiness();
return getSubregion(path, false);
}
+ @Override
public void invalidateRegion(Object aCallbackArgument) throws TimeoutException {
getDataView().checkSupportsRegionInvalidate();
validateCallbackArg(aCallbackArgument);
@@ -1583,6 +1562,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
basicInvalidateRegion(event);
}
+ @Override
public Object put(Object key, Object value, Object aCallbackArgument)
throws TimeoutException, CacheWriterException {
long startPut = CachePerfStats.getStatTime();
@@ -1595,11 +1575,11 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- public final Object validatedPut(EntryEventImpl event, long startPut)
+ Object validatedPut(EntryEventImpl event, long startPut)
throws TimeoutException, CacheWriterException {
if (event.getEventId() == null && generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
Object oldValue = null;
if (basicPut(event, false, // ifNew
@@ -1620,8 +1600,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
@Retained
- public final EntryEventImpl newUpdateEntryEvent(Object key, Object value,
- Object aCallbackArgument) {
+ EntryEventImpl newUpdateEntryEvent(Object key, Object value, Object aCallbackArgument) {
validateArguments(key, value, aCallbackArgument);
if (value == null) {
@@ -1665,31 +1644,27 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// 10. If any exception is caught while invoking the delta callbacks, throw it back.
// 11. Wrap any checked exception in InternalGemFireException before throwing it.
try {
- boolean extractDelta = false;
// How costly is this if check?
- if (this.getSystem().getConfig().getDeltaPropagation()
- && value instanceof org.apache.geode.Delta) {
+ if (getSystem().getConfig().getDeltaPropagation() && value instanceof Delta) {
+ boolean extractDelta = false;
if (!this.hasServerProxy()) {
- if ((this instanceof PartitionedRegion)) {
+ if (this instanceof PartitionedRegion) {
if (((PartitionedRegion) this).getRedundantCopies() > 0) {
extractDelta = true;
} else {
InternalDistributedMember ids = (InternalDistributedMember) PartitionRegionHelper
.getPrimaryMemberForKey(this, event.getKey());
if (ids != null) {
- if (this.getSystem().getMemberId().equals(ids.getId())) {
- extractDelta = hasAdjunctRecipientsNeedingDelta(event);
- } else {
- extractDelta = true;
- }
+ extractDelta = !this.getSystem().getMemberId().equals(ids.getId())
+ || hasAdjunctRecipientsNeedingDelta(event);
} else {
extractDelta = true;
}
}
- } else if ((this instanceof DistributedRegion)
+ } else if (this instanceof DistributedRegion
&& !((DistributedRegion) this).scope.isDistributedNoAck()
- && ((DistributedRegion) this).getCacheDistributionAdvisor().adviseCacheOp()
- .size() > 0) {
+ && !((CacheDistributionAdvisee) this).getCacheDistributionAdvisor().adviseCacheOp()
+ .isEmpty()) {
extractDelta = true;
}
if (!extractDelta && ClientHealthMonitor.getInstance() != null) {
@@ -1725,29 +1700,27 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
@SuppressWarnings("unchecked")
private boolean hasAdjunctRecipientsNeedingDelta(EntryEventImpl event) {
- PartitionedRegion pr = ((PartitionedRegion) this);
- BucketRegion br = null;
- FilterRoutingInfo filterRouting = null;
- Set twoMessages = Collections.EMPTY_SET;
- Set adjunctRecipients = Collections.EMPTY_SET;
- Set cacheservers = null;
+ PartitionedRegion partitionedRegion = (PartitionedRegion) this;
+ BucketRegion bucketRegion;
int bId = event.getKeyInfo().getBucketId();
try {
- br = pr.dataStore.getInitializedBucketForId(event.getKey(), bId);
- } catch (ForceReattemptException fre) {
+ bucketRegion = partitionedRegion.dataStore.getInitializedBucketForId(event.getKey(), bId);
+ } catch (ForceReattemptException ignore) {
return true;
}
Set<InternalDistributedMember> recipients =
- br.getCacheDistributionAdvisor().adviseUpdate(event);
- twoMessages = br.getBucketAdvisor().adviseRequiresTwoMessages();
- CacheDistributionAdvisor cda = pr.getCacheDistributionAdvisor();
- filterRouting = cda.adviseFilterRouting(event, recipients);
- adjunctRecipients = br.getAdjunctReceivers(event, recipients, twoMessages, filterRouting);
- cacheservers = cda.adviseCacheServers();
- return !Collections.disjoint(adjunctRecipients, cacheservers);
+ bucketRegion.getCacheDistributionAdvisor().adviseUpdate(event);
+ Set<Object> twoMessages = bucketRegion.getBucketAdvisor().adviseRequiresTwoMessages();
+ CacheDistributionAdvisor cda = partitionedRegion.getCacheDistributionAdvisor();
+ FilterRoutingInfo filterRouting = cda.adviseFilterRouting(event, recipients);
+ Set<Object> adjunctRecipients =
+ bucketRegion.getAdjunctReceivers(event, recipients, twoMessages, filterRouting);
+ Set cacheServerMembers = cda.adviseCacheServers();
+ return !Collections.disjoint(adjunctRecipients, cacheServerMembers);
}
+ @Override
public Region.Entry getEntry(Object key) {
validateKey(key);
checkReadiness();
@@ -1765,7 +1738,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* Just like getEntry but also updates the stats that get would have depending on a flag. See bug
* 42410. Also skips discovering JTA
*
- * @param key
* @return the entry if it exists; otherwise null.
*/
public Entry accessEntry(Object key, boolean updateStats) {
@@ -1781,32 +1753,31 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/** a fast estimate of total number of entries locally in the region */
public long getEstimatedLocalSize() {
- RegionMap rm;
if (!this.isDestroyed) {
long size;
// if region has not been initialized yet, then get the estimate from
// disk region's recovery map if available
+ RegionMap regionMap;
if (!this.initialized && this.diskRegion != null
- && (rm = this.diskRegion.getRecoveredEntryMap()) != null && (size = rm.size()) > 0) {
+ && (regionMap = this.diskRegion.getRecoveredEntryMap()) != null
+ && (size = regionMap.size()) > 0) {
return size;
}
- if ((rm = getRegionMap()) != null) {
- return rm.size();
+ if ((regionMap = getRegionMap()) != null) {
+ return regionMap.size();
}
}
return 0;
}
/**
- * @param keyInfo
* @param access true if caller wants last accessed time updated
* @param allowTombstones whether an entry with a TOMBSTONE value can be returned
- * @return TODO
*/
protected Region.Entry nonTXGetEntry(KeyInfo keyInfo, boolean access, boolean allowTombstones) {
final Object key = keyInfo.getKey();
RegionEntry re = this.entries.getEntry(key);
- boolean miss = (re == null || re.isDestroyedOrRemoved());
+ boolean miss = re == null || re.isDestroyedOrRemoved();
if (access) {
updateStatsForGet(re, !miss);
}
@@ -1821,12 +1792,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return null;
}
- Region.Entry ren = new NonTXEntry(re);
- // long start=0, end=0;
- // start = System.currentTimeMillis();
- // end = System.currentTimeMillis();
- // System.out.println("getEntry: " + (end-start));
- return ren;
+ return new NonTXEntry(re);
}
/**
@@ -1841,32 +1807,26 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* {@link #isDestroyed()} this method will not return true if the cache is closing but has not yet
* started closing this region.
*/
- public boolean isThisRegionBeingClosedOrDestroyed() {
+ boolean isThisRegionBeingClosedOrDestroyed() {
return this.isDestroyed;
}
/** returns true if this region has been destroyed */
+ @Override
public boolean isDestroyed() {
if (isClosed()) {
return true; // for bug 42328
}
+
boolean isTraceEnabled = logger.isTraceEnabled();
- // boolean result = false;
+
if (this.isDestroyed) {
if (isTraceEnabled) {
logger.trace("isDestroyed: true, this.isDestroyed: {}", getFullPath());
}
return true;
}
- // if (!isInitialized()) { // don't return true if still initializing
- // if (finestEnabled) {
- // log.finest("isDestroyed: false, not initialized: " + getFullPath());
- // }
- // return false;
- // }
- // @todo we could check parents here if we want this to be more accurate,
- // and the isDestroyed field could be made volatile as well.
- // if (this.parentRegion != null) return this.parentRegion.isDestroyed();
+
if (isTraceEnabled) {
logger.trace("isDestroyed: false : {}", getFullPath());
}
@@ -1874,15 +1834,17 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
/** a variant of subregions() that does not perform a readiness check */
- protected Set basicSubregions(boolean recursive) {
+ Set basicSubregions(boolean recursive) {
return new SubregionsSet(recursive);
}
+ @Override
public Set subregions(boolean recursive) {
checkReadiness();
return new SubregionsSet(recursive);
}
+ @Override
public Set entries(boolean recursive) {
checkReadiness();
checkForNoAccess();
@@ -1905,6 +1867,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return new EntriesSet(this, false, IteratorType.KEYS, false /* allowTombstones */);
}
+ @Override
public Set keys() {
checkReadiness();
checkForNoAccess();
@@ -1923,21 +1886,25 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return new EntriesSet(this, false, IteratorType.KEYS, allowTombstones);
}
+ @Override
public Collection values() {
checkReadiness();
checkForNoAccess();
return new EntriesSet(this, false, IteratorType.VALUES, false);
}
+ @Override
public Object getUserAttribute() {
return this.regionUserAttribute;
}
+ @Override
public void setUserAttribute(Object value) {
checkReadiness();
this.regionUserAttribute = value;
}
+ @Override
public boolean containsKey(Object key) {
checkReadiness();
checkForNoAccess();
@@ -1952,12 +1919,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
} else {
try {
Entry entry = getDataView().getEntry(getKeyInfo(key), this, true);
- if (entry == null) {
- return false;
- } else {
- return (entry.getValue() == Token.TOMBSTONE);
- }
- } catch (EntryDestroyedException e) {
+ return entry != null && entry.getValue() == Token.TOMBSTONE;
+ } catch (EntryDestroyedException ignore) {
return true;
}
}
@@ -1968,24 +1931,20 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
if (contains && this.imageState.isClient()) {
// fix for bug #40871 - concurrent RI causes containsKey for destroyed entry
// to return true
- RegionEntry re = this.entries.getEntry(keyInfo.getKey());
- // TODO:KIRK:OK if (re == null || Token.isRemoved(re.getValueInVM(this))) {
- if (re == null || re.isDestroyedOrRemoved()) {
+ RegionEntry regionEntry = this.entries.getEntry(keyInfo.getKey());
+ if (regionEntry == null || regionEntry.isDestroyedOrRemoved()) {
contains = false;
}
}
return contains;
}
+ @Override
public boolean containsValueForKey(Object key) {
discoverJTA();
return getDataView().containsValueForKey(getKeyInfo(key), this);
}
- /**
- * @param keyInfo
- * @return TODO
- */
protected boolean nonTXContainsValueForKey(KeyInfo keyInfo) {
checkReadiness();
checkForNoAccess();
@@ -1997,8 +1956,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
boolean result = entry != null;
if (result) {
ReferenceCountHelper.skipRefCountTracking();
- Object val = entry.getTransformedValue(); // no need to decompress since we only want to
- // know if we have an existing value
+ // no need to decompress since we only want to
+ Object val = entry.getTransformedValue();
+ // know if we have an existing value
if (val instanceof StoredObject) {
OffHeapHelper.release(val);
ReferenceCountHelper.unskipRefCountTracking();
@@ -2019,12 +1979,13 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
+ @Override
public RegionAttributes getAttributes() {
// to fix bug 35134 allow attribute access on closed regions
- // checkReadiness();
return this;
}
+ @Override
public String getName() {
return this.regionName;
}
@@ -2048,10 +2009,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* may change the number of entries in this region while this method is being invoked.
*
* @see RegionMap#size
- *
- * author David Whitlock
*/
- public final int entryCount() {
+ public int entryCount() {
return getDataView().entryCount(this);
}
@@ -2065,11 +2024,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return getDataView().entryCount(this);
}
- public int entryCountEstimate(final TXStateInterface tx, Set<Integer> buckets,
- boolean entryCountEstimate) {
- return entryCount(buckets, entryCountEstimate);
- }
-
/**
* @return size after considering imageState
*/
@@ -2086,9 +2040,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
/**
- * Returns the <code>DiskRegion</code> that this region uses to access data on disk.
+ * Returns the {@code DiskRegion} that this region uses to access data on disk.
*
- * @return <code>null</code> if disk regions are not being used
+ * @return {@code null} if disk regions are not being used
*
* @since GemFire 3.2
*/
@@ -2096,6 +2050,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
return this.diskRegion;
}
+ @Override
public DiskRegionView getDiskRegionView() {
return getDiskRegion();
}
@@ -2109,28 +2064,12 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- /**
- *
- * Initially called by EvictorThread.run
- *
- * @since GemFire 3.5.1
- */
- public void checkLRU() {
- if (this.entriesInitialized) {
- try {
- this.entries.lruUpdateCallback();
- } catch (DiskAccessException dae) {
- this.handleDiskAccessException(dae);
- throw dae;
- }
- }
- }
-
- protected boolean isOverflowEnabled() {
+ private boolean isOverflowEnabled() {
EvictionAttributes ea = getAttributes().getEvictionAttributes();
return ea != null && ea.getAction().isOverflowToDisk();
}
+ @Override
public void writeToDisk() {
if (this.diskRegion == null) {
DataPolicy dp = getDataPolicy();
@@ -2160,6 +2099,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* This implementation only checks readiness and scope
*/
+ @Override
public Lock getRegionDistributedLock() throws IllegalStateException {
checkReadiness();
checkForLimitedOrNoAccess();
@@ -2172,6 +2112,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* This implementation only checks readiness and scope
*/
+ @Override
public Lock getDistributedLock(Object key) throws IllegalStateException {
checkReadiness();
checkForLimitedOrNoAccess();
@@ -2181,6 +2122,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
LocalizedStrings.LocalRegion_ONLY_SUPPORTED_FOR_GLOBAL_SCOPE_NOT_LOCAL.toLocalizedString());
}
+ @Override
public void invalidate(Object key, Object aCallbackArgument)
throws TimeoutException, EntryNotFoundException {
checkReadiness();
@@ -2192,14 +2134,14 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* Destroys entry without performing validations. Call this after validating key, callback arg,
* and runtime state.
*/
- protected void validatedInvalidate(Object key, Object aCallbackArgument)
+ void validatedInvalidate(Object key, Object aCallbackArgument)
throws TimeoutException, EntryNotFoundException {
@Released
EntryEventImpl event = EntryEventImpl.create(this, Operation.INVALIDATE, key, null,
aCallbackArgument, false, getMyId());
try {
if (generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
basicInvalidate(event);
} finally {
@@ -2207,6 +2149,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
+ @Override
public void localDestroy(Object key, Object aCallbackArgument) throws EntryNotFoundException {
validateKey(key);
checkReadiness();
@@ -2215,7 +2158,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
EntryEventImpl event = EntryEventImpl.create(this, Operation.LOCAL_DESTROY, key, null,
aCallbackArgument, false, getMyId());
if (generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
try {
basicDestroy(event, false, null); // expectedOldValue
@@ -2236,6 +2179,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
+ @Override
public void localDestroyRegion(Object aCallbackArgument) {
getDataView().checkSupportsRegionDestroy();
RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_LOCAL_DESTROY,
@@ -2257,8 +2201,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
+ @Override
public void close() {
-
RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_CLOSE, null, false,
getMyId(), generateEventID()/* generate EventID */);
try {
@@ -2282,17 +2226,18 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- public void localInvalidate(Object key, Object callbackArgument) throws EntryNotFoundException {
+ @Override
+ public void localInvalidate(Object key, Object aCallbackArgument) throws EntryNotFoundException {
validateKey(key);
checkReadiness();
checkForNoAccess();
@Released
EntryEventImpl event = EntryEventImpl.create(this, Operation.LOCAL_INVALIDATE, key,
- null/* newValue */, callbackArgument, false, getMyId());
+ null/* newValue */, aCallbackArgument, false, getMyId());
try {
if (generateEventID()) {
- event.setNewEventId(cache.getDistributedSystem());
+ event.setNewEventId(this.cache.getDistributedSystem());
}
event.setLocalInvalid(true);
basicInvalidate(event);
@@ -2301,6 +2246,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
+ @Override
public void localInvalidateRegion(Object aCallbackArgument) {
getDataView().checkSupportsRegionInvalidate();
checkReadiness();
@@ -2316,28 +2262,21 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @param system the distributed system whose cache contains the root of interest
* @return the LocalRegion or null if not found
*/
- public static LocalRegion getRegionFromPath(DistributedSystem system, String path) {
- Cache c = GemFireCacheImpl.getInstance();
- if (c == null) {
+ static LocalRegion getRegionFromPath(DistributedSystem system, String path) {
+ Cache cache = GemFireCacheImpl.getInstance();
+ if (cache == null) {
return null;
} else {
- return (LocalRegion) c.getRegion(path);
+ return (LocalRegion) cache.getRegion(path);
}
}
- // public void dumpEntryMapStats(PrintStream out) {
- // ((ConcurrentHashMap)this.entries).dumpStats(out);
- // }
-
- ////////////////// Protected Methods ////////////////////////////////////////
-
/**
* Do any extra initialization required. Region is already visible in parent's subregion map. This
* method releases the initialization Latches, so subclasses should call this super method last
* after performing additional initialization.
*
* @param imageTarget ignored, used by subclass for get initial image
- * @param internalRegionArgs
* @see DistributedRegion#initialize(InputStream, InternalDistributedMember,
* InternalRegionArguments)
*/
@@ -2348,7 +2287,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// Subclasses may have already called this method, but this is
// acceptable because addResourceListener won't add it twice
if (!this.isDestroyed) {
- cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
+ this.cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
}
}
@@ -2363,20 +2302,19 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
try {
this.diskRegion.initializeOwner(this);
this.diskRegion.finishInitializeOwner(this, GIIStatus.NO_GII);
- { // This block was added so that early recovery could figure out that
- // this data needs to be recovered from disk. Local regions used to
- // not bother assigning a memberId but that is what the early
- // recovery
- // code uses to figure out that a region needs to be recovered.
- PersistentMemberID oldId = this.diskRegion.getMyInitializingID();
- if (oldId == null) {
- oldId = this.diskRegion.getMyPersistentID();
- }
- if (oldId == null) {
- PersistentMemberID newId = this.diskRegion.generatePersistentID();
- this.diskRegion.setInitializing(newId);
- this.diskRegion.setInitialized();
- }
+ // This block was added so that early recovery could figure out that
+ // this data needs to be recovered from disk. Local regions used to
+ // not bother assigning a memberId but that is what the early
+ // recovery
+ // code uses to figure out that a region needs to be recovered.
+ PersistentMemberID oldId = this.diskRegion.getMyInitializingID();
+ if (oldId == null) {
+ oldId = this.diskRegion.getMyPersistentID();
+ }
+ if (oldId == null) {
+ PersistentMemberID newId = this.diskRegion.generatePersistentID();
+ this.diskRegion.setInitializing(newId);
+ this.diskRegion.setInitialized();
}
} catch (DiskAccessException dae) {
releaseAfterRegionCreateEventLatch();
@@ -2397,7 +2335,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
throw dae;
}
}
+
releaseAfterGetInitialImageLatch();
+
if (logger.isDebugEnabled()) {
logger.debug("Calling addExpiryTasks for {}", this);
}
@@ -2411,7 +2351,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
rescheduleEntryExpiryTasks(); // called after gii to fix bug 35214
}
initialized();
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// whether it is this region or a parent region that is destroyed,
// then so must we be
Assert.assertTrue(isDestroyed());
@@ -2419,15 +2359,14 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
}
- protected void createOQLIndexes(InternalRegionArguments internalRegionArgs) {
+ void createOQLIndexes(InternalRegionArguments internalRegionArgs) {
createOQLIndexes(internalRegionArgs, false);
}
- protected void createOQLIndexes(InternalRegionArguments internalRegionArgs,
- boolean recoverFromDisk) {
+ void createOQLIndexes(InternalRegionArguments internalRegionArgs, boolean recoverFromDisk) {
if (internalRegionArgs == null || internalRegionArgs.getIndexes() == null
- || internalRegionArgs.getIndexes().size() == 0) {
+ || internalRegionArgs.getIndexes().isEmpty()) {
return;
}
if (logger.isDebugEnabled()) {
@@ -2439,9 +2378,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
if (this.indexManager == null) {
this.indexManager = IndexUtils.getIndexManager(this, true);
}
- Set<Index> indexes = new HashSet<Index>();
- Set<Index> prIndexes = new HashSet<Index>();
- int initLevel = 0;
DiskRegion dr = this.getDiskRegion();
boolean isOverflowToDisk = false;
if (dr != null) {
@@ -2455,6 +2391,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
dr.waitForAsyncRecovery();
}
}
+ Set<Index> indexes = new HashSet<Index>();
+ Set<Index> prIndexes = new HashSet<>();
+ int initLevel = 0;
try {
// Release the initialization latch for index creation.
initLevel = LocalRegion.setThreadInitLevelRequirement(ANY_INIT);
@@ -2480,10 +2419,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
if (logger.isDebugEnabled()) {
logger.debug("QueryService Index creation process for {}" + icd.getIndexName());
}
- DefaultQueryService qs =
- (DefaultQueryService) this.getGemFireCache().getLocalQueryService();
+ DefaultQueryService qs = (DefaultQueryService) getGemFireCache().getLocalQueryService();
String fromClause =
- (icd.getIndexType() == IndexType.FUNCTIONAL || icd.getIndexType() == IndexType.HASH)
+ icd.getIndexType() == IndexType.FUNCTIONAL || icd.getIndexType() == IndexType.HASH
? icd.getIndexFromClause() : this.getFullPath();
// load entries during initialization only for non overflow regions
indexes.add(
@@ -2499,11 +2437,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// Other case is when bucket regions are created dynamically, in that case ignore the
// exception.
if (internalRegionArgs.getDeclarativeIndexCreation()) {
- InternalGemFireError err =
- new InternalGemFireError(LocalizedStrings.GemFireCache_INDEX_CREATION_EXCEPTION_1
- .toLocalizedString(new Object[] {icd.getIndexName(), this.getFullPath()}));
- err.initCause(ex);
- throw err;
+ throw new InternalGemFireError(LocalizedStrings.GemFireCache_INDEX_CREATION_EXCEPTION_1
+ .toLocalizedString(icd.getIndexName(), this.getFullPath()), ex);
}
}
}
@@ -2531,7 +2466,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
/**
* Populate the indexes with region entries
*/
- protected void populateOQLIndexes(Set<Index> indexes) {
+ private void populateOQLIndexes(Set<Index> indexes) {
logger.info(LocalizedMessage.create(LocalizedStrings.GemFireCache_INDEX_LOADING));
try {
this.indexManager.populateIndexes(indexes);
@@ -2553,14 +2488,14 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
releaseAfterRegionCreateEventLatch();
}
- protected void releaseBeforeGetInitialImageLatch() {
+ void releaseBeforeGetInitialImageLatch() {
if (logger.isDebugEnabled()) {
logger.debug("Releasing Initialization Latch (before initial image) for {}", getFullPath());
}
releaseLatch(this.initializationLatchBeforeGetInitialImage);
}
- protected final void releaseAfterGetInitialImageLatch() {
+ final void releaseAfterGetInitialImageLatch() {
if (logger.isDebugEnabled()) {
logger.debug("Releasing Initialization Latch (after initial image) for {}", getFullPath());
}
@@ -2582,11 +2517,11 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @since GemFire 5.0
*/
private void waitForRegionCreateEvent() {
- StoppableCountDownLatch l = this.afterRegionCreateEventLatch;
- if (l != null && l.getCount() == 0) {
+ StoppableCountDownLatch latch = this.afterRegionCreateEventLatch;
+ if (latch != null && latch.getCount() == 0) {
return;
}
- waitOnInitialization(l);
+ waitOnInitialization(latch);
}
private static void releaseLatch(StoppableCountDownLatch latch) {
@@ -2601,17 +2536,16 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @param eventSet collects the events for all destroyed regions if null, then we're closing so
* don't send events to callbacks or destroy the disk region
*/
- private void recursiveDestroyRegion(Set eventSet, RegionEventImpl p_event, boolean cacheWrite)
+ private void recursiveDestroyRegion(Set eventSet, RegionEventImpl regionEvent, boolean cacheWrite)
throws CacheWriterException, TimeoutException {
- RegionEventImpl event = p_event;
- final boolean isClose = event.getOperation().isClose();
+ final boolean isClose = regionEvent.getOperation().isClose();
// do the cacheWriter beforeRegionDestroy first to fix bug 47736
if (eventSet != null && cacheWrite) {
try {
- cacheWriteBeforeRegionDestroy(event);
+ cacheWriteBeforeRegionDestroy(regionEvent);
} catch (CancelException e) {
// I don't think this should ever happens: bulletproofing for bug 39454
- if (!cache.forcedDisconnect()) {
+ if (!this.cache.forcedDisconnect()) {
logger.warn(
LocalizedMessage.create(
LocalizedStrings.LocalRegion_RECURSIVEDESTROYREGION_PROBLEM_IN_CACHEWRITEBEFOREREGIONDESTROY),
@@ -2633,7 +2567,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
if (!isInternalRegion()) {
getCachePerfStats().incRegions(-1);
}
- cache.getInternalResourceManager(false).removeResourceListener(this);
+ this.cache.getInternalResourceManager(false).removeResourceListener(this);
if (getMembershipAttributes().hasRequiredRoles()) {
if (!isInternalRegion()) {
getCachePerfStats().incReliableRegions(-1);
@@ -2644,8 +2578,8 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// because of the SystemMemberCacheEventProcessor. Once we have
// a way to check for existence of SystemMemberCacheEventProcessor listeners
// then the add only needs to be done if hasListener || hasAdminListener
- if (eventSet != null) { // && hasListener())
- eventSet.add(event);
+ if (eventSet != null) {
+ eventSet.add(regionEvent);
}
try {
@@ -2653,49 +2587,52 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// from this subregion map
Collection values = this.subregions.values();
for (Iterator itr = values.iterator(); itr.hasNext();) {
- Object element = itr.next(); // element is a LocalRegion
- LocalRegion rgn;
+ // element is a LocalRegion
+ Object element = itr.next();
+ LocalRegion region;
try {
LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
- rgn = toRegion(element); // converts to a LocalRegion
+ // converts to a LocalRegion
+ region = toRegion(element);
} finally {
LocalRegion.setThreadInitLevelRequirement(LocalRegion.AFTER_INITIAL_IMAGE);
}
- } catch (CancelException e) {
- rgn = (LocalRegion) element; // ignore, keep going through the motions though
- } catch (RegionDestroyedException rde) {
+ } catch (CancelException ignore) {
+ // ignore, keep going through the motions though
+ region = (LocalRegion) element;
+ } catch (RegionDestroyedException ignore) {
// SharedRegionData was destroyed
continue;
}
// if the region is destroyed, then it is a race condition with
// failed initialization removing it from the parent subregion map
- if (rgn.isDestroyed) {
+ if (region.isDestroyed) {
continue;
}
- /** ** BEGIN operating on subregion of this region (rgn) *** */
+ // BEGIN operating on subregion of this region (rgn)
if (eventSet != null) {
- event = (RegionEventImpl) event.clone();
- event.region = rgn;
+ regionEvent = (RegionEventImpl) regionEvent.clone();
+ regionEvent.region = region;
}
try {
- rgn.recursiveDestroyRegion(eventSet, event, cacheWrite);
- if (!rgn.isInternalRegion()) {
- InternalDistributedSystem system = rgn.cache.getInternalDistributedSystem();
- system.handleResourceEvent(ResourceEvent.REGION_REMOVE, rgn);
+ region.recursiveDestroyRegion(eventSet, regionEvent, cacheWrite);
+ if (!region.isInternalRegion()) {
+ InternalDistributedSystem system = region.cache.getInternalDistributedSystem();
+ system.handleResourceEvent(ResourceEvent.REGION_REMOVE, region);
}
} catch (CancelException e) {
// I don't think this should ever happen: bulletproofing for bug 39454
- if (!cache.forcedDisconnect()) {
+ if (!this.cache.forcedDisconnect()) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.LocalRegion_RECURSIVEDESTROYREGION_RECURSION_FAILED_DUE_TO_CACHE_CLOSURE_REGION_0,
- rgn.getFullPath()), e);
+ region.getFullPath()), e);
}
}
itr.remove(); // remove from this subregion map;
- /** ** END operating on subregion of this region *** */
+ // END operating on subregion of this region
} // for
try {
@@ -2711,7 +2648,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
} catch (CancelException e) {
// I don't think this should ever happens: bulletproofing for bug 39454
- if (!cache.forcedDisconnect()) {
+ if (!this.cache.forcedDisconnect()) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.LocalRegion_BASICDESTROYREGION_INDEX_REMOVAL_FAILED_DUE_TO_CACHE_CLOSURE_REGION_0,
getFullPath()), e);
@@ -2719,7 +2656,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
}
} finally {
// mark this region as destroyed.
- if (event.isReinitializing()) {
+ if (regionEvent.isReinitializing()) {
this.reinitialized_old = true;
}
this.cache.setRegionByPath(getFullPath(), null);
@@ -2743,7 +2680,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
// if eventSet is null then we need to close the listener as well
// otherwise, the listener will be closed after the destroy event
try {
- postDestroyRegion(!isClose, event);
+ postDestroyRegion(!isClose, regionEvent);
} catch (CancelException e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.LocalRegion_RECURSIVEDESTROYREGION_POSTDESTROYREGION_FAILED_DUE_TO_CACHE_CLOSURE_REGION_0,
@@ -2793,7 +2730,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
*
* @param entryKey the missing entry's key.
*/
- public void checkEntryNotFound(Object entryKey) {
+ void checkEntryNotFound(Object entryKey) {
checkReadiness();
// Localized string for partitioned region is generic enough for general use
throw new EntryNotFoundException(
@@ -2809,15 +2746,13 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
* @param preferCD return the CacheDeserializable, if that's what the value is.
* @param requestingClient the client making the request, if any
* @param clientEvent the client's event, if any. If not null, we set the version tag
- * @param returnTombstones TODO
* @return the deserialized value
- * @see LocalRegion#findObjectInSystem(KeyInfo, boolean, TXStateInterface, boolean, Object,
- * boolean, boolean, ClientProxyMembershipID, EntryEventImpl, boolean)
*/
protected Object findObjectInSystem(KeyInfo keyInfo, boolean isCreate, TXStateInterface tx,
boolean generateCallbacks, Object localValue, boolean disableCopyOnRead, boolean preferCD,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
boolean returnTombstones) throws CacheLoaderException, TimeoutException {
+
final Object key = keyInfo.getKey();
final Object aCallbackArgument = keyInfo.getCallbackArg();
Object value = null;
@@ -2827,13 +2762,11 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
<TRUNCATED>
[06/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
index 7ee5a8d..9c2ea23 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
@@ -14,8 +14,52 @@
*/
package org.apache.geode.internal.cache.ha;
-import org.apache.geode.*;
-import org.apache.geode.cache.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Queue;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.CancelException;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.StatisticsFactory;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.CacheException;
+import org.apache.geode.cache.CacheListener;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.CustomExpiry;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.ExpirationAction;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.MirrorType;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.query.internal.CqQueryVsdStats;
import org.apache.geode.cache.query.internal.cq.CqService;
@@ -30,9 +74,20 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.DataSerializableFixedID;
import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.*;
-import org.apache.geode.internal.cache.tier.sockets.*;
+import org.apache.geode.internal.cache.CacheServerImpl;
+import org.apache.geode.internal.cache.Conflatable;
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.RegionQueue;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
+import org.apache.geode.internal.cache.tier.sockets.ClientMarkerMessageImpl;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage;
+import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl.CqNameToOp;
+import org.apache.geode.internal.cache.tier.sockets.HAEventWrapper;
+import org.apache.geode.internal.cache.tier.sockets.HandShake;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
@@ -41,17 +96,6 @@ import org.apache.geode.internal.util.concurrent.StoppableCondition;
import org.apache.geode.internal.util.concurrent.StoppableReentrantLock;
import org.apache.geode.internal.util.concurrent.StoppableReentrantReadWriteLock;
import org.apache.geode.internal.util.concurrent.StoppableReentrantReadWriteLock.StoppableWriteLock;
-import org.apache.logging.log4j.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.*;
/**
* An implementation of Queue using Gemfire Region as the underlying datastructure. The key will be
@@ -72,26 +116,23 @@ import java.util.concurrent.locks.*;
*
* 30 May 2008: 5.7 onwards the underlying GemFire Region will continue to have key as counter(long)
* but the value will be a wrapper object(HAEventWrapper) which will be a key in a separate data
- * strucure called haContainer (an implementation of Map). The value against this wrapper will be
+ * structure called haContainer (an implementation of Map). The value against this wrapper will be
* the offered object in the queue. The purpose of this modification is to allow multiple
* ha-region-queues share their offered values without storing separate copies in memory, upon GII.
*
* (See BlockingHARegionQueue)
*
- *
* @since GemFire 4.3
- *
*/
public class HARegionQueue implements RegionQueue {
private static final Logger logger = LogService.getLogger();
- /** The <code>Region</code> backing this queue */
+ /** The {@code Region} backing this queue */
protected HARegion region;
/**
- * The key into the <code>Region</code> used when putting entries onto the queue. The counter uses
+ * The key into the {@code Region} used when putting entries onto the queue. The counter uses
* incrementAndGet so counter will always be started from 1
- *
*/
protected final AtomicLong tailKey = new AtomicLong(0);
@@ -100,26 +141,21 @@ public class HARegionQueue implements RegionQueue {
* object. Every add operation will be identified by the ThreadIdentifier object & the position
* recorded in the LastDispatchedAndCurrentEvents object.
*/
-
protected final ConcurrentMap eventsMap = new ConcurrentHashMap();
/**
- * The <code>Map</code> mapping the regionName->key to the queue key. This index allows fast
- * updating of entries in the queue for conflation.
+ * The {@code Map} mapping the regionName->key to the queue key. This index allows fast updating
+ * of entries in the queue for conflation.
*/
protected volatile Map indexes = Collections.unmodifiableMap(new HashMap());
- // TODO:Asif: Should we worry about whether to some how make it writer
- // preference?
- /** Lock object for updating the queue size by different operations */
- // private final Object SIZE_LOCK = new Object();
private final StoppableReentrantReadWriteLock rwLock;
private final StoppableReentrantReadWriteLock.StoppableReadLock readLock;
private final StoppableWriteLock writeLock;
- /** The name of the <code>Region</code> backing this queue */
+ /** The name of the {@code Region} backing this queue */
private final String regionName;
/** The ClientProxyMembershipID associated with the ha queue */
@@ -151,10 +187,7 @@ public class HARegionQueue implements RegionQueue {
* A sequence violation can occur , if an HARegionQueue receives events thru GII & the same event
* also arrives via Gemfire Put in that local VM. If the HARegionQueue does not receive any data
* via GII , then there should not be any violation. If there is data arriving thru GII, such
- * voiolations can be expected , but should be analyzed thoroughly.
- *
- * <p>
- * author Asif
+ * violations can be expected , but should be analyzed thoroughly.
*/
protected boolean puttingGIIDataInQueue;
@@ -166,14 +199,12 @@ public class HARegionQueue implements RegionQueue {
/**
* a thread local to store the counters corresponding to the events peeked by a particular thread.
- * When <code>remove()</code> will be called, these events stored in thread-local will be
- * destroyed.
+ * When {@code remove()} will be called, these events stored in thread-local will be destroyed.
*/
protected static final ThreadLocal peekedEventsContext = new ThreadLocal();
/**
- * Thread which creates the <code>QueueRemovalMessage</code> and sends it to other nodes in the
- * system
+ * Thread which creates the {@code QueueRemovalMessage} and sends it to other nodes in the system
*/
private static QueueRemovalThread qrmThread;
@@ -284,30 +315,18 @@ public class HARegionQueue implements RegionQueue {
protected long maxQueueSizeHitCount = 0;
/**
- *
* Processes the given string and returns a string which is allowed for region names
*
- * @param regionName
* @return legal region name
*/
public static String createRegionName(String regionName) {
- String result = regionName.replace('/', '#'); // [yogi]: region name cannot
- // contain the separator '/'
- return result;
+ return regionName.replace('/', '#');
}
/**
- *
- * @param regionName
- * @param cache
* @param isPrimary whether this is the primary queue for a client
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws CacheException
- * @throws InterruptedException
*/
-
- protected HARegionQueue(String regionName, GemFireCacheImpl cache,
+ protected HARegionQueue(String regionName, InternalCache cache,
HARegionQueueAttributes haAttributes, Map haContainer, ClientProxyMembershipID clientProxyId,
final byte clientConflation, boolean isPrimary)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
@@ -332,13 +351,13 @@ public class HARegionQueue implements RegionQueue {
this.readLock = this.rwLock.readLock();
this.writeLock = this.rwLock.writeLock();
- this.putGIIDataInRegion();
+ putGIIDataInRegion();
if (this.getClass() == HARegionQueue.class) {
initialized.set(true);
}
}
- private void createHARegion(String processedRegionName, GemFireCacheImpl cache)
+ private void createHARegion(String processedRegionName, InternalCache cache)
throws IOException, ClassNotFoundException {
AttributesFactory af = new AttributesFactory();
af.setMirrorType(MirrorType.KEYS_VALUES);
@@ -358,7 +377,7 @@ public class HARegionQueue implements RegionQueue {
* reinitialize the queue, presumably pulling current information from seconaries
*/
public void reinitializeRegion() {
- GemFireCacheImpl cache = this.region.getCache();
+ InternalCache cache = this.region.getCache();
String regionName = this.region.getName();
this.region.destroyRegion();
Exception problem = null;
@@ -412,7 +431,7 @@ public class HARegionQueue implements RegionQueue {
// use putIfAbsent to avoid overwriting newer dispatch information
Object o = this.eventsMap.putIfAbsent(entry.getKey(), giiDace);
if (o != null && isDebugEnabled_BS) {
- sb.append(" -- could not store. found " + o);
+ sb.append(" -- could not store. found ").append(o);
}
}
}
@@ -425,11 +444,8 @@ public class HARegionQueue implements RegionQueue {
* Repopulates the HARegion after the GII is over so as to reset the counters and populate the
* DACE objects for the thread identifiers . This method should be invoked as the last method in
* the constructor . Thus while creating BlockingQueue this method should be invoked lastly in the
- * derived class contructor , after the HARegionQueue contructor is complete. Otherwise, the
+ * derived class constructor , after the HARegionQueue contructor is complete. Otherwise, the
* ReentrantLock will be null.
- *
- * @throws CacheException
- * @throws InterruptedException
*/
void putGIIDataInRegion() throws CacheException, InterruptedException {
Set entrySet = this.region.entries(false);
@@ -498,8 +514,6 @@ public class HARegionQueue implements RegionQueue {
* Puts the GII'd entry into the ha region, if it was GII'd along with its ClientUpdateMessageImpl
* instance.
*
- * @param val
- * @throws InterruptedException
* @since GemFire 5.7
*/
protected void putInQueue(Object val) throws InterruptedException {
@@ -507,7 +521,7 @@ public class HARegionQueue implements RegionQueue {
if (logger.isDebugEnabled()) {
logger.debug(
"HARegionQueue.putGIIDataInRegion(): key={} was removed at sender side, so not putting it into the ha queue.",
- ((HAEventWrapper) val).getKeyToConflate());
+ ((Conflatable) val).getKeyToConflate());
}
} else {
this.put(val);
@@ -567,9 +581,6 @@ public class HARegionQueue implements RegionQueue {
* object & SIZE Lock
*
* @param object object to put onto the queue
- * @throws InterruptedException
- * @throws CacheException
- * @return boolean
*/
public boolean put(Object object) throws CacheException, InterruptedException {
this.giiLock.readLock().lock(); // fix for bug #41681 - durable client misses event
@@ -663,11 +674,9 @@ public class HARegionQueue implements RegionQueue {
dace = oldDace;
} else {
// Add the recently added ThreadIdentifier to the RegionQueue for expiry
- this.region.put(ti, Long.valueOf(dace.lastDispatchedSequenceId));
+ this.region.put(ti, dace.lastDispatchedSequenceId);
// update the stats
- // if (logger.isDebugEnabled()) {
this.stats.incThreadIdentifiers();
- // }
}
if (!dace.putObject(event, sequenceID)) {
this.put(object);
@@ -677,11 +686,6 @@ public class HARegionQueue implements RegionQueue {
}
}
}
- // update the stats
- // if (logger.isDebugEnabled()) {
- // this.stats.incEventsEnqued();
- // }
-
}
/**
@@ -691,7 +695,7 @@ public class HARegionQueue implements RegionQueue {
*/
public void startGiiQueueing() {
this.giiLock.writeLock().lock();
- this.giiCount++;
+ this.giiCount++; // TODO: non-atomic operation on volatile!
if (logger.isDebugEnabled()) {
logger.debug("{}: startGiiQueueing count is now {}", this.region.getName(), this.giiCount);
}
@@ -710,7 +714,7 @@ public class HARegionQueue implements RegionQueue {
this.giiLock.writeLock().lock();
final boolean isDebugEnabled = logger.isDebugEnabled();
try {
- this.giiCount--;
+ this.giiCount--; // TODO: non-atomic operation on volatile!
if (isDebugEnabled) {
logger.debug("{}: endGiiQueueing count is now {}", this.region.getName(), this.giiCount);
}
@@ -731,15 +735,7 @@ public class HARegionQueue implements RegionQueue {
Object value;
try {
value = this.giiQueue.remove();
- } catch (NoSuchElementException e) {
- // if (actualCount != expectedCount) {
- // logger.severe(LocalizedStrings.DEBUG, "expected to drain "
- // + expectedCount + " messages but drained " + actualCount
- // + " queue.size() is now " + giiQueue.size() + ", in queue" + this, e);
- // } else {
- // logger.severe(LocalizedStrings.DEBUG, "drained " + actualCount + " messages. Queue
- // size is " + giiQueue.size() + " in " + this);
- // }
+ } catch (NoSuchElementException ignore) {
break;
}
actualCount++;
@@ -765,13 +761,11 @@ public class HARegionQueue implements RegionQueue {
if (value instanceof HAEventWrapper) {
decAndRemoveFromHAContainer((HAEventWrapper) value);
}
- } catch (NoSuchElementException e) {
+ } catch (NoSuchElementException ignore) {
break;
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
// complete draining while holding the write-lock so nothing else
// can get into the queue
- // logger.severe(LocalizedStrings.DEBUG, "endGiiQueueing interrupted - ignoring until
- // draining completes");
interrupted = true;
}
}
@@ -804,19 +798,19 @@ public class HARegionQueue implements RegionQueue {
*/
public Map getEventMapForGII() {
// fix for bug #41621 - concurrent modification exception while serializing event map
- Map<ThreadIdentifier, DispatchedAndCurrentEvents> events = this.eventsMap;
final boolean isDebugEnabled = logger.isDebugEnabled();
do {
HashMap result = new HashMap();
try {
- for (Map.Entry<ThreadIdentifier, DispatchedAndCurrentEvents> entry : events.entrySet()) {
+ for (Map.Entry<ThreadIdentifier, DispatchedAndCurrentEvents> entry : ((Map<ThreadIdentifier, DispatchedAndCurrentEvents>) this.eventsMap)
+ .entrySet()) {
if (entry.getValue().isCountersEmpty()) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
- } catch (ConcurrentModificationException e) { // TODO:WTF: bad practice but eventsMap is
- // ConcurrentHashMap
+ } catch (ConcurrentModificationException ignore) {
+ // TODO:WTF: bad practice but eventsMap is ConcurrentHashMap
if (isDebugEnabled) {
logger.debug(
"HARegion encountered concurrent modification exception while analysing event state - will try again");
@@ -826,9 +820,7 @@ public class HARegionQueue implements RegionQueue {
}
/**
- * Implementation in BlokcingHARegionQueue class
- *
- * @throws InterruptedException
+ * Implementation in BlockingHARegionQueue class
*/
void checkQueueSizeConstraint() throws InterruptedException {
if (Thread.interrupted())
@@ -846,13 +838,11 @@ public class HARegionQueue implements RegionQueue {
/**
* Creates the static dispatchedMessagesMap (if not present) and starts the QueuRemovalThread if
* not running
- *
*/
- public static synchronized void startHAServices(GemFireCacheImpl c) {
-
+ static synchronized void startHAServices(InternalCache cache) {
if (qrmThread == null) {
dispatchedMessagesMap = new ConcurrentHashMap();
- qrmThread = new QueueRemovalThread(c);
+ qrmThread = new QueueRemovalThread(cache);
qrmThread.setName("Queue Removal Thread");
qrmThread.start();
}
@@ -913,20 +903,16 @@ public class HARegionQueue implements RegionQueue {
}
}
Object key = event.getKeyToConflate();
- Long previousPosition = (Long) latestIndexesForRegion.put(key, newPosition);
- return previousPosition;
-
+ return (Long) latestIndexesForRegion.put(key, newPosition);
}
/**
- *
* Creates and returns a ConcurrentMap. This method is over-ridden in test classes to test some
* functionality
*
* @return new ConcurrentMap
*/
ConcurrentMap createConcurrentMap() {
-
return new ConcurrentHashMap();
}
@@ -948,7 +934,7 @@ public class HARegionQueue implements RegionQueue {
// if (!HARegionQueue.this.isPrimary()) {
HARegionQueue.this.expireTheEventOrThreadIdentifier(event);
// }
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// ignore, we're done
} catch (CacheException ce) {
if (!destroyInProgress) {
@@ -967,11 +953,8 @@ public class HARegionQueue implements RegionQueue {
* overridden function createCacheListenerForHARegion of the HARegionQueueJUnitTest class for the
* test testConcurrentEventExpiryAndTake. This function provides the meaningful functionality for
* expiry of the Event object as well as ThreadIdentifier
- * <p>
- * author Asif
- *
+ *
* @param event event object representing the data being expired
- * @throws CacheException
*/
void expireTheEventOrThreadIdentifier(EntryEvent event) throws CacheException {
final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -980,11 +963,6 @@ public class HARegionQueue implements RegionQueue {
"HARegionQueue::afterInvalidate. Entry Event being invalidated:{}, isPrimaryQueue:{}",
event, HARegionQueue.this.isPrimary());
}
- // if (HARegionQueue.this.isPrimary()) {
- // logger.info(LocalizedStrings.DEBUG,
- // "HARegionQueue: Entry Event being invalidated ="
- // + event+", after current queue became primary.");
- // }
Object key = event.getKey();
if (key instanceof ThreadIdentifier) {
// Check if the sequenceID present as value against this key is same
@@ -998,7 +976,7 @@ public class HARegionQueue implements RegionQueue {
(DispatchedAndCurrentEvents) HARegionQueue.this.eventsMap.get(key);
Assert.assertTrue(dace != null);
Long expirySequenceID = (Long) event.getOldValue();
- boolean expired = dace.expireOrUpdate(expirySequenceID.longValue(), (ThreadIdentifier) key);
+ boolean expired = dace.expireOrUpdate(expirySequenceID, (ThreadIdentifier) key);
if (isDebugEnabled) {
logger.debug(
"HARegionQueue::afterInvalidate:Size of the region after expiring or updating the ThreadIdentifier={}",
@@ -1028,21 +1006,18 @@ public class HARegionQueue implements RegionQueue {
/**
* This method adds the position of newly added object to the List of available IDs so that it is
- * avaialble for peek or take. This method is called from DispatchedAndCurrentEvents object. This
+ * available for peek or take. This method is called from DispatchedAndCurrentEvents object. This
* method is invoked in a write lock for non blocking queue & in a reentrant lock in a blocking
- * queue. In case of blokcing queue , this method also signals the waiting take & peek threads to
+ * queue. In case of blocking queue , this method also signals the waiting take & peek threads to
* awake.
- * <p>
- * author Asif
- *
+ *
* @param position The Long position of the object which has been added
- * @throws InterruptedException
*/
void publish(Long position) throws InterruptedException {
acquireWriteLock();
try {
this.idsAvailable.add(position);
- // Asif:Notify the wiating peek threads or take threads of blocking queue
+ // Notify the waiting peek threads or take threads of blocking queue
// A void operation for the non blocking queue operations
notifyPeekAndTakeThreads();
} finally {
@@ -1055,12 +1030,8 @@ public class HARegionQueue implements RegionQueue {
}
/**
- *
- * <p>
- * author Asif
- *
* @param position Long value present in the Available IDs map against which Event object is
- * present in HARegion. This function is directly ivnoked from the basicInvalidate function
+ * present in HARegion. This function is directly invoked from the basicInvalidate function
* where expiry is aborted if this function returns false
* @return boolean true if the position could be removed from the Set
* @throws InterruptedException *
@@ -1087,12 +1058,10 @@ public class HARegionQueue implements RegionQueue {
* in the AvailableID Set. If the position existed in the Set, then only it is removed from the
* Set & the underlying Region
*
- * @param position Long poistion counter for entry in the Region
+ * @param position Long position counter for entry in the Region
* @return true if the entry with <br>
* position <br>
* specified was removed from the Set
- * @throws InterruptedException
- *
*/
protected boolean destroyFromAvailableIDsAndRegion(Long position) throws InterruptedException {
boolean removedOK = this.destroyFromAvailableIDs(position);
@@ -1100,9 +1069,7 @@ public class HARegionQueue implements RegionQueue {
if (removedOK) {
try {
this.destroyFromQueue(position);
- } catch (EntryNotFoundException enfe) {
- // if (!this.region.isDestroyed()) {
- // if (!HARegionQueue.this.destroyInProgress || !this.region.isDestroyed()) {
+ } catch (EntryNotFoundException ignore) {
if (!HARegionQueue.this.destroyInProgress) {
if (!this.region.isDestroyed()) {
Assert.assertTrue(false, "HARegionQueue::remove: The position " + position
@@ -1128,7 +1095,7 @@ public class HARegionQueue implements RegionQueue {
maintainCqStats(event, -1);
}
- /** Returns the <code>toString</code> for this RegionQueue object */
+ /** Returns the {@code toString} for this RegionQueue object */
@Override
public String toString() {
return "RegionQueue on " + this.regionName + "(" + (this.isPrimary ? "primary" : "backup")
@@ -1144,12 +1111,9 @@ public class HARegionQueue implements RegionQueue {
/**
- * This method is inoked by the take function . For non blocking queue it returns null or a valid
+ * This method is invoked by the take function . For non blocking queue it returns null or a valid
* long position while for blocking queue it waits for data in the queue or throws Exception if
* the thread encounters exception while waiting.
- *
- * @throws CacheException
- * @throws InterruptedException
*/
protected Long getAndRemoveNextAvailableID() throws InterruptedException {
Long next = null;
@@ -1177,14 +1141,9 @@ public class HARegionQueue implements RegionQueue {
/**
* Returns the next position counter present in idsAvailable set. This method is invoked by the
* peek function. In case of BlockingQueue, this method waits till a valid ID is available.
- *
- * <p>
- * author Asif
- *
+ *
* @return valid Long poistion or null depending upon the nature of the queue
- * @throws InterruptedException
* @throws TimeoutException if operation is interrupted (unfortunately)
- *
*/
private Long getNextAvailableID() throws InterruptedException {
Long next = null;
@@ -1208,7 +1167,6 @@ public class HARegionQueue implements RegionQueue {
* For non blocking queue , this method either returns null or an Object. For blocking queue it
* will always return with an Object or wait for queue to be populated.
*
- * @throws InterruptedException
* @throws CacheException The exception can be thrown by BlockingQueue if it encounters
* InterruptedException while waiting for data
*/
@@ -1281,8 +1239,6 @@ public class HARegionQueue implements RegionQueue {
/**
* Removes the events that were peeked by this thread. The events are destroyed from the queue and
* conflation map and DispatchedAndCurrentEvents are updated accordingly.
- *
- * @throws InterruptedException
*/
public void remove() throws InterruptedException {
List peekedIds = (List) HARegionQueue.peekedEventsContext.get();
@@ -1324,10 +1280,10 @@ public class HARegionQueue implements RegionQueue {
List countersList;
if ((countersList = (List) groupedThreadIDs.get(threadid)) != null) {
countersList.add(info);
- countersList.set(0, Long.valueOf(sequenceId));
+ countersList.set(0, sequenceId);
} else {
countersList = new ArrayList();
- countersList.add(Long.valueOf(sequenceId));
+ countersList.add(sequenceId);
countersList.add(info);
groupedThreadIDs.put(threadid, countersList);
}
@@ -1344,7 +1300,7 @@ public class HARegionQueue implements RegionQueue {
Map.Entry element = (Map.Entry) iter.next();
ThreadIdentifier tid = (ThreadIdentifier) element.getKey();
List removedEvents = (List) element.getValue();
- long lastDispatchedId = ((Long) removedEvents.remove(0)).longValue();
+ long lastDispatchedId = (Long) removedEvents.remove(0);
DispatchedAndCurrentEvents dace = (DispatchedAndCurrentEvents) this.eventsMap.get(tid);
if (dace != null && dace.lastDispatchedSequenceId < lastDispatchedId) {
try {
@@ -1387,7 +1343,7 @@ public class HARegionQueue implements RegionQueue {
if (next == null) {
break;
}
- } catch (TimeoutException te) {
+ } catch (TimeoutException ignore) {
throw new InterruptedException();
}
object = (Conflatable) this.region.get(next);
@@ -1459,8 +1415,6 @@ public class HARegionQueue implements RegionQueue {
* @param timeToWait The number of milliseconds to attempt to peek
*
* @return The list of events peeked
- * @throws InterruptedException
- *
*/
public List peek(int batchSize, int timeToWait) throws InterruptedException {
long start = System.currentTimeMillis();
@@ -1506,7 +1460,7 @@ public class HARegionQueue implements RegionQueue {
boolean interrupted = Thread.interrupted();
try {
Thread.sleep(50); // TODO this seems kinda busy IMNSHO -- jason
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
this.region.getCancelCriterion().checkCancelInProgress(null);
} finally {
@@ -1520,11 +1474,10 @@ public class HARegionQueue implements RegionQueue {
/**
* This method prepares the batch of events and updates the thread-context with corresponding
* counters, so that when remove is called by this thread, these events are destroyed from the
- * queue.This method should always be invoked within the <code>rwLock</code>.
+ * queue.This method should always be invoked within the {@code rwLock}.
*
* @param batchSize - number of events to be peeked
* @return - list of events peeked
- * @throws CacheException
*/
private List getBatchAndUpdateThreadContext(int batchSize) {
Iterator itr = this.idsAvailable.iterator();
@@ -1559,26 +1512,22 @@ public class HARegionQueue implements RegionQueue {
}
public void addCacheListener(CacheListener listener) {
- // TODO Auto-generated method stub
-
+ // nothing
}
public void removeCacheListener() {
- // TODO Auto-generated method stub
+ // nothing
}
/**
* It adds the entry to a static data structure dispatchedMessagesMap which is periodically
* operated upon by the QRM thread.
- *
- * <p>
- * author Asif
- *
+ *
* @param tid - the ThreadIdentifier object for this event
* @param sequenceId - the sequence id for this event
*/
public void addDispatchedMessage(ThreadIdentifier tid, long sequenceId) {
- Long lastSequenceNumber = Long.valueOf(sequenceId);
+ Long lastSequenceNumber = sequenceId;
boolean wasEmpty = false;
Long oldvalue = null;
Map internalMap = null;
@@ -1734,16 +1683,10 @@ public class HARegionQueue implements RegionQueue {
* creates a DACE. Only one QRM operates at a time on a DACE & any other mesasge will be waiting
* for the current thread to exit. This is accomplished by taking a lock on QRM_LOCK object in the
* DACE.
- *
- * <p>
- * author Asif
- *
+ *
* @param lastDispatched EventID containing the ThreadIdentifier and the last dispatched sequence
* Id
- * @throws CacheException
- * @throws InterruptedException
*/
-
void removeDispatchedEvents(EventID lastDispatched) throws CacheException, InterruptedException {
ThreadIdentifier ti = getThreadIdentifier(lastDispatched);
long sequenceID = lastDispatched.getSequenceID();
@@ -1764,11 +1707,9 @@ public class HARegionQueue implements RegionQueue {
} else {
// Add the recently added ThreadIdentifier to the RegionQueue for
// expiry
- this.region.put(ti, Long.valueOf(dace.lastDispatchedSequenceId));
+ this.region.put(ti, dace.lastDispatchedSequenceId);
// update the stats
- // if (logger.isDebugEnabled()) {
this.stats.incThreadIdentifiers();
- // }
}
}
}
@@ -1778,7 +1719,6 @@ public class HARegionQueue implements RegionQueue {
*
* @return the size of the queue
*/
-
public int size() {
acquireReadLock();
try {
@@ -1788,12 +1728,8 @@ public class HARegionQueue implements RegionQueue {
}
}
- void decrementTakeSidePutPermits() {
-
- }
-
void incrementTakeSidePutPermits() {
-
+ // nothing
}
// called from dace on a put.
@@ -1929,13 +1865,8 @@ public class HARegionQueue implements RegionQueue {
/**
* Always returns false for a HARegionQueue class. Suitably overridden in BlockingHARegionQueue
* class.
- *
- * <p>
- * author Asif
- *
+ *
* @return false for HAREgionQueue as this is a non blocking class
- * @throws InterruptedException
- *
*/
boolean waitForData() throws InterruptedException {
return false;
@@ -1976,12 +1907,8 @@ public class HARegionQueue implements RegionQueue {
* @param cache Gemfire Cache instance
* @param haRgnQType int identifying whether the HARegionQueue is of type blocking or non blocking
* @return an instance of HARegionQueue
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws InterruptedException
- * @throws CacheException
*/
- public static HARegionQueue getHARegionQueueInstance(String regionName, Cache cache,
+ public static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
final int haRgnQType, final boolean isDurable)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
Map container = null;
@@ -1993,7 +1920,7 @@ public class HARegionQueue implements RegionQueue {
container = new HashMap();
}
- return getHARegionQueueInstance(regionName, (GemFireCacheImpl) cache,
+ return getHARegionQueueInstance(regionName, cache,
HARegionQueueAttributes.DEFAULT_HARQ_ATTRIBUTES, haRgnQType, isDurable, container, null,
HandShake.CONFLATION_DEFAULT, false, Boolean.FALSE);
}
@@ -2009,12 +1936,8 @@ public class HARegionQueue implements RegionQueue {
* @param isPrimary whether this is the primary queue for the client
* @param canHandleDelta boolean indicating whether the HARegionQueue can handle delta or not
* @return an instance of HARegionQueue
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws CacheException
- * @throws InterruptedException
*/
- public static HARegionQueue getHARegionQueueInstance(String regionName, GemFireCacheImpl cache,
+ public static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable, Map haContainer,
ClientProxyMembershipID clientProxyId, final byte clientConflation, boolean isPrimary,
boolean canHandleDelta)
@@ -2038,12 +1961,11 @@ public class HARegionQueue implements RegionQueue {
default:
throw new IllegalArgumentException(
LocalizedStrings.HARegionQueue_HARGNQTYPE_CAN_EITHER_BE_BLOCKING_0_OR_NON_BLOCKING_1
- .toLocalizedString(new Object[] {Integer.valueOf(BLOCKING_HA_QUEUE),
- Integer.valueOf(NON_BLOCKING_HA_QUEUE)}));
+ .toLocalizedString(new Object[] {BLOCKING_HA_QUEUE, NON_BLOCKING_HA_QUEUE}));
}
if (!isDurable) {
Integer expiryTime = Integer.getInteger(REGION_ENTRY_EXPIRY_TIME, hrqa.getExpiryTime());
- hrqa.setExpiryTime(expiryTime.intValue());
+ hrqa.setExpiryTime(expiryTime);
ExpirationAttributes ea =
new ExpirationAttributes(hrqa.getExpiryTime(), ExpirationAction.LOCAL_INVALIDATE);
hrq.region.getAttributesMutator().setEntryTimeToLive(ea);
@@ -2054,19 +1976,10 @@ public class HARegionQueue implements RegionQueue {
/**
* Creates a HARegionQueue object with default attributes. used by tests
*
- * @param regionName
- * @param cache
- * @param hrqa
- * @param haRgnQType
- * @param isDurable
* @return an instance of HARegionQueue
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws CacheException
- * @throws InterruptedException
* @since GemFire 5.7
*/
- public static HARegionQueue getHARegionQueueInstance(String regionName, Cache cache,
+ public static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
Map container = null;
@@ -2078,8 +1991,8 @@ public class HARegionQueue implements RegionQueue {
container = new HashMap();
}
- return getHARegionQueueInstance(regionName, (GemFireCacheImpl) cache, hrqa, haRgnQType,
- isDurable, container, null, HandShake.CONFLATION_DEFAULT, false, Boolean.FALSE);
+ return getHARegionQueueInstance(regionName, cache, hrqa, haRgnQType, isDurable, container, null,
+ HandShake.CONFLATION_DEFAULT, false, Boolean.FALSE);
}
public boolean isEmptyAckList() {
@@ -2122,7 +2035,7 @@ public class HARegionQueue implements RegionQueue {
if (this.destroyFromAvailableIDsAndRegion(counter)) {
stats.incEventsRemoved();
}
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -2134,18 +2047,14 @@ public class HARegionQueue implements RegionQueue {
}
}
-
-
/**
- * This is an implemention of RegionQueue where peek() & take () are blocking operation and will
+ * This is an implementation of RegionQueue where peek() & take () are blocking operation and will
* not return unless it gets some legitimate value The Lock object used by this class is a
* ReentrantLock & not a ReadWriteLock as in the base class. This reduces the concurrency of peek
* operations, but it enables the condition object of the ReentrantLock used to guard the
* idsAvailable Set for notifying blocking peek & take operations. Previously a separate Lock
* object was used by the BlockingQueue for wait notify. This class will be performant if there is
* a single peek thread.
- *
- *
*/
private static class BlockingHARegionQueue extends HARegionQueue {
/**
@@ -2180,19 +2089,11 @@ public class HARegionQueue implements RegionQueue {
protected final StoppableCondition blockCond;
/**
- *
- * @param regionName
- * @param cache
* @param hrqa HARegionQueueAttributes through which expiry time etc for the HARegionQueue can
* be set
- * @param haContainer
* @param isPrimary whether this is the primary queue for a client
- * @throws IOException TODO-javadocs
- * @throws ClassNotFoundException TODO-javadocs
- * @throws CacheException TODO-javadocs
- * @throws InterruptedException
*/
- protected BlockingHARegionQueue(String regionName, GemFireCacheImpl cache,
+ protected BlockingHARegionQueue(String regionName, InternalCache cache,
HARegionQueueAttributes hrqa, Map haContainer, ClientProxyMembershipID clientProxyId,
final byte clientConflation, boolean isPrimary)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
@@ -2231,12 +2132,9 @@ public class HARegionQueue implements RegionQueue {
* This effectively makes the blocking queue behave like a non-blocking queue which throttles
* puts if it reaches its capacity. This was changed in 8.1, see #51400. This function is NOOP
* in the HARegionQueue.
- *
- * <p>
- * author Asif
*/
@Override
- @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "TLW_TWO_LOCK_WAIT")
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings("TLW_TWO_LOCK_WAIT")
void checkQueueSizeConstraint() throws InterruptedException {
if (this.haContainer instanceof HAContainerMap && isPrimary()) { // Fix for bug 39413
if (Thread.interrupted())
@@ -2261,8 +2159,8 @@ public class HARegionQueue implements RegionQueue {
this.maxQueueSizeHitCount = 0;
}
++this.maxQueueSizeHitCount;
- // for (;;) {
this.region.checkReadiness(); // fix for bug 37581
+ // TODO: wait called while holding two locks
this.permitMon.wait(CacheClientNotifier.eventEnqueueWaitTime);
this.region.checkReadiness(); // fix for bug 37581
// Fix for #51400. Allow the queue to grow beyond its
@@ -2270,15 +2168,13 @@ public class HARegionQueue implements RegionQueue {
// drain the queue, either due to a slower client or the
// deadlock scenario mentioned in the ticket.
reconcilePutPermits();
- // }
if ((this.maxQueueSizeHitCount % logFrequency) == 1) {
logger.info(LocalizedMessage
.create(LocalizedStrings.HARegionQueue_RESUMING_WITH_PROCESSING_PUTS));
}
} catch (InterruptedException ex) {
- // TODO:Asif: The line below is meaningless. Comment it out
- // later
- this.permitMon.notify();
+ // TODO: The line below is meaningless. Comment it out later
+ this.permitMon.notifyAll();
throw ex;
}
}
@@ -2292,14 +2188,10 @@ public class HARegionQueue implements RegionQueue {
/**
* This function should always be called under a lock on putGuard & permitMon obejct
- *
- * <p>
- * author Asif
- *
- * @return int currnet Put permits
+ *
+ * @return int current Put permits
*/
private int reconcilePutPermits() {
-
putPermits += takeSidePutPermits;
takeSidePutPermits = 0;
return putPermits;
@@ -2312,10 +2204,6 @@ public class HARegionQueue implements RegionQueue {
* added in case a put operation which has reduced the put permit optmistically but due to some
* reason ( most likely because of duplicate event) was not added in the queue. In such case it
* will increment take side permit without notifying any waiting thread
- *
- * <p>
- * author Asif
- *
*/
@Override
void incrementTakeSidePutPermitsWithoutNotify() {
@@ -2328,24 +2216,19 @@ public class HARegionQueue implements RegionQueue {
* Implemented to reduce contention between concurrent take/remove operations and put . The
* reconciliation between take side put permits & put side put permits happens only if theput
* side put permits are exhausted. In HARehionQueue base class this is a NOOP function
- *
- * <p>
- * author Asif
- *
*/
@Override
void incrementTakeSidePutPermits() {
if (this.haContainer instanceof HAContainerMap && isPrimary()) { // Fix for bug 39413
synchronized (this.permitMon) {
++this.takeSidePutPermits;
- this.permitMon.notify();
+ this.permitMon.notifyAll();
}
}
}
/**
* Identical to the acquireReadLock as there is only one type of Lock object in this class.
- *
*/
@Override
void acquireWriteLock() {
@@ -2378,8 +2261,6 @@ public class HARegionQueue implements RegionQueue {
* acquiring the lock on ReentrantLock object. It blocks the thread if the queue is empty or
* returns true otherwise . This will always return true indicating that data is available for
* retrieval or throw an Exception.It can never return false.
- *
- * @throws InterruptedException
*/
@Override
boolean waitForData() throws InterruptedException {
@@ -2443,7 +2324,7 @@ public class HARegionQueue implements RegionQueue {
LinkedList unremovedElements = null;
HashMap currDurableMap = null;
- protected DurableHARegionQueue(String regionName, GemFireCacheImpl cache,
+ protected DurableHARegionQueue(String regionName, InternalCache cache,
HARegionQueueAttributes hrqa, Map haContainer, ClientProxyMembershipID clientProxyId,
final byte clientConflation, boolean isPrimary)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
@@ -2604,11 +2485,11 @@ public class HARegionQueue implements RegionQueue {
this.releaseWriteLock();
}
}
- /**
- * ashetkar: Setting this threadlocal variable to null has no use as the current thread never
- * uses it. Instead it should really be set null by message dispatcher thread while starting
- * or resuming. This was added in revision 20914. Need to check if it really needs to be
- * thread local.
+ /*
+ * Setting this threadlocal variable to null has no use as the current thread never uses it.
+ * Instead it should really be set null by message dispatcher thread while starting or
+ * resuming. This was added in revision 20914. Need to check if it really needs to be thread
+ * local.
*/
peekedEventsContext.set(null);
this.threadIdToSeqId.list.clear();
@@ -2675,38 +2556,27 @@ public class HARegionQueue implements RegionQueue {
* bridge between the user defined HARegionQueue class & the actual class. This class object will
* be buggy as it will tend to publish the Object o QRM thread & the expiry thread before the
* complete creation of the HARegionQueue instance
- *
- * <p>
- * author Asif
- *
*/
static class TestOnlyHARegionQueue extends HARegionQueue {
/**
* Overloaded constructor to accept haContainer.
*
- * @param regionName
- * @param cache
- * @param haContainer
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws CacheException
- * @throws InterruptedException
* @since GemFire 5.7
*/
- TestOnlyHARegionQueue(String regionName, Cache cache, Map haContainer)
+ TestOnlyHARegionQueue(String regionName, InternalCache cache, Map haContainer)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
- this(regionName, (GemFireCacheImpl) cache, HARegionQueueAttributes.DEFAULT_HARQ_ATTRIBUTES,
- haContainer, HandShake.CONFLATION_DEFAULT, false);
+ this(regionName, cache, HARegionQueueAttributes.DEFAULT_HARQ_ATTRIBUTES, haContainer,
+ HandShake.CONFLATION_DEFAULT, false);
this.initialized.set(true);
}
- TestOnlyHARegionQueue(String regionName, Cache cache)
+ TestOnlyHARegionQueue(String regionName, InternalCache cache)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
- this(regionName, (GemFireCacheImpl) cache, HARegionQueueAttributes.DEFAULT_HARQ_ATTRIBUTES,
- new HashMap(), HandShake.CONFLATION_DEFAULT, false);
+ this(regionName, cache, HARegionQueueAttributes.DEFAULT_HARQ_ATTRIBUTES, new HashMap(),
+ HandShake.CONFLATION_DEFAULT, false);
}
- TestOnlyHARegionQueue(String regionName, GemFireCacheImpl cache, HARegionQueueAttributes hrqa,
+ TestOnlyHARegionQueue(String regionName, InternalCache cache, HARegionQueueAttributes hrqa,
Map haContainer, final byte clientConflation, boolean isPrimary)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
super(regionName, cache, hrqa, haContainer, null, clientConflation, isPrimary);
@@ -2718,34 +2588,21 @@ public class HARegionQueue implements RegionQueue {
}
/**
- * Overloaded constructor to pass an <code>HashMap</code> instance as a haContainer.
+ * Overloaded constructor to pass an {@code HashMap} instance as a haContainer.
*
- * @param regionName
- * @param cache
- * @param hrqa
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws CacheException
- * @throws InterruptedException
* @since GemFire 5.7
*/
- TestOnlyHARegionQueue(String regionName, Cache cache, HARegionQueueAttributes hrqa)
+ TestOnlyHARegionQueue(String regionName, InternalCache cache, HARegionQueueAttributes hrqa)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
- this(regionName, (GemFireCacheImpl) cache, hrqa, new HashMap(), HandShake.CONFLATION_DEFAULT,
- false);
+ this(regionName, cache, hrqa, new HashMap(), HandShake.CONFLATION_DEFAULT, false);
}
}
/**
* This thread will check for messages which have been dispatched. After a configurable time or
- * size is reached, it will create a new <code>QueueRemovalMessage</code> and send it to all the
- * nodes in the DistributedSystem
- *
- * <p>
- * author Mitul Bid
- *
+ * size is reached, it will create a new {@code QueueRemovalMessage} and send it to all the nodes
+ * in the DistributedSystem
*/
-
private static class QueueRemovalThread extends Thread {
/**
@@ -2753,14 +2610,14 @@ public class HARegionQueue implements RegionQueue {
*/
private volatile boolean shutdown = false;
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
/**
* Constructor : Creates and initializes the thread
*/
- public QueueRemovalThread(GemFireCacheImpl c) {
+ public QueueRemovalThread(InternalCache cache) {
this.setDaemon(true);
- this.cache = c;
+ this.cache = cache;
}
private boolean checkCancelled() {
@@ -2775,11 +2632,7 @@ public class HARegionQueue implements RegionQueue {
/**
* The thread will check the dispatchedMessages map for messages that have been dispatched. It
- * will create a new <code>QueueRemovalMessage</code> and send it to the other nodes
- */
- /**
- * The thread will check the dispatchedMessages map for messages that have been dispatched. It
- * will create a new <code>QueueRemovalMessage</code> and send it to the other nodes
+ * will create a new {@code QueueRemovalMessage} and send it to the other nodes
*/
@Override
public void run() {
@@ -2836,7 +2689,7 @@ public class HARegionQueue implements RegionQueue {
dm.putOutgoing(qrm);
} // messages exist
} // be somewhat tolerant of failures
- catch (CancelException e) {
+ catch (CancelException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("QueueRemovalThread is exiting due to cancellation");
}
@@ -2918,14 +2771,14 @@ public class HARegionQueue implements RegionQueue {
* threadIdToSequenceIdMap.list.add(internalMap); } }
*/
// first add the size within the lock
- queueRemovalMessageList.add(Integer.valueOf(internalMap.size()));
+ queueRemovalMessageList.add(internalMap.size());
internalIterator = internalMap.entrySet().iterator();
// then add the event ids to the message list within the lock
while (internalIterator.hasNext()) {
internalEntry = (Map.Entry) internalIterator.next();
tid = (ThreadIdentifier) internalEntry.getKey();
sequenceId = (Long) internalEntry.getValue();
- eventId = new EventID(tid.getMembershipID(), tid.getThreadID(), sequenceId.longValue());
+ eventId = new EventID(tid.getMembershipID(), tid.getThreadID(), sequenceId);
queueRemovalMessageList.add(eventId);
}
}
@@ -2945,7 +2798,7 @@ public class HARegionQueue implements RegionQueue {
boolean interrupted = Thread.interrupted();
try {
this.join(15 * 1000);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -2960,13 +2813,9 @@ public class HARegionQueue implements RegionQueue {
}
/**
- * Class whick keeps track of the positions ( keys) of underlying Region object for the events
+ * Class which keeps track of the positions ( keys) of underlying Region object for the events
* placed in the Queue. It also keeps track of the last sequence ID dispatched. Thus all the
* events with sequence ID less than that dispatched are eligible for removal
- *
- * <p>
- * author Asif
- *
*/
public static class DispatchedAndCurrentEvents implements DataSerializableFixedID, Serializable {
/**
@@ -3006,10 +2855,6 @@ public class HARegionQueue implements RegionQueue {
/**
* Used for debugging purpose to ensure that in no situation , for a given ThreadIdentifier the
* order gets violated
- *
- * <p>
- * author Asif
- *
*/
protected volatile long lastSequenceIDPut = INIT_OF_SEQUENCEID;
@@ -3024,15 +2869,9 @@ public class HARegionQueue implements RegionQueue {
* @param event Object to be added to the queue
* @param sequenceID Sequence ID of the event originating from a unqiue thread identified by its
* ThreadIdentifier
- * @throws CacheException
- * @throws InterruptedException
*/
protected boolean putObject(Conflatable event, long sequenceID)
throws CacheException, InterruptedException {
- // logger.debug("BRUCE: putObject() lastSequenceIDPut="+lastSequenceIDPut
- // +"; adding sequenceID="+sequenceID + " for " + event);
- // logger.info("putObject, sequenceID = " + sequenceID + "; lastSequenceIDPut = " +
- // lastSequenceIDPut, new Exception("putObject"));
Long oldPosition = null;
final boolean isDebugEnabled_BS = logger.isTraceEnabled(LogMarker.BRIDGE_SERVER);
if (isDebugEnabled_BS && this.lastSequenceIDPut >= sequenceID
@@ -3072,7 +2911,7 @@ public class HARegionQueue implements RegionQueue {
}
if (sequenceID > lastDispatchedSequenceId || owningQueue.puttingGIIDataInQueue) {
// Insert the object into the Region
- Long position = Long.valueOf(owningQueue.tailKey.incrementAndGet());
+ Long position = owningQueue.tailKey.incrementAndGet();
owningQueue.putEventInHARegion(event, position);
@@ -3128,15 +2967,11 @@ public class HARegionQueue implements RegionQueue {
/**
* Destroys the the old entry ( which got replaced by the new entry due to conflation) from the
- * availableIDs , Region & Counters set. Since this is executed within a synch block by the new
+ * availableIDs , Region & Counters set. Since this is executed within a sync block by the new
* entry thread, it is guaranteed that the old entry thread will exit first , placing the
- * poistion etc in the available IDs set. Also the new entry thraed & old entry thread are
- * belonging to diffrenet ThreadIdentifier objects & hence hold different
+ * position etc in the available IDs set. Also the new entry thread & old entry thread are
+ * belonging to different ThreadIdentifier objects & hence hold different
* DispatchedAndCurrentEvents object.
- *
- * @param oldPosition
- * @throws CacheException
- * @throws InterruptedException
*/
private void removeOldConflatedEntry(Long oldPosition)
throws CacheException, InterruptedException {
@@ -3152,9 +2987,8 @@ public class HARegionQueue implements RegionQueue {
}
// </HA overflow>
// update statistics
- // if (logger.isDebugEnabled()) {
- // vrao: Fix for bug 39291:
+ // Fix for bug 39291:
// Since markers are always conflated regardless of the conflation
// setting and they are not normal (are internal) events, we should
// not bump the events-conflated stat for markers.
@@ -3163,7 +2997,6 @@ public class HARegionQueue implements RegionQueue {
} else {
owningQueue.stats.incMarkerEventsConflated();
}
- // }
}
}
}
@@ -3184,13 +3017,10 @@ public class HARegionQueue implements RegionQueue {
ConcurrentMap conflationMap = (ConcurrentMap) owningQueue.indexes.get(rName);
Assert.assertTrue(conflationMap != null);
conflationMap.remove(key, position);
-
}
/**
* Removes the Entry from the Counters Set contained in DACE
- *
- * @param position
*/
protected synchronized void destroy(Long position) {
if (this.counters != null) {
@@ -3227,17 +3057,17 @@ public class HARegionQueue implements RegionQueue {
owningQueue.eventsMap.remove(ti);
expired = true;
this.owningQueue.getStatistics().decThreadIdentifiers();
- } catch (RegionDestroyedException ignore) {
+ } catch (RegionDestroyedException e) {
if (!owningQueue.destroyInProgress && logger.isDebugEnabled()) {
logger.debug(
"DispatchedAndCurrentEvents::expireOrUpdate: Queue found destroyed while removing expiry entry for ThreadIdentifier={} and expiry value={}",
- ti, expVal, ignore);
+ ti, expVal, e);
}
} catch (EntryNotFoundException enfe) {
if (!owningQueue.destroyInProgress) {
logger.error(LocalizedMessage.create(
LocalizedStrings.HARegionQueue_DISPATCHEDANDCURRENTEVENTSEXPIREORUPDATE_UNEXPECTEDLY_ENCOUNTERED_EXCEPTION_WHILE_REMOVING_EXPIRY_ENTRY_FOR_THREADIDENTIFIER_0_AND_EXPIRY_VALUE_1,
- new Object[] {ti, Long.valueOf(expVal), enfe}));
+ new Object[] {ti, expVal, enfe}));
}
}
}
@@ -3245,7 +3075,7 @@ public class HARegionQueue implements RegionQueue {
if (!expired) {
try {
// Update the entry with latest sequence ID
- owningQueue.region.put(ti, Long.valueOf(this.lastDispatchedSequenceId));
+ owningQueue.region.put(ti, this.lastDispatchedSequenceId);
} catch (CancelException e) {
throw e;
} catch (Exception e) {
@@ -3267,8 +3097,6 @@ public class HARegionQueue implements RegionQueue {
* be removed
*
* @param lastDispatchedSeqId long indicating the last dispatched ID which gets set in a DACE
- * @throws CacheException
- * @throws InterruptedException
*/
protected void setLastDispatchedIDAndRemoveEvents(long lastDispatchedSeqId)
throws CacheException, InterruptedException {
@@ -3341,8 +3169,6 @@ public class HARegionQueue implements RegionQueue {
* Events which have been peeked & are now candidate for removal. It has to be guaranteed
* that the sequence IDs of all the other counters is less than the last dispatched
* @param lastDispatchedSeqId long indicating the last dispatched ID which gets set in a DACE
- * @throws CacheException
- * @throws InterruptedException
*/
protected void setLastDispatchedIDAndRemoveEvents(List removedEventInfoList,
long lastDispatchedSeqId) throws CacheException, InterruptedException {
@@ -3472,8 +3298,6 @@ public class HARegionQueue implements RegionQueue {
/**
* destroys the underlying HARegion and removes its reference from the dispatched messages map
- *
- * @throws CacheWriterException
*/
public void destroy() throws CacheWriterException {
this.destroyInProgress = true;
@@ -3484,9 +3308,9 @@ public class HARegionQueue implements RegionQueue {
try {
try {
updateHAContainer();
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// keep going
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// keep going
if (logger.isDebugEnabled()) {
logger.debug("HARegionQueue#destroy: ignored cancellation!!!!");
@@ -3495,9 +3319,9 @@ public class HARegionQueue implements RegionQueue {
try {
this.region.destroyRegion();
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
// keep going
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// keep going
}
((HAContainerWrapper) haContainer).removeProxy(regionName);
@@ -3510,8 +3334,6 @@ public class HARegionQueue implements RegionQueue {
* If the event is an instance of HAEventWrapper, put it into the haContainer and then into the ha
* region. Otherwise, simply put it into the ha region.
*
- * @param event
- * @param position
* @since GemFire 5.7
*/
protected void putEventInHARegion(Conflatable event, Long position) {
@@ -3623,7 +3445,7 @@ public class HARegionQueue implements RegionQueue {
* If the wrapper's referenceCount becomes 1 after increment, then set this haEventWrapper and its
* clientUpdateMessage into the haContainer as <key, value>.
*
- * @param haEventWrapper An instance of <code>HAEventWrapper</code>
+ * @param haEventWrapper An instance of {@code HAEventWrapper}
* @since GemFire 5.7
*/
protected void putEntryConditionallyIntoHAContainer(HAEventWrapper haEventWrapper) {
@@ -3690,7 +3512,7 @@ public class HARegionQueue implements RegionQueue {
Object[] wrapperArray = null;
acquireReadLock();
try {
- if (!(this.availableIDsSize() == 0)) {
+ if (this.availableIDsSize() != 0) {
wrapperArray = this.availableIDsArray();
}
} finally {
@@ -3714,7 +3536,7 @@ public class HARegionQueue implements RegionQueue {
HARegionQueue.this.decAndRemoveFromHAContainer((HAEventWrapper) conflatable);
}
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
return; // we're done
} catch (Exception e) {
if (logger.isDebugEnabled()) {
@@ -3751,10 +3573,9 @@ public class HARegionQueue implements RegionQueue {
* If the conflatable is an instance of HAEventWrapper, and if the corresponding entry is present
* in the haContainer, then decrements its reference count. If the decremented ref count is zero
* and put is not in progress, removes the entry from the haContainer, before returning the
- * <code>ClientUpdateMessage</code> instance.
+ * {@code ClientUpdateMessage} instance.
*
- * @param conflatable
- * @return An instance of <code>ClientUpdateMessage</code>
+ * @return An instance of {@code ClientUpdateMessage}
* @since GemFire 5.7
*/
public Conflatable getAndRemoveFromHAContainer(Conflatable conflatable) {
@@ -3778,7 +3599,6 @@ public class HARegionQueue implements RegionQueue {
* Decrements wrapper's reference count by one. If the decremented ref count is zero and put is
* not in progress, removes the entry from the haContainer.
*
- * @param wrapper
* @since GemFire 5.7
*/
public void decAndRemoveFromHAContainer(HAEventWrapper wrapper) {
@@ -3813,7 +3633,7 @@ public class HARegionQueue implements RegionQueue {
/**
* Set whether the dispatcher of this node is active or not (i.e. primary or secondary node). If
- * <code>flag</code> is set to <code>true</code>, disables Entry Expiry Tasks.
+ * {@code flag} is set to {@code true}, disables Entry Expiry Tasks.
*
* @param flag the value to set isPrimary to
*/
@@ -3830,7 +3650,7 @@ public class HARegionQueue implements RegionQueue {
}
/**
- * Disables EntryExpiryTask for the HARegion (<code>this.region</code>).
+ * Disables EntryExpiryTask for the HARegion ({@code this.region}).
*
*/
private void disableEntryExpiryTasks() {
@@ -3842,7 +3662,7 @@ public class HARegionQueue implements RegionQueue {
this.region.setCustomEntryTimeToLive(new ThreadIdentifierCustomExpiry());
logger.info(LocalizedMessage.create(
LocalizedStrings.HARegionQueue_ENYTRY_EXPIRY_TASKS_DISABLED_BECAUSE_QUEUE_BECAME_PRIMARY_OLD_MSG_TTL_0,
- new Object[] {Integer.valueOf(oldTimeToLive)}));
+ new Object[] {oldTimeToLive}));
}
}
@@ -3882,7 +3702,7 @@ public class HARegionQueue implements RegionQueue {
if (r != null && !r.isDestroyed()) {
try {
r.close();
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
}
}
}
@@ -3895,97 +3715,83 @@ public class HARegionQueue implements RegionQueue {
*/
public boolean isPeekInitialized() {
return HARegionQueue.peekedEventsContext.get() != null;
-
}
-}
-
-
-/**
- * A wrapper class whose underlying map gets replaced with a fresh one when QRM thread is operating
- * on it. This wrapper acts as a means of communication between the QRM thread & the MapWrapper
- * object contained in the HARegionQueue
- *
- * <p>
- * author ashahid
- */
-
-class MapWrapper {
- Map map;
+ /**
+ * A wrapper class whose underlying map gets replaced with a fresh one when QRM thread is
+ * operating on it. This wrapper acts as a means of communication between the QRM thread & the
+ * MapWrapper object contained in the HARegionQueue
+ */
+ static class MapWrapper {
+ Map map;
- List list;
+ List list;
- boolean keepPrevAcks = false;
+ boolean keepPrevAcks = false;
- public MapWrapper() {
- super();
- map = new HashMap();
- list = new LinkedList();
- }
+ public MapWrapper() {
+ super();
+ map = new HashMap();
+ list = new LinkedList();
+ }
- void put(Object key, Object o) {
- synchronized (this.map) {
- this.map.put(key, o);
+ void put(Object key, Object o) {
+ synchronized (this.map) {
+ this.map.put(key, o);
+ }
}
}
-}
-
-/**
- * A wrapper class that has counter, key and the region-name for an event which was peeked and needs
- * to be removed. The key and regionName fields will be set only if conflation is true for the
- * event.
- *
- * <p>
- * author dpatel
- *
- */
-
-class RemovedEventInfo {
- Long counter;
+ /**
+ * A wrapper class that has counter, key and the region-name for an event which was peeked and
+ * needs to be removed. The key and regionName fields will be set only if conflation is true for
+ * the event.
+ */
+ static class RemovedEventInfo {
+ Long counter;
- String regionName;
+ String regionName;
- Object key;
+ Object key;
- public RemovedEventInfo(Long counter, String regionName, Object key) {
- this.counter = counter;
- this.regionName = regionName;
- this.key = key;
+ public RemovedEventInfo(Long counter, String regionName, Object key) {
+ this.counter = counter;
+ this.regionName = regionName;
+ this.key = key;
+ }
}
-}
+ /** this is used to expire thread identifiers, even in primary queues */
+ static class ThreadIdentifierCustomExpiry implements CustomExpiry {
+ private static final ExpirationAttributes DEFAULT_THREAD_ID_EXP_ATTS = new ExpirationAttributes(
+ HARegionQueue.DEFAULT_THREAD_ID_EXPIRY_TIME, ExpirationAction.LOCAL_INVALIDATE);
+ private static volatile ExpirationAttributes testExpAtts = null;
-/** this is used to expire thread identifiers, even in primary queues */
-class ThreadIdentifierCustomExpiry implements CustomExpiry {
- private static final ExpirationAttributes DEFAULT_THREAD_ID_EXP_ATTS = new ExpirationAttributes(
- HARegionQueue.DEFAULT_THREAD_ID_EXPIRY_TIME, ExpirationAction.LOCAL_INVALIDATE);
- private static volatile ExpirationAttributes testExpAtts = null;
-
- public ExpirationAttributes getExpiry(Region.Entry entry) {
- // Use key to determine expiration.
- Object key = entry.getKey();
- if (key instanceof ThreadIdentifier) {
- final int expTime = HARegionQueue.threadIdExpiryTime;
- if (expTime != HARegionQueue.DEFAULT_THREAD_ID_EXPIRY_TIME) {
- // This should only happen in unit test code
- ExpirationAttributes result = testExpAtts;
- if (result == null || result.getTimeout() != expTime) {
- result = new ExpirationAttributes(expTime, ExpirationAction.LOCAL_INVALIDATE);
- // save the expiration attributes in a static to prevent tests from creating lots of
- // instances.
- testExpAtts = result;
+ public ExpirationAttributes getExpiry(Region.Entry entry) {
+ // Use key to determine expiration.
+ Object key = entry.getKey();
+ if (key instanceof ThreadIdentifier) {
+ final int expTime = HARegionQueue.threadIdExpiryTime;
+ if (expTime != HARegionQueue.DEFAULT_THREAD_ID_EXPIRY_TIME) {
+ // This should only happen in unit test code
+ ExpirationAttributes result = testExpAtts;
+ if (result == null || result.getTimeout() != expTime) {
+ result = new ExpirationAttributes(expTime, ExpirationAction.LOCAL_INVALIDATE);
+ // save the expiration attributes in a static to prevent tests from creating lots of
+ // instances.
+ testExpAtts = result;
+ }
+ return result;
+ } else {
+ return DEFAULT_THREAD_ID_EXP_ATTS;
}
- return result;
} else {
- return DEFAULT_THREAD_ID_EXP_ATTS;
+ return null;
}
- } else {
- return null;
}
- }
- public void close() {}
+ public void close() {}
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
index ca9cc20..7879538 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
@@ -33,6 +33,7 @@ import org.apache.geode.distributed.internal.PooledDistributionMessage;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -42,34 +43,17 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
* This message is sent to all the nodes in the DistributedSystem. It contains the list of messages
* that have been dispatched by this node. The messages are received by other nodes and the
* processing is handed over to an executor
- *
- *
*/
public final class QueueRemovalMessage extends PooledDistributionMessage {
private static final Logger logger = LogService.getLogger();
- // /**
- // * Executor for processing incoming messages
- // */
- // private static final Executor executor;
-
-
/**
* List of messages (String[] )
*/
private List messagesList;
- // /**
- // * create the executor in a static block
- // */
- // static {
- // //TODO:Mitul best implementation of executor for this task?
- // executor = Executors.newCachedThreadPool();
- // }
-
/**
* Constructor : Set the recipient list to ALL_RECIPIENTS
- *
*/
public QueueRemovalMessage() {
this.setRecipient(ALL_RECIPIENTS);
@@ -77,8 +61,6 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
/**
* Set the message list
- *
- * @param messages
*/
public void setMessagesList(List messages) {
this.messagesList = messages;
@@ -87,22 +69,19 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
/**
* Extracts the region from the message list and hands over the message removal task to the
* executor
- *
- * @param dm
*/
@Override
protected void process(DistributionManager dm) {
-
- final GemFireCacheImpl cache;
+ final InternalCache cache;
// use GemFireCache.getInstance to avoid blocking during cache.xml processing.
- cache = GemFireCacheImpl.getInstance(); // CacheFactory.getAnyInstance();
+ cache = GemFireCacheImpl.getInstance();
if (cache != null) {
Iterator iterator = this.messagesList.iterator();
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
try {
while (iterator.hasNext()) {
final String regionName = (String) iterator.next();
- final int size = ((Integer) iterator.next()).intValue();
+ final int size = (Integer) iterator.next();
final LocalRegion region = (LocalRegion) cache.getRegion(regionName);
final HARegionQueue hrq;
if (region == null || !region.isInitialized()) {
@@ -134,21 +113,21 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
regionName, id);
}
hrq.removeDispatchedEvents(id);
- } catch (RegionDestroyedException rde) {
+ } catch (RegionDestroyedException ignore) {
logger.info(LocalizedMessage.create(
LocalizedStrings.QueueRemovalMessage_QUEUE_FOUND_DESTROYED_WHILE_PROCESSING_THE_LAST_DISPTACHED_SEQUENCE_ID_FOR_A_HAREGIONQUEUES_DACE_THE_EVENT_ID_IS_0_FOR_HAREGION_WITH_NAME_1,
new Object[] {id, regionName}));
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
return; // cache or DS is closing
} catch (CacheException e) {
logger.error(LocalizedMessage.create(
LocalizedStrings.QueueRemovalMessage_QUEUEREMOVALMESSAGEPROCESSEXCEPTION_IN_PROCESSING_THE_LAST_DISPTACHED_SEQUENCE_ID_FOR_A_HAREGIONQUEUES_DACE_THE_PROBLEM_IS_WITH_EVENT_ID__0_FOR_HAREGION_WITH_NAME_1,
new Object[] {regionName, id}), e);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
return; // interrupt occurs during shutdown. this runs in an executor, so just stop
// processing
}
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -165,14 +144,13 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
@Override
public void toData(DataOutput out) throws IOException {
- /**
+ /*
* first write the total list size then in a loop write the region name, number of eventIds and
* the event ids
- *
*/
super.toData(out);
// write the size of the data list
- DataSerializer.writeInteger(Integer.valueOf(this.messagesList.size()), out);
+ DataSerializer.writeInteger(this.messagesList.size(), out);
Iterator iterator = messagesList.iterator();
String regionName = null;
Integer numberOfIds = null;
@@ -185,7 +163,7 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
numberOfIds = (Integer) iterator.next();
// write the number of event ids
DataSerializer.writeInteger(numberOfIds, out);
- maxVal = numberOfIds.intValue();
+ maxVal = numberOfIds;
// write the event ids
for (int i = 0; i < maxVal; i++) {
eventId = iterator.next();
@@ -200,14 +178,13 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
- /**
+ /*
* read the total list size, reconstruct the message list in a loop by reading the region name,
* number of eventIds and the event ids
- *
*/
super.fromData(in);
// read the size of the message
- int size = DataSerializer.readInteger(in).intValue();
+ int size = DataSerializer.readInteger(in);
this.messagesList = new LinkedList();
int eventIdSizeInt;
for (int i = 0; i < size; i++) {
@@ -216,7 +193,7 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
// read the datasize
Integer eventIdSize = DataSerializer.readInteger(in);
this.messagesList.add(eventIdSize);
- eventIdSizeInt = eventIdSize.intValue();
+ eventIdSizeInt = eventIdSize;
// read the total number of events
for (int j = 0; j < eventIdSizeInt; j++) {
this.messagesList.add(DataSerializer.readObject(in));
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
index df6e2f2..eeb3704 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
@@ -134,7 +134,7 @@ public class BecomePrimaryBucketMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
buff.append("; isRebalance=").append(this.isRebalance);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
index 04349aa..ed17740 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
@@ -114,7 +114,7 @@ public final class BucketSizeMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
index 3cca861..d6422c2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
@@ -143,7 +143,7 @@ public final class ContainsKeyValueMessage extends PartitionMessageWithDirectRep
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; valueCheck=").append(this.valueCheck).append("; key=").append(this.key)
.append("; bucketId=").append(this.bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
index 03b5ded..744e013 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
@@ -172,9 +172,10 @@ public final class CreateBucketMessage extends PartitionMessage {
* Assists the toString method in reporting the contents of this message
*
* @see PartitionMessage#toString()
+ * @param buff
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId).append("; bucketSize=")
.append(this.bucketSize);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
index e765df0..f305fa8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
@@ -113,7 +113,7 @@ public class DeposePrimaryBucketMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
index dc55835..bffaf4d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
@@ -419,9 +419,10 @@ public class DestroyMessage extends PartitionMessageWithDirectReply {
* Assists the toString method in reporting the contents of this message
*
* @see PartitionMessage#toString()
+ * @param buff
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; key=").append(getKey());
if (originalSender != null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
index e9468dc..6314f2d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
@@ -315,7 +315,7 @@ public final class DumpB2NRegion extends PartitionMessage {
* StringBuffer)
*/
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append(" bucketId=").append(this.bucketId).append(" primaryInfoOnly=")
.append(this.onlyReturnPrimaryInfo);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
index 4a09f94..0502d5f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
@@ -107,7 +107,7 @@ public class EndBucketCreationMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
buff.append("; newPrimary=").append(this.newPrimary);
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
index 7208baf..41186ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
@@ -47,7 +47,6 @@ import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.BucketDump;
import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.ForceReattemptException;
import org.apache.geode.internal.cache.InitialImageOperation;
import org.apache.geode.internal.cache.PartitionedRegion;
@@ -139,7 +138,7 @@ public final class FetchBulkEntriesMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketIds);
buff.append("; recipient=").append(this.getRecipient());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
index b0f052a..c7ca279 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
@@ -128,7 +128,7 @@ public final class FetchEntriesMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; bucketId=").append(this.bucketId);
buff.append("; recipient=").append(this.getRecipient());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
index ae2ce37..301e154 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
@@ -174,7 +174,7 @@ public final class FetchEntryMessage extends PartitionMessage {
}
@Override
- protected void appendFields(StringBuffer buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; key=").append(this.key);
}
[36/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
GEODE-2632: change dependencies on GemFireCacheImpl to InternalCache
* misc cleanup of code where possible
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/57e93a5a
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/57e93a5a
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/57e93a5a
Branch: refs/heads/feature/GEODE-2632-10
Commit: 57e93a5a17caf77a62e90754958d00ad28f36cbb
Parents: 13824f4
Author: Kirk Lund <kl...@apache.org>
Authored: Mon May 1 12:48:06 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Mon May 1 14:21:09 2017 -0700
----------------------------------------------------------------------
.../session/internal/common/CacheProperty.java | 9 +-
.../internal/filter/GemfireSessionManager.java | 332 +-
.../session/catalina/DeltaSessionManager.java | 250 +-
.../modules/util/CreateRegionFunction.java | 62 +-
.../internal/ra/spi/JCALocalTransaction.java | 88 +-
.../internal/ra/spi/JCAManagedConnection.java | 225 +-
.../java/org/apache/geode/DataSerializer.java | 3 +-
.../apache/geode/admin/GemFireMemberStatus.java | 27 +-
.../admin/internal/CacheHealthEvaluator.java | 71 +-
.../admin/internal/FinishBackupRequest.java | 3 +-
.../admin/internal/FlushToDiskRequest.java | 9 +-
.../admin/internal/MemberHealthEvaluator.java | 102 +-
.../admin/internal/PrepareBackupRequest.java | 5 +-
.../apache/geode/cache/AttributesFactory.java | 279 +-
.../geode/cache/CacheClosedException.java | 18 +-
.../org/apache/geode/cache/CacheFactory.java | 66 +-
.../geode/cache/DynamicRegionFactory.java | 293 +-
.../org/apache/geode/cache/GemFireCache.java | 54 +-
.../java/org/apache/geode/cache/Region.java | 1 +
.../org/apache/geode/cache/RegionFactory.java | 114 +-
.../TransactionDataRebalancedException.java | 8 +
.../internal/AsyncEventQueueFactoryImpl.java | 13 +-
.../internal/AsyncEventQueueImpl.java | 8 +-
.../internal/ParallelAsyncEventQueueImpl.java | 7 +-
.../internal/SerialAsyncEventQueueImpl.java | 3 +-
.../geode/cache/client/ClientCacheFactory.java | 26 +-
.../internal/ClientRegionFactoryImpl.java | 11 +-
.../cache/client/internal/ConnectionImpl.java | 33 +-
.../cache/client/internal/ExecutablePool.java | 1 -
.../client/internal/ExecuteFunctionOp.java | 7 +-
.../internal/ExecuteRegionFunctionOp.java | 7 +-
.../ExecuteRegionFunctionSingleHopOp.java | 29 +-
.../geode/cache/client/internal/GetOp.java | 3 +-
.../client/internal/InternalClientCache.java | 37 +
.../cache/client/internal/LiveServerPinger.java | 3 +-
.../internal/PdxRegistryRecoveryListener.java | 3 +-
.../geode/cache/client/internal/PoolImpl.java | 113 +-
.../geode/cache/client/internal/ProxyCache.java | 73 +-
.../cache/client/internal/QueueManagerImpl.java | 22 +-
.../client/internal/RegisterInterestOp.java | 56 +-
.../internal/FunctionServiceManager.java | 105 +-
.../cache/partition/PartitionRegionHelper.java | 35 +-
.../query/internal/AbstractCompiledValue.java | 2 +-
.../internal/CompiledAggregateFunction.java | 2 +-
.../query/internal/CompiledBindArgument.java | 2 +-
.../query/internal/CompiledComparison.java | 2 +-
.../cache/query/internal/CompiledFunction.java | 4 +-
.../query/internal/CompiledGroupBySelect.java | 8 +-
.../geode/cache/query/internal/CompiledID.java | 2 +-
.../geode/cache/query/internal/CompiledIn.java | 185 +-
.../query/internal/CompiledIndexOperation.java | 2 +-
.../query/internal/CompiledIteratorDef.java | 87 +-
.../cache/query/internal/CompiledLike.java | 70 +-
.../cache/query/internal/CompiledLiteral.java | 2 +-
.../cache/query/internal/CompiledNegation.java | 2 +-
.../cache/query/internal/CompiledOperation.java | 2 +-
.../cache/query/internal/CompiledPath.java | 2 +-
.../cache/query/internal/CompiledRegion.java | 3 +-
.../cache/query/internal/CompiledSelect.java | 128 +-
.../query/internal/CompiledSortCriterion.java | 57 +-
.../cache/query/internal/CompiledUndefined.java | 5 +-
.../cache/query/internal/CompiledValue.java | 118 +-
.../cache/query/internal/DefaultQuery.java | 393 +-
.../cache/query/internal/ExecutionContext.java | 226 +-
.../query/internal/IndexConditioningHelper.java | 245 +
.../internal/IndexCutDownExpansionHelper.java | 80 +
.../query/internal/QueryExecutionContext.java | 54 +-
.../cache/query/internal/QueryMonitor.java | 86 +-
.../geode/cache/query/internal/QueryUtils.java | 862 +---
.../cache/query/internal/RangeJunction.java | 6 +-
.../cache/query/internal/RuntimeIterator.java | 2 +-
.../query/internal/index/AbstractIndex.java | 962 ++--
.../query/internal/index/AbstractMapIndex.java | 14 +-
.../internal/index/CompactMapRangeIndex.java | 6 +-
.../query/internal/index/CompactRangeIndex.java | 211 +-
.../query/internal/index/DummyQRegion.java | 20 +-
.../index/FunctionalIndexCreationHelper.java | 409 +-
.../cache/query/internal/index/HashIndex.java | 251 +-
.../internal/index/IndexCreationHelper.java | 81 +-
.../query/internal/index/IndexManager.java | 155 +-
.../cache/query/internal/index/IndexStats.java | 27 +-
.../cache/query/internal/index/IndexUtils.java | 40 +-
.../query/internal/index/MemoryIndexStore.java | 125 +-
.../query/internal/index/PartitionedIndex.java | 2 +-
.../query/internal/index/PrimaryKeyIndex.java | 57 +-
.../index/PrimaryKeyIndexCreationHelper.java | 21 +-
.../cache/query/internal/index/RangeIndex.java | 21 +-
.../geode/distributed/ServerLauncher.java | 69 +-
.../internal/ClusterConfigurationService.java | 238 +-
.../geode/distributed/internal/DSClock.java | 7 +-
.../internal/InternalDistributedSystem.java | 25 +-
.../distributed/internal/InternalLocator.java | 465 +-
.../gms/mgr/GMSMembershipManager.java | 6 +-
.../internal/tcpserver/TcpServer.java | 91 +-
.../org/apache/geode/internal/DSFIDFactory.java | 5 +-
.../org/apache/geode/internal/DeployedJar.java | 73 +-
.../geode/internal/InternalDataSerializer.java | 1058 ++---
.../geode/internal/InternalInstantiator.java | 77 +-
.../apache/geode/internal/MigrationClient.java | 82 +-
.../apache/geode/internal/MigrationServer.java | 159 +-
.../geode/internal/PdxSerializerObject.java | 2 +-
.../admin/ClientHealthMonitoringRegion.java | 32 +-
.../internal/admin/ClientStatsManager.java | 150 +-
.../admin/remote/BridgeServerResponse.java | 40 +-
.../admin/remote/CacheConfigResponse.java | 38 +-
.../admin/remote/CacheInfoResponse.java | 34 +-
.../internal/admin/remote/CompactRequest.java | 31 +-
.../admin/remote/DurableClientInfoResponse.java | 38 +-
.../remote/MissingPersistentIDsRequest.java | 32 +-
.../PrepareRevokePersistentIDRequest.java | 36 +-
.../remote/RefreshMemberSnapshotResponse.java | 18 +-
.../remote/RegionSubRegionsSizeResponse.java | 57 +-
.../internal/admin/remote/RemoteCacheInfo.java | 74 +-
.../admin/remote/RevokePersistentIDRequest.java | 25 +-
.../admin/remote/RootRegionResponse.java | 60 +-
.../admin/remote/ShutdownAllRequest.java | 75 +-
.../cache/AbstractBucketRegionQueue.java | 13 +-
.../internal/cache/AbstractCacheServer.java | 8 +-
.../internal/cache/AbstractDiskRegionEntry.java | 6 -
.../cache/AbstractOplogDiskRegionEntry.java | 4 +-
.../geode/internal/cache/AbstractRegion.java | 721 +--
.../internal/cache/AbstractRegionEntry.java | 724 ++-
.../geode/internal/cache/AbstractRegionMap.java | 87 +-
.../cache/AddCacheServerProfileMessage.java | 33 +-
.../geode/internal/cache/BucketAdvisor.java | 40 +-
.../geode/internal/cache/BucketRegion.java | 35 +-
.../geode/internal/cache/BucketRegionQueue.java | 21 +-
.../geode/internal/cache/CacheConfig.java | 3 +-
.../cache/CacheDistributionAdvisee.java | 3 +-
.../internal/cache/CacheLifecycleListener.java | 10 +-
.../geode/internal/cache/CachePerfStats.java | 5 +-
.../geode/internal/cache/CacheServerImpl.java | 137 +-
.../internal/cache/CacheServerLauncher.java | 39 +-
.../cache/CachedDeserializableFactory.java | 7 +-
.../geode/internal/cache/ColocationHelper.java | 29 +-
.../internal/cache/CreateRegionProcessor.java | 104 +-
.../cache/DestroyPartitionedRegionMessage.java | 2 +-
.../internal/cache/DestroyRegionOperation.java | 37 +-
.../apache/geode/internal/cache/DiskEntry.java | 126 +-
.../apache/geode/internal/cache/DiskRegion.java | 24 +-
.../geode/internal/cache/DiskStoreBackup.java | 2 -
.../internal/cache/DiskStoreFactoryImpl.java | 62 +-
.../geode/internal/cache/DiskStoreImpl.java | 292 +-
.../geode/internal/cache/DiskStoreMonitor.java | 75 +-
.../internal/cache/DistTXCommitMessage.java | 23 +-
.../internal/cache/DistTXPrecommitMessage.java | 47 +-
.../internal/cache/DistTXRollbackMessage.java | 27 +-
.../DistTXStateProxyImplOnCoordinator.java | 47 +-
.../cache/DistributedCacheOperation.java | 120 +-
.../geode/internal/cache/DistributedRegion.java | 1030 ++--
...stributedRegionFunctionStreamingMessage.java | 17 +-
.../cache/DynamicRegionFactoryImpl.java | 10 +-
.../geode/internal/cache/EntryEventImpl.java | 116 +-
.../geode/internal/cache/EventTracker.java | 51 +-
.../apache/geode/internal/cache/ExpiryTask.java | 32 +-
.../geode/internal/cache/FilterProfile.java | 58 +-
.../geode/internal/cache/FilterRoutingInfo.java | 49 +-
.../cache/FindDurableQueueProcessor.java | 25 +-
.../internal/cache/FindRemoteTXMessage.java | 15 +-
.../internal/cache/FindVersionTagOperation.java | 15 +-
.../geode/internal/cache/GemFireCacheImpl.java | 88 +-
.../geode/internal/cache/GridAdvisor.java | 48 +-
.../apache/geode/internal/cache/HARegion.java | 20 +-
.../internal/cache/InitialImageOperation.java | 2 +-
.../geode/internal/cache/InternalCache.java | 110 +-
.../cache/JtaAfterCompletionMessage.java | 27 -
.../cache/JtaBeforeCompletionMessage.java | 23 +-
.../geode/internal/cache/LeafRegionEntry.cpp | 2 +-
.../geode/internal/cache/LocalDataSet.java | 2 +-
.../geode/internal/cache/LocalRegion.java | 4433 ++++++++----------
.../cache/MemberFunctionStreamingMessage.java | 37 +-
.../internal/cache/NonLocalRegionEntry.java | 7 -
.../org/apache/geode/internal/cache/Oplog.java | 642 +--
.../geode/internal/cache/OverflowOplog.java | 277 +-
.../internal/cache/PRHARedundancyProvider.java | 5 +-
.../geode/internal/cache/PRQueryProcessor.java | 96 +-
.../internal/cache/PartitionAttributesImpl.java | 122 +-
.../geode/internal/cache/PartitionedRegion.java | 1464 +++---
.../internal/cache/PartitionedRegionHelper.java | 176 +-
.../geode/internal/cache/PoolFactoryImpl.java | 29 +-
.../geode/internal/cache/ProxyBucketRegion.java | 2 +-
.../geode/internal/cache/ProxyRegionMap.java | 12 +-
.../geode/internal/cache/RegionEvictorTask.java | 25 +-
.../geode/internal/cache/RegionFactoryImpl.java | 20 +-
.../internal/cache/RemoteOperationMessage.java | 76 +-
.../geode/internal/cache/RemotePutMessage.java | 11 -
.../cache/SearchLoadAndWriteProcessor.java | 209 +-
.../geode/internal/cache/ServerPingMessage.java | 2 +-
.../internal/cache/StateFlushOperation.java | 35 +-
.../geode/internal/cache/TXCommitMessage.java | 286 +-
.../geode/internal/cache/TXManagerImpl.java | 179 +-
.../apache/geode/internal/cache/TXMessage.java | 17 +-
.../internal/cache/TXRegionLockRequestImpl.java | 31 +-
.../geode/internal/cache/TXRegionState.java | 2 +-
.../internal/cache/TXRemoteCommitMessage.java | 21 +-
.../internal/cache/TXRemoteRollbackMessage.java | 11 +-
.../geode/internal/cache/TXStateProxyImpl.java | 339 +-
.../cache/TXSynchronizationRunnable.java | 22 +-
.../geode/internal/cache/TombstoneService.java | 55 +-
.../VMStatsDiskLRURegionEntryHeapIntKey.java | 2 +-
.../VMStatsDiskLRURegionEntryHeapLongKey.java | 2 +-
.../VMStatsDiskLRURegionEntryHeapObjectKey.java | 2 +-
...VMStatsDiskLRURegionEntryHeapStringKey1.java | 2 +-
...VMStatsDiskLRURegionEntryHeapStringKey2.java | 2 +-
.../VMStatsDiskLRURegionEntryHeapUUIDKey.java | 2 +-
.../VMStatsDiskLRURegionEntryOffHeapIntKey.java | 2 +-
...VMStatsDiskLRURegionEntryOffHeapLongKey.java | 2 +-
...StatsDiskLRURegionEntryOffHeapObjectKey.java | 2 +-
...tatsDiskLRURegionEntryOffHeapStringKey1.java | 2 +-
...tatsDiskLRURegionEntryOffHeapStringKey2.java | 2 +-
...VMStatsDiskLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../internal/cache/VMStatsDiskRegionEntry.java | 3 -
.../cache/VMStatsDiskRegionEntryHeapIntKey.java | 2 +-
.../VMStatsDiskRegionEntryHeapLongKey.java | 2 +-
.../VMStatsDiskRegionEntryHeapObjectKey.java | 2 +-
.../VMStatsDiskRegionEntryHeapStringKey1.java | 2 +-
.../VMStatsDiskRegionEntryHeapStringKey2.java | 2 +-
.../VMStatsDiskRegionEntryHeapUUIDKey.java | 2 +-
.../VMStatsDiskRegionEntryOffHeapIntKey.java | 2 +-
.../VMStatsDiskRegionEntryOffHeapLongKey.java | 2 +-
.../VMStatsDiskRegionEntryOffHeapObjectKey.java | 2 +-
...VMStatsDiskRegionEntryOffHeapStringKey1.java | 2 +-
...VMStatsDiskRegionEntryOffHeapStringKey2.java | 2 +-
.../VMStatsDiskRegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/VMStatsLRURegionEntryHeapIntKey.java | 2 +-
.../cache/VMStatsLRURegionEntryHeapLongKey.java | 2 +-
.../VMStatsLRURegionEntryHeapObjectKey.java | 2 +-
.../VMStatsLRURegionEntryHeapStringKey1.java | 2 +-
.../VMStatsLRURegionEntryHeapStringKey2.java | 2 +-
.../cache/VMStatsLRURegionEntryHeapUUIDKey.java | 2 +-
.../VMStatsLRURegionEntryOffHeapIntKey.java | 2 +-
.../VMStatsLRURegionEntryOffHeapLongKey.java | 2 +-
.../VMStatsLRURegionEntryOffHeapObjectKey.java | 2 +-
.../VMStatsLRURegionEntryOffHeapStringKey1.java | 2 +-
.../VMStatsLRURegionEntryOffHeapStringKey2.java | 2 +-
.../VMStatsLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/VMStatsRegionEntryHeapIntKey.java | 2 +-
.../cache/VMStatsRegionEntryHeapLongKey.java | 2 +-
.../cache/VMStatsRegionEntryHeapObjectKey.java | 2 +-
.../cache/VMStatsRegionEntryHeapStringKey1.java | 2 +-
.../cache/VMStatsRegionEntryHeapStringKey2.java | 2 +-
.../cache/VMStatsRegionEntryHeapUUIDKey.java | 2 +-
.../cache/VMStatsRegionEntryOffHeapIntKey.java | 2 +-
.../cache/VMStatsRegionEntryOffHeapLongKey.java | 2 +-
.../VMStatsRegionEntryOffHeapObjectKey.java | 2 +-
.../VMStatsRegionEntryOffHeapStringKey1.java | 2 +-
.../VMStatsRegionEntryOffHeapStringKey2.java | 2 +-
.../cache/VMStatsRegionEntryOffHeapUUIDKey.java | 2 +-
.../VMThinDiskLRURegionEntryHeapIntKey.java | 2 +-
.../VMThinDiskLRURegionEntryHeapLongKey.java | 2 +-
.../VMThinDiskLRURegionEntryHeapObjectKey.java | 2 +-
.../VMThinDiskLRURegionEntryHeapStringKey1.java | 2 +-
.../VMThinDiskLRURegionEntryHeapStringKey2.java | 2 +-
.../VMThinDiskLRURegionEntryHeapUUIDKey.java | 2 +-
.../VMThinDiskLRURegionEntryOffHeapIntKey.java | 2 +-
.../VMThinDiskLRURegionEntryOffHeapLongKey.java | 2 +-
...MThinDiskLRURegionEntryOffHeapObjectKey.java | 2 +-
...ThinDiskLRURegionEntryOffHeapStringKey1.java | 2 +-
...ThinDiskLRURegionEntryOffHeapStringKey2.java | 2 +-
.../VMThinDiskLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/VMThinDiskRegionEntryHeapIntKey.java | 2 +-
.../cache/VMThinDiskRegionEntryHeapLongKey.java | 2 +-
.../VMThinDiskRegionEntryHeapObjectKey.java | 2 +-
.../VMThinDiskRegionEntryHeapStringKey1.java | 2 +-
.../VMThinDiskRegionEntryHeapStringKey2.java | 2 +-
.../cache/VMThinDiskRegionEntryHeapUUIDKey.java | 2 +-
.../VMThinDiskRegionEntryOffHeapIntKey.java | 2 +-
.../VMThinDiskRegionEntryOffHeapLongKey.java | 2 +-
.../VMThinDiskRegionEntryOffHeapObjectKey.java | 2 +-
.../VMThinDiskRegionEntryOffHeapStringKey1.java | 2 +-
.../VMThinDiskRegionEntryOffHeapStringKey2.java | 2 +-
.../VMThinDiskRegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/VMThinLRURegionEntryHeapIntKey.java | 2 +-
.../cache/VMThinLRURegionEntryHeapLongKey.java | 2 +-
.../VMThinLRURegionEntryHeapObjectKey.java | 2 +-
.../VMThinLRURegionEntryHeapStringKey1.java | 2 +-
.../VMThinLRURegionEntryHeapStringKey2.java | 2 +-
.../cache/VMThinLRURegionEntryHeapUUIDKey.java | 2 +-
.../VMThinLRURegionEntryOffHeapIntKey.java | 2 +-
.../VMThinLRURegionEntryOffHeapLongKey.java | 2 +-
.../VMThinLRURegionEntryOffHeapObjectKey.java | 2 +-
.../VMThinLRURegionEntryOffHeapStringKey1.java | 2 +-
.../VMThinLRURegionEntryOffHeapStringKey2.java | 2 +-
.../VMThinLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/VMThinRegionEntryHeapIntKey.java | 2 +-
.../cache/VMThinRegionEntryHeapLongKey.java | 2 +-
.../cache/VMThinRegionEntryHeapObjectKey.java | 2 +-
.../cache/VMThinRegionEntryHeapStringKey1.java | 2 +-
.../cache/VMThinRegionEntryHeapStringKey2.java | 2 +-
.../cache/VMThinRegionEntryHeapUUIDKey.java | 2 +-
.../cache/VMThinRegionEntryOffHeapIntKey.java | 2 +-
.../cache/VMThinRegionEntryOffHeapLongKey.java | 2 +-
.../VMThinRegionEntryOffHeapObjectKey.java | 2 +-
.../VMThinRegionEntryOffHeapStringKey1.java | 2 +-
.../VMThinRegionEntryOffHeapStringKey2.java | 2 +-
.../cache/VMThinRegionEntryOffHeapUUIDKey.java | 2 +-
...sionedStatsDiskLRURegionEntryHeapIntKey.java | 2 +-
...ionedStatsDiskLRURegionEntryHeapLongKey.java | 2 +-
...nedStatsDiskLRURegionEntryHeapObjectKey.java | 2 +-
...edStatsDiskLRURegionEntryHeapStringKey1.java | 2 +-
...edStatsDiskLRURegionEntryHeapStringKey2.java | 2 +-
...ionedStatsDiskLRURegionEntryHeapUUIDKey.java | 2 +-
...nedStatsDiskLRURegionEntryOffHeapIntKey.java | 2 +-
...edStatsDiskLRURegionEntryOffHeapLongKey.java | 2 +-
...StatsDiskLRURegionEntryOffHeapObjectKey.java | 2 +-
...tatsDiskLRURegionEntryOffHeapStringKey1.java | 2 +-
...tatsDiskLRURegionEntryOffHeapStringKey2.java | 2 +-
...edStatsDiskLRURegionEntryOffHeapUUIDKey.java | 2 +-
...VersionedStatsDiskRegionEntryHeapIntKey.java | 2 +-
...ersionedStatsDiskRegionEntryHeapLongKey.java | 2 +-
...sionedStatsDiskRegionEntryHeapObjectKey.java | 2 +-
...ionedStatsDiskRegionEntryHeapStringKey1.java | 2 +-
...ionedStatsDiskRegionEntryHeapStringKey2.java | 2 +-
...ersionedStatsDiskRegionEntryHeapUUIDKey.java | 2 +-
...sionedStatsDiskRegionEntryOffHeapIntKey.java | 2 +-
...ionedStatsDiskRegionEntryOffHeapLongKey.java | 2 +-
...nedStatsDiskRegionEntryOffHeapObjectKey.java | 2 +-
...edStatsDiskRegionEntryOffHeapStringKey1.java | 2 +-
...edStatsDiskRegionEntryOffHeapStringKey2.java | 2 +-
...ionedStatsDiskRegionEntryOffHeapUUIDKey.java | 2 +-
.../VersionedStatsLRURegionEntryHeapIntKey.java | 2 +-
...VersionedStatsLRURegionEntryHeapLongKey.java | 2 +-
...rsionedStatsLRURegionEntryHeapObjectKey.java | 2 +-
...sionedStatsLRURegionEntryHeapStringKey1.java | 2 +-
...sionedStatsLRURegionEntryHeapStringKey2.java | 2 +-
...VersionedStatsLRURegionEntryHeapUUIDKey.java | 2 +-
...rsionedStatsLRURegionEntryOffHeapIntKey.java | 2 +-
...sionedStatsLRURegionEntryOffHeapLongKey.java | 2 +-
...onedStatsLRURegionEntryOffHeapObjectKey.java | 2 +-
...nedStatsLRURegionEntryOffHeapStringKey1.java | 2 +-
...nedStatsLRURegionEntryOffHeapStringKey2.java | 2 +-
...sionedStatsLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../VersionedStatsRegionEntryHeapIntKey.java | 2 +-
.../VersionedStatsRegionEntryHeapLongKey.java | 2 +-
.../VersionedStatsRegionEntryHeapObjectKey.java | 2 +-
...VersionedStatsRegionEntryHeapStringKey1.java | 2 +-
...VersionedStatsRegionEntryHeapStringKey2.java | 2 +-
.../VersionedStatsRegionEntryHeapUUIDKey.java | 2 +-
.../VersionedStatsRegionEntryOffHeapIntKey.java | 2 +-
...VersionedStatsRegionEntryOffHeapLongKey.java | 2 +-
...rsionedStatsRegionEntryOffHeapObjectKey.java | 2 +-
...sionedStatsRegionEntryOffHeapStringKey1.java | 2 +-
...sionedStatsRegionEntryOffHeapStringKey2.java | 2 +-
...VersionedStatsRegionEntryOffHeapUUIDKey.java | 2 +-
...rsionedThinDiskLRURegionEntryHeapIntKey.java | 2 +-
...sionedThinDiskLRURegionEntryHeapLongKey.java | 2 +-
...onedThinDiskLRURegionEntryHeapObjectKey.java | 2 +-
...nedThinDiskLRURegionEntryHeapStringKey1.java | 2 +-
...nedThinDiskLRURegionEntryHeapStringKey2.java | 2 +-
...sionedThinDiskLRURegionEntryHeapUUIDKey.java | 2 +-
...onedThinDiskLRURegionEntryOffHeapIntKey.java | 2 +-
...nedThinDiskLRURegionEntryOffHeapLongKey.java | 2 +-
...dThinDiskLRURegionEntryOffHeapObjectKey.java | 2 +-
...ThinDiskLRURegionEntryOffHeapStringKey1.java | 2 +-
...ThinDiskLRURegionEntryOffHeapStringKey2.java | 2 +-
...nedThinDiskLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../VersionedThinDiskRegionEntryHeapIntKey.java | 2 +-
...VersionedThinDiskRegionEntryHeapLongKey.java | 2 +-
...rsionedThinDiskRegionEntryHeapObjectKey.java | 2 +-
...sionedThinDiskRegionEntryHeapStringKey1.java | 2 +-
...sionedThinDiskRegionEntryHeapStringKey2.java | 2 +-
...VersionedThinDiskRegionEntryHeapUUIDKey.java | 2 +-
...rsionedThinDiskRegionEntryOffHeapIntKey.java | 2 +-
...sionedThinDiskRegionEntryOffHeapLongKey.java | 2 +-
...onedThinDiskRegionEntryOffHeapObjectKey.java | 2 +-
...nedThinDiskRegionEntryOffHeapStringKey1.java | 2 +-
...nedThinDiskRegionEntryOffHeapStringKey2.java | 2 +-
...sionedThinDiskRegionEntryOffHeapUUIDKey.java | 2 +-
.../VersionedThinLRURegionEntryHeapIntKey.java | 2 +-
.../VersionedThinLRURegionEntryHeapLongKey.java | 2 +-
...ersionedThinLRURegionEntryHeapObjectKey.java | 2 +-
...rsionedThinLRURegionEntryHeapStringKey1.java | 2 +-
...rsionedThinLRURegionEntryHeapStringKey2.java | 2 +-
.../VersionedThinLRURegionEntryHeapUUIDKey.java | 2 +-
...ersionedThinLRURegionEntryOffHeapIntKey.java | 2 +-
...rsionedThinLRURegionEntryOffHeapLongKey.java | 2 +-
...ionedThinLRURegionEntryOffHeapObjectKey.java | 2 +-
...onedThinLRURegionEntryOffHeapStringKey1.java | 2 +-
...onedThinLRURegionEntryOffHeapStringKey2.java | 2 +-
...rsionedThinLRURegionEntryOffHeapUUIDKey.java | 2 +-
.../VersionedThinRegionEntryHeapIntKey.java | 2 +-
.../VersionedThinRegionEntryHeapLongKey.java | 2 +-
.../VersionedThinRegionEntryHeapObjectKey.java | 2 +-
.../VersionedThinRegionEntryHeapStringKey1.java | 2 +-
.../VersionedThinRegionEntryHeapStringKey2.java | 2 +-
.../VersionedThinRegionEntryHeapUUIDKey.java | 2 +-
.../VersionedThinRegionEntryOffHeapIntKey.java | 2 +-
.../VersionedThinRegionEntryOffHeapLongKey.java | 2 +-
...ersionedThinRegionEntryOffHeapObjectKey.java | 2 +-
...rsionedThinRegionEntryOffHeapStringKey1.java | 2 +-
...rsionedThinRegionEntryOffHeapStringKey2.java | 2 +-
.../VersionedThinRegionEntryOffHeapUUIDKey.java | 2 +-
.../cache/control/HeapMemoryMonitor.java | 71 +-
.../cache/control/InternalResourceManager.java | 47 +-
.../cache/control/OffHeapMemoryMonitor.java | 10 +-
.../cache/control/RebalanceOperationImpl.java | 35 +-
.../internal/cache/control/ResourceAdvisor.java | 22 +-
.../DistributedRegionFunctionExecutor.java | 10 +-
.../DistributedRegionFunctionResultSender.java | 7 +-
.../execute/FunctionExecutionNodePruner.java | 2 +-
.../cache/execute/LocalResultCollectorImpl.java | 3 +-
.../cache/execute/MemberFunctionExecutor.java | 11 +-
.../execute/MultiRegionFunctionExecutor.java | 29 +-
.../PartitionedRegionFunctionExecutor.java | 19 +-
.../execute/ServerRegionFunctionExecutor.java | 35 +-
.../util/FindRestEnabledServersFunction.java | 13 +-
.../geode/internal/cache/ha/HARegionQueue.java | 676 +--
.../internal/cache/ha/QueueRemovalMessage.java | 51 +-
.../partitioned/BecomePrimaryBucketMessage.java | 2 +-
.../cache/partitioned/BucketSizeMessage.java | 2 +-
.../partitioned/ContainsKeyValueMessage.java | 2 +-
.../cache/partitioned/CreateBucketMessage.java | 3 +-
.../partitioned/DeposePrimaryBucketMessage.java | 2 +-
.../cache/partitioned/DestroyMessage.java | 3 +-
.../cache/partitioned/DumpB2NRegion.java | 2 +-
.../partitioned/EndBucketCreationMessage.java | 2 +-
.../partitioned/FetchBulkEntriesMessage.java | 3 +-
.../cache/partitioned/FetchEntriesMessage.java | 2 +-
.../cache/partitioned/FetchEntryMessage.java | 2 +-
.../cache/partitioned/FetchKeysMessage.java | 2 +-
.../FetchPartitionDetailsMessage.java | 2 +-
.../internal/cache/partitioned/GetMessage.java | 2 +-
.../cache/partitioned/InterestEventMessage.java | 2 +-
.../partitioned/ManageBackupBucketMessage.java | 3 +-
.../cache/partitioned/ManageBucketMessage.java | 3 +-
.../cache/partitioned/MoveBucketMessage.java | 2 +-
.../cache/partitioned/PRSanityCheckMessage.java | 2 +-
.../cache/partitioned/PRTombstoneMessage.java | 3 +-
.../PRUpdateEntryVersionMessage.java | 3 +-
.../cache/partitioned/PartitionMessage.java | 31 +-
.../PartitionMessageWithDirectReply.java | 2 +-
...rtitionedRegionFunctionStreamingMessage.java | 2 +-
.../cache/partitioned/PutAllPRMessage.java | 60 +-
.../internal/cache/partitioned/PutMessage.java | 5 +-
.../cache/partitioned/QueryMessage.java | 122 +-
.../cache/partitioned/RemoveAllPRMessage.java | 3 +-
.../cache/partitioned/RemoveBucketMessage.java | 2 +-
.../internal/cache/partitioned/SizeMessage.java | 2 +-
.../cache/persistence/BackupManager.java | 48 +-
.../tier/sockets/command/ExecuteFunction66.java | 4 +-
.../command/ExecuteRegionFunction66.java | 4 +-
.../command/ExecuteRegionFunctionSingleHop.java | 4 +-
.../cache/wan/AbstractGatewaySender.java | 2 +-
.../internal/cache/xmlcache/CacheCreation.java | 814 ++--
.../cache/xmlcache/ClientCacheCreation.java | 132 +-
.../xmlcache/DiskStoreAttributesCreation.java | 2 +-
.../internal/cache/xmlcache/RegionCreation.java | 3 +-
.../apache/geode/internal/lang/SystemUtils.java | 41 +-
.../management/internal/JmxManagerLocator.java | 29 +-
.../internal/beans/MemberMBeanBridge.java | 72 +-
.../handlers/ConfigurationRequestHandler.java | 2 +-
.../apache/geode/pdx/PdxInstanceFactory.java | 96 +-
.../pdx/internal/ClientTypeRegistration.java | 6 +-
.../pdx/internal/LonerTypeRegistration.java | 12 +-
.../pdx/internal/PdxInstanceFactoryImpl.java | 111 +-
.../pdx/internal/PeerTypeRegistration.java | 42 +-
.../apache/geode/pdx/internal/TypeRegistry.java | 176 +-
.../apache/geode/cache/query/CacheUtils.java | 181 +-
.../query/functional/FunctionJUnitTest.java | 4 +-
.../CompiledAggregateFunctionJUnitTest.java | 5 +-
.../CompiledJunctionInternalsJUnitTest.java | 28 +-
.../internal/ExecutionContextJUnitTest.java | 10 +-
.../query/internal/IndexManagerJUnitTest.java | 16 +-
...ueryFromClauseCanonicalizationJUnitTest.java | 14 +-
.../query/internal/QueryUtilsJUnitTest.java | 4 +-
.../internal/index/RangeIndexAPIJUnitTest.java | 13 +-
.../internal/cache/AbstractRegionEntryTest.java | 2 +-
.../internal/cache/AbstractRegionJUnitTest.java | 5 +-
.../geode/internal/cache/BackupJUnitTest.java | 55 +-
.../cache/CacheLifecycleListenerJUnitTest.java | 90 +-
.../internal/cache/DiskRegionTestingBase.java | 19 +-
.../cache/IncrementalBackupDUnitTest.java | 183 +-
.../PartitionedRegionCacheCloseDUnitTest.java | 2 +-
.../PartitionedRegionCreationDUnitTest.java | 2 +-
.../PartitionedRegionDestroyDUnitTest.java | 2 +-
...onedRegionHAFailureAndRecoveryDUnitTest.java | 10 +-
...onedRegionQueryEvaluatorIntegrationTest.java | 2 +-
.../cache/PartitionedRegionTestHelper.java | 10 +-
.../geode/internal/cache/TXManagerImplTest.java | 2 +-
.../cache/ha/BlockingHARegionJUnitTest.java | 5 +-
.../internal/cache/ha/HAExpiryDUnitTest.java | 39 +-
.../internal/cache/ha/HAGIIBugDUnitTest.java | 5 +-
.../geode/internal/cache/ha/HAHelper.java | 4 +-
.../cache/ha/HARQAddOperationJUnitTest.java | 8 +-
.../internal/cache/ha/HARegionDUnitTest.java | 9 +-
.../cache/ha/HARegionQueueDUnitTest.java | 9 +-
.../cache/ha/HARegionQueueJUnitTest.java | 11 +-
.../ha/HARegionQueueStartStopJUnitTest.java | 9 +-
.../cache/ha/HARegionQueueStatsJUnitTest.java | 7 +-
.../cache/ha/TestBlockingHARegionQueue.java | 3 +-
.../cache/partitioned/ShutdownAllDUnitTest.java | 36 +-
.../fixed/FixedPartitioningTestBase.java | 5 +-
.../cache/xmlcache/CacheCreationJUnitTest.java | 142 +-
.../commands/DiskStoreCommandsDUnitTest.java | 23 +-
.../cache/internal/JUnit3CacheTestCase.java | 12 +-
.../cache/internal/JUnit4CacheTestCase.java | 30 +-
.../test/dunit/standalone/RemoteDUnitVM.java | 53 +-
.../test/dunit/standalone/RemoteDUnitVMIF.java | 6 +-
.../cache/query/internal/cq/CqQueryImpl.java | 3 +-
499 files changed, 12432 insertions(+), 16000 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/CacheProperty.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/CacheProperty.java b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/CacheProperty.java
index fe16fc3..aa1a621 100644
--- a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/CacheProperty.java
+++ b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/CacheProperty.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.modules.session.internal.common;
/**
@@ -37,7 +36,7 @@ public enum CacheProperty {
/**
* This parameter can take the following values which match the respective attribute container
* classes
- * <p/>
+ * <p>
* delta_queued : QueuedDeltaSessionAttributes delta_immediate : DeltaSessionAttributes immediate
* : ImmediateSessionAttributes queued : QueuedSessionAttributes
*/
@@ -45,18 +44,18 @@ public enum CacheProperty {
/**
* This parameter can take the following values:
- * <p/>
+ * <p>
* set (default) set_and_get
*/
REPLICATION_TRIGGER(String.class);
- Class clazz;
+ private final Class clazz;
CacheProperty(Class clazz) {
this.clazz = clazz;
}
public Class getClazz() {
- return clazz;
+ return this.clazz;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireSessionManager.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireSessionManager.java b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireSessionManager.java
index 20cfeca..1bd8b88 100644
--- a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireSessionManager.java
+++ b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/filter/GemfireSessionManager.java
@@ -12,15 +12,35 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.modules.session.internal.filter;
+import java.util.EnumMap;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.FilterConfig;
+import javax.servlet.http.HttpSession;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.control.ResourceManager;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.modules.session.bootstrap.AbstractCache;
import org.apache.geode.modules.session.bootstrap.ClientServerCache;
import org.apache.geode.modules.session.bootstrap.LifecycleTypeAdapter;
@@ -33,21 +53,8 @@ import org.apache.geode.modules.session.internal.filter.attributes.AbstractSessi
import org.apache.geode.modules.session.internal.filter.attributes.DeltaQueuedSessionAttributes;
import org.apache.geode.modules.session.internal.filter.attributes.DeltaSessionAttributes;
import org.apache.geode.modules.session.internal.filter.attributes.ImmediateSessionAttributes;
-import org.apache.geode.modules.session.internal.filter.util.TypeAwareMap;
import org.apache.geode.modules.session.internal.jmx.SessionStatistics;
import org.apache.geode.modules.util.RegionHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.servlet.FilterConfig;
-import javax.servlet.http.HttpSession;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
/**
* This class implements the session management using a Gemfire distributedCache as a persistent
@@ -55,7 +62,7 @@ import java.util.UUID;
*/
public class GemfireSessionManager implements SessionManager {
- private final Logger LOG;
+ private final Logger logger;
/**
* Prefix of init param string used to set gemfire properties
@@ -95,12 +102,12 @@ public class GemfireSessionManager implements SessionManager {
/**
* Map of wrapping GemFire session id to native session id
*/
- private Map<String, String> nativeSessionMap = new HashMap<String, String>();
+ private final Map<String, String> nativeSessionMap = new HashMap<>();
/**
* MBean for statistics
*/
- private SessionStatistics mbean;
+ private final SessionStatistics mBean;
/**
* This CL is used to compare against the class loader of attributes getting pulled out of the
@@ -118,138 +125,114 @@ public class GemfireSessionManager implements SessionManager {
/**
* Set up properties with default values
*/
- private TypeAwareMap<CacheProperty, Object> properties =
- new TypeAwareMap<CacheProperty, Object>(CacheProperty.class) {
- {
- put(CacheProperty.REGION_NAME, RegionHelper.NAME + "_sessions");
- put(CacheProperty.ENABLE_GATEWAY_DELTA_REPLICATION, Boolean.FALSE);
- put(CacheProperty.ENABLE_GATEWAY_REPLICATION, Boolean.FALSE);
- put(CacheProperty.ENABLE_DEBUG_LISTENER, Boolean.FALSE);
- put(CacheProperty.STATISTICS_NAME, "gemfire_statistics");
- put(CacheProperty.SESSION_DELTA_POLICY, "delta_queued");
- put(CacheProperty.REPLICATION_TRIGGER, "set");
- /**
- * For REGION_ATTRIBUTES_ID and ENABLE_LOCAL_CACHE the default is different for
- * ClientServerCache and PeerToPeerCache so those values are set in the relevant
- * constructors when these properties are passed in to them.
- */
- }
- };
+ private final EnumMap<CacheProperty, Object> properties = createPropertiesEnumMap();
public GemfireSessionManager() {
- LOG = LoggerFactory.getLogger(GemfireSessionManager.class.getName());
+ this.logger = LoggerFactory.getLogger(GemfireSessionManager.class.getName());
+ this.mBean = new SessionStatistics();
}
- /**
- * {@inheritDoc}
- */
@Override
- public void start(Object conf, ClassLoader loader) {
+ public void start(Object config, ClassLoader loader) {
this.referenceClassLoader = loader;
- FilterConfig config = (FilterConfig) conf;
+ FilterConfig filterConfig = (FilterConfig) config;
- startDistributedSystem(config);
- initializeSessionCache(config);
+ startDistributedSystem(filterConfig);
+ initializeSessionCache(filterConfig);
// Register MBean
- registerMBean();
+ try {
+ registerMBean(this.mBean);
+ } catch (NamingException e) {
+ this.logger.warn("Unable to register statistics MBean. Error: {}", e.getMessage(), e);
+ }
- if (distributedCache.getClass().getClassLoader() == loader) {
- isolated = true;
+ if (this.distributedCache.getClass().getClassLoader() == loader) {
+ this.isolated = true;
}
- String sessionCookieName = config.getInitParameter(INIT_PARAM_SESSION_COOKIE_NAME);
+ String sessionCookieName = filterConfig.getInitParameter(INIT_PARAM_SESSION_COOKIE_NAME);
if (sessionCookieName != null && !sessionCookieName.isEmpty()) {
this.sessionCookieName = sessionCookieName;
- LOG.info("Session cookie name set to: {}", this.sessionCookieName);
+ this.logger.info("Session cookie name set to: {}", this.sessionCookieName);
}
- jvmId = config.getInitParameter(INIT_PARAM_JVM_ID);
- if (jvmId == null || jvmId.isEmpty()) {
- jvmId = DEFAULT_JVM_ID;
+ this.jvmId = filterConfig.getInitParameter(INIT_PARAM_JVM_ID);
+ if (this.jvmId == null || this.jvmId.isEmpty()) {
+ this.jvmId = DEFAULT_JVM_ID;
}
- LOG.info("Started GemfireSessionManager (isolated={}, jvmId={})", isolated, jvmId);
+ this.logger.info("Started GemfireSessionManager (isolated={}, jvmId={})", this.isolated,
+ this.jvmId);
}
- /**
- * {@inheritDoc}
- */
@Override
public void stop() {
- isStopping = true;
+ this.isStopping = true;
- if (isolated) {
- if (distributedCache != null) {
- LOG.info("Closing distributed cache - assuming isolated cache");
- distributedCache.close();
+ if (this.isolated) {
+ if (this.distributedCache != null) {
+ this.logger.info("Closing distributed cache - assuming isolated cache");
+ this.distributedCache.close();
}
} else {
- LOG.info("Not closing distributed cache - assuming common cache");
+ this.logger.info("Not closing distributed cache - assuming common cache");
}
}
- /**
- * {@inheritDoc}
- */
@Override
public HttpSession getSession(String id) {
- GemfireHttpSession session = (GemfireHttpSession) sessionCache.getOperatingRegion().get(id);
+ GemfireHttpSession session =
+ (GemfireHttpSession) this.sessionCache.getOperatingRegion().get(id);
if (session != null) {
if (session.justSerialized()) {
session.setManager(this);
- LOG.debug("Recovered serialized session {} (jvmId={})", id, session.getJvmOwnerId());
+ this.logger.debug("Recovered serialized session {} (jvmId={})", id,
+ session.getJvmOwnerId());
}
- LOG.debug("Retrieved session id {}", id);
+ this.logger.debug("Retrieved session id {}", id);
} else {
- LOG.debug("Session id {} not found", id);
+ this.logger.debug("Session id {} not found", id);
}
return session;
}
- /**
- * {@inheritDoc}
- */
@Override
public HttpSession wrapSession(HttpSession nativeSession) {
String id = generateId();
GemfireHttpSession session = new GemfireHttpSession(id, nativeSession);
- /**
- * Set up the attribute container depending on how things are configured
- */
+ // Set up the attribute container depending on how things are configured
AbstractSessionAttributes attributes;
- if ("delta_queued".equals(properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
+ if ("delta_queued".equals(this.properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
attributes = new DeltaQueuedSessionAttributes();
((DeltaQueuedSessionAttributes) attributes)
- .setReplicationTrigger((String) properties.get(CacheProperty.REPLICATION_TRIGGER));
- } else if ("delta_immediate".equals(properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
+ .setReplicationTrigger((String) this.properties.get(CacheProperty.REPLICATION_TRIGGER));
+ } else if ("delta_immediate".equals(this.properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
attributes = new DeltaSessionAttributes();
- } else if ("immediate".equals(properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
+ } else if ("immediate".equals(this.properties.get(CacheProperty.SESSION_DELTA_POLICY))) {
attributes = new ImmediateSessionAttributes();
} else {
attributes = new DeltaSessionAttributes();
- LOG.warn("No session delta policy specified - using default of 'delta_immediate'");
+ this.logger.warn("No session delta policy specified - using default of 'delta_immediate'");
}
attributes.setSession(session);
- attributes.setJvmOwnerId(jvmId);
+ attributes.setJvmOwnerId(this.jvmId);
session.setManager(this);
session.setAttributes(attributes);
- LOG.debug("Creating new session {}", id);
- sessionCache.getOperatingRegion().put(id, session);
+ this.logger.debug("Creating new session {}", id);
+ this.sessionCache.getOperatingRegion().put(id, session);
- mbean.incActiveSessions();
+ this.mBean.incActiveSessions();
return session;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public HttpSession getWrappingSession(String nativeId) {
HttpSession session = null;
String gemfireId = getGemfireSessionIdFromNativeId(nativeId);
@@ -260,112 +243,81 @@ public class GemfireSessionManager implements SessionManager {
return session;
}
- /**
- * {@inheritDoc}
- */
@Override
public void destroySession(String id) {
- if (!isStopping) {
+ if (!this.isStopping) {
try {
- GemfireHttpSession session = (GemfireHttpSession) sessionCache.getOperatingRegion().get(id);
- if (session != null && session.getJvmOwnerId().equals(jvmId)) {
- LOG.debug("Destroying session {}", id);
- sessionCache.getOperatingRegion().destroy(id);
- mbean.decActiveSessions();
+ GemfireHttpSession session =
+ (GemfireHttpSession) this.sessionCache.getOperatingRegion().get(id);
+ if (session != null && session.getJvmOwnerId().equals(this.jvmId)) {
+ this.logger.debug("Destroying session {}", id);
+ this.sessionCache.getOperatingRegion().destroy(id);
+ this.mBean.decActiveSessions();
}
- } catch (EntryNotFoundException nex) {
+ } catch (EntryNotFoundException ignore) {
}
} else {
- if (sessionCache.isClientServer()) {
- LOG.debug("Destroying session {}", id);
+ if (this.sessionCache.isClientServer()) {
+ this.logger.debug("Destroying session {}", id);
try {
- sessionCache.getOperatingRegion().localDestroy(id);
- } catch (EntryNotFoundException nex) {
- // Ignored
- } catch (CacheClosedException ccex) {
+ this.sessionCache.getOperatingRegion().localDestroy(id);
+ } catch (EntryNotFoundException | CacheClosedException ignore) {
// Ignored
}
} else {
- GemfireHttpSession session = (GemfireHttpSession) sessionCache.getOperatingRegion().get(id);
+ GemfireHttpSession session =
+ (GemfireHttpSession) this.sessionCache.getOperatingRegion().get(id);
if (session != null) {
session.setNativeSession(null);
}
}
}
- synchronized (nativeSessionMap) {
- String nativeId = nativeSessionMap.remove(id);
- LOG.debug("destroySession called for {} wrapping {}", id, nativeId);
+ synchronized (this.nativeSessionMap) {
+ String nativeId = this.nativeSessionMap.remove(id);
+ this.logger.debug("destroySession called for {} wrapping {}", id, nativeId);
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void putSession(HttpSession session) {
- sessionCache.getOperatingRegion().put(session.getId(), session);
- mbean.incRegionUpdates();
- nativeSessionMap.put(session.getId(),
+ this.sessionCache.getOperatingRegion().put(session.getId(), session);
+ this.mBean.incRegionUpdates();
+ this.nativeSessionMap.put(session.getId(),
((GemfireHttpSession) session).getNativeSession().getId());
}
@Override
- public String destroyNativeSession(String nativeId) {
- String gemfireSessionId = getGemfireSessionIdFromNativeId(nativeId);
+ public String destroyNativeSession(String id) {
+ String gemfireSessionId = getGemfireSessionIdFromNativeId(id);
if (gemfireSessionId != null) {
destroySession(gemfireSessionId);
}
return gemfireSessionId;
}
- public ClassLoader getReferenceClassLoader() {
- return referenceClassLoader;
- }
-
- /**
- * This method is called when a native session gets destroyed. It will check if the GemFire
- * session is actually still valid/not expired and will then attach a new, native session.
- *
- * @param nativeId the id of the native session
- * @return the id of the newly attached native session or null if the GemFire session was already
- * invalid
- */
- public String refreshSession(String nativeId) {
- String gemfireId = getGemfireSessionIdFromNativeId(nativeId);
- if (gemfireId == null) {
- return null;
- }
-
- GemfireHttpSession session =
- (GemfireHttpSession) sessionCache.getOperatingRegion().get(gemfireId);
- if (session.isValid()) {
-
- }
-
- return null;
+ ClassLoader getReferenceClassLoader() {
+ return this.referenceClassLoader;
}
+ @Override
public String getSessionCookieName() {
- return sessionCookieName;
+ return this.sessionCookieName;
}
+ @Override
public String getJvmId() {
- return jvmId;
+ return this.jvmId;
}
-
- ///////////////////////////////////////////////////////////////////////
- // Private methods
-
private String getGemfireSessionIdFromNativeId(String nativeId) {
if (nativeId == null) {
return null;
}
- for (Map.Entry<String, String> e : nativeSessionMap.entrySet()) {
- if (nativeId.equals(e.getValue())) {
- return e.getKey();
+ for (Map.Entry<String, String> entry : this.nativeSessionMap.entrySet()) {
+ if (nativeId.equals(entry.getValue())) {
+ return entry.getKey();
}
}
return null;
@@ -373,23 +325,21 @@ public class GemfireSessionManager implements SessionManager {
/**
* Start the underlying distributed system
- *
- * @param config
*/
private void startDistributedSystem(FilterConfig config) {
// Get the distributedCache type
final String cacheType = config.getInitParameter(INIT_PARAM_CACHE_TYPE);
if (CACHE_TYPE_CLIENT_SERVER.equals(cacheType)) {
- distributedCache = ClientServerCache.getInstance();
+ this.distributedCache = ClientServerCache.getInstance();
} else if (CACHE_TYPE_PEER_TO_PEER.equals(cacheType)) {
- distributedCache = PeerToPeerCache.getInstance();
+ this.distributedCache = PeerToPeerCache.getInstance();
} else {
- LOG.error("No 'cache-type' initialization param set. " + "Cache will not be started");
+ this.logger.error("No 'cache-type' initialization param set. " + "Cache will not be started");
return;
}
- if (!distributedCache.isStarted()) {
- /**
+ if (!this.distributedCache.isStarted()) {
+ /*
* Process all the init params and see if any apply to the distributed system.
*/
for (Enumeration<String> e = config.getInitParameterNames(); e.hasMoreElements();) {
@@ -399,12 +349,12 @@ public class GemfireSessionManager implements SessionManager {
}
String gemfireProperty = param.substring(GEMFIRE_PROPERTY.length());
- LOG.info("Setting gemfire property: {} = {}", gemfireProperty,
+ this.logger.info("Setting gemfire property: {} = {}", gemfireProperty,
config.getInitParameter(param));
- distributedCache.setProperty(gemfireProperty, config.getInitParameter(param));
+ this.distributedCache.setProperty(gemfireProperty, config.getInitParameter(param));
}
- distributedCache.lifecycleEvent(LifecycleTypeAdapter.START);
+ this.distributedCache.lifecycleEvent(LifecycleTypeAdapter.START);
}
}
@@ -413,21 +363,18 @@ public class GemfireSessionManager implements SessionManager {
*/
private void initializeSessionCache(FilterConfig config) {
// Retrieve the distributedCache
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+ InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
if (cache == null) {
throw new IllegalStateException(
- "No cache exists. Please configure " + "either a PeerToPeerCacheLifecycleListener or "
- + "ClientServerCacheLifecycleListener in the " + "server.xml file.");
+ "No cache exists. Please configure either a PeerToPeerCacheLifecycleListener or ClientServerCacheLifecycleListener in the server.xml file.");
}
- /**
- * Process all the init params and see if any apply to the distributedCache
- */
+ // Process all the init params and see if any apply to the distributedCache
ResourceManager rm = cache.getResourceManager();
for (Enumeration<String> e = config.getInitParameterNames(); e.hasMoreElements();) {
String param = e.nextElement();
- // Uggh - don't like this non-generic stuff
+ // Ugh - don't like this non-generic stuff
if (param.equalsIgnoreCase("criticalHeapPercentage")) {
float val = Float.parseFloat(config.getInitParameter(param));
rm.setCriticalHeapPercentage(val);
@@ -444,37 +391,41 @@ public class GemfireSessionManager implements SessionManager {
}
String gemfireWebParam = param.substring(GEMFIRE_CACHE.length());
- LOG.info("Setting cache parameter: {} = {}", gemfireWebParam, config.getInitParameter(param));
- properties.put(CacheProperty.valueOf(gemfireWebParam.toUpperCase()),
+ this.logger.info("Setting cache parameter: {} = {}", gemfireWebParam,
+ config.getInitParameter(param));
+ this.properties.put(CacheProperty.valueOf(gemfireWebParam.toUpperCase()),
config.getInitParameter(param));
}
// Create the appropriate session distributedCache
- sessionCache = cache.isClient() ? new ClientServerSessionCache(cache, properties)
- : new PeerToPeerSessionCache(cache, properties);
+ if (cache.isClient()) {
+ this.sessionCache = new ClientServerSessionCache((ClientCache) cache, this.properties);
+ } else {
+ this.sessionCache = new PeerToPeerSessionCache(cache, this.properties);
+ }
// Initialize the session distributedCache
- sessionCache.initialize();
+ this.sessionCache.initialize();
}
/**
* Register a bean for statistic gathering purposes
*/
- private void registerMBean() {
- mbean = new SessionStatistics();
-
+ private void registerMBean(final SessionStatistics mBean) throws NamingException {
+ InitialContext ctx = new InitialContext();
try {
- InitialContext ctx = new InitialContext();
- MBeanServer mbs = MBeanServer.class.cast(ctx.lookup("java:comp/env/jmx/runtime"));
- ObjectName oname = new ObjectName(Constants.SESSION_STATISTICS_MBEAN_NAME);
-
- mbs.registerMBean(mbean, oname);
- } catch (Exception ex) {
- LOG.warn("Unable to register statistics MBean. Error: {}", ex.getMessage());
+ MBeanServer mBeanServer = MBeanServer.class.cast(ctx.lookup("java:comp/env/jmx/runtime"));
+ ObjectName objectName = new ObjectName(Constants.SESSION_STATISTICS_MBEAN_NAME);
+
+ mBeanServer.registerMBean(mBean, objectName);
+ } catch (MalformedObjectNameException | NotCompliantMBeanException
+ | InstanceAlreadyExistsException | MBeanRegistrationException e) {
+ this.logger.warn("Unable to register statistics MBean. Error: {}", e.getMessage(), e);
+ } finally {
+ ctx.close();
}
}
-
/**
* Generate an ID string
*/
@@ -483,6 +434,23 @@ public class GemfireSessionManager implements SessionManager {
}
AbstractCache getCache() {
- return distributedCache;
+ return this.distributedCache;
+ }
+
+ private EnumMap<CacheProperty, Object> createPropertiesEnumMap() {
+ EnumMap<CacheProperty, Object> cacheProperties = new EnumMap<>(CacheProperty.class);
+ cacheProperties.put(CacheProperty.REGION_NAME, RegionHelper.NAME + "_sessions");
+ cacheProperties.put(CacheProperty.ENABLE_GATEWAY_DELTA_REPLICATION, Boolean.FALSE);
+ cacheProperties.put(CacheProperty.ENABLE_GATEWAY_REPLICATION, Boolean.FALSE);
+ cacheProperties.put(CacheProperty.ENABLE_DEBUG_LISTENER, Boolean.FALSE);
+ cacheProperties.put(CacheProperty.STATISTICS_NAME, "gemfire_statistics");
+ cacheProperties.put(CacheProperty.SESSION_DELTA_POLICY, "delta_queued");
+ cacheProperties.put(CacheProperty.REPLICATION_TRIGGER, "set");
+ /*
+ * For REGION_ATTRIBUTES_ID and ENABLE_LOCAL_CACHE the default is different for
+ * ClientServerCache and PeerToPeerCache so those values are set in the relevant constructors
+ * when these properties are passed in to them.
+ */
+ return cacheProperties;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionManager.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionManager.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionManager.java
index edc2b7d..98a3db4 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionManager.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSessionManager.java
@@ -14,33 +14,11 @@
*/
package org.apache.geode.modules.session.catalina;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryService;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.modules.session.catalina.internal.DeltaSessionStatistics;
-import org.apache.geode.modules.util.ContextMapper;
-import org.apache.geode.modules.util.RegionConfiguration;
-import org.apache.geode.modules.util.RegionHelper;
-import org.apache.catalina.Container;
-import org.apache.catalina.Context;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.Loader;
-import org.apache.catalina.Pipeline;
-import org.apache.catalina.Session;
-import org.apache.catalina.Valve;
-import org.apache.catalina.session.ManagerBase;
-import org.apache.catalina.session.StandardSession;
-import org.apache.catalina.util.CustomObjectInputStream;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -58,10 +36,41 @@ import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
-abstract public class DeltaSessionManager extends ManagerBase
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.Loader;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.Session;
+import org.apache.catalina.Valve;
+import org.apache.catalina.session.ManagerBase;
+import org.apache.catalina.session.StandardSession;
+import org.apache.catalina.util.CustomObjectInputStream;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.modules.session.catalina.internal.DeltaSessionStatistics;
+import org.apache.geode.modules.util.ContextMapper;
+import org.apache.geode.modules.util.RegionConfiguration;
+import org.apache.geode.modules.util.RegionHelper;
+
+public abstract class DeltaSessionManager extends ManagerBase
implements Lifecycle, PropertyChangeListener, SessionManager {
+ private static final Pattern PATTERN_SLASH = Pattern.compile("/", Pattern.LITERAL);
+
/**
* The number of rejected sessions.
*/
@@ -73,12 +82,12 @@ abstract public class DeltaSessionManager extends ManagerBase
protected int maxActiveSessions = -1;
/**
- * Has this <code>Manager</code> been started?
+ * Has this {@code Manager} been started?
*/
protected AtomicBoolean started = new AtomicBoolean(false);
/**
- * The name of this <code>Manager</code>
+ * The name of this {@code Manager}
*/
protected String name;
@@ -106,7 +115,7 @@ abstract public class DeltaSessionManager extends ManagerBase
* This *MUST* only be assigned during start/startInternal otherwise it will be associated with
* the incorrect context class loader.
*/
- protected Log LOGGER;
+ protected Log logger;
protected String regionName = DEFAULT_REGION_NAME;
@@ -137,7 +146,7 @@ abstract public class DeltaSessionManager extends ManagerBase
private static final long TIMER_TASK_DELAY =
Long.getLong("gemfiremodules.sessionTimerTaskDelay", 10000);
- public DeltaSessionManager() {
+ protected DeltaSessionManager() {
// Create the set to store sessions to be touched after get attribute requests
this.sessionsToTouch = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
}
@@ -193,7 +202,7 @@ abstract public class DeltaSessionManager extends ManagerBase
public void setMaxActiveSessions(int maxActiveSessions) {
int oldMaxActiveSessions = this.maxActiveSessions;
this.maxActiveSessions = maxActiveSessions;
- support.firePropertyChange("maxActiveSessions", new Integer(oldMaxActiveSessions),
+ this.support.firePropertyChange("maxActiveSessions", new Integer(oldMaxActiveSessions),
new Integer(this.maxActiveSessions));
}
@@ -245,7 +254,7 @@ abstract public class DeltaSessionManager extends ManagerBase
@Override
public boolean isBackingCacheAvailable() {
- return sessionCache.isBackingCacheAvailable();
+ return this.sessionCache.isBackingCacheAvailable();
}
public void setPreferDeserializedForm(boolean enable) {
@@ -259,15 +268,15 @@ abstract public class DeltaSessionManager extends ManagerBase
@Override
public String getStatisticsName() {
- return getContextName().replace("/", "");
+ return PATTERN_SLASH.matcher(getContextName()).replaceAll(Matcher.quoteReplacement(""));
}
@Override
public Log getLogger() {
- if (LOGGER == null) {
- LOGGER = LogFactory.getLog(DeltaSessionManager.class);
+ if (this.logger == null) {
+ this.logger = LogFactory.getLog(DeltaSessionManager.class);
}
- return LOGGER;
+ return this.logger;
}
public SessionCache getSessionCache() {
@@ -298,18 +307,18 @@ abstract public class DeltaSessionManager extends ManagerBase
@Override
public void setContainer(Container container) {
// De-register from the old Container (if any)
- if ((this.container != null) && (this.container instanceof Context)) {
- ((Context) this.container).removePropertyChangeListener(this);
+ if (Context.class.isInstance(this.container)) {
+ this.container.removePropertyChangeListener(this);
}
// Default processing provided by our superclass
super.setContainer(container);
// Register with the new Container (if any)
- if ((this.container != null) && (this.container instanceof Context)) {
+ if (Context.class.isInstance(this.container)) {
// Overwrite the max inactive interval with the context's session timeout.
setMaxInactiveInterval(((Context) this.container).getSessionTimeout() * 60);
- ((Context) this.container).addPropertyChangeListener(this);
+ this.container.addPropertyChangeListener(this);
}
}
@@ -363,15 +372,18 @@ abstract public class DeltaSessionManager extends ManagerBase
protected void initializeSessionCache() {
// Retrieve the cache
- GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+ InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
if (cache == null) {
throw new IllegalStateException(
"No cache exists. Please configure either a PeerToPeerCacheLifecycleListener or ClientServerCacheLifecycleListener in the server.xml file.");
}
// Create the appropriate session cache
- this.sessionCache = cache.isClient() ? new ClientServerSessionCache(this, cache)
- : new PeerToPeerSessionCache(this, cache);
+ if (cache.isClient()) {
+ this.sessionCache = new ClientServerSessionCache(this, (ClientCache) cache);
+ } else {
+ this.sessionCache = new PeerToPeerSessionCache(this, cache);
+ }
// Initialize the session cache
this.sessionCache.initialize();
@@ -430,6 +442,7 @@ abstract public class DeltaSessionManager extends ManagerBase
return this.rejectedSessions.get();
}
+ @Override
public void setRejectedSessions(int rejectedSessions) {
this.rejectedSessions.set(rejectedSessions);
}
@@ -458,7 +471,7 @@ abstract public class DeltaSessionManager extends ManagerBase
while (sessionIds.hasNext()) {
builder.append(sessionIds.next());
if (sessionIds.hasNext()) {
- builder.append(" ");
+ builder.append(' ');
}
}
return builder.toString();
@@ -504,12 +517,11 @@ abstract public class DeltaSessionManager extends ManagerBase
@Override
public void run() {
// Get the sessionIds to touch and clear the set inside synchronization
- Set<String> sessionIds = null;
- sessionIds = new HashSet<String>(getSessionsToTouch());
+ Set<String> sessionIds = new HashSet<>(getSessionsToTouch());
getSessionsToTouch().clear();
// Touch the sessions we currently have
- if (sessionIds != null && (!sessionIds.isEmpty())) {
+ if (!sessionIds.isEmpty()) {
getSessionCache().touchSessions(sessionIds);
if (getLogger().isDebugEnabled()) {
getLogger().debug(DeltaSessionManager.this + ": Touched sessions: " + sessionIds);
@@ -521,7 +533,7 @@ abstract public class DeltaSessionManager extends ManagerBase
}
protected void cancelTimer() {
- if (timer != null) {
+ if (this.timer != null) {
this.timer.cancel();
}
}
@@ -559,8 +571,8 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled()) {
getLogger().debug(this + ": Registering JVM route binder valve");
}
- jvmRouteBinderValve = new JvmRouteBinderValve();
- getPipeline().addValve(jvmRouteBinderValve);
+ this.jvmRouteBinderValve = new JvmRouteBinderValve();
+ getPipeline().addValve(this.jvmRouteBinderValve);
}
protected Pipeline getPipeline() {
@@ -571,8 +583,8 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled()) {
getLogger().debug(this + ": Unregistering JVM route binder valve");
}
- if (jvmRouteBinderValve != null) {
- getPipeline().removeValve(jvmRouteBinderValve);
+ if (this.jvmRouteBinderValve != null) {
+ getPipeline().removeValve(this.jvmRouteBinderValve);
}
}
@@ -580,21 +592,19 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled()) {
getLogger().debug(this + ": Registering CommitSessionValve");
}
- commitSessionValve = new CommitSessionValve();
- getPipeline().addValve(commitSessionValve);
+ this.commitSessionValve = new CommitSessionValve();
+ getPipeline().addValve(this.commitSessionValve);
}
protected void unregisterCommitSessionValve() {
if (getLogger().isDebugEnabled()) {
getLogger().debug(this + ": Unregistering CommitSessionValve");
}
- if (commitSessionValve != null) {
- getPipeline().removeValve(commitSessionValve);
+ if (this.commitSessionValve != null) {
+ getPipeline().removeValve(this.commitSessionValve);
}
}
- // ------------------------------ Lifecycle Methods
-
/**
* Process property change events from our associated Context.
* <p>
@@ -604,7 +614,6 @@ abstract public class DeltaSessionManager extends ManagerBase
* session timeout value specified in the web.xml.
* <p>
* The precedence order for setting the session timeout value is:
- * <p>
* <ol>
* <li>the max inactive interval is set based on the Manager defined in the context.xml
* <li>the max inactive interval is then overwritten by the value of the Context's session timeout
@@ -622,17 +631,16 @@ abstract public class DeltaSessionManager extends ManagerBase
if (!(event.getSource() instanceof Context)) {
return;
}
- Context context = (Context) event.getSource();
// Process a relevant property change
if (event.getPropertyName().equals("sessionTimeout")) {
try {
- int interval = ((Integer) event.getNewValue()).intValue();
+ int interval = (Integer) event.getNewValue();
if (interval < RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL) {
getLogger().warn("The configured session timeout of " + interval
+ " minutes is invalid. Using the original value of " + event.getOldValue()
+ " minutes.");
- interval = ((Integer) event.getOldValue()).intValue();;
+ interval = (Integer) event.getOldValue();
}
// StandardContext.setSessionTimeout passes -1 if the configured timeout
// is 0; otherwise it passes the value set in web.xml. If the interval
@@ -640,7 +648,7 @@ abstract public class DeltaSessionManager extends ManagerBase
// default (no expiration); otherwise set it in seconds.
setMaxInactiveInterval(interval == RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL
? RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL : interval * 60);
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException ignore) {
getLogger()
.error(sm.getString("standardManager.sessionTimeout", event.getNewValue().toString()));
}
@@ -654,7 +662,7 @@ abstract public class DeltaSessionManager extends ManagerBase
* @throws IOException if an input/output error occurs
*/
protected void doUnload() throws IOException {
- QueryService querySvc = sessionCache.getCache().getQueryService();
+ QueryService querySvc = this.sessionCache.getCache().getQueryService();
Context context = getTheContext();
if (context == null) {
return;
@@ -663,10 +671,10 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getRegionName().startsWith("/")) {
regionName = getRegionName();
} else {
- regionName = "/" + getRegionName();
+ regionName = '/' + getRegionName();
}
Query query = querySvc.newQuery("select s.id from " + regionName
- + " as s where s.contextName = '" + context.getPath() + "'");
+ + " as s where s.contextName = '" + context.getPath() + '\'');
getLogger().debug("Query: " + query.getQueryString());
SelectResults results;
@@ -690,9 +698,11 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled()) {
getLogger().debug("Unloading sessions to " + store.getAbsolutePath());
}
+
FileOutputStream fos = null;
BufferedOutputStream bos = null;
ObjectOutputStream oos = null;
+
boolean error = false;
try {
fos = new FileOutputStream(store.getAbsolutePath());
@@ -704,31 +714,13 @@ abstract public class DeltaSessionManager extends ManagerBase
throw e;
} finally {
if (error) {
- if (oos != null) {
- try {
- oos.close();
- } catch (IOException ioe) {
- // Ignore
- }
- }
- if (bos != null) {
- try {
- bos.close();
- } catch (IOException ioe) {
- // Ignore
- }
- }
- if (fos != null) {
- try {
- fos.close();
- } catch (IOException ioe) {
- // Ignore
- }
- }
+ closeQuietly(oos);
+ closeQuietly(bos);
+ closeQuietly(fos);
}
}
- ArrayList<DeltaSessionInterface> list = new ArrayList<DeltaSessionInterface>();
+ ArrayList<DeltaSessionInterface> list = new ArrayList<>();
Iterator<String> elements = results.iterator();
while (elements.hasNext()) {
String id = elements.next();
@@ -742,7 +734,7 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled())
getLogger().debug("Unloading " + list.size() + " sessions");
try {
- oos.writeObject(new Integer(list.size()));
+ oos.writeObject(list.size());
for (DeltaSessionInterface session : list) {
if (session instanceof StandardSession) {
StandardSession standardSession = (StandardSession) session;
@@ -755,24 +747,12 @@ abstract public class DeltaSessionManager extends ManagerBase
}
} catch (IOException e) {
getLogger().error("Exception unloading sessions", e);
- try {
- oos.close();
- } catch (IOException f) {
- // Ignore
- }
+ closeQuietly(oos);
throw e;
}
// Flush and close the output stream
- try {
- oos.flush();
- } finally {
- try {
- oos.close();
- } catch (IOException f) {
- // Ignore
- }
- }
+ closeQuietly(oos);
// Locally destroy the sessions we just wrote
if (getSessionCache().isClientServer()) {
@@ -784,22 +764,6 @@ abstract public class DeltaSessionManager extends ManagerBase
}
}
- // // Expire all the sessions we just wrote
- // if (getLogger().isDebugEnabled()) {
- // getLogger().debug("Expiring " + list.size() + " persisted sessions");
- // }
- // Iterator<StandardSession> expires = list.iterator();
- // while (expires.hasNext()) {
- // StandardSession session = expires.next();
- // try {
- // session.expire(false);
- // } catch (Throwable t) {
- //// ExceptionUtils.handleThrowable(t);
- // } finally {
- // session.recycle();
- // }
- // }
-
if (getLogger().isDebugEnabled()) {
getLogger().debug("Unloading complete");
}
@@ -827,17 +791,18 @@ abstract public class DeltaSessionManager extends ManagerBase
if (getLogger().isDebugEnabled()) {
getLogger().debug("Loading sessions from " + store.getAbsolutePath());
}
+
FileInputStream fis = null;
BufferedInputStream bis = null;
- ObjectInputStream ois = null;
- Loader loader = null;
- ClassLoader classLoader = null;
+ ObjectInputStream ois;
try {
fis = new FileInputStream(store.getAbsolutePath());
bis = new BufferedInputStream(fis);
+ Loader loader = null;
if (getTheContext() != null) {
loader = getTheContext().getLoader();
}
+ ClassLoader classLoader = null;
if (loader != null) {
classLoader = loader.getClassLoader();
}
@@ -854,7 +819,7 @@ abstract public class DeltaSessionManager extends ManagerBase
}
} catch (FileNotFoundException e) {
if (getLogger().isDebugEnabled()) {
- getLogger().debug("No persisted data file found");
+ getLogger().debug("No persisted data file found", e);
}
return;
} catch (IOException e) {
@@ -862,14 +827,14 @@ abstract public class DeltaSessionManager extends ManagerBase
if (fis != null) {
try {
fis.close();
- } catch (IOException f) {
+ } catch (IOException ignore) {
// Ignore
}
}
if (bis != null) {
try {
bis.close();
- } catch (IOException f) {
+ } catch (IOException ignore) {
// Ignore
}
}
@@ -878,8 +843,7 @@ abstract public class DeltaSessionManager extends ManagerBase
// Load the previously unloaded active sessions
try {
- Integer count = (Integer) ois.readObject();
- int n = count.intValue();
+ int n = (Integer) ois.readObject();
if (getLogger().isDebugEnabled()) {
getLogger().debug("Loading " + n + " persisted sessions");
}
@@ -888,7 +852,7 @@ abstract public class DeltaSessionManager extends ManagerBase
session.readObjectData(ois);
session.setManager(this);
- Region region = getSessionCache().getOperatingRegion();
+ Region<String, HttpSession> region = getSessionCache().getOperatingRegion();
DeltaSessionInterface existingSession = (DeltaSessionInterface) region.get(session.getId());
// Check whether the existing session is newer
if (existingSession != null
@@ -911,19 +875,11 @@ abstract public class DeltaSessionManager extends ManagerBase
session.activate();
add(session);
}
- } catch (ClassNotFoundException e) {
+ } catch (ClassNotFoundException | IOException e) {
getLogger().error(e);
try {
ois.close();
- } catch (IOException f) {
- // Ignore
- }
- throw e;
- } catch (IOException e) {
- getLogger().error(e);
- try {
- ois.close();
- } catch (IOException f) {
+ } catch (IOException ignore) {
// Ignore
}
throw e;
@@ -931,7 +887,7 @@ abstract public class DeltaSessionManager extends ManagerBase
// Close the input stream
try {
ois.close();
- } catch (IOException f) {
+ } catch (IOException ignore) {
// ignored
}
@@ -952,16 +908,14 @@ abstract public class DeltaSessionManager extends ManagerBase
} else {
storeDir += System.getProperty("file.separator") + "temp";
}
- File file = new File(storeDir, ctxPath.replaceAll("/", "_") + ".sessions.ser");
-
- return (file);
+ return new File(storeDir, PATTERN_SLASH.matcher(ctxPath).replaceAll("_") + ".sessions.ser");
}
@Override
public String toString() {
- return new StringBuilder().append(getClass().getSimpleName()).append("[").append("container=")
+ return new StringBuilder().append(getClass().getSimpleName()).append('[').append("container=")
.append(getTheContext()).append("; regionName=").append(this.regionName)
- .append("; regionAttributesId=").append(this.regionAttributesId).append("]").toString();
+ .append("; regionAttributesId=").append(this.regionAttributesId).append(']').toString();
}
protected String getContextName() {
@@ -969,7 +923,7 @@ abstract public class DeltaSessionManager extends ManagerBase
}
public Context getTheContext() {
- if (getContainer() instanceof Context) {
+ if (Context.class.isInstance(getContainer())) {
return (Context) getContainer();
} else {
getLogger().error("Unable to unload sessions - container is of type "
@@ -977,4 +931,14 @@ abstract public class DeltaSessionManager extends ManagerBase
return null;
}
}
+
+ private static void closeQuietly(Closeable closeable) {
+ if (closeable == null) {
+ return;
+ }
+ try {
+ closeable.close();
+ } catch (IOException ignore) {
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 4e9e9fd..d10ff2a 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
@@ -24,19 +24,18 @@ import org.apache.geode.InternalGemFireError;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheWriterException;
import org.apache.geode.cache.Declarable;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
-import org.apache.geode.cache.RegionFactory;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.Scope;
-import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.internal.locks.DistributedMemberLock;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
@@ -58,20 +57,16 @@ public class CreateRegionFunction implements Function, Declarable {
private static final String REGION_CONFIGURATION_METADATA_REGION =
"__regionConfigurationMetadata";
- public CreateRegionFunction() {
+ CreateRegionFunction() {
this(CacheFactory.getAnyInstance());
}
- public CreateRegionFunction(Cache cache) {
+ private CreateRegionFunction(Cache cache) {
this.cache = cache;
this.regionConfigurationsRegion = createRegionConfigurationMetadataRegion();
}
- public CreateRegionFunction(ClientCache cache) {
- this.cache = null;
- this.regionConfigurationsRegion = null;
- }
-
+ @Override
public void execute(FunctionContext context) {
RegionConfiguration configuration = (RegionConfiguration) context.getArguments();
if (this.cache.getLogger().fineEnabled()) {
@@ -92,19 +87,19 @@ public class CreateRegionFunction implements Function, Declarable {
}
private RegionStatus createOrRetrieveRegion(RegionConfiguration configuration) {
- RegionStatus status = null;
String regionName = configuration.getRegionName();
if (this.cache.getLogger().fineEnabled()) {
this.cache.getLogger().fine("Function " + ID + " retrieving region named: " + regionName);
}
- Region region = this.cache.getRegion(regionName);
+ Region<Object, Object> region = this.cache.getRegion(regionName);
+ RegionStatus status;
if (region == null) {
status = createRegion(configuration);
} else {
status = RegionStatus.VALID;
try {
RegionHelper.validateRegion(this.cache, configuration, region);
- } catch (Exception e) {
+ } catch (RuntimeException e) {
if (!e.getMessage()
.equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME
.toLocalizedString())) {
@@ -116,23 +111,28 @@ public class CreateRegionFunction implements Function, Declarable {
return status;
}
+ @Override
public String getId() {
return ID;
}
+ @Override
public boolean optimizeForWrite() {
return false;
}
+ @Override
public boolean isHA() {
return true;
}
+ @Override
public boolean hasResult() {
return true;
}
- public void init(Properties properties) {}
+ @Override
+ public void init(Properties props) {}
private RegionStatus createRegion(RegionConfiguration configuration) {
// Get a distributed lock
@@ -140,23 +140,23 @@ public class CreateRegionFunction implements Function, Declarable {
if (this.cache.getLogger().fineEnabled()) {
this.cache.getLogger().fine(this + ": Attempting to lock " + dml);
}
- long start = 0, end = 0;
- RegionStatus status = null;
+ RegionStatus status;
try {
+ long start = 0;
if (this.cache.getLogger().fineEnabled()) {
start = System.currentTimeMillis();
}
// Obtain a lock on the distributed lock
dml.lockInterruptibly();
if (this.cache.getLogger().fineEnabled()) {
- end = System.currentTimeMillis();
+ long end = System.currentTimeMillis();
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
String regionName = configuration.getRegionName();
- Region region = this.cache.getRegion(regionName);
+ Region<Object, Object> region = this.cache.getRegion(regionName);
// If it exists now, validate it.
// Else put an entry into the sessionRegionConfigurationsRegion
@@ -182,7 +182,7 @@ public class CreateRegionFunction implements Function, Declarable {
status = RegionStatus.VALID;
try {
RegionHelper.validateRegion(this.cache, configuration, region);
- } catch (Exception e) {
+ } catch (RuntimeException e) {
if (!e.getMessage()
.equals(LocalizedStrings.RegionAttributesCreation_CACHELISTENERS_ARE_NOT_THE_SAME
.toLocalizedString())) {
@@ -191,17 +191,17 @@ public class CreateRegionFunction implements Function, Declarable {
status = RegionStatus.INVALID;
}
}
- } catch (Exception e) {
+ } catch (InterruptedException | CacheWriterException | TimeoutException e) {
StringBuilder builder = new StringBuilder();
builder.append(this).append(": Caught Exception attempting to create region named ")
- .append(configuration.getRegionName()).append(":");
+ .append(configuration.getRegionName()).append(':');
this.cache.getLogger().warning(builder.toString(), e);
status = RegionStatus.INVALID;
} finally {
// Unlock the distributed lock
try {
dml.unlock();
- } catch (Exception ignore) {
+ } catch (RuntimeException ignore) {
}
}
return status;
@@ -219,19 +219,17 @@ public class CreateRegionFunction implements Function, Declarable {
if (r != null) {
return r;
}
- GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
+ InternalCache internalCache = (InternalCache) this.cache;
InternalRegionArguments ira = new InternalRegionArguments().setInternalRegion(true);
- AttributesFactory af = new AttributesFactory();
+ AttributesFactory<String, RegionConfiguration> af = new AttributesFactory<>();
af.setScope(Scope.LOCAL);
af.addCacheListener(new RegionConfigurationCacheListener());
- RegionAttributes ra = af.create();
+ RegionAttributes<String, RegionConfiguration> ra = af.create();
try {
- return gemFireCache.createVMRegion(REGION_CONFIGURATION_METADATA_REGION, ra, ira);
+ return internalCache.createVMRegion(REGION_CONFIGURATION_METADATA_REGION, ra, ira);
} catch (IOException | ClassNotFoundException e) {
- InternalGemFireError assErr = new InternalGemFireError(
- LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
- assErr.initCause(e);
- throw assErr;
+ throw new InternalGemFireError(
+ LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString(), e);
}
}
@@ -241,7 +239,7 @@ public class CreateRegionFunction implements Function, Declarable {
PrintWriter pw = new PrintWriter(new FileWriter(file), true);
CacheXmlGenerator.generate(this.cache, pw);
pw.close();
- } catch (IOException e) {
+ } catch (IOException ignore) {
}
}
[26/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index c96732c..459123f 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -55,6 +55,7 @@ import org.apache.geode.internal.cache.AbstractCacheServer;
import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.cache.CacheServerLauncher;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.tier.sockets.CacheServerHelper;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -101,6 +102,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @deprecated This is specific to the internal implementation and may go away in a future
* release.
*/
+ @Deprecated
protected static final Integer DEFAULT_SERVER_PORT = getDefaultServerPort();
private static final Map<String, String> helpMap = new HashMap<>();
@@ -156,6 +158,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @deprecated This is specific to the internal implementation and may go away in a future
* release.
*/
+ @Deprecated
public static final String DEFAULT_SERVER_PID_FILE = "vf.gf.server.pid";
private static final String DEFAULT_SERVER_LOG_EXT = ".log";
@@ -167,9 +170,9 @@ public class ServerLauncher extends AbstractLauncher<String> {
private static final ServerLauncherCacheProvider DEFAULT_CACHE_PROVIDER =
new DefaultServerLauncherCacheProvider();
- private volatile transient boolean debug;
+ private volatile boolean debug;
- private final transient ControlNotificationHandler controlHandler;
+ private final ControlNotificationHandler controlHandler;
private final AtomicBoolean starting = new AtomicBoolean(false);
@@ -180,9 +183,9 @@ public class ServerLauncher extends AbstractLauncher<String> {
private final boolean rebalance;
private final boolean redirectOutput;
- private volatile transient Cache cache;
+ private volatile Cache cache;
- private final transient CacheConfig cacheConfig;
+ private final CacheConfig cacheConfig;
private final Command command;
@@ -198,7 +201,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
private final String workingDirectory;
// NOTE in addition to debug, the other shared, mutable state
- private volatile transient String statusMessage;
+ private volatile String statusMessage;
private final Float criticalHeapPercentage;
private final Float evictionHeapPercentage;
@@ -214,9 +217,9 @@ public class ServerLauncher extends AbstractLauncher<String> {
private final Integer maxThreads;
- private volatile transient ControllableProcess process;
+ private volatile ControllableProcess process;
- private final transient ServerControllerParameters controllerParameters;
+ private final ServerControllerParameters controllerParameters;
/**
* Launches a GemFire Server from the command-line configured with the given arguments.
@@ -459,8 +462,8 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @return a String indicating the name of the member (this Server) in the GemFire distributed
* system.
- * @see AbstractLauncher#getMemberName()
*/
+ @Override
public String getMemberName() {
return StringUtils.defaultIfBlank(this.memberName, super.getMemberName());
}
@@ -653,12 +656,12 @@ public class ServerLauncher extends AbstractLauncher<String> {
} else {
info(StringUtils.wrap(helpMap.get(command.getName()), 80, ""));
info("\n\nusage: \n\n");
- info(StringUtils.wrap("> java ... " + getClass().getName() + " " + usageMap.get(command), 80,
+ info(StringUtils.wrap("> java ... " + getClass().getName() + ' ' + usageMap.get(command), 80,
"\t\t"));
info("\n\noptions: \n\n");
for (final String option : command.getOptions()) {
- info(StringUtils.wrap("--" + option + ": " + helpMap.get(option) + "\n", 80, "\t"));
+ info(StringUtils.wrap("--" + option + ": " + helpMap.get(option) + '\n', 80, "\t"));
}
info("\n\n");
@@ -904,7 +907,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
/**
* Causes the calling Thread to block until the GemFire Cache Server/Data Member stops.
*/
- public void waitOnServer() {
+ void waitOnServer() {
assert getCache() != null : "The Cache Server must first be started with a call to start!";
if (!isServing(getCache())) {
@@ -1012,8 +1015,8 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @return a boolean indicating if bucket assignment is both enabled and allowed.
* @see #isAssignBuckets()
*/
- protected boolean isAssignBucketsAllowed(final Cache cache) {
- return (isAssignBuckets() && (cache instanceof GemFireCacheImpl));
+ private boolean isAssignBucketsAllowed(final Cache cache) {
+ return isAssignBuckets() && cache instanceof GemFireCacheImpl;
}
/**
@@ -1022,9 +1025,9 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @param cache the Cache who's Partitioned Regions are accessed to assign buckets to.
* @see PartitionRegionHelper#assignBucketsToPartitions(org.apache.geode.cache.Region)
*/
- final void assignBuckets(final Cache cache) {
+ private void assignBuckets(final Cache cache) {
if (isAssignBucketsAllowed(cache)) {
- for (PartitionedRegion region : ((GemFireCacheImpl) cache).getPartitionedRegions()) {
+ for (PartitionedRegion region : ((InternalCache) cache).getPartitionedRegions()) {
PartitionRegionHelper.assignBucketsToPartitions(region);
}
}
@@ -1192,7 +1195,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* process with an embedded Server).
*/
private boolean isStoppable() {
- return (isRunning() && getCache() != null);
+ return isRunning() && getCache() != null;
}
/**
@@ -1388,9 +1391,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
public ObjectName getNamePattern() {
try {
return ObjectName.getInstance("GemFire:type=Member,*");
- } catch (MalformedObjectNameException e) {
- return null;
- } catch (NullPointerException e) {
+ } catch (MalformedObjectNameException | NullPointerException ignore) {
return null;
}
}
@@ -1545,12 +1546,12 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @param args the array of arguments used to configure this Builder and create an instance of
* ServerLauncher.
*/
- protected void parseArguments(final String... args) {
+ void parseArguments(final String... args) {
try {
OptionSet options = getParser().parse(args);
parseCommand(args);
- parseMemberName(args); // TODO:KIRK: need to get the name to LogService for log file name
+ parseMemberName(args);
setAssignBuckets(options.has("assign-buckets"));
setDebug(options.has("debug"));
@@ -2424,8 +2425,8 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @see org.apache.geode.distributed.ServerLauncher.Command#START
*/
- protected void validateOnStart() {
- if (Command.START.equals(getCommand())) {
+ void validateOnStart() {
+ if (Command.START == getCommand()) {
if (StringUtils.isBlank(getMemberName())
&& !isSet(System.getProperties(), DistributionConfig.GEMFIRE_PREFIX + NAME)
&& !isSet(getDistributedSystemProperties(), NAME)
@@ -2448,8 +2449,8 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @see org.apache.geode.distributed.ServerLauncher.Command#STATUS
*/
- protected void validateOnStatus() {
- if (Command.STATUS.equals(getCommand())) {
+ void validateOnStatus() {
+ if (Command.STATUS == getCommand()) {
// do nothing
}
}
@@ -2459,8 +2460,8 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @see org.apache.geode.distributed.ServerLauncher.Command#STOP
*/
- protected void validateOnStop() {
- if (Command.STOP.equals(getCommand())) {
+ void validateOnStop() {
+ if (Command.STOP == getCommand()) {
// do nothing
}
}
@@ -2482,7 +2483,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
/**
* An enumerated type representing valid commands to the Server launcher.
*/
- public static enum Command {
+ public enum Command {
START("start", "assign-buckets", "disable-default-server", "rebalance", SERVER_BIND_ADDRESS,
"server-port", "force", "debug", "help"),
STATUS("status", "member", "pid", "dir", "debug", "help"),
@@ -2688,10 +2689,10 @@ public class ServerLauncher extends AbstractLauncher<String> {
@SuppressWarnings("unchecked")
private static String getServerBindAddressAsString(final ServerLauncher launcher) {
- final GemFireCacheImpl gemfireCache = GemFireCacheImpl.getInstance();
+ final InternalCache internalCache = GemFireCacheImpl.getInstance();
- if (gemfireCache != null) {
- final List<CacheServer> csList = gemfireCache.getCacheServers();
+ if (internalCache != null) {
+ final List<CacheServer> csList = internalCache.getCacheServers();
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String serverBindAddressAsString = cs.getBindAddress();
@@ -2706,10 +2707,10 @@ public class ServerLauncher extends AbstractLauncher<String> {
@SuppressWarnings("unchecked")
private static String getServerPortAsString(final ServerLauncher launcher) {
- final GemFireCacheImpl gemfireCache = GemFireCacheImpl.getInstance();
+ final InternalCache internalCache = GemFireCacheImpl.getInstance();
- if (gemfireCache != null) {
- final List<CacheServer> csList = gemfireCache.getCacheServers();
+ if (internalCache != null) {
+ final List<CacheServer> csList = internalCache.getCacheServers();
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String portAsString = String.valueOf(cs.getPort());
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
index 95d1a5b..0de3d24 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
@@ -14,26 +14,56 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_CONFIGURATION_DIR;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
import org.apache.geode.CancelException;
import org.apache.geode.cache.AttributesFactory;
-import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheLoaderException;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.TimeoutException;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedLockService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.LeaseExpiredException;
import org.apache.geode.distributed.internal.locks.DLockService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
@@ -51,44 +81,18 @@ import org.apache.geode.management.internal.configuration.messages.Configuration
import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
import org.apache.geode.management.internal.configuration.utils.XmlUtils;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Path;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactoryConfigurationError;
@SuppressWarnings({"deprecation", "unchecked"})
public class ClusterConfigurationService {
-
private static final Logger logger = LogService.getLogger();
/**
* Name of the directory where the shared configuration artifacts are stored
*/
public static final String CLUSTER_CONFIG_ARTIFACTS_DIR_NAME = "cluster_config";
+
private static final String CLUSTER_CONFIG_DISK_STORE_NAME = "cluster_config";
+
public static final String CLUSTER_CONFIG_DISK_DIR_PREFIX = "ConfigDiskDir_";
public static final String CLUSTER_CONFIG = "cluster";
@@ -101,7 +105,7 @@ public class ClusterConfigurationService {
/**
* Name of the lock for locking the shared configuration
*/
- public static final String SHARED_CONFIG_LOCK_NAME = "__CLUSTER_CONFIG_LOCK";
+ private static final String SHARED_CONFIG_LOCK_NAME = "__CLUSTER_CONFIG_LOCK";
/**
* Name of the region which is used to store the configuration information
@@ -114,11 +118,11 @@ public class ClusterConfigurationService {
private final Set<PersistentMemberPattern> newerSharedConfigurationLocatorInfo = new HashSet<>();
private final AtomicReference<SharedConfigurationStatus> status = new AtomicReference<>();
- private GemFireCacheImpl cache;
+ private final InternalCache cache;
private final DistributedLockService sharedConfigLockingService;
- public ClusterConfigurationService(Cache cache) throws IOException {
- this.cache = (GemFireCacheImpl) cache;
+ public ClusterConfigurationService(InternalCache cache) throws IOException {
+ this.cache = cache;
Properties properties = cache.getDistributedSystem().getProperties();
// resolve the cluster config dir
String clusterConfigRootDir = properties.getProperty(CLUSTER_CONFIGURATION_DIR);
@@ -137,10 +141,11 @@ public class ClusterConfigurationService {
String configDiskDirName =
CLUSTER_CONFIG_DISK_DIR_PREFIX + cache.getDistributedSystem().getName();
- configDirPath = FilenameUtils.concat(clusterConfigRootDir, CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
- configDiskDirPath = FilenameUtils.concat(clusterConfigRootDir, configDiskDirName);
- sharedConfigLockingService = getSharedConfigLockService(cache.getDistributedSystem());
- status.set(SharedConfigurationStatus.NOT_STARTED);
+ this.configDirPath =
+ FilenameUtils.concat(clusterConfigRootDir, CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
+ this.configDiskDirPath = FilenameUtils.concat(clusterConfigRootDir, configDiskDirName);
+ this.sharedConfigLockingService = getSharedConfigLockService(cache.getDistributedSystem());
+ this.status.set(SharedConfigurationStatus.NOT_STARTED);
}
/**
@@ -154,7 +159,7 @@ public class ClusterConfigurationService {
sharedConfigDls = DLockService.create(SHARED_CONFIG_LOCK_SERVICE_NAME,
(InternalDistributedSystem) ds, true, true);
}
- } catch (IllegalArgumentException e) {
+ } catch (IllegalArgumentException ignore) {
return DLockService.getServiceNamed(SHARED_CONFIG_LOCK_SERVICE_NAME);
}
return sharedConfigDls;
@@ -172,7 +177,7 @@ public class ClusterConfigurationService {
groups = new String[] {ClusterConfigurationService.CLUSTER_CONFIG};
}
for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
+ Configuration configuration = configRegion.get(group);
if (configuration == null) {
configuration = new Configuration(group);
}
@@ -189,7 +194,7 @@ public class ClusterConfigurationService {
configuration.setCacheXmlContent(XmlUtils.prettyXml(doc));
configRegion.put(group, configuration);
} catch (Exception e) {
- logger.error("error updating cluster configuration for group " + group, e);
+ logger.error("error updating cluster configuration for group {}", group, e);
}
}
} finally {
@@ -210,7 +215,7 @@ public class ClusterConfigurationService {
groups = groupSet.toArray(new String[groupSet.size()]);
}
for (String group : groups) {
- Configuration configuration = (Configuration) configRegion.get(group);
+ Configuration configuration = configRegion.get(group);
if (configuration != null) {
String xmlContent = configuration.getCacheXmlContent();
try {
@@ -221,7 +226,7 @@ public class ClusterConfigurationService {
configRegion.put(group, configuration);
}
} catch (Exception e) {
- logger.error("error updating cluster configuration for group " + group, e);
+ logger.error("error updating cluster configuration for group {}", group, e);
}
}
}
@@ -230,8 +235,10 @@ public class ClusterConfigurationService {
}
}
- // we don't need to trigger the change listener for this modification, so it's ok to
- // operate on the original configuration object
+ /**
+ * we don't need to trigger the change listener for this modification, so it's ok to operate on
+ * the original configuration object
+ */
public void modifyXmlAndProperties(Properties properties, XmlEntity xmlEntity, String[] groups) {
lockSharedConfiguration();
try {
@@ -260,7 +267,7 @@ public class ClusterConfigurationService {
// Change the xml content of the configuration and put it the config region
configuration.setCacheXmlContent(XmlUtils.prettyXml(doc));
} catch (Exception e) {
- logger.error("error updating cluster configuration for group " + group, e);
+ logger.error("error updating cluster configuration for group {}", group, e);
}
}
@@ -274,7 +281,6 @@ public class ClusterConfigurationService {
}
}
-
/**
* Add jar information into the shared configuration and save the jars in the file system used
* when deploying jars
@@ -282,8 +288,8 @@ public class ClusterConfigurationService {
* @return true on success
*/
public boolean addJarsToThisLocator(String[] jarNames, byte[][] jarBytes, String[] groups) {
- boolean success = true;
lockSharedConfiguration();
+ boolean success = true;
try {
if (groups == null) {
groups = new String[] {ClusterConfigurationService.CLUSTER_CONFIG};
@@ -297,11 +303,11 @@ public class ClusterConfigurationService {
createConfigDirIfNecessary(group);
}
- String groupDir = FilenameUtils.concat(configDirPath, group);
+ String groupDir = FilenameUtils.concat(this.configDirPath, group);
for (int i = 0; i < jarNames.length; i++) {
String filePath = FilenameUtils.concat(groupDir, jarNames[i]);
- File jarFile = new File(filePath);
try {
+ File jarFile = new File(filePath);
FileUtils.writeByteArrayToFile(jarFile, jarBytes[i]);
} catch (IOException e) {
logger.info(e);
@@ -333,8 +339,8 @@ public class ClusterConfigurationService {
* @return true on success.
*/
public boolean removeJars(final String[] jarNames, String[] groups) {
- boolean success = true;
lockSharedConfiguration();
+ boolean success = true;
try {
Region<String, Configuration> configRegion = getConfigurationRegion();
if (groups == null) {
@@ -360,10 +366,10 @@ public class ClusterConfigurationService {
/**
* read the jar bytes in the file system
+ * <p>
+ * used when creating cluster config response and used when uploading the jars to another locator
*/
- // used when creating cluster config response
- // and used when uploading the jars to another locator
- public byte[] getJarBytesFromThisLocator(String group, String jarName) throws Exception {
+ public byte[] getJarBytesFromThisLocator(String group, String jarName) throws IOException {
Configuration configuration = getConfiguration(group);
File jar = getPathToJarOnThisLocator(group, jarName).toFile();
@@ -376,10 +382,11 @@ public class ClusterConfigurationService {
}
// used in the cluster config change listener when jarnames are changed in the internal region
- public void downloadJarFromOtherLocators(String groupName, String jarName) throws Exception {
+ public void downloadJarFromOtherLocators(String groupName, String jarName)
+ throws IllegalStateException, IOException {
logger.info("Getting Jar files from other locators");
- DM dm = cache.getDistributionManager();
- DistributedMember me = cache.getMyId();
+ DM dm = this.cache.getDistributionManager();
+ DistributedMember me = this.cache.getMyId();
Set<DistributedMember> locators =
new HashSet<>(dm.getAllHostedLocatorsWithSharedConfiguration().keySet());
locators.remove(me);
@@ -396,7 +403,7 @@ public class ClusterConfigurationService {
}
// used when creating cluster config response
- public Map<String, byte[]> getAllJarsFromThisLocator(Set<String> groups) throws Exception {
+ public Map<String, byte[]> getAllJarsFromThisLocator(Set<String> groups) throws IOException {
Map<String, byte[]> jarNamesToJarBytes = new HashMap<>();
for (String group : groups) {
@@ -421,8 +428,10 @@ public class ClusterConfigurationService {
* @param loadSharedConfigFromDir when set to true, loads the configuration from the share_config
* directory
*/
- public void initSharedConfiguration(boolean loadSharedConfigFromDir) throws Exception {
- status.set(SharedConfigurationStatus.STARTED);
+ void initSharedConfiguration(boolean loadSharedConfigFromDir)
+ throws CacheLoaderException, TimeoutException, IllegalStateException, IOException,
+ TransformerException, SAXException, ParserConfigurationException {
+ this.status.set(SharedConfigurationStatus.STARTED);
Region<String, Configuration> configRegion = this.getConfigurationRegion();
lockSharedConfiguration();
try {
@@ -434,12 +443,12 @@ public class ClusterConfigurationService {
persistSecuritySettings(configRegion);
// for those groups that have jar files, need to download the jars from other locators
// if it doesn't exist yet
- Set<String> groups = configRegion.keySet();
- for (String group : groups) {
- Configuration config = configRegion.get(group);
+ for (Entry<String, Configuration> stringConfigurationEntry : configRegion.entrySet()) {
+ Configuration config = stringConfigurationEntry.getValue();
for (String jar : config.getJarNames()) {
- if (!(getPathToJarOnThisLocator(group, jar).toFile()).exists()) {
- downloadJarFromOtherLocators(group, jar);
+ if (!getPathToJarOnThisLocator((String) stringConfigurationEntry.getKey(), jar).toFile()
+ .exists()) {
+ downloadJarFromOtherLocators((String) stringConfigurationEntry.getKey(), jar);
}
}
}
@@ -448,11 +457,11 @@ public class ClusterConfigurationService {
unlockSharedConfiguration();
}
- status.set(SharedConfigurationStatus.RUNNING);
+ this.status.set(SharedConfigurationStatus.RUNNING);
}
private void persistSecuritySettings(final Region<String, Configuration> configRegion) {
- Properties securityProps = cache.getDistributedSystem().getSecurityProperties();
+ Properties securityProps = this.cache.getDistributedSystem().getSecurityProperties();
Configuration clusterPropertiesConfig =
configRegion.get(ClusterConfigurationService.CLUSTER_CONFIG);
@@ -476,13 +485,13 @@ public class ClusterConfigurationService {
* Creates a ConfigurationResponse based on the configRequest, configuration response contains the
* requested shared configuration This method locks the ClusterConfigurationService
*/
- public ConfigurationResponse createConfigurationReponse(final ConfigurationRequest configRequest)
- throws Exception {
+ public ConfigurationResponse createConfigurationResponse(final ConfigurationRequest configRequest)
+ throws LeaseExpiredException, IOException {
ConfigurationResponse configResponse = new ConfigurationResponse();
for (int i = 0; i < configRequest.getNumAttempts(); i++) {
- boolean isLocked = sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, 5000, 5000);
+ boolean isLocked = this.sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, 5000, 5000);
try {
if (isLocked) {
Set<String> groups = configRequest.getGroups();
@@ -504,7 +513,7 @@ public class ClusterConfigurationService {
return configResponse;
}
} finally {
- sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
+ this.sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
}
}
@@ -519,16 +528,16 @@ public class ClusterConfigurationService {
* @return {@link SharedConfigurationStatusResponse} containing the
* {@link SharedConfigurationStatus}
*/
- public SharedConfigurationStatusResponse createStatusResponse() {
+ SharedConfigurationStatusResponse createStatusResponse() {
SharedConfigurationStatusResponse response = new SharedConfigurationStatusResponse();
response.setStatus(getStatus());
- response.addWaitingLocatorInfo(newerSharedConfigurationLocatorInfo);
+ response.addWaitingLocatorInfo(this.newerSharedConfigurationLocatorInfo);
return response;
}
/**
* For tests only. TODO: clean this up and remove from production code
- * <p/>
+ * <p>
* Throws {@code AssertionError} wrapping any exception thrown by operation.
*/
public void destroySharedConfiguration() {
@@ -540,25 +549,24 @@ public class ClusterConfigurationService {
DiskStore configDiskStore = this.cache.findDiskStore(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME);
if (configDiskStore != null) {
configDiskStore.destroy();
- File file = new File(configDiskDirPath);
+ File file = new File(this.configDiskDirPath);
FileUtils.deleteDirectory(file);
}
- FileUtils.deleteDirectory(new File(configDirPath));
+ FileUtils.deleteDirectory(new File(this.configDirPath));
} catch (Exception exception) {
throw new AssertionError(exception);
}
}
public Path getPathToJarOnThisLocator(String groupName, String jarName) {
- return new File(configDirPath).toPath().resolve(groupName).resolve(jarName);
+ return new File(this.configDirPath).toPath().resolve(groupName).resolve(jarName);
}
public Configuration getConfiguration(String groupName) {
- Configuration configuration = getConfigurationRegion().get(groupName);
- return configuration;
+ return getConfigurationRegion().get(groupName);
}
- public Map<String, Configuration> getEntireConfiguration() throws Exception {
+ public Map<String, Configuration> getEntireConfiguration() {
Set<String> keys = getConfigurationRegion().keySet();
return getConfigurationRegion().getAll(keys);
}
@@ -581,7 +589,7 @@ public class ClusterConfigurationService {
public SharedConfigurationStatus getStatus() {
SharedConfigurationStatus scStatus = this.status.get();
if (scStatus == SharedConfigurationStatus.STARTED) {
- PersistentMemberManager pmm = cache.getPersistentMemberManager();
+ PersistentMemberManager pmm = this.cache.getPersistentMemberManager();
Map<String, Set<PersistentMemberID>> waitingRegions = pmm.getWaitingRegions();
if (!waitingRegions.isEmpty()) {
this.status.compareAndSet(SharedConfigurationStatus.STARTED,
@@ -589,7 +597,7 @@ public class ClusterConfigurationService {
Set<PersistentMemberID> persMemIds =
waitingRegions.get(Region.SEPARATOR_CHAR + CONFIG_REGION_NAME);
for (PersistentMemberID persMemId : persMemIds) {
- newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
+ this.newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
}
}
}
@@ -599,18 +607,19 @@ public class ClusterConfigurationService {
/**
* Loads the internal region with the configuration in the configDirPath
*/
- public void loadSharedConfigurationFromDisk() throws Exception {
+ public void loadSharedConfigurationFromDisk()
+ throws SAXException, ParserConfigurationException, TransformerException, IOException {
lockSharedConfiguration();
File[] groupNames =
- new File(configDirPath).listFiles((FileFilter) DirectoryFileFilter.INSTANCE);
- Map<String, Configuration> sharedConfiguration = new HashMap<String, Configuration>();
+ new File(this.configDirPath).listFiles((FileFilter) DirectoryFileFilter.INSTANCE);
try {
+ Map<String, Configuration> sharedConfiguration = new HashMap<>();
for (File groupName : groupNames) {
Configuration configuration = readConfiguration(groupName);
sharedConfiguration.put(groupName.getName(), configuration);
}
- Region clusterRegion = getConfigurationRegion();
+ Region<String, Configuration> clusterRegion = getConfigurationRegion();
clusterRegion.clear();
clusterRegion.putAll(sharedConfiguration);
@@ -624,12 +633,12 @@ public class ClusterConfigurationService {
}
public void renameExistingSharedConfigDirectory() {
- File configDirFile = new File(configDirPath);
+ File configDirFile = new File(this.configDirPath);
if (configDirFile.exists()) {
String configDirFileName2 = CLUSTER_CONFIG_ARTIFACTS_DIR_NAME
- + new SimpleDateFormat("yyyyMMddhhmm").format(new Date()) + "." + System.nanoTime();
- File configDirFile2 = new File(configDirFile.getParent(), configDirFileName2);
+ + new SimpleDateFormat("yyyyMMddhhmm").format(new Date()) + '.' + System.nanoTime();
try {
+ File configDirFile2 = new File(configDirFile.getParent(), configDirFileName2);
FileUtils.moveDirectory(configDirFile, configDirFile2);
} catch (IOException e) {
logger.info(e);
@@ -639,7 +648,7 @@ public class ClusterConfigurationService {
// Write the content of xml and properties into the file system for exporting purpose
- public void writeConfigToFile(final Configuration configuration) throws Exception {
+ public void writeConfigToFile(final Configuration configuration) throws IOException {
File configDir = createConfigDirIfNecessary(configuration.getConfigName());
File propsFile = new File(configDir, configuration.getPropertiesFileName());
@@ -651,15 +660,15 @@ public class ClusterConfigurationService {
FileUtils.writeStringToFile(xmlFile, configuration.getCacheXmlContent(), "UTF-8");
}
+ // TODO: return value is never used
private boolean lockSharedConfiguration() {
- return sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, -1, -1);
+ return this.sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, -1, -1);
}
private void unlockSharedConfiguration() {
- sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
+ this.sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
}
-
private byte[] downloadJarFromLocator(DistributedMember locator, String groupName,
String jarName) {
ResultCollector<byte[], List<byte[]>> rc = (ResultCollector<byte[], List<byte[]>>) CliUtil
@@ -679,24 +688,24 @@ public class ClusterConfigurationService {
* @return {@link Region} ConfigurationRegion, this should never be null
*/
private Region<String, Configuration> getConfigurationRegion() {
- Region<String, Configuration> configRegion = cache.getRegion(CONFIG_REGION_NAME);
+ Region<String, Configuration> configRegion = this.cache.getRegion(CONFIG_REGION_NAME);
try {
if (configRegion == null) {
- File diskDir = new File(configDiskDirPath);
+ File diskDir = new File(this.configDiskDirPath);
if (!diskDir.exists()) {
if (!diskDir.mkdirs()) {
- throw new IOException("Cannot create directory at " + configDiskDirPath);
+ // TODO: throw caught by containing try statement
+ throw new IOException("Cannot create directory at " + this.configDiskDirPath);
}
}
File[] diskDirs = {diskDir};
- cache.createDiskStoreFactory().setDiskDirs(diskDirs).setAutoCompact(true)
+ this.cache.createDiskStoreFactory().setDiskDirs(diskDirs).setAutoCompact(true)
.setMaxOplogSize(10).create(CLUSTER_CONFIG_DISK_STORE_NAME);
- AttributesFactory<String, Configuration> regionAttrsFactory =
- new AttributesFactory<String, Configuration>();
+ AttributesFactory<String, Configuration> regionAttrsFactory = new AttributesFactory<>();
regionAttrsFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
regionAttrsFactory.setCacheListener(new ConfigurationChangeListener(this));
regionAttrsFactory.setDiskStoreName(CLUSTER_CONFIG_DISK_STORE_NAME);
@@ -705,15 +714,16 @@ public class ClusterConfigurationService {
internalArgs.setIsUsedForMetaRegion(true);
internalArgs.setMetaRegionWithTransactions(false);
- configRegion =
- cache.createVMRegion(CONFIG_REGION_NAME, regionAttrsFactory.create(), internalArgs);
+ configRegion = this.cache.createVMRegion(CONFIG_REGION_NAME, regionAttrsFactory.create(),
+ internalArgs);
}
} catch (CancelException e) {
if (configRegion == null) {
this.status.set(SharedConfigurationStatus.STOPPED);
}
- throw e; // CONFIG: don't rethrow as Exception, keep it a subclass of CancelException
+ // CONFIG: don't rethrow as Exception, keep it a subclass of CancelException
+ throw e;
} catch (Exception e) {
if (configRegion == null) {
@@ -750,7 +760,7 @@ public class ClusterConfigurationService {
/**
* Creates a directory for this configuration if it doesn't already exist.
*/
- private File createConfigDirIfNecessary(final String configName) throws Exception {
+ private File createConfigDirIfNecessary(final String configName) throws IOException {
File clusterConfigDir = new File(getSharedConfigurationDirPath());
if (!clusterConfigDir.exists()) {
if (!clusterConfigDir.mkdirs()) {
@@ -769,20 +779,4 @@ public class ClusterConfigurationService {
return configDir;
}
- // check if it's ok from populate the properties from one member to another
- public static boolean isMisConfigured(Properties fromProps, Properties toProps, String key) {
- String fromPropValue = fromProps.getProperty(key);
- String toPropValue = toProps.getProperty(key);
-
- // if this to prop is not specified, this is always OK.
- if (org.apache.commons.lang.StringUtils.isBlank(toPropValue))
- return false;
-
- // to props is not blank, but from props is blank, NOT OK.
- if (org.apache.commons.lang.StringUtils.isBlank(fromPropValue))
- return true;
-
- // at this point check for eqality
- return !fromPropValue.equals(toPropValue);
- }
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/distributed/internal/DSClock.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DSClock.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DSClock.java
index 9694394..70bf2c2 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DSClock.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DSClock.java
@@ -18,6 +18,7 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.SystemTimer;
import org.apache.geode.internal.SystemTimer.SystemTimerTask;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.DateFormatter;
import org.apache.geode.internal.logging.LogService;
@@ -203,12 +204,10 @@ public class DSClock implements CacheTime {
/**
* Cancel the previous slow down task (If it exists) and schedule a new one.
- *
- * @param offset
*/
private void cancelAndScheduleNewCacheTimerTask(long offset) {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
if (this.cacheTimeTask != null) {
@@ -288,7 +287,7 @@ public class DSClock implements CacheTime {
@Override
public boolean cancel() {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
suspendCacheTimeMillis(false);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 86bc7a4..b47b50a 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
@@ -80,6 +80,7 @@ import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.cache.CacheServerImpl;
import org.apache.geode.internal.cache.EventID;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.execute.FunctionServiceStats;
import org.apache.geode.internal.cache.execute.FunctionStats;
import org.apache.geode.internal.cache.tier.sockets.HandShake;
@@ -1311,7 +1312,7 @@ public class InternalDistributedSystem extends DistributedSystem
//
// However, make sure cache is completely closed before starting
// the distributed system close.
- GemFireCacheImpl currentCache = GemFireCacheImpl.getInstance();
+ InternalCache currentCache = GemFireCacheImpl.getInstance();
if (currentCache != null && !currentCache.isClosed()) {
disconnectListenerThread.set(Boolean.TRUE); // bug #42663 - this must be set while
// closing the cache
@@ -1541,7 +1542,7 @@ public class InternalDistributedSystem extends DistributedSystem
StringTokenizer st = new StringTokenizer(locators, ",");
while (st.hasMoreTokens()) {
String l = st.nextToken();
- StringBuffer canonical = new StringBuffer();
+ StringBuilder canonical = new StringBuilder();
DistributionLocatorId locId = new DistributionLocatorId(l);
String addr = locId.getBindAddress();
if (addr != null && addr.trim().length() > 0) {
@@ -1555,7 +1556,7 @@ public class InternalDistributedSystem extends DistributedSystem
sorted.add(canonical.toString());
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (Iterator iter = sorted.iterator(); iter.hasNext();) {
sb.append((String) iter.next());
if (iter.hasNext()) {
@@ -1678,7 +1679,7 @@ public class InternalDistributedSystem extends DistributedSystem
*/
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("Connected ");
String name = this.getName();
if (name != null && !name.equals("")) {
@@ -2481,7 +2482,7 @@ public class InternalDistributedSystem extends DistributedSystem
*
* @param oldCache cache that has apparently failed
*/
- public boolean tryReconnect(boolean forcedDisconnect, String reason, GemFireCacheImpl oldCache) {
+ public boolean tryReconnect(boolean forcedDisconnect, String reason, InternalCache oldCache) {
final boolean isDebugEnabled = logger.isDebugEnabled();
if (this.isReconnectingDS && forcedDisconnect) {
return false;
@@ -2490,7 +2491,7 @@ public class InternalDistributedSystem extends DistributedSystem
// cache
synchronized (GemFireCacheImpl.class) {
// bug 39329: must lock reconnectLock *after* the cache
- synchronized (reconnectLock) {
+ synchronized (this.reconnectLock) {
if (!forcedDisconnect && !oldCache.isClosed()
&& oldCache.getCachePerfStats().getReliableRegionsMissing() == 0) {
if (isDebugEnabled) {
@@ -2503,7 +2504,7 @@ public class InternalDistributedSystem extends DistributedSystem
logger.debug("tryReconnect: forcedDisconnect={}", forcedDisconnect);
}
if (forcedDisconnect) {
- if (config.getDisableAutoReconnect()) {
+ if (this.config.getDisableAutoReconnect()) {
if (isDebugEnabled) {
logger.debug("tryReconnect: auto reconnect after forced disconnect is disabled");
}
@@ -2511,7 +2512,7 @@ public class InternalDistributedSystem extends DistributedSystem
}
}
reconnect(forcedDisconnect, reason);
- return (this.reconnectDS != null && this.reconnectDS.isConnected());
+ return this.reconnectDS != null && this.reconnectDS.isConnected();
} // synchronized reconnectLock
} // synchronized cache
} // synchronized CacheFactory.class
@@ -2557,7 +2558,7 @@ public class InternalDistributedSystem extends DistributedSystem
String cacheXML = null;
List<CacheServerCreation> cacheServerCreation = null;
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
cacheXML = cache.getCacheConfig().getCacheXMLDescription();
cacheServerCreation = cache.getCacheConfig().getCacheServerCreation();
@@ -2826,7 +2827,7 @@ public class InternalDistributedSystem extends DistributedSystem
* after an auto-reconnect we may need to recreate a cache server and start it
*/
public void createAndStartCacheServers(List<CacheServerCreation> cacheServerCreation,
- GemFireCacheImpl cache) {
+ InternalCache cache) {
List<CacheServer> servers = cache.getCacheServers();
@@ -2860,11 +2861,11 @@ public class InternalDistributedSystem extends DistributedSystem
*
* @param propsToCheck the Properties instance to compare with the existing Properties
*
- * @throws java.lang.IllegalStateException when the configuration is not the same other returns
+ * @throws IllegalStateException when the configuration is not the same other returns
*/
public void validateSameProperties(Properties propsToCheck, boolean isConnected) {
if (!this.sameAs(propsToCheck, isConnected)) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
DistributionConfig wanted = DistributionConfigImpl.produce(propsToCheck);
[18/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 bbff29c..b3c23b1 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
@@ -14,19 +14,62 @@
*/
package org.apache.geode.internal.cache;
-import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.nio.channels.ClosedByInterruptException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.CancelCriterion;
import org.apache.geode.CancelException;
import org.apache.geode.StatisticsFactory;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DiskAccessException;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.DiskStoreFactory;
@@ -72,55 +115,11 @@ import org.apache.geode.pdx.internal.EnumInfo;
import org.apache.geode.pdx.internal.PdxField;
import org.apache.geode.pdx.internal.PdxType;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.nio.channels.ClosedByInterruptException;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* Represents a (disk-based) persistent store for region data. Used for both persistent recoverable
* regions and overflow-only regions.
- *
- *
+ *
* @since GemFire 3.2
*/
@SuppressWarnings("synthetic-access")
@@ -128,6 +127,7 @@ public class DiskStoreImpl implements DiskStore {
private static final Logger logger = LogService.getLogger();
private static final String BACKUP_DIR_PREFIX = "dir";
+
public static final boolean KRF_DEBUG = Boolean.getBoolean("disk.KRF_DEBUG");
public static final int MAX_OPEN_INACTIVE_OPLOGS =
@@ -166,6 +166,7 @@ public class DiskStoreImpl implements DiskStore {
public static final String RECOVER_VALUE_PROPERTY_NAME =
DistributionConfig.GEMFIRE_PREFIX + "disk.recoverValues";
+
public static final String RECOVER_VALUES_SYNC_PROPERTY_NAME =
DistributionConfig.GEMFIRE_PREFIX + "disk.recoverValuesSync";
@@ -177,9 +178,12 @@ public class DiskStoreImpl implements DiskStore {
DistributionConfig.GEMFIRE_PREFIX + "disk.recoverLruValues";
boolean RECOVER_VALUES = getBoolean(DiskStoreImpl.RECOVER_VALUE_PROPERTY_NAME, true);
+
boolean RECOVER_VALUES_SYNC = getBoolean(DiskStoreImpl.RECOVER_VALUES_SYNC_PROPERTY_NAME, false);
+
boolean FORCE_KRF_RECOVERY =
getBoolean(DistributionConfig.GEMFIRE_PREFIX + "disk.FORCE_KRF_RECOVERY", false);
+
final boolean RECOVER_LRU_VALUES =
getBoolean(DiskStoreImpl.RECOVER_LRU_VALUES_PROPERTY_NAME, false);
@@ -188,7 +192,9 @@ public class DiskStoreImpl implements DiskStore {
}
public static final long MIN_RESERVED_DRID = 1;
+
public static final long MAX_RESERVED_DRID = 8;
+
static final long MIN_DRID = MAX_RESERVED_DRID + 1;
/**
@@ -205,9 +211,7 @@ public class DiskStoreImpl implements DiskStore {
private final int MAX_OPLOGS_PER_COMPACTION = Integer.getInteger(
DistributionConfig.GEMFIRE_PREFIX + "MAX_OPLOGS_PER_COMPACTION",
Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "MAX_OPLOGS_PER_ROLL", 1).intValue());
- /**
- *
- */
+
public static final int MAX_CONCURRENT_COMPACTIONS = Integer.getInteger(
DistributionConfig.GEMFIRE_PREFIX + "MAX_CONCURRENT_COMPACTIONS",
Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "MAX_CONCURRENT_ROLLS", 1).intValue());
@@ -219,6 +223,7 @@ public class DiskStoreImpl implements DiskStore {
*/
public static final int MAX_PENDING_TASKS =
Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "disk.MAX_PENDING_TASKS", 6);
+
/**
* This system property indicates that IF should also be preallocated. This property will be used
* in conjunction with the PREALLOCATE_OPLOGS property. If PREALLOCATE_OPLOGS is ON the below will
@@ -227,6 +232,7 @@ public class DiskStoreImpl implements DiskStore {
static final boolean PREALLOCATE_IF =
!System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "preAllocateIF", "true")
.equalsIgnoreCase("false");
+
/**
* This system property indicates that Oplogs should be preallocated till the maxOplogSize as
* specified for the disk store.
@@ -252,19 +258,14 @@ public class DiskStoreImpl implements DiskStore {
public static volatile HashSet<String> TEST_CHK_FALLOC_DIRS;
public static volatile HashSet<String> TEST_NO_FALLOC_DIRS;
- // /** delay for slowing down recovery, for testing purposes only */
- // public static volatile int recoverDelay = 0;
-
- // //////////////////// Instance Fields ///////////////////////
-
- private final GemFireCacheImpl cache;
+ private final InternalCache cache;
/** The stats for this store */
private final DiskStoreStats stats;
/**
- * Asif:Added as stop gap arrangement to fix bug 39380. It is not a clean fix as keeping track of
- * the threads acquiring read lock, etc is not a good idea to solve the issue
+ * Added as stop gap arrangement to fix bug 39380. It is not a clean fix as keeping track of the
+ * threads acquiring read lock, etc is not a good idea to solve the issue
*/
private final AtomicInteger entryOpsCount = new AtomicInteger();
/**
@@ -291,10 +292,11 @@ public class DiskStoreImpl implements DiskStore {
* is forced. If this value is 0 then no limit.
*/
private final int maxAsyncItems;
+
private final AtomicInteger forceFlushCount;
+
private final Object asyncMonitor;
- // complex vars
/** Compactor task which does the compaction. Null if compaction not possible. */
private final OplogCompactor oplogCompactor;
@@ -303,7 +305,9 @@ public class DiskStoreImpl implements DiskStore {
private volatile DiskStoreBackup diskStoreBackup = null;
private final ReentrantReadWriteLock compactorLock = new ReentrantReadWriteLock();
+
private final WriteLock compactorWriteLock = compactorLock.writeLock();
+
private final ReadLock compactorReadLock = compactorLock.readLock();
/**
@@ -316,37 +320,21 @@ public class DiskStoreImpl implements DiskStore {
new AtomicReference<DiskAccessException>();
PersistentOplogSet persistentOplogs = new PersistentOplogSet(this);
- OverflowOplogSet overflowOplogs = new OverflowOplogSet(this);
-
- // private boolean isThreadWaitingForSpace = false;
-
- /**
- * Get the next available dir
- */
-
- // /**
- // * Max timed wait for disk space to become available for an entry operation
- // ,
- // * in milliseconds. This will be the maximum time for which a
- // * create/modify/remove operation will wait so as to allow switch over & get
- // a
- // * new Oplog for writing. If no space is available in that time,
- // * DiskAccessException will be thrown. The default wait will be for 120
- // * seconds
- // */
- // private static final long MAX_WAIT_FOR_SPACE = Integer.getInteger(
- // "MAX_WAIT_FOR_SPACE", 20).intValue() * 1000;
+ OverflowOplogSet overflowOplogs = new OverflowOplogSet(this);
private final AtomicLong regionIdCtr = new AtomicLong(MIN_DRID);
+
/**
* Only contains backup DiskRegions. The Value could be a RecoveredDiskRegion or a DiskRegion
*/
private final ConcurrentMap<Long, DiskRegion> drMap = new ConcurrentHashMap<Long, DiskRegion>();
+
/**
* A set of overflow only regions that are using this disk store.
*/
private final Set<DiskRegion> overflowMap = new ConcurrentHashSet<DiskRegion>();
+
/**
* Contains all of the disk recovery stores for which we are recovering values asnynchronously.
*/
@@ -369,9 +357,8 @@ public class DiskStoreImpl implements DiskStore {
private final ThreadPoolExecutor diskStoreTaskPool;
private final ThreadPoolExecutor delayedWritePool;
- private volatile Future lastDelayedWrite;
- // ///////////////////// Constructors /////////////////////////
+ private volatile Future lastDelayedWrite;
private static int calcCompactionThreshold(int ct) {
if (ct == DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD) {
@@ -387,19 +374,19 @@ public class DiskStoreImpl implements DiskStore {
}
/**
- * Creates a new <code>DiskRegion</code> that access disk on behalf of the given region.
+ * Creates a new {@code DiskRegion} that access disk on behalf of the given region.
*/
- DiskStoreImpl(Cache cache, DiskStoreAttributes props) {
+ DiskStoreImpl(InternalCache cache, DiskStoreAttributes props) {
this(cache, props, false, null);
}
- DiskStoreImpl(Cache cache, DiskStoreAttributes props, boolean ownedByRegion,
+ DiskStoreImpl(InternalCache cache, DiskStoreAttributes props, boolean ownedByRegion,
InternalRegionArguments internalRegionArgs) {
this(cache, props.getName(), props, ownedByRegion, internalRegionArgs, false,
false/* upgradeVersionOnly */, false, false, true, false/* offlineModify */);
}
- DiskStoreImpl(Cache cache, String name, DiskStoreAttributes props, boolean ownedByRegion,
+ DiskStoreImpl(InternalCache cache, String name, DiskStoreAttributes props, boolean ownedByRegion,
InternalRegionArguments internalRegionArgs, boolean offline, boolean upgradeVersionOnly,
boolean offlineValidating, boolean offlineCompacting, boolean needsOplogs,
boolean offlineModify) {
@@ -427,7 +414,7 @@ public class DiskStoreImpl implements DiskStore {
this.warningPercent = props.getDiskUsageWarningPercentage();
this.criticalPercent = props.getDiskUsageCriticalPercentage();
- this.cache = (GemFireCacheImpl) cache;
+ this.cache = cache;
StatisticsFactory factory = cache.getDistributedSystem();
this.stats = new DiskStoreStats(factory, getName());
@@ -474,7 +461,7 @@ public class DiskStoreImpl implements DiskStore {
this.maxDirSize = tempMaxDirSize * 1024 * 1024;
this.infoFileDirIndex = 0;
// Now that we no longer have db files, use all directories for oplogs
- /**
+ /*
* The infoFileDir contains the lock file and the init file. It will be directories[0] on a
* brand new disk store. On an existing disk store it will be the directory the init file is
* found in.
@@ -495,7 +482,7 @@ public class DiskStoreImpl implements DiskStore {
int MAXT = DiskStoreImpl.MAX_CONCURRENT_COMPACTIONS;
final ThreadGroup compactThreadGroup =
- LoggingThreadGroup.createThreadGroup("Oplog Compactor Thread Group", this.logger);
+ LoggingThreadGroup.createThreadGroup("Oplog Compactor Thread Group", logger);
final ThreadFactory compactThreadFactory =
GemfireCacheHelper.CreateThreadFactory(compactThreadGroup, "Idle OplogCompactor");
this.diskStoreTaskPool = new ThreadPoolExecutor(MAXT, MAXT, 10, TimeUnit.SECONDS,
@@ -504,7 +491,7 @@ public class DiskStoreImpl implements DiskStore {
final ThreadGroup deleteThreadGroup =
- LoggingThreadGroup.createThreadGroup("Oplog Delete Thread Group", this.logger);
+ LoggingThreadGroup.createThreadGroup("Oplog Delete Thread Group", logger);
final ThreadFactory deleteThreadFactory =
GemfireCacheHelper.CreateThreadFactory(deleteThreadGroup, "Oplog Delete Task");
@@ -583,7 +570,7 @@ public class DiskStoreImpl implements DiskStore {
}
/**
- * Returns the <code>DiskStoreStats</code> for this store
+ * Returns the {@code DiskStoreStats} for this store
*/
public DiskStoreStats getStats() {
return this.stats;
@@ -697,7 +684,7 @@ public class DiskStoreImpl implements DiskStore {
* @param entry The entry which is going to be written to disk
* @throws RegionClearedException If a clear operation completed before the put operation
* completed successfully, resulting in the put operation to abort.
- * @throws IllegalArgumentException If <code>id</code> is less than zero
+ * @throws IllegalArgumentException If {@code id} is less than zero
*/
final void put(LocalRegion region, DiskEntry entry, ValueWrapper value, boolean async)
throws RegionClearedException {
@@ -886,7 +873,6 @@ public class DiskStoreImpl implements DiskStore {
* Given a BytesAndBits object convert it to the relevant Object (deserialize if necessary) and
* return the object
*
- * @param bb
* @return the converted object
*/
static Object convertBytesAndBitsIntoObject(BytesAndBits bb) {
@@ -909,7 +895,6 @@ public class DiskStoreImpl implements DiskStore {
/**
* Given a BytesAndBits object get the serialized blob
*
- * @param bb
* @return the converted object
*/
static Object convertBytesAndBitsToSerializedForm(BytesAndBits bb) {
@@ -1029,7 +1014,7 @@ public class DiskStoreImpl implements DiskStore {
* HTree with the oplog being destroyed
*
* @return null if entry has nothing stored on disk (id == INVALID_ID)
- * @throws IllegalArgumentException If <code>id</code> is less than zero, no action is taken.
+ * @throws IllegalArgumentException If {@code id} is less than zero, no action is taken.
*/
public final Object getNoBuffer(DiskRegion dr, DiskId id) {
BytesAndBits bb = null;
@@ -1067,8 +1052,8 @@ public class DiskStoreImpl implements DiskStore {
*
* @throws RegionClearedException If a clear operation completed before the put operation
* completed successfully, resulting in the put operation to abort.
- * @throws IllegalArgumentException If <code>id</code> is {@linkplain #INVALID_ID invalid}or is
- * less than zero, no action is taken.
+ * @throws IllegalArgumentException If {@code id} is {@linkplain #INVALID_ID invalid}or is less
+ * than zero, no action is taken.
*/
final void remove(LocalRegion region, DiskEntry entry, boolean async, boolean isClear)
throws RegionClearedException {
@@ -1191,7 +1176,7 @@ public class DiskStoreImpl implements DiskStore {
if (currentOpsInProgress == 0) {
synchronized (this.closeRegionGuard) {
if (dr.isRegionClosed() && entryOpsCount.get() == 0) {
- this.closeRegionGuard.notify();
+ this.closeRegionGuard.notifyAll();
}
}
}
@@ -1237,7 +1222,6 @@ public class DiskStoreImpl implements DiskStore {
/**
* Get serialized form of data off the disk
*
- * @param id
* @since GemFire 5.7
*/
public Object getSerializedData(DiskRegion dr, DiskId id) {
@@ -1269,7 +1253,7 @@ public class DiskStoreImpl implements DiskStore {
DiskEntry entry = ade.de;
DiskEntry.Helper.handleFullAsyncQueue(entry, region, tag);
}
- } catch (RegionDestroyedException ex) {
+ } catch (RegionDestroyedException ignore) {
// Normally we flush before closing or destroying a region
// but in some cases it is closed w/o flushing.
// So just ignore it; see bug 41305.
@@ -1397,8 +1381,7 @@ public class DiskStoreImpl implements DiskStore {
private int fillDrainList() {
synchronized (this.drainSync) {
this.drainList = new ArrayList(asyncQueue.size());
- int drainCount = asyncQueue.drainTo(this.drainList);
- return drainCount;
+ return asyncQueue.drainTo(this.drainList);
}
}
@@ -1410,8 +1393,6 @@ public class DiskStoreImpl implements DiskStore {
* To fix bug 41770 clear the list in a way that will not break a concurrent iterator that is not
* synced on drainSync. Only clear from it entries on the given region. Currently we do this by
* clearing the isPendingAsync bit on each entry in this list.
- *
- * @param rvv
*/
void clearDrainList(LocalRegion r, RegionVersionVector rvv) {
synchronized (this.drainSync) {
@@ -1516,7 +1497,7 @@ public class DiskStoreImpl implements DiskStore {
try {
this.flusherThread.join(waitMs);
return true;
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
return false;
@@ -1532,7 +1513,7 @@ public class DiskStoreImpl implements DiskStore {
}
}
- public GemFireCacheImpl getCache() {
+ public InternalCache getCache() {
return this.cache;
}
@@ -1759,7 +1740,7 @@ public class DiskStoreImpl implements DiskStore {
}
}
} // else
- } catch (RegionDestroyedException ex) {
+ } catch (RegionDestroyedException ignore) {
// Normally we flush before closing or destroying a region
// but in some cases it is closed w/o flushing.
// So just ignore it; see bug 41305.
@@ -2050,18 +2031,8 @@ public class DiskStoreImpl implements DiskStore {
return this.directories[this.infoFileDirIndex];
}
- /** For Testing * */
- // void addToOplogSet(int oplogID, File opFile, DirectoryHolder dirHolder) {
- // Oplog oplog = new Oplog(oplogID, this);
- // oplog.addRecoveredFile(opFile, dirHolder);
- // // @todo check callers to see if they need drf support
- // this.oplogSet.add(oplog);
- // }
-
- /** For Testing * */
/**
* returns the size of the biggest directory available to the region
- *
*/
public long getMaxDirSize() {
return maxDirSize;
@@ -2143,8 +2114,6 @@ public class DiskStoreImpl implements DiskStore {
/**
* Removes anything found in the async queue for the given region
- *
- * @param rvv
*/
private void clearAsyncQueue(LocalRegion region, boolean needsWriteLock,
RegionVersionVector rvv) {
@@ -2263,7 +2232,7 @@ public class DiskStoreImpl implements DiskStore {
if (diskException.get() != null) {
try {
_testHandleDiskAccessException.await();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -2466,25 +2435,26 @@ public class DiskStoreImpl implements DiskStore {
dr.setRegionClosed(true);
}
gotLock = true;
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
synchronized (this.closeRegionGuard) {
if (!dr.isRegionClosed()) {
if (!closeDataOnly) {
dr.setRegionClosed(true);
}
- // Asif: I am quite sure that it should also be Ok if instead
+ // I am quite sure that it should also be Ok if instead
// while it is a If Check below. Because if acquireReadLock
// thread
- // has acquired thelock, it is bound to see the isRegionClose as
+ // has acquired the lock, it is bound to see the isRegionClose as
// true
- // and so will realse teh lock causing decrement to zeo , before
+ // and so will release the lock causing decrement to zero , before
// releasing the closeRegionGuard. But still...not to take any
// chance
while (this.entryOpsCount.get() > 0) {
try {
+ // TODO: calling wait while holding two locks
this.closeRegionGuard.wait(20000);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignored) {
// Exit without closing the region, do not know what else
// can be done
Thread.currentThread().interrupt();
@@ -2534,8 +2504,6 @@ public class DiskStoreImpl implements DiskStore {
/**
* stops the compactor outside the write lock. Once stopped then it proceeds to destroy the
* current & old oplogs
- *
- * @param dr
*/
void beginDestroyRegion(LocalRegion region, DiskRegion dr) {
if (dr.isBackup()) {
@@ -2571,7 +2539,7 @@ public class DiskStoreImpl implements DiskStore {
while (this.backgroundTasks.get() > 0) {
try {
this.backgroundTasks.wait(500L);
- } catch (InterruptedException ex) {
+ } catch (InterruptedException ignore) {
interrupted = true;
}
}
@@ -2720,7 +2688,7 @@ public class DiskStoreImpl implements DiskStore {
return null;
}
- return l.toArray(new CompactableOplog[0]);
+ return l.toArray(new CompactableOplog[l.size()]);
}
/**
@@ -2745,7 +2713,6 @@ public class DiskStoreImpl implements DiskStore {
* @param baselineCopyMap this will be populated with baseline oplogs Files that will be used in
* the restore script.
* @return an array of Oplogs to be copied for an incremental backup.
- * @throws IOException
*/
private Oplog[] filterBaselineOplogs(BackupInspector baselineInspector,
Map<File, File> baselineCopyMap) throws IOException {
@@ -2796,11 +2763,9 @@ public class DiskStoreImpl implements DiskStore {
}
// Convert the filtered oplog list to an array
- return oplogList.toArray(new Oplog[] {});
+ return oplogList.toArray(new Oplog[oplogList.size()]);
}
-
-
/**
* Get all of the oplogs
*/
@@ -3013,7 +2978,7 @@ public class DiskStoreImpl implements DiskStore {
while (this.scheduled) {
try {
wait();
- } catch (InterruptedException ex) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
@@ -3114,30 +3079,13 @@ public class DiskStoreImpl implements DiskStore {
if (dr.isRegionClosed()) {
return;
}
- // // Stop the compactor if running, without taking lock.
- // if (this.oplogCompactor != null) {
- // try {
- // this.oplogCompactor.stopCompactor();
- // }
- // catch (CancelException ignore) {
- // // Asif:To fix Bug 39380 , ignore the cache closed exception here.
- // // allow it to call super .close so that it would be able to close
- // the
- // // oplogs
- // // Though I do not think this exception will be thrown by
- // // the stopCompactor. Still not taking chance and ignoring it
-
- // }
- // }
- // // if (!isSync()) {
- // stopAsyncFlusher(true); // do this before writeLock
- // // }
+
boolean gotLock = false;
try {
try {
acquireWriteLock(dr);
gotLock = true;
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
// see workaround below.
}
@@ -3163,8 +3111,9 @@ public class DiskStoreImpl implements DiskStore {
}
boolean interrupted = Thread.interrupted();
try {
+ // TODO: calling wait while holding two locks
this.closeRegionGuard.wait(1000);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -3175,7 +3124,7 @@ public class DiskStoreImpl implements DiskStore {
if (this.entryOpsCount.get() > 0) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.DisKRegion_OUTSTANDING_OPS_REMAIN_AFTER_0_SECONDS_FOR_DISK_REGION_1,
- new Object[] {Integer.valueOf(loopCount), dr.getName()}));
+ new Object[] {loopCount, dr.getName()}));
for (;;) {
if (this.entryOpsCount.get() == 0) {
@@ -3183,8 +3132,9 @@ public class DiskStoreImpl implements DiskStore {
}
boolean interrupted = Thread.interrupted();
try {
+ // TODO: calling wait while holding two locks
this.closeRegionGuard.wait(1000);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ignore) {
interrupted = true;
} finally {
if (interrupted) {
@@ -3233,7 +3183,7 @@ public class DiskStoreImpl implements DiskStore {
dr.resetRVV();
dr.setRVVTrusted(false);
dr.writeRVV(null, null); // just persist the empty rvv with trust=false
- } catch (RegionDestroyedException rde) {
+ } catch (RegionDestroyedException ignore) {
// ignore a RegionDestroyedException at this stage
}
if (this.initFile != null && dr.isBackup()) {
@@ -4111,11 +4061,6 @@ public class DiskStoreImpl implements DiskStore {
* Start the backup process. This is the second step of the backup process. In this method, we
* define the data we're backing up by copying the init file and rolling to the next file. After
* this method returns operations can proceed as normal, except that we don't remove oplogs.
- *
- * @param targetDir
- * @param baselineInspector
- * @param restoreScript
- * @throws IOException
*/
public void startBackup(File targetDir, BackupInspector baselineInspector,
RestoreScript restoreScript) throws IOException {
@@ -4130,7 +4075,7 @@ public class DiskStoreImpl implements DiskStore {
}
// Get an appropriate lock object for each set of oplogs.
- Object childLock = childOplog.lock;;
+ Object childLock = childOplog.lock;
// TODO - We really should move this lock into the disk store, but
// until then we need to do this magic to make sure we're actually
@@ -4201,9 +4146,6 @@ public class DiskStoreImpl implements DiskStore {
/**
* Copy the oplogs to the backup directory. This is the final step of the backup process. The
* oplogs we copy are defined in the startBackup method.
- *
- * @param backupManager
- * @throws IOException
*/
public void finishBackup(BackupManager backupManager) throws IOException {
if (diskStoreBackup == null) {
@@ -4312,17 +4254,17 @@ public class DiskStoreImpl implements DiskStore {
props.setProperty(CACHE_XML_FILE, "");
DistributedSystem ds = DistributedSystem.connect(props);
offlineDS = ds;
- Cache c = org.apache.geode.cache.CacheFactory.create(ds);
- offlineCache = c;
- org.apache.geode.cache.DiskStoreFactory dsf = c.createDiskStoreFactory();
+ InternalCache cache = (InternalCache) CacheFactory.create(ds);
+ offlineCache = cache;
+ DiskStoreFactory dsf = cache.createDiskStoreFactory();
dsf.setDiskDirs(dsDirs);
if (offlineCompacting && maxOplogSize != -1L) {
dsf.setMaxOplogSize(maxOplogSize);
}
- DiskStoreImpl dsi = new DiskStoreImpl(c, dsName,
+ DiskStoreImpl dsi = new DiskStoreImpl(cache, dsName,
((DiskStoreFactoryImpl) dsf).getDiskStoreAttributes(), false, null, true,
upgradeVersionOnly, offlineValidate, offlineCompacting, needsOplogs, offlineModify);
- ((GemFireCacheImpl) c).addDiskStore(dsi);
+ cache.addDiskStore(dsi);
return dsi;
}
@@ -4536,7 +4478,7 @@ public class DiskStoreImpl implements DiskStore {
while (!isClosing() && currentAsyncValueRecoveryMap.containsKey(diskRegion.getId())) {
try {
currentAsyncValueRecoveryMap.wait();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
interrupted = true;
}
}
@@ -4591,9 +4533,9 @@ public class DiskStoreImpl implements DiskStore {
if (lastWriteTask != null) {
try {
lastWriteTask.get();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
- } catch (Exception e) {
+ } catch (Exception ignore) {
// do nothing, an exception from the write task was already logged.
}
}
@@ -4684,7 +4626,7 @@ public class DiskStoreImpl implements DiskStore {
delayedWritePool.shutdown();
try {
delayedWritePool.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
index 551f733..ac72361 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
@@ -14,6 +14,19 @@
*/
package org.apache.geode.internal.cache;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.DiskAccessException;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
@@ -22,25 +35,16 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.*;
public class DiskStoreMonitor {
private static final Logger logger = LogService.getLogger();
private static final boolean DISABLE_MONITOR =
Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "DISK_USAGE_DISABLE_MONITORING");
- // private static final boolean AUTO_RECONNECT =
- // Boolean.getBoolean("gemfire.DISK_USAGE_ENABLE_AUTO_RECONNECT");
private static final int USAGE_CHECK_INTERVAL = Integer
.getInteger(DistributionConfig.GEMFIRE_PREFIX + "DISK_USAGE_POLLING_INTERVAL_MILLIS", 10000);
+
private static final float LOG_WARNING_THRESHOLD_PCT =
Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "DISK_USAGE_LOG_WARNING_PERCENT", 99);
@@ -67,7 +71,7 @@ public class DiskStoreMonitor {
if (val < 0 || val > 100) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_DISK_USAGE_WARNING_INVALID_0
- .toLocalizedString(Float.valueOf(val)));
+ .toLocalizedString(val));
}
}
@@ -80,17 +84,15 @@ public class DiskStoreMonitor {
if (val < 0 || val > 100) {
throw new IllegalArgumentException(
LocalizedStrings.DiskWriteAttributesFactory_DISK_USAGE_CRITICAL_INVALID_0
- .toLocalizedString(Float.valueOf(val)));
+ .toLocalizedString(val));
}
}
private final ScheduledExecutorService exec;
private final Map<DiskStoreImpl, Set<DirectoryHolderUsage>> disks;
- private final LogUsage logDisk;
- // // this is set when we go into auto_reconnect mode
- // private volatile DirectoryHolderUsage criticalDisk;
+ private final LogUsage logDisk;
volatile DiskStateAction _testAction;
@@ -209,9 +211,9 @@ public class DiskStoreMonitor {
private File getLogDir() {
File log = null;
- GemFireCacheImpl gci = GemFireCacheImpl.getInstance();
- if (gci != null) {
- InternalDistributedSystem ds = gci.getInternalDistributedSystem();
+ InternalCache internalCache = GemFireCacheImpl.getInstance();
+ if (internalCache != null) {
+ InternalDistributedSystem ds = internalCache.getInternalDistributedSystem();
if (ds != null) {
DistributionConfig conf = ds.getConfig();
if (conf != null) {
@@ -230,7 +232,7 @@ public class DiskStoreMonitor {
return log;
}
- abstract class DiskUsage {
+ abstract static class DiskUsage {
private DiskState state;
DiskUsage() {
@@ -305,7 +307,7 @@ public class DiskStoreMonitor {
protected abstract void handleStateChange(DiskState next, String pct);
}
- class LogUsage extends DiskUsage {
+ static class LogUsage extends DiskUsage {
private final File dir;
public LogUsage(File dir) {
@@ -382,41 +384,12 @@ public class DiskStoreMonitor {
logger.error(LogMarker.DISK_STORE_MONITOR,
LocalizedMessage.create(LocalizedStrings.DiskStoreMonitor_DISK_CRITICAL, args));
- try {
- // // prepare for restart
- // if (AUTO_RECONNECT) {
- // disk.getCache().saveCacheXmlForReconnect();
- // criticalDisk = this;
- // }
- } finally {
- // pull the plug
- disk.handleDiskAccessException(new DiskAccessException(msg, disk));
- }
+ // TODO: this is weird...
+ disk.handleDiskAccessException(new DiskAccessException(msg, disk));
break;
}
}
- // private void performReconnect(String msg) {
- // try {
- // // don't try to reconnect before the cache is closed
- // disk._testHandleDiskAccessException.await();
- //
- // // now reconnect, clear out the var first so a close can interrupt the
- // // reconnect
- // criticalDisk = null;
- // boolean restart = disk.getCache().getDistributedSystem().tryReconnect(true, msg,
- // disk.getCache());
- // if (LogMarker.DISK_STORE_MONITOR || logger.isDebugEnabled()) {
- // String pre = restart ? "Successfully" : "Unsuccessfully";
- // logger.info(LocalizedStrings.DEBUG, pre + " attempted to restart cache");
- // }
- // } catch (InterruptedException e) {
- // Thread.currentThread().interrupt();
- // } finally {
- // close();
- // }
- // }
-
@Override
protected File dir() {
return dir.getDir();
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXCommitMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXCommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXCommitMessage.java
index 36ad9ce..e22e1d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXCommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXCommitMessage.java
@@ -48,12 +48,10 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
-/**
- *
- */
public class DistTXCommitMessage extends TXMessage {
private static final Logger logger = LogService.getLogger();
+
protected ArrayList<ArrayList<DistTxThinEntryState>> entryStateList = null;
/** for deserialization */
@@ -75,7 +73,7 @@ public class DistTXCommitMessage extends TXMessage {
logger.debug("DistTXCommitMessage.operateOnTx: Tx {}", txId);
}
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
TXManagerImpl txMgr = cache.getTXMgr();
final TXStateProxy txStateProxy = txMgr.getTXState();
TXCommitMessage cmsg = null;
@@ -256,7 +254,7 @@ public class DistTXCommitMessage extends TXMessage {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("DistTXCommitPhaseTwoReplyMessage ").append("processorid=").append(this.processorId)
.append(" reply to sender ").append(this.getSender());
return sb.toString();
@@ -339,7 +337,7 @@ public class DistTXCommitMessage extends TXMessage {
(DistTxCommitExceptionCollectingException) this.exception;
return cce.getCacheClosedMembers();
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -349,7 +347,7 @@ public class DistTXCommitMessage extends TXMessage {
(DistTxCommitExceptionCollectingException) this.exception;
return cce.getRegionDestroyedMembers(regionFullPath);
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -387,14 +385,12 @@ public class DistTXCommitMessage extends TXMessage {
/**
* Determine if the commit processing was incomplete, if so throw a detailed exception
* indicating the source of the problem
- *
- * @param msgMap
*/
public void handlePotentialCommitFailure(
HashMap<DistributedMember, DistTXCoordinatorInterface> msgMap) {
if (fatalExceptions.size() > 0) {
- StringBuffer errorMessage = new StringBuffer("Incomplete commit of transaction ").append(id)
- .append(". Caused by the following exceptions: ");
+ StringBuilder errorMessage = new StringBuilder("Incomplete commit of transaction ")
+ .append(id).append(". Caused by the following exceptions: ");
for (Iterator i = fatalExceptions.entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry) i.next();
DistributedMember mem = (DistributedMember) me.getKey();
@@ -428,16 +424,13 @@ public class DistTXCommitMessage extends TXMessage {
public Set getRegionDestroyedMembers(String regionFullPath) {
Set members = (Set) this.regionExceptions.get(regionFullPath);
if (members == null) {
- members = Collections.EMPTY_SET;
+ members = Collections.emptySet();
}
return members;
}
/**
* Protected by (this)
- *
- * @param member
- * @param exceptions
*/
public void addExceptionsFromMember(InternalDistributedMember member, Set exceptions) {
for (Iterator iter = exceptions.iterator(); iter.hasNext();) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXPrecommitMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXPrecommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXPrecommitMessage.java
index ffbc3ba..0f7aa72 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXPrecommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXPrecommitMessage.java
@@ -53,12 +53,10 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
-/**
- *
- */
public final class DistTXPrecommitMessage extends TXMessage {
private static final Logger logger = LogService.getLogger();
+
ArrayList<DistTxEntryEvent> secondaryTransactionalOperations;
/** for deserialization */
@@ -76,7 +74,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
@Override
protected boolean operateOnTx(TXId txId, DistributionManager dm) throws RemoteOperationException {
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
TXManagerImpl txMgr = cache.getTXMgr();
if (logger.isDebugEnabled()) {
@@ -132,7 +130,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
}
// Send Response : Send false if conflict
- DistTxPrecommitResponse finalResponse = new DistTxPrecommitResponse(precommitSuccess,
+ DistTxPreCommitResponse finalResponse = new DistTxPreCommitResponse(precommitSuccess,
new ArrayList<ArrayList<DistTxThinEntryState>>(entryStateSortedMap.values()));
DistTXPrecommitReplyMessage.send(getSender(), getProcessorId(), finalResponse,
getReplySender(dm));
@@ -176,7 +174,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
* This is the reply to a {@link DistTXPrecommitMessage}.
*/
public static final class DistTXPrecommitReplyMessage extends ReplyMessage {
- private transient DistTxPrecommitResponse commitResponse;
+ private transient DistTxPreCommitResponse commitResponse;
/**
* Empty constructor to conform to DataSerializable interface
@@ -187,7 +185,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
fromData(in);
}
- private DistTXPrecommitReplyMessage(int processorId, DistTxPrecommitResponse val) {
+ private DistTXPrecommitReplyMessage(int processorId, DistTxPreCommitResponse val) {
setProcessorId(processorId);
this.commitResponse = val;
}
@@ -209,7 +207,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
* @param replySender distribution manager used to send the reply
*/
public static void send(InternalDistributedMember recipient, int processorId,
- DistTxPrecommitResponse val, ReplySender replySender) throws RemoteOperationException {
+ DistTxPreCommitResponse val, ReplySender replySender) throws RemoteOperationException {
Assert.assertTrue(recipient != null, "DistTXPhaseOneCommitReplyMessage NULL reply message");
DistTXPrecommitReplyMessage m = new DistTXPrecommitReplyMessage(processorId, val);
m.setRecipient(recipient);
@@ -253,18 +251,18 @@ public final class DistTXPrecommitMessage extends TXMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.commitResponse = (DistTxPrecommitResponse) DataSerializer.readObject(in);
+ this.commitResponse = (DistTxPreCommitResponse) DataSerializer.readObject(in);
}
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("DistTXPhaseOneCommitReplyMessage").append("processorid=").append(this.processorId)
.append(" reply to sender ").append(this.getSender());
return sb.toString();
}
- public DistTxPrecommitResponse getCommitResponse() {
+ public DistTxPreCommitResponse getCommitResponse() {
return commitResponse;
}
}
@@ -279,7 +277,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
*/
public static final class DistTxPrecommitReplyProcessor extends ReplyProcessor21 {
private HashMap<DistributedMember, DistTXCoordinatorInterface> msgMap;
- private Map<DistributedMember, DistTxPrecommitResponse> commitResponseMap;
+ private Map<DistributedMember, DistTxPreCommitResponse> commitResponseMap;
private transient TXId txIdent = null;
public DistTxPrecommitReplyProcessor(TXId txUniqId, DM dm, Set initMembers,
@@ -288,7 +286,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
this.msgMap = msgMap;
// [DISTTX] TODO Do we need synchronised map?
this.commitResponseMap =
- Collections.synchronizedMap(new HashMap<DistributedMember, DistTxPrecommitResponse>());
+ Collections.synchronizedMap(new HashMap<DistributedMember, DistTxPreCommitResponse>());
this.txIdent = txUniqId;
}
@@ -340,7 +338,7 @@ public final class DistTXPrecommitMessage extends TXMessage {
(DistTxPrecommitExceptionCollectingException) this.exception;
return cce.getCacheClosedMembers();
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -350,11 +348,11 @@ public final class DistTXPrecommitMessage extends TXMessage {
(DistTxPrecommitExceptionCollectingException) this.exception;
return cce.getRegionDestroyedMembers(regionFullPath);
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
- public Map<DistributedMember, DistTxPrecommitResponse> getCommitResponseMap() {
+ public Map<DistributedMember, DistTxPreCommitResponse> getCommitResponseMap() {
return commitResponseMap;
}
}
@@ -388,14 +386,12 @@ public final class DistTXPrecommitMessage extends TXMessage {
/**
* Determine if the commit processing was incomplete, if so throw a detailed exception
* indicating the source of the problem
- *
- * @param msgMap
*/
public void handlePotentialCommitFailure(
HashMap<DistributedMember, DistTXCoordinatorInterface> msgMap) {
if (fatalExceptions.size() > 0) {
- StringBuffer errorMessage = new StringBuffer("Incomplete commit of transaction ").append(id)
- .append(". Caused by the following exceptions: ");
+ StringBuilder errorMessage = new StringBuilder("Incomplete commit of transaction ")
+ .append(id).append(". Caused by the following exceptions: ");
for (Iterator i = fatalExceptions.entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry) i.next();
DistributedMember mem = (DistributedMember) me.getKey();
@@ -429,16 +425,13 @@ public final class DistTXPrecommitMessage extends TXMessage {
public Set getRegionDestroyedMembers(String regionFullPath) {
Set members = (Set) this.regionExceptions.get(regionFullPath);
if (members == null) {
- members = Collections.EMPTY_SET;
+ members = Collections.emptySet();
}
return members;
}
/**
* Protected by (this)
- *
- * @param member
- * @param exceptions
*/
public void addExceptionsFromMember(InternalDistributedMember member, Set exceptions) {
for (Iterator iter = exceptions.iterator(); iter.hasNext();) {
@@ -465,14 +458,14 @@ public final class DistTXPrecommitMessage extends TXMessage {
}
}
- public static final class DistTxPrecommitResponse implements DataSerializableFixedID {
+ public static final class DistTxPreCommitResponse implements DataSerializableFixedID {
private transient Boolean commitState;
private transient ArrayList<ArrayList<DistTxThinEntryState>> distTxEventList;
// Default constructor for serialisation
- public DistTxPrecommitResponse() {}
+ public DistTxPreCommitResponse() {}
- public DistTxPrecommitResponse(boolean precommitSuccess,
+ public DistTxPreCommitResponse(boolean precommitSuccess,
ArrayList<ArrayList<DistTxThinEntryState>> eventList) {
this.commitState = precommitSuccess;
this.distTxEventList = eventList;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXRollbackMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXRollbackMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXRollbackMessage.java
index bfe302a..d4f5943 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXRollbackMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXRollbackMessage.java
@@ -75,7 +75,7 @@ public final class DistTXRollbackMessage extends TXMessage {
logger.debug("Dist TX: Rollback: {}", txId);
}
- GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = GemFireCacheImpl.getInstance();
TXManagerImpl txMgr = cache.getTXMgr();
final TXStateProxy txState = txMgr.getTXState();
boolean rollbackSuccessful = false;
@@ -87,10 +87,6 @@ public final class DistTXRollbackMessage extends TXMessage {
"DistTXRollbackMessage.operateOnTx: found a previously committed transaction:{}",
txId);
}
- // TXCommitMessage cmsg = txMgr.getRecentlyCompletedMessage(txId);
- // if (txMgr.isExceptionToken(cmsg)) {
- // throw txMgr.getExceptionForToken(cmsg, txId);
- // }
} else if (txState != null) {
// [DISTTX] TODO - Handle scenarios of no txState
// if no TXState was created (e.g. due to only getEntry/size operations
@@ -219,7 +215,7 @@ public final class DistTXRollbackMessage extends TXMessage {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("DistTXRollbackReplyMessage ").append("processorid=").append(this.processorId)
.append(" reply to sender ").append(this.getSender());
return sb.toString();
@@ -232,7 +228,6 @@ public final class DistTXRollbackMessage extends TXMessage {
/**
* A processor to capture the value returned by {@link DistTXRollbackReplyMessage}
- *
*/
public static class DistTXRollbackResponse extends RemoteOperationResponse {
private volatile Boolean rollbackState;
@@ -275,9 +270,6 @@ public final class DistTXRollbackMessage extends TXMessage {
final String msg = "DistTXRollbackResponse got RemoteOperationException; rethrowing";
logger.debug(msg, e);
throw e;
- } catch (TransactionDataNotColocatedException e) {
- // Throw this up to user!
- throw e;
}
return rollbackState;
}
@@ -354,7 +346,7 @@ public final class DistTXRollbackMessage extends TXMessage {
(DistTxRollbackExceptionCollectingException) this.exception;
return cce.getCacheClosedMembers();
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -364,7 +356,7 @@ public final class DistTXRollbackMessage extends TXMessage {
(DistTxRollbackExceptionCollectingException) this.exception;
return cce.getRegionDestroyedMembers(regionFullPath);
} else {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
}
@@ -402,14 +394,12 @@ public final class DistTXRollbackMessage extends TXMessage {
/**
* Determine if the commit processing was incomplete, if so throw a detailed exception
* indicating the source of the problem
- *
- * @param msgMap
*/
public void handlePotentialCommitFailure(
HashMap<DistributedMember, DistTXCoordinatorInterface> msgMap) {
if (fatalExceptions.size() > 0) {
- StringBuffer errorMessage = new StringBuffer("Incomplete commit of transaction ").append(id)
- .append(". Caused by the following exceptions: ");
+ StringBuilder errorMessage = new StringBuilder("Incomplete commit of transaction ")
+ .append(id).append(". Caused by the following exceptions: ");
for (Iterator i = fatalExceptions.entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry) i.next();
DistributedMember mem = (DistributedMember) me.getKey();
@@ -443,16 +433,13 @@ public final class DistTXRollbackMessage extends TXMessage {
public Set getRegionDestroyedMembers(String regionFullPath) {
Set members = (Set) this.regionExceptions.get(regionFullPath);
if (members == null) {
- members = Collections.EMPTY_SET;
+ members = Collections.emptySet();
}
return members;
}
/**
* Protected by (this)
- *
- * @param member
- * @param exceptions
*/
public void addExceptionsFromMember(InternalDistributedMember member, Set exceptions) {
for (Iterator iter = exceptions.iterator(); iter.hasNext();) {
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
index 68bde4e..50f36c2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
@@ -15,10 +15,8 @@
package org.apache.geode.internal.cache;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.Map.Entry;
@@ -32,10 +30,9 @@ import org.apache.geode.cache.UnsupportedOperationInTransactionException;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.DistTXPrecommitMessage.DistTxPrecommitResponse;
-import org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData;
-import org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData;
+import org.apache.geode.internal.cache.DistTXPrecommitMessage.DistTxPreCommitResponse;
import org.apache.geode.internal.cache.TXEntryState.DistTxThinEntryState;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
import org.apache.geode.internal.cache.tx.DistClientTXStateStub;
import org.apache.geode.internal.cache.tx.DistTxEntryEvent;
@@ -50,8 +47,11 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
*/
protected HashMap<DistributedMember, DistTXCoordinatorInterface> target2realDeals =
new HashMap<>();
+
private HashMap<LocalRegion, DistributedMember> rrTargets;
+
private Set<DistributedMember> txRemoteParticpants = null; // other than local
+
protected HashMap<String, ArrayList<DistTxThinEntryState>> txEntryEventMap = null;
public DistTXStateProxyImplOnCoordinator(TXManagerImpl managerImpl, TXId id,
@@ -132,8 +132,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
* those
*/
private HashMap<DistributedMember, DistTXCoordinatorInterface> getSecondariesAndReplicasForTxOps() {
- final GemFireCacheImpl cache =
- GemFireCacheImpl.getExisting("getSecondariesAndReplicasForTxOps");
+ final InternalCache cache = GemFireCacheImpl.getExisting("getSecondariesAndReplicasForTxOps");
InternalDistributedMember currentNode =
cache.getInternalDistributedSystem().getDistributedMember();
@@ -143,7 +142,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
DistributedMember originalTarget = e.getKey();
DistTXCoordinatorInterface distPeerTxStateStub = e.getValue();
- ArrayList<DistTxEntryEvent> primaryTxOps =
+ Iterable<DistTxEntryEvent> primaryTxOps =
distPeerTxStateStub.getPrimaryTransactionalOperations();
for (DistTxEntryEvent dtop : primaryTxOps) {
LocalRegion lr = dtop.getRegion();
@@ -155,8 +154,8 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
allNodes.remove(originalTarget);
otherNodes = allNodes;
} else if (lr instanceof DistributedRegion) {
- otherNodes =
- ((DistributedRegion) lr).getCacheDistributionAdvisor().adviseInitializedReplicates();
+ otherNodes = ((CacheDistributionAdvisee) lr).getCacheDistributionAdvisor()
+ .adviseInitializedReplicates();
otherNodes.remove(originalTarget);
}
@@ -196,7 +195,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
}
boolean finalResult = false;
- final GemFireCacheImpl cache = GemFireCacheImpl.getExisting("Applying Dist TX Rollback");
+ final InternalCache cache = GemFireCacheImpl.getExisting("Applying Dist TX Rollback");
final DM dm = cache.getDistributionManager();
try {
// Create Tx Participants
@@ -319,7 +318,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
if (r instanceof PartitionedRegion) {
target = getOwnerForKey(r, key);
} else if (r instanceof BucketRegion) {
- target = ((BucketRegion) r).getBucketAdvisor().getPrimary();
+ target = ((Bucket) r).getBucketAdvisor().getPrimary();
// target = r.getMyId();
} else { // replicated region
target = getRRTarget(key, r);
@@ -390,7 +389,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
throw new UnsupportedOperationInTransactionException(LocalizedStrings.DISTTX_TX_EXPECTED
.toLocalizedString("DistPeerTXStateStub", this.realDeal.getClass().getSimpleName()));
}
- target2realDeals.put(target, (DistPeerTXStateStub) realDeal);
+ target2realDeals.put(target, (DistTXCoordinatorInterface) realDeal);
if (logger.isDebugEnabled()) {
logger.debug(
"DistTXStateProxyImplOnCoordinator.getRealDeal(t) added TxState target2realDeals = "
@@ -438,7 +437,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
private boolean doPrecommit() {
boolean finalResult = true;
- final GemFireCacheImpl cache = GemFireCacheImpl.getExisting("Applying Dist TX Precommit");
+ final InternalCache cache = GemFireCacheImpl.getExisting("Applying Dist TX Precommit");
final DM dm = cache.getDistributionManager();
// Create Tx Participants
@@ -468,7 +467,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
} else if (lr instanceof PartitionedRegion || lr instanceof BucketRegion) {
final PartitionedRegion pr;
if (lr instanceof BucketRegion) {
- pr = ((BucketRegion) lr).getPartitionedRegion();
+ pr = ((Bucket) lr).getPartitionedRegion();
} else {
pr = (PartitionedRegion) lr;
}
@@ -528,8 +527,8 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
new TreeMap<String, ArrayList<DistTxThinEntryState>>();
ArrayList<ArrayList<DistTxThinEntryState>> entryEventList = null;
if (localResult) {
- localResult = ((DistTXStateOnCoordinator) localTXState)
- .populateDistTxEntryStateList(entryStateSortedMap);
+ localResult =
+ ((DistTXState) localTXState).populateDistTxEntryStateList(entryStateSortedMap);
if (localResult) {
entryEventList =
new ArrayList<ArrayList<DistTxThinEntryState>>(entryStateSortedMap.values());
@@ -572,11 +571,11 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
// [DISTTX} TODO Handle stats
// dm.getStats().incCommitWaits();
- Map<DistributedMember, DistTxPrecommitResponse> remoteResults =
+ Map<DistributedMember, DistTxPreCommitResponse> remoteResults =
processor.getCommitResponseMap();
- for (Entry<DistributedMember, DistTxPrecommitResponse> e : remoteResults.entrySet()) {
+ for (Entry<DistributedMember, DistTxPreCommitResponse> e : remoteResults.entrySet()) {
DistributedMember target = e.getKey();
- DistTxPrecommitResponse remoteResponse = e.getValue();
+ DistTxPreCommitResponse remoteResponse = e.getValue();
ArrayList<ArrayList<DistTxThinEntryState>> entryEventList =
remoteResponse.getDistTxEntryEventList();
populateEntryEventMap(target, entryEventList, sortedRegionName);
@@ -665,7 +664,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
*/
private boolean doCommit() {
boolean finalResult = true;
- final GemFireCacheImpl cache = GemFireCacheImpl.getExisting("Applying Dist TX Commit");
+ final InternalCache cache = GemFireCacheImpl.getExisting("Applying Dist TX Commit");
final DM dm = cache.getDistributionManager();
// Create Tx Participants
@@ -716,7 +715,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
localTXState.getClass().getSimpleName()));
}
populateEntryEventList(dm.getId(), entryEventList, sortedRegionName);
- ((DistTXStateOnCoordinator) localTXState).setDistTxEntryStates(entryEventList);
+ ((DistTXState) localTXState).setDistTxEntryStates(entryEventList);
localTXState.commit();
TXCommitMessage localResultMsg = localTXState.getCommitMessage();
if (logger.isDebugEnabled()) {
@@ -821,7 +820,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
Object key = putallOp.putAllData[i].key;
int bucketId = putallOp.putAllData[i].getBucketId();
- DistributedPutAllOperation putAllForBucket = bucketToPutallMap.get(bucketId);;
+ DistributedPutAllOperation putAllForBucket = bucketToPutallMap.get(bucketId);
if (putAllForBucket == null) {
// TODO DISTTX: event is never released
EntryEventImpl event = EntryEventImpl.createPutAllEvent(null, region,
@@ -982,7 +981,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
public DistributedMember getOwnerForKey(LocalRegion r, KeyInfo key) {
DistributedMember m = r.getOwnerForKey(key);
if (m == null) {
- GemFireCacheImpl cache = GemFireCacheImpl.getExisting("getOwnerForKey");
+ InternalCache cache = GemFireCacheImpl.getExisting("getOwnerForKey");
m = cache.getDistributedSystem().getDistributedMember();
}
return m;
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index 0a9ccd8..7ba7d0c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.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.internal.cache;
import java.io.DataInput;
@@ -39,6 +38,7 @@ import org.apache.geode.cache.CacheEvent;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DiskAccessException;
import org.apache.geode.cache.EntryNotFoundException;
+import org.apache.geode.cache.EntryOperation;
import org.apache.geode.cache.Operation;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.query.internal.cq.CqService;
@@ -58,12 +58,11 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.CopyOnWriteHashSet;
import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile;
-import org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllMessage;
import org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter;
import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
import org.apache.geode.internal.cache.UpdateOperation.UpdateMessage;
+import org.apache.geode.internal.cache.partitioned.Bucket;
import org.apache.geode.internal.cache.partitioned.PartitionMessage;
import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.tier.MessageType;
@@ -75,26 +74,26 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
+import org.apache.geode.internal.offheap.Releasable;
import org.apache.geode.internal.offheap.StoredObject;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.sequencelog.EntryLogger;
import org.apache.geode.internal.util.DelayedAction;
-/**
- *
- */
public abstract class DistributedCacheOperation {
private static final Logger logger = LogService.getLogger();
public static double LOSS_SIMULATION_RATIO = 0; // test hook
+
public static Random LOSS_SIMULATION_GENERATOR;
public static long SLOW_DISTRIBUTION_MS = 0; // test hook
// constants used in subclasses and distribution messages
// should use enum in source level 1.5+
+
/**
* Deserialization policy: do not deserialize (for byte array, null or cases where the value
* should stay serialized)
@@ -145,11 +144,12 @@ public abstract class DistributedCacheOperation {
}
- public final static byte DESERIALIZATION_POLICY_NUMBITS =
+ public static final byte DESERIALIZATION_POLICY_NUMBITS =
DistributionMessage.getNumBits(DESERIALIZATION_POLICY_LAZY);
public static final short DESERIALIZATION_POLICY_END =
(short) (1 << DESERIALIZATION_POLICY_NUMBITS);
+
public static final short DESERIALIZATION_POLICY_MASK = (short) (DESERIALIZATION_POLICY_END - 1);
public static boolean testSendingOldValues;
@@ -263,7 +263,7 @@ public abstract class DistributedCacheOperation {
try {
_distribute();
} catch (InvalidVersionException e) {
- if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
logger.trace(LogMarker.DM, "PutAll failed since versions were missing; retrying again", e);
}
@@ -283,7 +283,7 @@ public abstract class DistributedCacheOperation {
DistributedRegion region = getRegion();
if (viewVersion != -1) {
region.getDistributionAdvisor().endOperation(viewVersion);
- if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
logger.trace(LogMarker.STATE_FLUSH_OP, "done dispatching operation in view version {}",
viewVersion);
}
@@ -317,7 +317,7 @@ public abstract class DistributedCacheOperation {
if (SLOW_DISTRIBUTION_MS > 0) { // test hook
try {
Thread.sleep(SLOW_DISTRIBUTION_MS);
- } catch (InterruptedException e) {
+ } catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
SLOW_DISTRIBUTION_MS = 0;
@@ -335,15 +335,15 @@ public abstract class DistributedCacheOperation {
}
// some members requiring old value are also in the cache op recipients set
- Set needsOldValueInCacheOp = Collections.EMPTY_SET;
+ Set needsOldValueInCacheOp = Collections.emptySet();
// set client routing information into the event
boolean routingComputed = false;
FilterRoutingInfo filterRouting = null;
// recipients that will get a cacheop msg and also a PR message
- Set twoMessages = Collections.EMPTY_SET;
+ Set twoMessages = Collections.emptySet();
if (region.isUsedForPartitionedRegionBucket()) {
- twoMessages = ((BucketRegion) region).getBucketAdvisor().adviseRequiresTwoMessages();
+ twoMessages = ((Bucket) region).getBucketAdvisor().adviseRequiresTwoMessages();
routingComputed = true;
filterRouting = getRecipientFilterRouting(recipients);
if (filterRouting != null) {
@@ -355,7 +355,7 @@ public abstract class DistributedCacheOperation {
// some members need PR notification of the change for client/wan
// notification
- Set adjunctRecipients = Collections.EMPTY_SET;
+ Set adjunctRecipients = Collections.emptySet();
// Partitioned region listener notification messages piggyback on this
// operation's replyprocessor and need to be sent at the same time as
@@ -377,20 +377,17 @@ public abstract class DistributedCacheOperation {
recipients.removeAll(needsOldValueInCacheOp);
}
- Set cachelessNodes = Collections.EMPTY_SET;
- Set adviseCacheServers = Collections.EMPTY_SET;
- Set<InternalDistributedMember> cachelessNodesWithNoCacheServer =
- new HashSet<InternalDistributedMember>();
+ Set cachelessNodes = Collections.emptySet();
+ Set adviseCacheServers;
+ Set<InternalDistributedMember> cachelessNodesWithNoCacheServer = new HashSet<>();
if (region.getDistributionConfig().getDeltaPropagation() && this.supportsDeltaPropagation()) {
cachelessNodes = region.getCacheDistributionAdvisor().adviseEmptys();
if (!cachelessNodes.isEmpty()) {
List list = new ArrayList(cachelessNodes);
for (Object member : cachelessNodes) {
- if (!recipients.contains(member)) {
+ if (!recipients.contains(member) || adjunctRecipients.contains(member)) {
// Don't include those originally excluded.
list.remove(member);
- } else if (adjunctRecipients.contains(member)) {
- list.remove(member);
}
}
cachelessNodes.clear();
@@ -421,10 +418,10 @@ public abstract class DistributedCacheOperation {
if (!reliableOp || region.isNoDistributionOk()) {
// nothing needs be done in this case
} else {
- region.handleReliableDistribution(Collections.EMPTY_SET);
+ region.handleReliableDistribution(Collections.emptySet());
}
- /** compute local client routing before waiting for an ack only for a bucket */
+ // compute local client routing before waiting for an ack only for a bucket
if (region.isUsedForPartitionedRegionBucket()) {
FilterInfo filterInfo = getLocalFilterRouting(filterRouting);
this.event.setLocalFilterInfo(filterInfo);
@@ -433,7 +430,7 @@ public abstract class DistributedCacheOperation {
} else {
boolean directAck = false;
boolean useMulticast = region.getMulticastEnabled()
- && region.getSystem().getConfig().getMcastPort() != 0 && this.supportsMulticast();;
+ && region.getSystem().getConfig().getMcastPort() != 0 && this.supportsMulticast();
boolean shouldAck = shouldAck();
if (shouldAck) {
@@ -491,7 +488,7 @@ public abstract class DistributedCacheOperation {
recipients);
}
waitForMembers.removeAll(recipients);
- recipients = Collections.EMPTY_SET;
+ recipients = Collections.emptySet();
}
}
if (reliableOp) {
@@ -625,7 +622,7 @@ public abstract class DistributedCacheOperation {
}
adjunctRecipientsWithNoCacheServer.addAll(adjunctRecipients);
- adviseCacheServers = ((BucketRegion) region).getPartitionedRegion()
+ adviseCacheServers = ((Bucket) region).getPartitionedRegion()
.getCacheDistributionAdvisor().adviseCacheServers();
adjunctRecipientsWithNoCacheServer.removeAll(adviseCacheServers);
@@ -652,7 +649,7 @@ public abstract class DistributedCacheOperation {
}
}
- /** compute local client routing before waiting for an ack only for a bucket */
+ // compute local client routing before waiting for an ack only for a bucket
if (region.isUsedForPartitionedRegionBucket()) {
FilterInfo filterInfo = getLocalFilterRouting(filterRouting);
event.setLocalFilterInfo(filterInfo);
@@ -693,7 +690,6 @@ public abstract class DistributedCacheOperation {
}
}
-
/**
* Cleanup destroyed events in CQ result cache for remote CQs. While maintaining the CQ results
* key caching. the destroy event keys are marked as destroyed instead of removing them, this is
@@ -710,7 +706,7 @@ public abstract class DistributedCacheOperation {
continue;
}
- CacheProfile cf = (CacheProfile) ((BucketRegion) getRegion()).getPartitionedRegion()
+ CacheProfile cf = (CacheProfile) ((Bucket) getRegion()).getPartitionedRegion()
.getCacheDistributionAdvisor().getProfile(m);
if (cf == null || cf.filterProfile == null || cf.filterProfile.isLocalProfile()
@@ -718,7 +714,6 @@ public abstract class DistributedCacheOperation {
continue;
}
-
for (Object value : cf.filterProfile.getCqMap().values()) {
ServerCQ cq = (ServerCQ) value;
@@ -726,16 +721,14 @@ public abstract class DistributedCacheOperation {
Long cqID = e.getKey();
// For the CQs satisfying the event with destroy CQEvent, remove
// the entry form CQ cache.
- if (cq.getFilterID() == cqID
- && (e.getValue().equals(Integer.valueOf(MessageType.LOCAL_DESTROY)))) {
- cq.removeFromCqResultKeys(((EntryEventImpl) event).getKey(), true);
+ if (cq.getFilterID() == cqID && (e.getValue().equals(MessageType.LOCAL_DESTROY))) {
+ cq.removeFromCqResultKeys(((EntryOperation) event).getKey(), true);
}
}
}
}
}
-
/**
* Get the adjunct receivers for a partitioned region operation
*
@@ -752,9 +745,6 @@ public abstract class DistributedCacheOperation {
/**
* perform any operation-specific initialization on the given reply processor
- *
- * @param p
- * @param msg
*/
protected void initProcessor(CacheOperationReplyProcessor p, CacheOperationMessage msg) {
// nothing to do here - see UpdateMessage
@@ -783,9 +773,6 @@ public abstract class DistributedCacheOperation {
}
}
- /**
- * @param closedMembers
- */
private void handleClosedMembers(Set<InternalDistributedMember> closedMembers,
Map<InternalDistributedMember, PersistentMemberID> persistentIds) {
if (persistentIds == null) {
@@ -837,11 +824,7 @@ public abstract class DistributedCacheOperation {
return null;
}
CacheDistributionAdvisor advisor;
- // if (region.isUsedForPartitionedRegionBucket()) {
- advisor = ((BucketRegion) region).getPartitionedRegion().getCacheDistributionAdvisor();
- // } else {
- // advisor = ((DistributedRegion)region).getCacheDistributionAdvisor();
- // }
+ advisor = region.getPartitionedRegion().getCacheDistributionAdvisor();
return advisor.adviseFilterRouting(this.event, cacheOpRecipients);
}
@@ -915,7 +898,6 @@ public abstract class DistributedCacheOperation {
protected final static short PERSISTENT_TAG_MASK = (VERSION_TAG_MASK << 1);
protected final static short UNRESERVED_FLAGS_START = (PERSISTENT_TAG_MASK << 1);
-
private final static int INHIBIT_NOTIFICATIONS_MASK = 0x400;
public boolean needsRouting;
@@ -959,7 +941,6 @@ public abstract class DistributedCacheOperation {
return this.op;
}
-
/** sets the concurrency versioning tag for this message */
public void setVersionTag(VersionTag tag) {
this.versionTag = tag;
@@ -1001,8 +982,6 @@ public abstract class DistributedCacheOperation {
/**
* process a reply
*
- * @param reply
- * @param processor
* @return true if the reply-processor should continue to process this response
*/
boolean processReply(ReplyMessage reply, CacheOperationReplyProcessor processor) {
@@ -1019,13 +998,11 @@ public abstract class DistributedCacheOperation {
* @param event the entry event that contains the old value
*/
public void appendOldValueToMessage(EntryEventImpl event) {
- {
- @Unretained
- Object val = event.getRawOldValue();
- if (val == null || val == Token.NOT_AVAILABLE || val == Token.REMOVED_PHASE1
- || val == Token.REMOVED_PHASE2 || val == Token.DESTROYED || val == Token.TOMBSTONE) {
- return;
- }
+ @Unretained
+ Object val = event.getRawOldValue();
+ if (val == null || val == Token.NOT_AVAILABLE || val == Token.REMOVED_PHASE1
+ || val == Token.REMOVED_PHASE2 || val == Token.DESTROYED || val == Token.TOMBSTONE) {
+ return;
}
event.exportOldValue(this);
}
@@ -1086,7 +1063,7 @@ public abstract class DistributedCacheOperation {
protected LocalRegion getLocalRegionForProcessing(DistributionManager dm) {
Assert.assertTrue(this.regionPath != null, "regionPath was null");
- GemFireCacheImpl gfc = (GemFireCacheImpl) CacheFactory.getInstance(dm.getSystem());
+ InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
return gfc.getRegionByPathForProcessing(this.regionPath);
}
@@ -1112,7 +1089,7 @@ public abstract class DistributedCacheOperation {
final LocalRegion lclRgn = getLocalRegionForProcessing(dm);
sendReply = false;
basicProcess(dm, lclRgn);
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
this.closed = true;
if (logger.isDebugEnabled()) {
logger.debug("{} Cancelled: nothing to do", this);
@@ -1203,7 +1180,7 @@ public abstract class DistributedCacheOperation {
// region
if (!rgn.isEventTrackerInitialized()
&& (rgn.getDataPolicy().withReplication() || rgn.getDataPolicy().withPreloaded())) {
- if (logger.isDebugEnabled()) {
+ if (logger.isTraceEnabled()) {
logger.trace(LogMarker.DM_BRIDGE_SERVER, "Ignoring possible duplicate event");
}
return;
@@ -1213,15 +1190,15 @@ public abstract class DistributedCacheOperation {
sendReply = operateOnRegion(event, dm) && sendReply;
} finally {
if (event instanceof EntryEventImpl) {
- ((EntryEventImpl) event).release();
+ ((Releasable) event).release();
}
}
- } catch (RegionDestroyedException e) {
+ } catch (RegionDestroyedException ignore) {
this.closed = true;
if (logger.isDebugEnabled()) {
logger.debug("{} Region destroyed: nothing to do", this);
}
- } catch (CancelException e) {
+ } catch (CancelException ignore) {
this.closed = true;
if (logger.isDebugEnabled()) {
logger.debug("{} Cancelled: nothing to do", this);
@@ -1231,7 +1208,7 @@ public abstract class DistributedCacheOperation {
if (!lclRgn.isDestroyed()) {
logger.error("Got disk access exception, expected region to be destroyed", e);
}
- } catch (EntryNotFoundException e) {
+ } catch (EntryNotFoundException ignore) {
this.appliedOperation = true;
if (logger.isDebugEnabled()) {
logger.debug("{} Entry not found, nothing to do", this);
@@ -1275,8 +1252,7 @@ public abstract class DistributedCacheOperation {
if (pId == 0 && (dm instanceof DM) && !this.directAck) {// Fix for #41871
// distributed-no-ack message. Don't respond
} else {
- ReplyException exception = rex;
- ReplyMessage.send(recipient, pId, exception, dm, !this.appliedOperation, this.closed, false,
+ ReplyMessage.send(recipient, pId, rex, dm, !this.appliedOperation, this.closed, false,
isInternal());
}
}
@@ -1312,9 +1288,6 @@ public abstract class DistributedCacheOperation {
* When an event is discarded because of an attempt to overwrite a more recent change we still
* need to deliver that event to clients. Clients can then perform their own concurrency checks
* on the event.
- *
- * @param rgn
- * @param ev
*/
protected void dispatchElidedEvent(LocalRegion rgn, EntryEventImpl ev) {
if (logger.isDebugEnabled()) {
@@ -1325,11 +1298,6 @@ public abstract class DistributedCacheOperation {
rgn.notifyBridgeClients(ev);
}
- // protected LocalRegion getRegionFromPath(InternalDistributedSystem sys,
- // String path) {
- // return LocalRegion.getRegionFromPath(sys, path);
- // }
-
protected abstract InternalCacheEvent createEvent(DistributedRegion rgn)
throws EntryNotFoundException;
@@ -1380,7 +1348,6 @@ public abstract class DistributedCacheOperation {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
- // super.fromData(in);
short bits = in.readShort();
short extBits = in.readShort();
this.flags = bits;
@@ -1424,8 +1391,6 @@ public abstract class DistributedCacheOperation {
@Override
public void toData(DataOutput out) throws IOException {
- // super.toData(out);
-
short bits = 0;
short extendedBits = 0;
bits = computeCompressedShort(bits);
@@ -1611,8 +1576,7 @@ public abstract class DistributedCacheOperation {
static class CacheOperationReplyProcessor extends DirectReplyProcessor {
public CacheOperationMessage msg;
- public CopyOnWriteHashSet<InternalDistributedMember> closedMembers =
- new CopyOnWriteHashSet<InternalDistributedMember>();
+ public CopyOnWriteHashSet<InternalDistributedMember> closedMembers = new CopyOnWriteHashSet<>();
public CacheOperationReplyProcessor(InternalDistributedSystem system, Collection initMembers) {
super(system, initMembers);
[31/36] geode git commit: GEODE-2632: change dependencies on
GemFireCacheImpl to InternalCache
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
index 544fc13..48658fe 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
@@ -12,9 +12,19 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.query.internal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheRuntimeException;
@@ -42,7 +52,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.NanoTimer;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.CachePerfStats;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalDataSet;
import org.apache.geode.internal.cache.PRQueryProcessor;
import org.apache.geode.internal.cache.PartitionedRegion;
@@ -50,36 +60,24 @@ import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-
/**
* Thread-safe implementation of org.apache.persistence.query.Query
- *
*/
-
public class DefaultQuery implements Query {
+
private final CompiledValue compiledQuery;
+
private final String queryString;
- private final Cache cache;
- // private Pool pool;
+
+ private final InternalCache cache;
+
private ServerProxy serverProxy;
protected AtomicLong numExecutions = new AtomicLong(0);
- protected AtomicLong totalExecutionTime = new AtomicLong(0);
- private QueryStatistics stats;
- // TODO : Toggle the flag appropriately when implementing the compile() functionality
- private boolean isCompiled = false;
+ private final AtomicLong totalExecutionTime = new AtomicLong(0);
+
+ private final QueryStatistics stats;
private boolean traceOn = false;
@@ -93,21 +91,25 @@ public class DefaultQuery implements Query {
* used for more than the set value. By default its set to 10 minutes, the time is set in
* MilliSecs.
*/
- public static final int COMPILED_QUERY_CLEAR_TIME =
- Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "Query.COMPILED_QUERY_CLEAR_TIME",
- 10 * 60 * 1000).intValue();
+ public static final int COMPILED_QUERY_CLEAR_TIME = Integer.getInteger(
+ DistributionConfig.GEMFIRE_PREFIX + "Query.COMPILED_QUERY_CLEAR_TIME", 10 * 60 * 1000);
public static int TEST_COMPILED_QUERY_CLEAR_TIME = -1;
- // Use to represent null result.
- // Used while adding PR results to the results-queue, which is a blocking queue.
+ /**
+ * Use to represent null result. Used while adding PR results to the results-queue, which is a
+ * blocking queue.
+ */
public static final Object NULL_RESULT = new Object();
private volatile boolean isCanceled = false;
+
private CacheRuntimeException canceledException;
- // This is declared as array so that it can be synchronized between
- // two threads to validate the state.
+ /**
+ * This is declared as array so that it can be synchronized between two threads to validate the
+ * state.
+ */
private final boolean[] queryCompletedForMonitoring = new boolean[] {false};
private ProxyCache proxyCache;
@@ -116,28 +118,26 @@ public class DefaultQuery implements Query {
private boolean isQueryWithFunctionContext = false;
- // Holds the CQ reference. In cases of peer PRs this will be set to null
- // even though isCqQuery is set to true.
+ /**
+ * Holds the CQ reference. In cases of peer PRs this will be set to null even though isCqQuery is
+ * set to true.
+ */
private InternalCqQuery cqQuery = null;
private volatile boolean lastUsed = true;
public static TestHook testHook;
- private static final ThreadLocal<Boolean> pdxReadSerialized = new ThreadLocal() {
- @Override
- protected Boolean initialValue() {
- return new Boolean(Boolean.FALSE);
- }
- };
+ private static final ThreadLocal<Boolean> pdxReadSerialized =
+ ThreadLocal.withInitial(() -> Boolean.FALSE);
- // indicates query executed remotely
+ /** indicates query executed remotely */
private boolean isRemoteQuery = false;
// to prevent objects from getting deserialized
private boolean keepSerialized = false;
- public static final Set<String> reservedKeywords = new HashSet<String>();
+ public static final Set<String> reservedKeywords = new HashSet<>();
static {
reservedKeywords.add("hint");
@@ -230,14 +230,10 @@ public class DefaultQuery implements Query {
new ThreadLocal() {
@Override
protected Map<String, Set<String>> initialValue() {
- return new HashMap<String, Set<String>>();
+ return new HashMap<>();
}
};
- public static void setPdxClasstofieldsmap(Map<String, Set<String>> map) {
- pdxClassToFieldsMap.set(map);
- }
-
public static Map<String, Set<String>> getPdxClasstofieldsmap() {
return pdxClassToFieldsMap.get();
}
@@ -269,11 +265,11 @@ public class DefaultQuery implements Query {
*
* @see QueryService#newQuery
*/
- public DefaultQuery(String queryString, Cache cache, boolean isForRemote) {
+ public DefaultQuery(String queryString, InternalCache cache, boolean isForRemote) {
this.queryString = queryString;
QCompiler compiler = new QCompiler();
this.compiledQuery = compiler.compileQuery(queryString);
- CompiledSelect cs = this.getSimpleSelect();
+ CompiledSelect cs = getSimpleSelect();
if (cs != null && !isForRemote && (cs.isGroupBy() || cs.isOrderBy())) {
QueryExecutionContext ctx = new QueryExecutionContext(null, cache);
try {
@@ -282,7 +278,7 @@ public class DefaultQuery implements Query {
throw new QueryInvalidException("", qe);
}
}
- this.traceOn = (compiler.isTraceRequested() || QUERY_VERBOSE);
+ this.traceOn = compiler.isTraceRequested() || QUERY_VERBOSE;
this.cache = cache;
this.stats = new DefaultQueryStatistics();
}
@@ -295,7 +291,7 @@ public class DefaultQuery implements Query {
pdxReadSerialized.set(readSerialized);
}
- /*
+ /**
* helper method for setPdxReadSerialized
*/
public static void setPdxReadSerialized(Cache cache, boolean readSerialized) {
@@ -304,20 +300,20 @@ public class DefaultQuery implements Query {
}
}
-
/**
* Get statistics information for this query.
*/
+ @Override
public QueryStatistics getStatistics() {
- return stats;
+ return this.stats;
}
-
+ @Override
public String getQueryString() {
return this.queryString;
}
-
+ @Override
public Object execute() throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
return execute(EMPTY_ARRAY);
@@ -326,43 +322,43 @@ public class DefaultQuery implements Query {
/**
* namespace or parameters can be null
*/
- public Object execute(Object[] parameters) throws FunctionDomainException, TypeMismatchException,
+ @Override
+ public Object execute(Object[] params) throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
// Local Query.
- if (parameters == null) {
+ if (params == null) {
throw new IllegalArgumentException(
LocalizedStrings.DefaultQuery_PARAMETERS_CANNOT_BE_NULL.toLocalizedString());
}
- // If pool is associated with the Query; execute the query on pool.
- // ServerSide query.
+ // If pool is associated with the Query; execute the query on pool. ServerSide query.
if (this.serverProxy != null) {
// Execute Query using pool.
- return executeOnServer(parameters);
+ return executeOnServer(params);
}
long startTime = 0L;
- Object result = null;
if (this.traceOn && this.cache != null) {
startTime = NanoTimer.getTime();
}
QueryObserver indexObserver = null;
QueryMonitor queryMonitor = null;
- QueryExecutor qe = checkQueryOnPR(parameters);
+ QueryExecutor qe = checkQueryOnPR(params);
+ Object result = null;
try {
- // Setting the readserialized flag for local queries
- setPdxReadSerialized(cache, true);
- ExecutionContext context = new QueryExecutionContext(parameters, this.cache, this);
+ // Setting the readSerialized flag for local queries
+ setPdxReadSerialized(this.cache, true);
+ ExecutionContext context = new QueryExecutionContext(params, this.cache, this);
indexObserver = this.startTrace();
if (qe != null) {
if (DefaultQuery.testHook != null) {
DefaultQuery.testHook.doTestHook(1);
}
- result = qe.executeQuery(this, parameters, null);
+ result = qe.executeQuery(this, params, null);
// For local queries returning pdx objects wrap the resultset with
// ResultsCollectionPdxDeserializerWrapper
// which deserializes these pdx objects.
@@ -375,10 +371,8 @@ public class DefaultQuery implements Query {
return result;
}
- // Get QueryMonitor.
- if (GemFireCacheImpl.getInstance() != null) {
- queryMonitor = GemFireCacheImpl.getInstance().getQueryMonitor();
- }
+ queryMonitor = this.cache.getQueryMonitor();
+
// If QueryMonitor is enabled add query to be monitored.
if (queryMonitor != null) {
// Add current thread to be monitored by QueryMonitor.
@@ -422,55 +416,44 @@ public class DefaultQuery implements Query {
}
}
return result;
- } catch (QueryExecutionCanceledException e) {
+ } catch (QueryExecutionCanceledException ignore) {
// query execution canceled exception will be thrown from the QueryMonitor
// canceled exception should not be null at this point as it should be set
// when query is canceled.
- if (canceledException != null) {
- throw canceledException;
+ if (this.canceledException != null) {
+ throw this.canceledException;
} else {
throw new QueryExecutionCanceledException(
"Query was canceled. It may be due to low memory or the query was running longer than the MAX_QUERY_EXECUTION_TIME.");
}
} finally {
- setPdxReadSerialized(cache, false);
+ setPdxReadSerialized(this.cache, false);
if (queryMonitor != null) {
queryMonitor.stopMonitoringQueryThread(Thread.currentThread(), this);
}
this.endTrace(indexObserver, startTime, result);
}
-
}
- // For Order by queries ,since they are already ordered by the comparator
- // && it takes care of conversion, we do not have to wrap it in a wrapper
- public boolean needsPDXDeserializationWrapper(boolean isQueryOnPR) {
- if (!isRemoteQuery() && !this.cache.getPdxReadSerialized()) {
- return true;
- /*
- * if(isQueryOnPR) { // if the query is on PR we need a top level pdx deserialization wrapper
- * only in case of //order by query or non distinct query CompiledSelect cs =
- * this.getSimpleSelect(); if(cs != null) { return cs.getOrderByAttrs() != null ; }else {
- * return true; } }else { return true; }
- */
- } else {
- return false;
- }
+ /**
+ * For Order by queries ,since they are already ordered by the comparator && it takes care of
+ * conversion, we do not have to wrap it in a wrapper
+ */
+ private boolean needsPDXDeserializationWrapper(boolean isQueryOnPR) {
+ return !isRemoteQuery() && !this.cache.getPdxReadSerialized();
}
private Object executeOnServer(Object[] parameters) {
long startTime = CachePerfStats.getStatTime();
Object result = null;
try {
- if (proxyCache != null) {
+ if (this.proxyCache != null) {
if (this.proxyCache.isClosed()) {
throw new CacheClosedException("Cache is closed for this user.");
}
UserAttributes.userAttributes.set(this.proxyCache.getUserAttributes());
}
result = this.serverProxy.query(this.queryString, parameters);
- // } catch (QueryExecutionCanceledException e) {
- // throw canceledException;
} finally {
UserAttributes.userAttributes.set(null);
long endTime = CachePerfStats.getStatTime();
@@ -491,7 +474,6 @@ public class DefaultQuery implements Query {
}
long startTime = 0L;
- Object result = null;
if (this.traceOn && this.cache != null) {
startTime = NanoTimer.getTime();
}
@@ -514,12 +496,9 @@ public class DefaultQuery implements Query {
context.setBucketRegion(pr, bukRgn);
context.setCqQueryContext(this.isCqQuery);
- // Check if QueryMonitor is eabled, if enabled add query to be monitored.
- QueryMonitor queryMonitor = null;
+ // Check if QueryMonitor is enabled, if enabled add query to be monitored.
+ QueryMonitor queryMonitor = this.cache.getQueryMonitor();
- if (GemFireCacheImpl.getInstance() != null) {
- queryMonitor = GemFireCacheImpl.getInstance().getQueryMonitor();
- }
// PRQueryProcessor executes the query using single thread(in-line) or ThreadPool.
// In case of threadPool each individual threads needs to be added into
// QueryMonitor Service.
@@ -528,6 +507,7 @@ public class DefaultQuery implements Query {
queryMonitor.monitorQueryThread(Thread.currentThread(), this);
}
+ Object result = null;
try {
result = executeUsingContext(context);
} finally {
@@ -545,8 +525,7 @@ public class DefaultQuery implements Query {
String queryVerboseMsg = DefaultQuery.getLogMessage(indexObserver, startTime, otherObserver,
resultSize, this.queryString, bukRgn);
- if (this.traceOn && this.cache != null) {
-
+ if (this.traceOn) {
if (this.cache.getLogger().fineEnabled()) {
this.cache.getLogger().fine(queryVerboseMsg);
}
@@ -555,20 +534,20 @@ public class DefaultQuery implements Query {
return result;
}
-
public Object executeUsingContext(ExecutionContext context) throws FunctionDomainException,
TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
QueryObserver observer = QueryObserverHolder.getInstance();
+
long startTime = CachePerfStats.getStatTime();
TXStateProxy tx = ((TXManagerImpl) this.cache.getCacheTransactionManager()).internalSuspend();
try {
observer.startQuery(this);
- observer.beforeQueryEvaluation(compiledQuery, context);
- Object results = null;
+ observer.beforeQueryEvaluation(this.compiledQuery, context);
if (DefaultQuery.testHook != null) {
DefaultQuery.testHook.doTestHook(6);
}
+ Object results = null;
try {
// two-pass evaluation.
// first pre-compute dependencies, cached in the context.
@@ -577,12 +556,12 @@ public class DefaultQuery implements Query {
testHook.doTestHook(1);
}
results = this.compiledQuery.evaluate(context);
- } catch (QueryExecutionCanceledException e) {
+ } catch (QueryExecutionCanceledException ignore) {
// query execution canceled exception will be thrown from the QueryMonitor
// canceled exception should not be null at this point as it should be set
// when query is canceled.
- if (canceledException != null) {
- throw canceledException;
+ if (this.canceledException != null) {
+ throw this.canceledException;
} else {
throw new QueryExecutionCanceledException(
"Query was canceled. It may be due to low memory or the query was running longer than the MAX_QUERY_EXECUTION_TIME.");
@@ -591,8 +570,6 @@ public class DefaultQuery implements Query {
observer.afterQueryEvaluation(results);
}
return results;
- // } catch (QueryExecutionCanceledException e) {
- // throw canceledException;
} finally {
observer.endQuery();
long endTime = CachePerfStats.getStatTime();
@@ -603,22 +580,18 @@ public class DefaultQuery implements Query {
}
}
-
private QueryExecutor checkQueryOnPR(Object[] parameters)
throws RegionNotFoundException, PartitionOfflineException {
- // check for PartititionedRegions. If a PartitionedRegion is referred to in the query,
+ // check for PartitionedRegions. If a PartitionedRegion is referred to in the query,
// then the following restrictions apply:
// 1) the query must be just a SELECT expression; (preceded by zero or more IMPORT statements)
// 2) the first FROM clause iterator cannot contain a subquery;
// 3) PR reference can only be in the first FROM clause
- // QueryExecutor foundPR = null;
- // Region otherRgn = null;
-
- List<QueryExecutor> prs = new ArrayList<QueryExecutor>();
- for (Iterator itr = getRegionsInQuery(parameters).iterator(); itr.hasNext();) {
- String regionPath = (String) itr.next();
+ List<QueryExecutor> prs = new ArrayList<>();
+ for (final Object o : getRegionsInQuery(parameters)) {
+ String regionPath = (String) o;
Region rgn = this.cache.getRegion(regionPath);
if (rgn == null) {
this.cache.getCancelCriterion().checkCancelInProgress(null);
@@ -632,7 +605,9 @@ public class DefaultQuery implements Query {
}
if (prs.size() == 1) {
return prs.get(0);
- } else if (prs.size() > 1) { // colocation checks; valid for more the one PRs
+ } else if (prs.size() > 1) {
+ // colocation checks; valid for more the one PRs
+
// First query has to be executed in a Function.
if (!this.isQueryWithFunctionContext()) {
throw new UnsupportedOperationException(
@@ -650,8 +625,8 @@ public class DefaultQuery implements Query {
continue;
}
other = allPRs;
- if ((((PartitionedRegion) eachPR).getColocatedByList().contains(allPRs)
- || ((PartitionedRegion) allPRs).getColocatedByList().contains(eachPR))) {
+ if (((PartitionedRegion) eachPR).getColocatedByList().contains(allPRs)
+ || ((PartitionedRegion) allPRs).getColocatedByList().contains(eachPR)) {
colocated = true;
break;
}
@@ -672,6 +647,7 @@ public class DefaultQuery implements Query {
LocalizedStrings.DefaultQuery_QUERY_MUST_BE_A_SIMPLE_SELECT_WHEN_REFERENCING_A_PARTITIONED_REGION
.toLocalizedString());
}
+
// make sure the where clause references no regions
Set regions = new HashSet();
CompiledValue whereClause = select.getWhereClause();
@@ -688,9 +664,11 @@ public class DefaultQuery implements Query {
// the first iterator in the FROM clause must be just a reference to the Partitioned Region
Iterator fromClauseIterator = fromClause.iterator();
CompiledIteratorDef itrDef = (CompiledIteratorDef) fromClauseIterator.next();
+
// By process of elimination, we know that the first iterator contains a reference
// to the PR. Check to make sure there are no subqueries in this first iterator
itrDef.visitNodes(new CompiledValue.NodeVisitor() {
+ @Override
public boolean visit(CompiledValue node) {
if (node instanceof CompiledSelect) {
throw new UnsupportedOperationException(
@@ -716,8 +694,8 @@ public class DefaultQuery implements Query {
// check the projections, must not reference any regions
List projs = select.getProjectionAttributes();
if (projs != null) {
- for (Iterator itr = projs.iterator(); itr.hasNext();) {
- Object[] rawProj = (Object[]) itr.next();
+ for (Object proj1 : projs) {
+ Object[] rawProj = (Object[]) proj1;
CompiledValue proj = (CompiledValue) rawProj[1];
proj.getRegionsInQuery(regions, parameters);
if (!regions.isEmpty()) {
@@ -728,10 +706,9 @@ public class DefaultQuery implements Query {
}
}
// check the orderByAttrs, must not reference any regions
- List orderBys = select.getOrderByAttrs();
+ List<CompiledSortCriterion> orderBys = select.getOrderByAttrs();
if (orderBys != null) {
- for (Iterator itr = orderBys.iterator(); itr.hasNext();) {
- CompiledValue orderBy = (CompiledValue) itr.next();
+ for (CompiledSortCriterion orderBy : orderBys) {
orderBy.getRegionsInQuery(regions, parameters);
if (!regions.isEmpty()) {
throw new UnsupportedOperationException(
@@ -747,43 +724,43 @@ public class DefaultQuery implements Query {
}
private void updateStatistics(long executionTime) {
- numExecutions.incrementAndGet();
- totalExecutionTime.addAndGet(executionTime);
- ((GemFireCacheImpl) this.cache).getCachePerfStats().endQueryExecution(executionTime);
+ this.numExecutions.incrementAndGet();
+ this.totalExecutionTime.addAndGet(executionTime);
+ this.cache.getCachePerfStats().endQueryExecution(executionTime);
}
// TODO: Implement the function. Toggle the isCompiled flag accordingly
-
+ @Override
public void compile() throws TypeMismatchException, NameResolutionException {
throw new UnsupportedOperationException(
LocalizedStrings.DefaultQuery_NOT_YET_IMPLEMENTED.toLocalizedString());
}
-
+ @Override
public boolean isCompiled() {
- return this.isCompiled;
+ return false;
}
-
public boolean isTraced() {
- return traceOn;
+ return this.traceOn;
}
-
class DefaultQueryStatistics implements QueryStatistics {
/**
* Returns the total amount of time (in nanoseconds) spent executing the query.
*/
+ @Override
public long getTotalExecutionTime() {
- return totalExecutionTime.get();
+ return DefaultQuery.this.totalExecutionTime.get();
}
/**
* Returns the total number of times the query has been executed.
*/
+ @Override
public long getNumExecutions() {
- return numExecutions.get();
+ return DefaultQuery.this.numExecutions.get();
}
}
@@ -798,7 +775,7 @@ public class DefaultQuery implements Query {
*/
public Set getRegionsInQuery(Object[] parameters) {
Set regions = new HashSet();
- compiledQuery.getRegionsInQuery(regions, parameters);
+ this.compiledQuery.getRegionsInQuery(regions, parameters);
return Collections.unmodifiableSet(regions);
}
@@ -818,13 +795,8 @@ public class DefaultQuery implements Query {
}
/**
- *
- * @return int idenitifying the limit. A value of -1 indicates that no limit is imposed or the
+ * @return int identifying the limit. A value of -1 indicates that no limit is imposed or the
* query is not a select query
- * @throws QueryInvocationTargetException
- * @throws NameResolutionException
- * @throws TypeMismatchException
- * @throws FunctionDomainException
*/
public int getLimit(Object[] bindArguments) throws FunctionDomainException, TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
@@ -832,7 +804,7 @@ public class DefaultQuery implements Query {
? ((CompiledSelect) this.compiledQuery).getLimitValue(bindArguments) : -1;
}
- public void setServerProxy(ServerProxy serverProxy) {
+ void setServerProxy(ServerProxy serverProxy) {
this.serverProxy = serverProxy;
}
@@ -845,19 +817,22 @@ public class DefaultQuery implements Query {
}
public CacheRuntimeException getQueryCanceledException() {
- return canceledException;
+ return this.canceledException;
}
- public boolean[] getQueryCompletedForMonitoring() {
+ boolean[] getQueryCompletedForMonitoring() {
return this.queryCompletedForMonitoring;
}
- public void setQueryCompletedForMonitoring(boolean value) {
+ // TODO: parameter value is always true
+ void setQueryCompletedForMonitoring(boolean value) {
this.queryCompletedForMonitoring[0] = value;
}
/**
* The query gets canceled by the QueryMonitor with the reason being specified
+ * <p>
+ * TODO: parameter isCanceled is always true
*/
public void setCanceled(boolean isCanceled, CacheRuntimeException canceledException) {
this.isCanceled = isCanceled;
@@ -888,18 +863,18 @@ public class DefaultQuery implements Query {
return this.cqQuery;
}
-
+ @Override
public String toString() {
- StringBuffer tempBuff = new StringBuffer("Query String = ");
- tempBuff.append(this.queryString);
- tempBuff.append(';');
- tempBuff.append("isCancelled = ");
- tempBuff.append(this.isCanceled);
- tempBuff.append("; Total Executions = ");
- tempBuff.append(this.numExecutions);
- tempBuff.append("; Total Execution Time = ");
- tempBuff.append(this.totalExecutionTime);
- return tempBuff.toString();
+ StringBuilder sb = new StringBuilder("Query String = ");
+ sb.append(this.queryString);
+ sb.append(';');
+ sb.append("isCancelled = ");
+ sb.append(this.isCanceled);
+ sb.append("; Total Executions = ");
+ sb.append(this.numExecutions);
+ sb.append("; Total Execution Time = ");
+ sb.append(this.totalExecutionTime);
+ return sb.toString();
}
void setProxyCache(ProxyCache proxyCache) {
@@ -913,82 +888,78 @@ public class DefaultQuery implements Query {
DefaultQuery.TEST_COMPILED_QUERY_CLEAR_TIME = val;
}
- public static String getLogMessage(QueryObserver observer, long startTime, int resultSize,
+ private static String getLogMessage(QueryObserver observer, long startTime, int resultSize,
String query) {
- String usedIndexesString = null;
- String rowCountString = null;
- float time = 0.0f;
-
- time = (NanoTimer.getTime() - startTime) / 1.0e6f;
+ float time = (NanoTimer.getTime() - startTime) / 1.0e6f;
+ String usedIndexesString = null;
if (observer != null && observer instanceof IndexTrackingQueryObserver) {
IndexTrackingQueryObserver indexObserver = (IndexTrackingQueryObserver) observer;
Map usedIndexes = indexObserver.getUsedIndexes();
indexObserver.reset();
- StringBuffer buf = new StringBuffer();
- buf.append(" indexesUsed(");
- buf.append(usedIndexes.size());
- buf.append(")");
+ StringBuilder sb = new StringBuilder();
+ sb.append(" indexesUsed(");
+ sb.append(usedIndexes.size());
+ sb.append(')');
if (usedIndexes.size() > 0) {
- buf.append(":");
+ sb.append(':');
for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry) itr.next();
- buf.append(entry.getKey().toString() + entry.getValue());
+ sb.append(entry.getKey()).append(entry.getValue());
if (itr.hasNext()) {
- buf.append(",");
+ sb.append(',');
}
}
}
- usedIndexesString = buf.toString();
+ usedIndexesString = sb.toString();
} else if (DefaultQuery.QUERY_VERBOSE) {
usedIndexesString = " indexesUsed(NA due to other observer in the way: "
- + observer.getClass().getName() + ")";
+ + observer.getClass().getName() + ')';
}
+ String rowCountString = null;
if (resultSize != -1) {
- rowCountString = " rowCount = " + resultSize + ";";
+ rowCountString = " rowCount = " + resultSize + ';';
}
return "Query Executed in " + time + " ms;" + (rowCountString != null ? rowCountString : "")
- + (usedIndexesString != null ? usedIndexesString : "") + " \"" + query + "\"";
+ + (usedIndexesString != null ? usedIndexesString : "") + " \"" + query + '"';
}
- public static String getLogMessage(IndexTrackingQueryObserver indexObserver, long startTime,
+ private static String getLogMessage(IndexTrackingQueryObserver indexObserver, long startTime,
String otherObserver, int resultSize, String query, BucketRegion bucket) {
- String usedIndexesString = null;
- String rowCountString = null;
float time = 0.0f;
if (startTime > 0L) {
time = (NanoTimer.getTime() - startTime) / 1.0e6f;
}
+ String usedIndexesString = null;
if (indexObserver != null) {
Map usedIndexes = indexObserver.getUsedIndexes(bucket.getFullPath());
- StringBuffer buf = new StringBuffer();
- buf.append(" indexesUsed(");
- buf.append(usedIndexes.size());
- buf.append(")");
- if (usedIndexes.size() > 0) {
- buf.append(":");
+ StringBuilder sb = new StringBuilder();
+ sb.append(" indexesUsed(");
+ sb.append(usedIndexes.size());
+ sb.append(')');
+ if (!usedIndexes.isEmpty()) {
+ sb.append(':');
for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry) itr.next();
- buf.append(entry.getKey().toString() + "(Results: " + entry.getValue() + ", Bucket: "
- + bucket.getId() + ")");
+ sb.append(entry.getKey()).append("(Results: ").append(entry.getValue())
+ .append(", Bucket: ").append(bucket.getId()).append(")");
if (itr.hasNext()) {
- buf.append(",");
+ sb.append(',');
}
}
}
- usedIndexesString = buf.toString();
+ usedIndexesString = sb.toString();
} else if (DefaultQuery.QUERY_VERBOSE) {
usedIndexesString =
- " indexesUsed(NA due to other observer in the way: " + otherObserver + ")";
+ " indexesUsed(NA due to other observer in the way: " + otherObserver + ')';
}
- rowCountString = " rowCount = " + resultSize + ";";
- return "Query Executed" + (startTime > 0L ? " in " + time + " ms;" : ";")
- + (rowCountString != null ? rowCountString : "")
- + (usedIndexesString != null ? usedIndexesString : "") + " \"" + query + "\"";
+ String rowCountString = " rowCount = " + resultSize + ';';
+ return "Query Executed" + (startTime > 0L ? " in " + time + " ms;" : ";") + rowCountString
+ + (usedIndexesString != null ? usedIndexesString : "") + " \"" + query + '"';
}
@Override
@@ -998,10 +969,9 @@ public class DefaultQuery implements Query {
}
@Override
- public Object execute(RegionFunctionContext context, Object[] parameters)
+ public Object execute(RegionFunctionContext context, Object[] params)
throws FunctionDomainException, TypeMismatchException, NameResolutionException,
QueryInvocationTargetException {
- Object result = null;
// Supported only with RegionFunctionContext
if (context == null) {
@@ -1010,7 +980,7 @@ public class DefaultQuery implements Query {
}
this.isQueryWithFunctionContext = true;
- if (parameters == null) {
+ if (params == null) {
throw new IllegalArgumentException(
LocalizedStrings.DefaultQuery_PARAMETERS_CANNOT_BE_NULL.toLocalizedString());
}
@@ -1021,16 +991,16 @@ public class DefaultQuery implements Query {
}
QueryObserver indexObserver = null;
- QueryExecutor qe = checkQueryOnPR(parameters);
+ QueryExecutor qe = checkQueryOnPR(params);
+ Object result = null;
try {
indexObserver = startTrace();
if (qe != null) {
- Set buckets = null;
LocalDataSet localDataSet =
(LocalDataSet) PartitionRegionHelper.getLocalDataForContext(context);
- buckets = (localDataSet).getBucketSet();
- result = qe.executeQuery(this, parameters, buckets);
+ Set<Integer> buckets = localDataSet.getBucketSet();
+ result = qe.executeQuery(this, params, buckets);
return result;
} else {
// Not supported on regions other than PartitionRegion.
@@ -1038,8 +1008,6 @@ public class DefaultQuery implements Query {
LocalizedStrings.DefaultQuery_API_ONLY_FOR_PR.toLocalizedString());
}
- // } catch (QueryExecutionCanceledException e) {
- // throw canceledException;
} finally {
this.endTrace(indexObserver, startTime, result);
}
@@ -1080,7 +1048,7 @@ public class DefaultQuery implements Query {
}
String queryVerboseMsg =
- DefaultQuery.getLogMessage(indexObserver, startTime, resultSize, queryString);
+ DefaultQuery.getLogMessage(indexObserver, startTime, resultSize, this.queryString);
this.cache.getLogger().info(queryVerboseMsg);
}
}
@@ -1089,13 +1057,12 @@ public class DefaultQuery implements Query {
if (this.cache != null && this.cache.getLogger().infoEnabled() && this.traceOn) {
int resultSize = 0;
- Iterator<Collection> iterator = result.iterator();
- while (iterator.hasNext()) {
- resultSize += iterator.next().size();
+ for (Collection aResult : result) {
+ resultSize += aResult.size();
}
String queryVerboseMsg =
- DefaultQuery.getLogMessage(indexObserver, startTime, resultSize, queryString);
+ DefaultQuery.getLogMessage(indexObserver, startTime, resultSize, this.queryString);
if (this.cache.getLogger().infoEnabled()) {
this.cache.getLogger().info(queryVerboseMsg);
}
@@ -1103,7 +1070,7 @@ public class DefaultQuery implements Query {
}
public boolean isRemoteQuery() {
- return isRemoteQuery;
+ return this.isRemoteQuery;
}
public void setRemoteQuery(boolean isRemoteQuery) {
@@ -1112,33 +1079,29 @@ public class DefaultQuery implements Query {
/**
* set keepSerialized flag for remote queries of type 'select *' having independent operators
- *
- * @param cs
- * @param context
*/
- public void keepResultsSerialized(CompiledSelect cs, ExecutionContext context) {
+ void keepResultsSerialized(CompiledSelect cs, ExecutionContext context) {
if (isRemoteQuery()) {
// for dependent iterators, deserialization is required
if (cs.getIterators().size() == context.getAllIndependentIteratorsOfCurrentScope().size()
&& cs.getWhereClause() == null && cs.getProjectionAttributes() == null && !cs.isDistinct()
&& cs.getOrderByAttrs() == null) {
- setKeepSerialized(true);
+ setKeepSerialized();
}
}
}
public boolean isKeepSerialized() {
- return keepSerialized;
+ return this.keepSerialized;
}
- private void setKeepSerialized(boolean keepSerialized) {
- this.keepSerialized = keepSerialized;
+ private void setKeepSerialized() {
+ this.keepSerialized = true;
}
-
public interface TestHook {
- public void doTestHook(int spot);
+ void doTestHook(int spot);
- public void doTestHook(String spot);
+ void doTestHook(String spot);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java
index 18fe266..6675e02 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java
@@ -14,20 +14,30 @@
*/
package org.apache.geode.cache.query.internal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.*;
+import org.apache.geode.cache.query.AmbiguousNameException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.TypeMismatchException;
import org.apache.geode.cache.query.internal.index.IndexManager;
+import org.apache.geode.cache.query.internal.index.IndexUtils;
import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes;
-import org.apache.geode.cache.query.internal.types.*;
+import org.apache.geode.cache.query.internal.types.TypeUtils;
import org.apache.geode.internal.Assert;
-import org.apache.geode.cache.query.internal.index.IndexUtils;
-import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.CachePerfStats;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.pdx.internal.PdxString;
@@ -37,13 +47,14 @@ import org.apache.geode.pdx.internal.PdxString;
* clauses or index expressions to from clause iterators.
*
* @see QueryExecutionContext for extended version of this ONLY for querying.
- *
*/
public class ExecutionContext {
- protected Object[] bindArguments;
+ Object[] bindArguments;
+
private final Stack scopes = new Stack();
- private final Cache cache;
+
+ private final InternalCache cache;
/**
* a Sequentially increasing number identifying a scope & also indicating whether a given scope
@@ -56,23 +67,22 @@ public class ExecutionContext {
* Dependency graph. Maps CompiledValues in tree to the RuntimeIterators each node is dependent
* on. This information is computed just before the query is evaluated. The information is good
* for only one execution, since regions can be destroyed and re-created with different type
- * constraints. Type of this map: map <CompiledValue, set <RuntimeIterator>>
+ * constraints. Type of this map: map <CompiledValue, set <RuntimeIterator>>
*/
- Map dependencyGraph = new HashMap();
+ private Map dependencyGraph = new HashMap();
+
/**
* Map which stores the CompiledIteratorDef as the key & the value is the set of Independent
* RuntimeIterators on which it is dependent upon. The idea is that this Map will identify the
- * final Independent RuntimeIterator or Iterators , ie. those refering to a Region or
- * BindArgument, on which the CompiledIteratorDef depends upon . TODO:Asif: For a single vale ,
- * should we still use a Set?
- *
+ * final Independent RuntimeIterator or Iterators , ie. those referring to a Region or
+ * BindArgument, on which the CompiledIteratorDef depends upon .
*/
private final Map itrDefToIndpndtRuntimeItrMap = new HashMap();
+
/**
- * Asif : This Map will store its Region Path String against an Independent RuntimeIterator An
- * entry in this Map will be only for those RuntimeIteartors which have an underlying Region as
- * its Collection Expression
- *
+ * This Map will store its Region Path String against an Independent RuntimeIterator An entry in
+ * this Map will be only for those RuntimeIterators which have an underlying Region as its
+ * Collection Expression
*/
private final Map indpndtItrToRgnMap = new HashMap();
@@ -89,23 +99,13 @@ public class ExecutionContext {
*
* @see org.apache.geode.cache.Region#query
*/
- public ExecutionContext(Object[] bindArguments, Cache cache) {
- this.bindArguments = bindArguments;
- this.cache = cache;
- }
-
- public ExecutionContext(Object[] bindArguments, Cache cache, SelectResults results) {
- this.bindArguments = bindArguments;
- this.cache = cache;
- }
-
- public ExecutionContext(Object[] bindArguments, Cache cache, Query query) {
+ public ExecutionContext(Object[] bindArguments, InternalCache cache) {
this.bindArguments = bindArguments;
this.cache = cache;
}
public CachePerfStats getCachePerfStats() {
- return ((GemFireCacheImpl) this.cache).getCachePerfStats();
+ return this.cache.getCachePerfStats();
}
/**
@@ -129,10 +129,8 @@ public class ExecutionContext {
return ds;
}
- // TODO:ASIF:QUERY
/**
* Return true if given CompiledValue is dependent on any RuntimeIterator in current scope
- *
*/
boolean isDependentOnCurrentScope(CompiledValue cv) {
// return !getDependencySet(cv, true).isEmpty();
@@ -170,7 +168,7 @@ public class ExecutionContext {
Set set = (Set) this.dependencyGraph.get(cv);
if (set == null) {
if (readOnly)
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
set = new HashSet(1);
this.dependencyGraph.put(cv, set);
}
@@ -179,7 +177,7 @@ public class ExecutionContext {
/**
* Returns all dependencies in from this context which are reused during index update by new
- * {@link ExecutionContext} for concurrent updates on indexes.
+ * ExecutionContext for concurrent updates on indexes.
*
* @return All {@link AbstractCompiledValue} dependencies.
*/
@@ -198,10 +196,8 @@ public class ExecutionContext {
return this.bindArguments[index - 1];
}
- // TODO:ASIF:Query
/** bind a named iterator (to current scope) */
public void bindIterator(RuntimeIterator itr) {
- // int currScopeID = this.scopes.size();
QScope currentScope = this.currentScope();
int currScopeID = currentScope.getScopeID();
itr.setScopeID(currScopeID);
@@ -212,10 +208,8 @@ public class ExecutionContext {
CompiledValue value = resolveAsVariable(name);
if (value != null)
return value;
- // attribute name or operation name (no args) of a variable in the current
- // scope
- // when there is no ambiguity, i.e. this property name belongs to only one
- // variable in the scope
+ // attribute name or operation name (no args) of a variable in the current scope when there is
+ // no ambiguity, i.e. this property name belongs to only one variable in the scope
value = resolveImplicitPath(name);
if (value == null)
// cannot be resolved
@@ -246,11 +240,9 @@ public class ExecutionContext {
}
/**
- *
- * @return int indentifying the scope ID which can be assosciated with the scope
+ * @return the scope ID which can be associated with the scope
*/
- int assosciateScopeID() {
- // this.scopeIDMap.put(cs, Integer.valueOf(num));
+ int associateScopeID() {
return ++this.scopeNum;
}
@@ -271,11 +263,10 @@ public class ExecutionContext {
* argument . Also the self independent Runtime Iterator present in the scope ( that is teh
* RuntimeIterator same as the independent iterator passed as argument) is added at start of the
* list. If an iterator is dependent on more than one independent iterator, it is not added to the
- * List TODO:Asif If we are storing a single Iterator instead of Set , in the
- * itrDefToIndpndtRuntimeItrMap , we need to take care of this function.
- *
- * <P>
- * author Asif
+ * List
+ * <p>
+ * TODO: If we are storing a single Iterator instead of Set , in the itrDefToIndpndtRuntimeItrMap
+ * , we need to take care of this function.
*
* @param rIter Independent RuntimeIterator on which dependent iterators of current scope need to
* identified
@@ -297,27 +288,13 @@ public class ExecutionContext {
return list;
}
- public List getAllIterators() {
- int numScopes = scopes.size();
- List iterators = new ArrayList();
- for (int i = 1; i <= numScopes; i++) {
- iterators.addAll(((QScope) scopes.get(numScopes - i)).getIterators());
- }
- return iterators;
- }
-
void setOneIndexLookup(boolean b) {
QScope scope = currentScope();
Support.Assert(scope != null, "must be called within valid scope");
scope._oneIndexLookup = b;
}
-
- void setCurrent(RuntimeIterator iter, Object obj) {
- currentScope().setCurrent(iter, obj);
- }
-
- public Cache getCache() {
+ public InternalCache getCache() {
return this.cache;
}
@@ -336,7 +313,6 @@ public class ExecutionContext {
*/
RuntimeIterator resolveImplicitOperationName(String name, int numArgs, boolean mustBeMethod)
throws AmbiguousNameException {
- // System.out.println("In resolveImplicitOperationName");
// iterate through all properties of iterator variables in scope
// to see if there is a unique resolution
RuntimeIterator oneUnknown = null;
@@ -353,8 +329,8 @@ public class ExecutionContext {
if (scope.getLimit() == itr) {
continue NEXT_SCOPE; // don't go any farther in this scope
}
- // Shobhit: If Element type is ObjectType then we don't need to
- // apply reflection to find out field or method. This save lot of CPU time.
+ // If Element type is ObjectType then we don't need to apply reflection to find out field or
+ // method. This save lot of CPU time.
if (!TypeUtils.OBJECT_TYPE.equals(itr.getElementType())
&& itr.containsProperty(name, numArgs, mustBeMethod)) {
hits.add(itr);
@@ -368,14 +344,15 @@ public class ExecutionContext {
}
}
}
- if (hits.size() == 1)
+ if (hits.size() == 1) {
return (RuntimeIterator) hits.get(0);
+ }
if (hits.size() > 1) {
// ambiguous
if (mustBeMethod)
throw new AmbiguousNameException(
LocalizedStrings.ExecutionContext_METHOD_NAMED_0_WITH_1_ARGUMENTS_IS_AMBIGUOUS_BECAUSE_IT_CAN_APPLY_TO_MORE_THAN_ONE_VARIABLE_IN_SCOPE
- .toLocalizedString(new Object[] {name, Integer.valueOf(numArgs)}));
+ .toLocalizedString(name, numArgs));
throw new AmbiguousNameException(
LocalizedStrings.ExecutionContext_ATTRIBUTE_NAMED_0_IS_AMBIGUOUS_BECAUSE_IT_CAN_APPLY_TO_MORE_THAN_ONE_VARIABLE_IN_SCOPE
.toLocalizedString(name));
@@ -387,25 +364,13 @@ public class ExecutionContext {
return oneUnknown;
}
- protected CompiledValue resolveScopeVariable(String name) {
- CompiledValue value = null;
- for (int i = scopes.size() - 1; i >= 0; i--) {
- QScope scope = (QScope) scopes.get(i);
- value = scope.resolve(name);
- if (value != null)
- break;
- }
- return value;
- }
-
/**
* Tries to find for RuntimeIterator associated with specified expression
*/
public RuntimeIterator findRuntimeIterator(CompiledValue expr) {
// Check if expr is itself RuntimeIterator
if (expr instanceof RuntimeIterator) {
- RuntimeIterator rIter = (RuntimeIterator) expr;
- return rIter;
+ return (RuntimeIterator) expr;
}
// Try to find RuntimeIterator
return (RuntimeIterator) findIterator(expr);
@@ -427,9 +392,8 @@ public class ExecutionContext {
CompiledOperation operation = (CompiledOperation) path;
CompiledValue rec = operation.getReceiver(this);
if (rec == null) {
- RuntimeIterator rcvrItr = resolveImplicitOperationName(operation.getMethodName(),
+ return resolveImplicitOperationName(operation.getMethodName(),
operation.getArguments().size(), true);
- return rcvrItr;
}
return findIterator(rec);
}
@@ -442,44 +406,29 @@ public class ExecutionContext {
CompiledValue expr = resolve(((CompiledID) path).getId());
return findIterator(expr);
} // if we get these exceptions return null
- } catch (TypeMismatchException e) {
- } catch (NameResolutionException e) {
+ } catch (TypeMismatchException | NameResolutionException ignore) {
}
return null;
}
- int getScopeCount() {
- return this.scopes.size();
- }
-
/**
- *
* Calculates set of Runtime Iterators on which a given CompiledValue ultimately depends. The
* independent iterators may belong to other scopes.
- *
- * <P>
- * author Asif/Ketan
- *
- * @param cv
- * @param set
+ * <p>
+ * This function will populate the set to its independent RuntimeIterators. However if the
+ * CompiledValue happens to be a CompiledIteratorDef & if it is independent of any other
+ * RuntimeIterators then no addition will be done in the Set.
+ * <p>
+ * TODO: the behavior of this function will change if we modify the computeDependency function of
+ * the CompiledIteratorDef as in that case the Set will be added with the self RuntimeIterator (
+ * if the CompiledIteratorDef is independent) which is not the case now.
+ * <p>
+ * TODO: If a CompiledIteratorDef has only one dependent RuntimeIterator should it still be stored
+ * in a Set or should it be a single value?
*/
- // Ketan - Asif:This function will populate the set to its independent
- // RuntimeIterators
- // However if the CompiledValue happens to be a CompiledIteratorDef & if it is
- // independent of any other RuntimeIterators then no adition will be done in
- // the Set
- // TODO: Asif : The behaviour of this function will change if we modify the
- // computeDependency
- // function of the CompiledIteratorDef as in that case the Set will be added
- // with the self RuntimeIterator ( if the CompiledIteratorDef is independent)
- // which is
- // not the case now
- // TODO:Asif : If a CompiledIteratorDef has only one dependent RuntimeIterator
- // should it still be
- // stored in a Set or should it be a single value?
- public void computeUtlimateDependencies(CompiledValue cv, Set set) {
+ void computeUltimateDependencies(CompiledValue cv, Set set) {
Set dependencySet = this.getDependencySet(cv, true /* readOnly */);
- if (dependencySet != Collections.EMPTY_SET) {
+ if (dependencySet != Collections.emptySet()) {
Iterator iter = dependencySet.iterator();
RuntimeIterator rIter;
while (iter.hasNext()) {
@@ -494,29 +443,25 @@ public class ExecutionContext {
}
/**
- * Asif : This function populates the Map itrDefToIndpndtRuntimeItrMap. It creates a Set of
+ * This function populates the Map itrDefToIndpndtRuntimeItrMap. It creates a Set of
* RuntimeIterators to which the current CompilediteratorDef is dependent upon. Also it sets the
* index_internal_id for the RuntimeIterator, which is used for calculating the canonicalized
* iterator definitions for identifying the available index.
*
* @param itrDef CompiledIteratorDef object representing iterator in the query from clause
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
*/
public void addToIndependentRuntimeItrMap(CompiledIteratorDef itrDef)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
Set set = new HashSet();
- this.computeUtlimateDependencies(itrDef, set);
+ this.computeUltimateDependencies(itrDef, set);
RuntimeIterator itr = null;
String rgnPath = null;
// If the set is empty then add the self RuntimeIterator to the Map.
if (set.isEmpty()) {
itr = itrDef.getRuntimeIterator(this);
set.add(itr);
- // Asif : Since it is a an independent RuntimeIterator , check if its
- // Collection Expr
- // boils down to a Region. If it is , we need to store the QRegion in the
- // Map
+ // Since it is a an independent RuntimeIterator , check if its Collection Expr boils down to a
+ // Region. If it is , we need to store the QRegion in the Map
CompiledValue startVal =
QueryUtils.obtainTheBottomMostCompiledValue(itrDef.getCollectionExpr());
if (startVal.getType() == OQLLexerTokenTypes.RegionPath) {
@@ -532,12 +477,10 @@ public class ExecutionContext {
}
this.itrDefToIndpndtRuntimeItrMap.put(itrDef, set);
IndexManager mgr = null;
- // Asif : Set the canonicalized index_internal_id if the condition is
- // satisfied
+ // Set the canonicalized index_internal_id if the condition is satisfied
if (set.size() == 1) {
if (itr == null) {
itr = (RuntimeIterator) set.iterator().next();
- // if (itr.getScopeID() == this.getScopeCount()) {
if (itr.getScopeID() == this.currentScope().getScopeID()) {
rgnPath = (String) this.indpndtItrToRgnMap.get(itr);
}
@@ -556,7 +499,6 @@ public class ExecutionContext {
currItr.setIndexInternalID((mgr == null
|| (tempIndexID = mgr.getCanonicalizedIteratorName(itrDef.genFromClause(this))) == null)
? currItr.getInternalId() : tempIndexID);
-
}
public List getAllIndependentIteratorsOfCurrentScope() {
@@ -573,12 +515,11 @@ public class ExecutionContext {
}
/**
- * Asif : This method returns the Region path for the independent RuntimeIterator if itr exists
- * else returns null. It is the caller's responsibility to ensure that the passed Iterator is the
+ * This method returns the Region path for the independent RuntimeIterator if itr exists else
+ * returns null. It is the caller's responsibility to ensure that the passed Iterator is the
* ultimate Independent Runtime Iterator or else the method may return null if the RunTimeIterator
* is genuinely dependent on a Region iterator
*
- * @param riter
* @return String containing region path
*/
String getRegionPathForIndependentRuntimeIterator(RuntimeIterator riter) {
@@ -588,22 +529,15 @@ public class ExecutionContext {
/**
* Populates the independent runtime iterator map for index creation purposes. This method does
* not create any canonicalized index ids etc.
- * <p>
- * author Asif
- *
- * @param itrDef
- * @throws AmbiguousNameException
- * @throws TypeMismatchException
*/
public void addToIndependentRuntimeItrMapForIndexCreation(CompiledIteratorDef itrDef)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
Set set = new HashSet();
- this.computeUtlimateDependencies(itrDef, set);
- RuntimeIterator itr = null;
+ this.computeUltimateDependencies(itrDef, set);
// If the set is empty then add the self RuntimeIterator to the Map.
if (set.isEmpty()) {
- itr = itrDef.getRuntimeIterator(this);
+ RuntimeIterator itr = itrDef.getRuntimeIterator(this);
set.add(itr);
}
this.itrDefToIndpndtRuntimeItrMap.put(itrDef, set);
@@ -637,11 +571,7 @@ public class ExecutionContext {
return this.pr;
}
- // General purpose caching methods for data that is only valid for one
- // query execution
- void cachePut(Object key, Object value) {
- // throw new UnsupportedOperationException("Method should not have been called");
- }
+ void cachePut(Object key, Object value) {}
public Object cacheGet(Object key) {
return null;
@@ -683,14 +613,6 @@ public class ExecutionContext {
throw new UnsupportedOperationException("Method should not have been called");
}
- public void addToSuccessfulBuckets(int bId) {
- throw new UnsupportedOperationException("Method should not have been called");
- }
-
- public int[] getSuccessfulBuckets() {
- throw new UnsupportedOperationException("Method should not have been called");
- }
-
public PdxString getSavedPdxString(int index) {
throw new UnsupportedOperationException("Method should not have been called");
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexConditioningHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexConditioningHelper.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexConditioningHelper.java
new file mode 100644
index 0000000..75ce930
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexConditioningHelper.java
@@ -0,0 +1,245 @@
+/*
+ * 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.cache.query.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.geode.cache.query.types.StructType;
+
+/**
+ * This is a helper class which provides information on how an index data be used so as to make it
+ * compatible with the query.
+ */
+class IndexConditioningHelper {
+
+ /**
+ * boolean if true implies that the index results need to be iterated so as to make it compatible
+ * with from clause. Shuffling may be needed for any of the following reasons: 1) Match level not
+ * zero ( implying index result expansion or cutdown) 2) Match level zero , but the relative
+ * positions of iterators in the List of iterators for the group not matching the positions in the
+ * index result StructBag 3) Iter operand is not null. *
+ *
+ */
+ // If shuffling is not needed , then it can be bcoz of two reasons
+ // 1) The Index results is a ResultSet & match level is zero ( in that case we
+ // don't have to do anything)
+ // 2) The Index results is a StructBag with match level as zero & inddex
+ // fields matching
+ // the order of RuntimeIterators. In that case we just have to change the
+ // StructType of the StructBag
+ boolean shufflingNeeded = true;
+
+ /**
+ * An arary of RuntimeIterators whose size is equal to the number of fields in the Index results.
+ * It identifies the RuntimeIterator for the field in the Index Results. Thus the Runtime Iterator
+ * at position 0 will be that for field 0 in the index result & so on. For those index fields
+ * which do not have a Runtime Iterator assosciated , the value is null (This is the case if index
+ * results require cut down)
+ */
+ RuntimeIterator[] indexFieldToItrsMapping = null;
+
+ /**
+ * The List containing RuntimeIterators to which the index results need to be expanded This will
+ * usually be Final List of RuntimeIterators - RuntimeIteratosr already accounted for in the index
+ * results
+ */
+ // The default is initialized as empty List rather than null to avoid
+ // Null Pointer Exception in the function
+ // getconditionedRelationshipIndexResults
+ List expansionList = Collections.emptyList();
+
+ /**
+ * The List containing RuntimeIterators which define the final SelectResults after the relevant
+ * expansion/cutdown of index results
+ */
+ // Though in case of single index usage , if no shuffling is needed (
+ // exact match) we
+ // do not need finalList , but it is used in relation ship index , even if
+ // match level is zero.
+ // So we should never leave it as null
+ List finalList = null;
+
+ /**
+ * This is the List of RuntimeIterators which gets created only if the index resulst require a
+ * cutdown. In such cases , it identifies those Runtime Iterators of Index Results which will be
+ * selected to form the result tuple. The RuntimeIterators in this List will have corresponding
+ * fields in the resultset obtained from Index usage. This List will be populated only if there
+ * exists fields in index resultset which will not be selected.If all the fields of index
+ * resultset will be used , then this List should be null or empty. It is used in preventing
+ * unnecessary expansion of same type, when a similar expansion has already occured. as for eg
+ *
+ * consider a index result containing 3 fields field1 field2 & field3 . Assume that field3 is for
+ * cutdown. Since the expansion iterators can either be independent of all the fields in the index
+ * result or at the max be dependent on field1 & field2, we should expand for a given combination
+ * of field1 & field2 , only once ( as we have resulst as Set, we can only have unique entries)
+ * ie. suppose a index result tuple has values ( 1,2 , 3 ) & ( 1,2,4) , we should expand only once
+ * ( as field with value 3 & 4 are to be discarded).
+ */
+ /*
+ * Below Can be null or empty collections if the match level is exact & no shuffling needed
+ */
+ List checkList = null;
+
+ /**
+ * This field is meaningful iff the match level is zero, no shuffling needed & there exists a
+ * StructBag (& not a ResultBag)
+ */
+ StructType structType = null;
+
+ /**
+ * Independent Iterator for the Group to which the Path expression belongs to
+ */
+ RuntimeIterator indpndntItr = null;
+
+ /**
+ * Indexnfo object for the path expression
+ */
+ IndexInfo indxInfo = null;
+
+ IndexConditioningHelper(IndexInfo indexInfo, ExecutionContext context, int indexFieldsSize,
+ boolean completeExpansion, CompiledValue iterOperands, RuntimeIterator grpIndpndntItr) {
+ /*
+ * First obtain the match level of index resultset. If the match level happens to be zero , this
+ * implies that we just have to change the StructType ( again if only the Index resultset is a
+ * StructBag). If the match level is zero & expand to to top level flag is true & iff the total
+ * no. of iterators in current scope is greater than the no. of fields in StructBag , then only
+ * we need to do any expansion. The grpIndpndtItr passed can be null if the where clause
+ * comprises of just this condition. However if it is invoked from GroupJunction , it will be
+ * not null
+ *
+ */
+ this.indxInfo = indexInfo;
+ List grpItrs = null;
+ int size = indexInfo.mapping.length;
+ this.indpndntItr = grpIndpndntItr;
+ this.indexFieldToItrsMapping = new RuntimeIterator[indexFieldsSize];
+ // Obtain the grpIndpndt iterator if it is passed as null
+ if (this.indpndntItr == null) {
+ Set set1 = new HashSet();
+ context.computeUltimateDependencies(indexInfo._path, set1);
+ Support.Assert(set1.size() == 1,
+ " Since we are in Indexed Evaluate that means there has to be exactly one independent iterator for this compiled comparison");
+ // The ultimate independent RuntimeIterator
+ this.indpndntItr = (RuntimeIterator) set1.iterator().next();
+ Support.Assert(
+ this.indpndntItr.getScopeID() == context.currentScope()
+ .getScopeID()/* context.getScopeCount() */,
+ " Since we are in Indexed Evaluate that means the current scope count & indpenedent iterator's scope count should match");
+ }
+ if (indexInfo._matchLevel == 0
+ && (!completeExpansion || context.getCurrentIterators().size() == size)) {
+ // Don't do anything , just change the StructType if the set is
+ // structset.
+ if (size > 1) {
+ // The Index resultset is a structType.
+ Support.Assert(indexInfo._index.getResultSetType() instanceof StructType,
+ " If the match level is zero & the size of mapping array is 1 then Index is surely ResultBag else StructBag");
+ // The independent iterator is added as the first element
+ grpItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(this.indpndntItr);
+ // Check if reshuffling is needed or just changing the struct
+ // type will suffice
+ boolean isReshufflingNeeded = false;
+ int pos = -1;
+ for (int i = 0; i < size; ++i) {
+ pos = indexInfo.mapping[i];
+ isReshufflingNeeded = isReshufflingNeeded || (pos != (i + 1));
+ this.indexFieldToItrsMapping[pos - 1] = (RuntimeIterator) grpItrs.get(i);
+ }
+ this.finalList = grpItrs;
+ // Even if Reshuffle is not need but if the iter conditions are
+ // present we need to do evaluation
+ // We can avoid iterating over the set iff reshuffling is not needed &
+ // there is no iter eval condition
+ if (isReshufflingNeeded || iterOperands != null) {
+ // this.expansionList = Collections.EMPTY_LIST;
+ this.checkList = null;
+ // indexReults = QueryUtils.cutDownAndExpandIndexResults(indexReults,
+ // indexFieldToItrsMapping, Collections.EMPTY_LIST, grpItrs,
+ // context, Collections.EMPTY_LIST, iterOperands);
+ } else {
+ this.structType = QueryUtils.createStructTypeForRuntimeIterators(grpItrs);
+ // indexReults.setElementType(structType);
+ // Shuffling is not needed. Index results is a StructBag
+ // with match level zero & no expansion needed & index fields map
+ // with the RuntimeIterators. But we need to change the StructType
+ // of the StructBag
+ this.shufflingNeeded = false;
+ }
+ } else {
+ // The finalList should not be left uninitialized, & if the match
+ // level is zero
+ // & the Index Results is a ResultBag ( & not an StructBag ) implying
+ // indexFieldsSize of
+ // 1 , then the final List should contain only the independent iterator
+ this.finalList = new ArrayList();
+ this.finalList.add(this.indpndntItr);
+ Support.Assert(this.indexFieldToItrsMapping.length == 1,
+ "In this else block , it should be guaranteed that there exists only one iterator in query as well as index from clause & that should be nothing but the independent RuntimeIterator of the group ");
+ this.indexFieldToItrsMapping[0] = this.indpndntItr;
+ // Shuffling is needed if iter operand is not null even if index results is a
+ // ResultSet
+ // with match level zero & no expansion needed
+ this.shufflingNeeded = (iterOperands != null);
+ }
+ } else {
+ // There is some expansion or truncation needed on the data
+ // obtained from index.Identify a the iterators belonging to this group
+ // The independent iterator is added as the first element
+ grpItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(this.indpndntItr);
+ // Create an array of RuntimeIterators which map to the fields of the
+ // Index set.
+ // For those fields which do not have corresponding RuntimeIterator , keep
+ // it as null;
+ int pos = -1;
+ this.finalList = completeExpansion ? context.getCurrentIterators() : grpItrs;
+ // This is the List of runtimeIterators which have corresponding fields
+ // in the resultset obtained from Index usage. This List will be populated
+ // only if there exists fields in index resultset which will not be
+ // selected
+ // If all the fields of index resultset will be used , then this List
+ // should
+ // be null or empty
+ this.checkList = new ArrayList();
+ // This List contains the RuntimeIterators which are missing from
+ // index resultset but are present in the final iterators
+ this.expansionList = new LinkedList(finalList);
+ RuntimeIterator tempItr = null;
+ // boolean cutDownNeeded = false;
+ int unMappedFields = indexFieldsSize;
+ for (int i = 0; i < size; ++i) {
+ pos = indexInfo.mapping[i];
+ if (pos > 0) {
+ tempItr = (RuntimeIterator) grpItrs.get(i);
+ this.indexFieldToItrsMapping[pos - 1] = tempItr;
+ this.expansionList.remove(tempItr);
+ this.checkList.add(tempItr);
+ --unMappedFields;
+ }
+ }
+ boolean cutDownNeeded = unMappedFields > 0;
+ if (!cutDownNeeded)
+ this.checkList = null;
+ /*
+ * indexReults = QueryUtils.cutDownAndExpandIndexResults(indexReults, indexFieldToItrsMapping,
+ * expansionList, finalList, context, checkList, iterOperands);
+ */
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexCutDownExpansionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexCutDownExpansionHelper.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexCutDownExpansionHelper.java
new file mode 100644
index 0000000..d5514a5
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/IndexCutDownExpansionHelper.java
@@ -0,0 +1,80 @@
+/*
+ * 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.cache.query.internal;
+
+import java.util.List;
+
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.cache.query.internal.types.StructTypeImpl;
+import org.apache.geode.cache.query.types.ObjectType;
+
+/**
+ * This is a helper class which contains informaion on how to expand / cutdown index results for
+ * making it compatible with the query.
+ */
+class IndexCutDownExpansionHelper {
+
+ /**
+ * booelan which identifies if a cutdown of index results is needed or not.
+ */
+ boolean cutDownNeeded = false;
+
+ /**
+ * A SelectResults ( ResultBag or StructBag) object used to prevent unnecessary expansion of index
+ * results as described in IndexConditionalHelper class.
+ */
+ SelectResults checkSet = null;
+
+ /**
+ * ObjectType for the checkSet object ( An ObjectType for a ResultBag & StructType for a
+ * StructBag)
+ */
+ ObjectType checkType = null;
+
+ int checkSize = -1;
+
+ IndexCutDownExpansionHelper(List checkList, ExecutionContext context) {
+ cutDownNeeded = checkList != null && (checkSize = checkList.size()) > 0;
+ if (cutDownNeeded) {
+ Boolean orderByClause = (Boolean) context.cacheGet(CompiledValue.CAN_APPLY_ORDER_BY_AT_INDEX);
+ boolean useLinkedDataStructure = false;
+ boolean nullValuesAtStart = true;
+ if (orderByClause != null && orderByClause) {
+ List orderByAttrs = (List) context.cacheGet(CompiledValue.ORDERBY_ATTRIB);
+ useLinkedDataStructure = orderByAttrs.size() == 1;
+ nullValuesAtStart = !((CompiledSortCriterion) orderByAttrs.get(0)).getCriterion();
+ }
+ if (checkSize > 1) {
+
+ checkType = QueryUtils.createStructTypeForRuntimeIterators(checkList);
+ if (useLinkedDataStructure) {
+ checkSet = context.isDistinct() ? new LinkedStructSet((StructTypeImpl) checkType)
+ : new SortedResultsBag<Struct>((StructTypeImpl) checkType, nullValuesAtStart);
+ } else {
+ checkSet = QueryUtils.createStructCollection(context, (StructTypeImpl) checkType);
+ }
+ } else {
+ checkType = ((RuntimeIterator) checkList.get(0)).getElementType();
+ if (useLinkedDataStructure) {
+ checkSet = context.isDistinct() ? new LinkedResultSet(checkType)
+ : new SortedResultsBag(checkType, nullValuesAtStart);
+ } else {
+ checkSet = QueryUtils.createResultCollection(context, checkType);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryExecutionContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryExecutionContext.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryExecutionContext.java
index 7d029a1..eb51fcc 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryExecutionContext.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryExecutionContext.java
@@ -22,9 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.Stack;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.pdx.internal.PdxString;
/**
@@ -37,7 +36,9 @@ import org.apache.geode.pdx.internal.PdxString;
public class QueryExecutionContext extends ExecutionContext {
private int nextFieldNum = 0;
+
private Query query;
+
private IntOpenHashSet successfulBuckets;
private boolean cqQueryContext = false;
@@ -67,31 +68,18 @@ public class QueryExecutionContext extends ExecutionContext {
* List of query index names that the user has hinted on using
*/
- private ArrayList<String> hints = null;
+ private List<String> hints = null;
- /**
- * @param bindArguments
- * @param cache
- */
- public QueryExecutionContext(Object[] bindArguments, Cache cache) {
+ public QueryExecutionContext(Object[] bindArguments, InternalCache cache) {
super(bindArguments, cache);
}
-
-
- /**
- * @param bindArguments
- * @param cache
- * @param query
- */
- public QueryExecutionContext(Object[] bindArguments, Cache cache, Query query) {
+ public QueryExecutionContext(Object[] bindArguments, InternalCache cache, Query query) {
super(bindArguments, cache);
this.query = query;
}
-
- // General purpose caching methods for data that is only valid for one
- // query execution
+ @Override
void cachePut(Object key, Object value) {
if (key.equals(CompiledValue.QUERY_INDEX_HINTS)) {
setHints((ArrayList) value);
@@ -111,10 +99,12 @@ public class QueryExecutionContext extends ExecutionContext {
execCache.put(key, value);
}
+ @Override
public Object cacheGet(Object key) {
return cacheGet(key, null);
}
+ @Override
public Object cacheGet(Object key, Object defaultValue) {
// execCache can be empty in cases where we are doing adds to indexes
// in that case, we use a default execCache
@@ -132,10 +122,12 @@ public class QueryExecutionContext extends ExecutionContext {
return defaultValue;
}
+ @Override
public void pushExecCache(int scopeNum) {
execCacheStack.push(scopeNum);
}
+ @Override
public void popExecCache() {
execCacheStack.pop();
}
@@ -143,48 +135,47 @@ public class QueryExecutionContext extends ExecutionContext {
/**
* Added to reset the state from the last execution. This is added for CQs only.
*/
+ @Override
public void reset() {
super.reset();
this.execCacheStack.clear();
}
+ @Override
int nextFieldNum() {
return this.nextFieldNum++;
}
+ @Override
public void setCqQueryContext(boolean cqQuery) {
this.cqQueryContext = cqQuery;
}
+ @Override
public boolean isCqQueryContext() {
return this.cqQueryContext;
}
-
+ @Override
public Query getQuery() {
return query;
}
+ @Override
public void setBucketList(List list) {
this.bucketList = list;
this.successfulBuckets = new IntOpenHashSet();
}
+ @Override
public List getBucketList() {
return this.bucketList;
}
- public void addToSuccessfulBuckets(int bId) {
- this.successfulBuckets.add(bId);
- }
-
- public int[] getSuccessfulBuckets() {
- return this.successfulBuckets.toIntArray();
- }
-
/**
* creates new PdxString from String and caches it
*/
+ @Override
public PdxString getSavedPdxString(int index) {
if (bindArgumentToPdxStringMap == null) {
bindArgumentToPdxStringMap = new HashMap<Integer, PdxString>();
@@ -196,7 +187,6 @@ public class QueryExecutionContext extends ExecutionContext {
bindArgumentToPdxStringMap.put(index - 1, pdxString);
}
return pdxString;
-
}
public boolean isIndexUsed() {
@@ -207,7 +197,7 @@ public class QueryExecutionContext extends ExecutionContext {
this.indexUsed = indexUsed;
}
- public void setHints(ArrayList<String> hints) {
+ private void setHints(ArrayList<String> hints) {
this.hints = new ArrayList();
this.hints.addAll(hints);
}
@@ -227,11 +217,11 @@ public class QueryExecutionContext extends ExecutionContext {
return -(hints.size() - hints.indexOf(indexName));
}
- public boolean hasHints() {
+ boolean hasHints() {
return hints != null;
}
- public boolean hasMultiHints() {
+ boolean hasMultiHints() {
return hints != null && hints.size() > 1;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/57e93a5a/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 569fbb0..45b32ed 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
@@ -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.query.internal;
import java.util.concurrent.ConcurrentHashMap;
@@ -50,26 +49,23 @@ public class QueryMonitor implements Runnable {
* canceled due to max query execution timeout. TRUE it the query is canceled due to max query
* execution timeout timeout.
*/
- private static ThreadLocal<AtomicBoolean> queryExecutionStatus =
- new ThreadLocal<AtomicBoolean>() {
- @Override
- protected AtomicBoolean initialValue() {
- return new AtomicBoolean(Boolean.FALSE);
- }
- };
+ private static final ThreadLocal<AtomicBoolean> queryExecutionStatus =
+ ThreadLocal.withInitial(() -> new AtomicBoolean(Boolean.FALSE));
private final long maxQueryExecutionTime;
private static final ConcurrentLinkedQueue queryThreads = new ConcurrentLinkedQueue();
private Thread monitoringThread;
+
private final AtomicBoolean stopped = new AtomicBoolean(Boolean.FALSE);
- /** For DUnit test purpose */
+ /** For DUnit test purpose TODO: delete this ConcurrentMap */
private ConcurrentMap queryMonitorTasks = null;
// Variables for cancelling queries due to low memory
private volatile static Boolean LOW_MEMORY = Boolean.FALSE;
+
private volatile static long LOW_MEMORY_USED_BYTES = 0;
public QueryMonitor(long maxQueryExecutionTime) {
@@ -92,7 +88,7 @@ public class QueryMonitor implements Runnable {
QueryThreadTask queryTask = new QueryThreadTask(queryThread, query, queryExecutionStatus.get());
synchronized (queryThreads) {
queryThreads.add(queryTask);
- queryThreads.notify();
+ queryThreads.notifyAll();
}
if (logger.isDebugEnabled()) {
@@ -101,7 +97,7 @@ public class QueryMonitor implements Runnable {
queryThreads.size(), queryThread.getId(), query.getQueryString(), queryThread);
}
- /** For dunit test purpose */
+ // For dunit test purpose
if (GemFireCacheImpl.getInstance() != null
&& GemFireCacheImpl.getInstance().testMaxQueryExecutionTime > 0) {
if (this.queryMonitorTasks == null) {
@@ -113,14 +109,12 @@ public class QueryMonitor implements Runnable {
/**
* Stops monitoring the query. Removes the passed thread from QueryMonitor queue.
- *
- * @param queryThread
*/
public void stopMonitoringQueryThread(Thread queryThread, Query query) {
// Re-Set the queryExecution status on the LocalThread.
QueryExecutionTimeoutException testException = null;
- DefaultQuery q = (DefaultQuery) query;
- boolean[] queryCompleted = q.getQueryCompletedForMonitoring();
+ DefaultQuery defaultQuery = (DefaultQuery) query;
+ boolean[] queryCompleted = defaultQuery.getQueryCompletedForMonitoring();
synchronized (queryCompleted) {
queryExecutionStatus.get().getAndSet(Boolean.FALSE);
@@ -137,7 +131,7 @@ public class QueryMonitor implements Runnable {
// Its seen that in some cases based on OS thread scheduling the thread can sleep much
// longer than the specified time.
if (queryTask != null) {
- if ((currentTime - queryTask.StartTime) > maxTimeSet) {
+ if (currentTime - queryTask.StartTime > maxTimeSet) {
// The sleep() is unpredictable.
testException = new QueryExecutionTimeoutException(
"The QueryMonitor thread may be sleeping longer than"
@@ -148,7 +142,7 @@ public class QueryMonitor implements Runnable {
}
// END - DUnit Test purpose.
- q.setQueryCompletedForMonitoring(true);
+ defaultQuery.setQueryCompletedForMonitoring(true);
// Remove the query task from the queue.
queryThreads.remove(new QueryThreadTask(queryThread, null, null));
}
@@ -183,11 +177,11 @@ public class QueryMonitor implements Runnable {
*/
public void stopMonitoring() {
// synchronized in the rare case where query monitor was created but not yet run
- synchronized (stopped) {
+ synchronized (this.stopped) {
if (this.monitoringThread != null) {
this.monitoringThread.interrupt();
}
- stopped.set(Boolean.TRUE);
+ this.stopped.set(Boolean.TRUE);
}
}
@@ -195,26 +189,28 @@ public class QueryMonitor implements Runnable {
* Starts monitoring the query. If query runs longer than the set MAX_QUERY_EXECUTION_TIME,
* interrupts the thread executing the query.
*/
+ @Override
public void run() {
// if the query monitor is stopped before run has been called, we should not run
- synchronized (stopped) {
- if (stopped.get()) {
+ synchronized (this.stopped) {
+ if (this.stopped.get()) {
queryThreads.clear();
return;
}
this.monitoringThread = Thread.currentThread();
}
try {
- QueryThreadTask queryTask = null;
- long sleepTime = 0;
+ QueryThreadTask queryTask;
+ long sleepTime;
+ // TODO: while-block cannot complete without throwing
while (true) {
// Get the first query task from the queue. This query will have the shortest
// remaining time that needs to canceled first.
queryTask = (QueryThreadTask) queryThreads.peek();
if (queryTask == null) {
// Empty queue.
- synchronized (this.queryThreads) {
- this.queryThreads.wait();
+ synchronized (queryThreads) {
+ queryThreads.wait();
}
continue;
}
@@ -222,7 +218,7 @@ public class QueryMonitor implements Runnable {
long currentTime = System.currentTimeMillis();
// Check if the sleepTime is greater than the remaining query execution time.
- if ((currentTime - queryTask.StartTime) < this.maxQueryExecutionTime) {
+ if (currentTime - queryTask.StartTime < this.maxQueryExecutionTime) {
sleepTime = this.maxQueryExecutionTime - (currentTime - queryTask.StartTime);
// Its been noted that the sleep is not guaranteed to wait for the specified
// time (as stated in Suns doc too), it depends on the OSs thread scheduling
@@ -256,16 +252,18 @@ public class QueryMonitor implements Runnable {
logger.debug("Query Execution for the thread {} got canceled.", queryTask.queryThread);
}
}
- } catch (InterruptedException ex) {
+ } catch (InterruptedException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("Query Monitoring thread got interrupted.");
}
} finally {
- this.queryThreads.clear();
+ queryThreads.clear();
}
}
- // Assumes LOW_MEMORY will only be set if query monitor is enabled
+ /**
+ * Assumes LOW_MEMORY will only be set if query monitor is enabled
+ */
public static boolean isLowMemory() {
return LOW_MEMORY;
}
@@ -283,21 +281,22 @@ public class QueryMonitor implements Runnable {
}
public void cancelAllQueriesDueToMemory() {
- synchronized (this.queryThreads) {
+ synchronized (queryThreads) {
QueryThreadTask queryTask = (QueryThreadTask) queryThreads.poll();
while (queryTask != null) {
cancelQueryDueToLowMemory(queryTask, LOW_MEMORY_USED_BYTES);
queryTask = (QueryThreadTask) queryThreads.poll();
}
queryThreads.clear();
- queryThreads.notify();
+ queryThreads.notifyAll();
}
}
private void cancelQueryDueToLowMemory(QueryThreadTask queryTask, long memoryThreshold) {
boolean[] queryCompleted = ((DefaultQuery) queryTask.query).getQueryCompletedForMonitoring();
synchronized (queryCompleted) {
- if (!queryCompleted[0]) { // cancel if query is not completed
+ if (!queryCompleted[0]) {
+ // cancel if query is not completed
String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY
.toLocalizedString(memoryThreshold);
((DefaultQuery) queryTask.query).setCanceled(true,
@@ -307,25 +306,27 @@ public class QueryMonitor implements Runnable {
}
}
- // FOR TEST PURPOSE
+ /** FOR TEST PURPOSE */
public int getQueryMonitorThreadCount() {
- return this.queryThreads.size();
+ return queryThreads.size();
}
/**
* Query Monitoring task, placed in the queue.
- *
*/
- private class QueryThreadTask {
+ private static class QueryThreadTask {
- private final long StartTime;
+ // package-private to avoid synthetic accessor
+ final long StartTime;
- private final Thread queryThread;
+ // package-private to avoid synthetic accessor
+ final Thread queryThread;
- private final Query query;
-
- private final AtomicBoolean queryExecutionStatus;
+ // package-private to avoid synthetic accessor
+ final Query query;
+ // package-private to avoid synthetic accessor
+ final AtomicBoolean queryExecutionStatus;
QueryThreadTask(Thread queryThread, Query query, AtomicBoolean queryExecutionStatus) {
this.StartTime = System.currentTimeMillis();
@@ -358,9 +359,8 @@ public class QueryMonitor implements Runnable {
return new StringBuffer().append("QueryThreadTask[StartTime:").append(this.StartTime)
.append(", queryThread:").append(this.queryThread).append(", threadId:")
.append(this.queryThread.getId()).append(", query:").append(this.query.getQueryString())
- .append(", queryExecutionStatus:").append(this.queryExecutionStatus).append("]")
+ .append(", queryExecutionStatus:").append(this.queryExecutionStatus).append(']')
.toString();
}
-
}
}