@Override public int getProcessId() { return getPid(); }
private LocatorState statusWithPid() { try { final ProcessController controller = new ProcessControllerFactory() .createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); final String statusJson = controller.status(); return LocatorState.fromJson(statusJson); } catch (ConnectionFailedException handled) { // failed to attach to locator JVM return createNoResponseState(handled, "Failed to connect to locator with process id " + getPid()); } catch (IOException | MBeanInvocationFailedException | UnableToControlProcessException | TimeoutException handled) { return createNoResponseState(handled, "Failed to communicate with locator with process id " + getPid()); } catch (InterruptedException handled) { Thread.currentThread().interrupt(); return createNoResponseState(handled, "Interrupted while trying to communicate with locator with process id " + getPid()); } }
private LocatorState stopWithPid() { try { final ProcessController controller = new ProcessControllerFactory() .createProcessController(new LocatorControllerParameters(), getPid()); controller.checkPidSupport(); controller.stop(); return new LocatorState(this, Status.STOPPED); } catch (ConnectionFailedException handled) { // failed to attach to locator JVM return createNoResponseState(handled, "Failed to connect to locator with process id " + getPid()); } catch (IOException | MBeanInvocationFailedException | UnableToControlProcessException handled) { return createNoResponseState(handled, "Failed to communicate with locator with process id " + getPid()); } }
else if (getPid() != null) { return stopWithPid();