GEODE-780: Change GFSH to not require Attach API when starting processes
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ecbd773a Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ecbd773a Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ecbd773a Branch: refs/heads/feature/GEODE-217 Commit: ecbd773a4eceaf86796d235fba130ab5b9197946 Parents: d863b6e Author: Kirk Lund <kl...@pivotal.io> Authored: Mon Jan 18 12:11:10 2016 -0800 Committer: Kirk Lund <kl...@pivotal.io> Committed: Mon Jan 18 12:11:10 2016 -0800 ---------------------------------------------------------------------- .../internal/process/AttachProcessUtils.java | 5 +++++ .../internal/process/NativeProcessUtils.java | 5 +++++ .../gemfire/internal/process/ProcessUtils.java | 16 ++++++++++++++-- .../cli/commands/LauncherLifecycleCommands.java | 4 ++-- 4 files changed, 26 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ecbd773a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/AttachProcessUtils.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/AttachProcessUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/AttachProcessUtils.java index 31f5e9e..3fe758e 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/AttachProcessUtils.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/AttachProcessUtils.java @@ -49,4 +49,9 @@ final class AttachProcessUtils implements InternalProcessUtils { public boolean isAvailable() { return true; } + + @Override + public boolean isAttachApiAvailable() { + return true; + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ecbd773a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/NativeProcessUtils.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/NativeProcessUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/NativeProcessUtils.java index 4896cdb..26a7722 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/NativeProcessUtils.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/NativeProcessUtils.java @@ -45,4 +45,9 @@ final class NativeProcessUtils implements InternalProcessUtils { public boolean isAvailable() { return true; } + + @Override + public boolean isAttachApiAvailable() { + return false; + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ecbd773a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/ProcessUtils.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/ProcessUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/ProcessUtils.java index edbb9bb..30f2713 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/ProcessUtils.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/process/ProcessUtils.java @@ -117,13 +117,20 @@ public final class ProcessUtils { } /** - * Returns true if a fully functional implementation is available. If the - * Attach API or JNA NativeCalls are available then this returns true. + * Returns true if Attach API or JNA NativeCalls is available for killing + * process or checking if it is alive. */ public static boolean isAvailable() { return internal.isAvailable(); } + /** + * Returns true if Attach API is available for checking status. + */ + public static boolean isAttachApiAvailable() { + return internal.isAttachApiAvailable(); + } + private static InternalProcessUtils initializeInternalProcessUtils() { // 1) prefer Attach because it filters out non-JVM processes try { @@ -169,6 +176,10 @@ public final class ProcessUtils { public boolean isAvailable() { return false; } + @Override + public boolean isAttachApiAvailable() { + return false; + } }; } @@ -179,5 +190,6 @@ public final class ProcessUtils { public boolean isProcessAlive(int pid); public boolean killProcess(int pid); public boolean isAvailable(); + public boolean isAttachApiAvailable(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ecbd773a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java index f540e19..e49acbe 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java @@ -425,7 +425,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport { TimeUnit.MILLISECONDS.timedWait(this, 500); } - locatorState = (ProcessUtils.isAvailable() ? locatorStatus(locatorPidFile, oldPid, memberName) + locatorState = (ProcessUtils.isAttachApiAvailable() ? locatorStatus(locatorPidFile, oldPid, memberName) : locatorStatus(workingDirectory, memberName)); String currentLocatorStatusMessage = locatorState.getStatusMessage(); @@ -1735,7 +1735,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport { TimeUnit.MILLISECONDS.timedWait(this, 500); } - serverState = (ProcessUtils.isAvailable() ? serverStatus(serverPidFile, oldPid, memberName) + serverState = (ProcessUtils.isAttachApiAvailable() ? serverStatus(serverPidFile, oldPid, memberName) : serverStatus(workingDirectory, memberName)); String currentServerStatusMessage = serverState.getStatusMessage();