SGF-498 - Fix apache-geode build due to recent changes in Apache Geode that removed the SharedConfiguration.destroySharedConfiguration() method from the API.

This commit is contained in:
John Blum
2016-05-08 18:23:43 -07:00
parent 54befa0522
commit b42442d9cd
2 changed files with 11 additions and 18 deletions

View File

@@ -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 extends Locator> T getLocator() {
return (T) InternalLocator.getLocator();
}
}

View File

@@ -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);
}
}
}