Repository: geode Updated Branches: refs/heads/develop 64798a583 -> aa189b1a6
GEODE-2959: remove DistributedSystem instance in tearDown Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/aa189b1a Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/aa189b1a Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/aa189b1a Branch: refs/heads/develop Commit: aa189b1a620e543c5fabf007384612f20376be4c Parents: 64798a5 Author: Kirk Lund <[email protected]> Authored: Mon May 22 11:03:43 2017 -0700 Committer: Kirk Lund <[email protected]> Committed: Mon May 22 11:23:28 2017 -0700 ---------------------------------------------------------------------- .../org/apache/geode/distributed/DistributedSystem.java | 11 +++++------ .../distributed/internal/InternalDistributedSystem.java | 4 ++++ .../internal/cache/xmlcache/CacheXmlParserJUnitTest.java | 6 ++++++ 3 files changed, 15 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/aa189b1a/geode-core/src/main/java/org/apache/geode/distributed/DistributedSystem.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/DistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/DistributedSystem.java index 29ebf06..13a1721 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/DistributedSystem.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/DistributedSystem.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.distributed; import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; @@ -225,16 +224,16 @@ public abstract class DistributedSystem implements StatisticsFactory { protected static boolean removeSystem(InternalDistributedSystem oldSystem) { synchronized (existingSystemsLock) { - ArrayList l = new ArrayList(existingSystems); - boolean result = l.remove(oldSystem); + List listOfSystems = new ArrayList(existingSystems); + boolean result = listOfSystems.remove(oldSystem); if (result) { - int size = l.size(); + int size = listOfSystems.size(); if (size == 0) { existingSystems = Collections.EMPTY_LIST; } else if (size == 1) { - existingSystems = Collections.singletonList(l.get(0)); + existingSystems = Collections.singletonList(listOfSystems.get(0)); } else { - existingSystems = Collections.unmodifiableList(l); + existingSystems = Collections.unmodifiableList(listOfSystems); } } return result; http://git-wip-us.apache.org/repos/asf/geode/blob/aa189b1a/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 eeb44e7a..7caad3f 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 @@ -330,6 +330,10 @@ public class InternalDistributedSystem extends DistributedSystem return sys; } + public static boolean removeSystem(InternalDistributedSystem oldSystem) { + return DistributedSystem.removeSystem(oldSystem); + } + /** * Returns a connection to the distributed system that is suitable for administration. For * administration, we are not as strict when it comes to existing connections. http://git-wip-us.apache.org/repos/asf/geode/blob/aa189b1a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java index b0f5c8d..4043888 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java @@ -26,6 +26,7 @@ import static org.mockito.Mockito.when; import org.apache.geode.distributed.internal.DM; import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.test.junit.categories.UnitTest; +import org.junit.After; import org.junit.Test; import org.junit.experimental.categories.Category; import org.xml.sax.Attributes; @@ -49,6 +50,11 @@ public class CacheXmlParserJUnitTest { private static final String NAMESPACE_URI = "urn:java:org.apache.geode.internal.cache.xmlcache.MockXmlParser"; + @After + public void tearDown() throws Exception { + InternalDistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance()); + } + /** * Test {@link CacheXmlParser#getDelegate(String)}. *
