From b42442d9cdd361286f883701f2aabc5cf2f0f038 Mon Sep 17 00:00:00 2001 From: John Blum Date: Sun, 8 May 2016 18:23:43 -0700 Subject: [PATCH] SGF-498 - Fix apache-geode build due to recent changes in Apache Geode that removed the SharedConfiguration.destroySharedConfiguration() method from the API. --- .../gemfire/util/DistributedSystemUtils.java | 7 ++++++ .../data/gemfire/fork/LocatorProcess.java | 22 ++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/springframework/data/gemfire/util/DistributedSystemUtils.java b/src/main/java/org/springframework/data/gemfire/util/DistributedSystemUtils.java index b7e77d36..c0982ca8 100644 --- a/src/main/java/org/springframework/data/gemfire/util/DistributedSystemUtils.java +++ b/src/main/java/org/springframework/data/gemfire/util/DistributedSystemUtils.java @@ -24,8 +24,10 @@ import org.springframework.util.StringUtils; import com.gemstone.gemfire.cache.GemFireCache; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.distributed.Locator; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +import com.gemstone.gemfire.distributed.internal.InternalLocator; import com.gemstone.gemfire.internal.DistributionLocator; /** @@ -89,4 +91,9 @@ public abstract class DistributedSystemUtils extends SpringUtils { return (gemfireCache != null ? (T) gemfireCache.getDistributedSystem() : null); } + /* (non-Javadoc)*/ + @SuppressWarnings("unchecked") + public static T getLocator() { + return (T) InternalLocator.getLocator(); + } } diff --git a/src/test/java/org/springframework/data/gemfire/fork/LocatorProcess.java b/src/test/java/org/springframework/data/gemfire/fork/LocatorProcess.java index ed99a288..c0cfbe02 100644 --- a/src/test/java/org/springframework/data/gemfire/fork/LocatorProcess.java +++ b/src/test/java/org/springframework/data/gemfire/fork/LocatorProcess.java @@ -21,14 +21,15 @@ import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; +import org.springframework.data.gemfire.GemfireUtils; import org.springframework.data.gemfire.process.support.ProcessUtils; import org.springframework.data.gemfire.test.support.FileSystemUtils; import org.springframework.data.gemfire.test.support.ThreadUtils; +import com.gemstone.gemfire.distributed.Locator; import com.gemstone.gemfire.distributed.LocatorLauncher; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalLocator; -import com.gemstone.gemfire.distributed.internal.SharedConfiguration; /** * The LocatorProcess class is a main Java class that is used fork and launch a GemFire Locator process using the @@ -130,28 +131,14 @@ public class LocatorProcess { private static void registerShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { - stopLocator(stopSharedConfigurationService(InternalLocator.getLocator())); + stopLocator(GemfireUtils.getLocator()); } - private void stopLocator(final InternalLocator locator) { + private void stopLocator(final Locator locator) { if (locator != null) { locator.stop(); } } - - private InternalLocator stopSharedConfigurationService(final InternalLocator locator) { - if (isClusterConfigurationEnabled(locator)) { - SharedConfiguration sharedConfiguration = locator.getSharedConfiguration(); - - if (sharedConfiguration != null) { - if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) { - sharedConfiguration.destroySharedConfiguration(); - } - } - } - - return locator; - } })); } @@ -170,5 +157,4 @@ public class LocatorProcess { TimeUnit.MILLISECONDS); } } - }