public ProcessController createProcessController(final ProcessControllerParameters arguments, final File pidFile) throws IOException { return createProcessController(arguments, readPid(pidFile)); }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final File directory, final String pidFilename) throws IOException { return createProcessController(arguments, readPid(directory, pidFilename)); }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final File directory, final String pidFilename, final long timeout, final TimeUnit unit) throws IOException, InterruptedException, TimeoutException { if (arguments == null) { throw new NullPointerException("ProcessControllerParameters must not be null"); } if (directory == null) { throw new NullPointerException("Directory must not be null"); } if (pidFilename == null) { throw new NullPointerException("Pid file name must not be null"); } return createProcessController(arguments, new PidFile(directory, pidFilename).readPid(timeout, unit)); }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final File pidFile, final long timeout, final TimeUnit unit) throws IOException, InterruptedException, TimeoutException { if (arguments == null) { throw new NullPointerException("ProcessControllerParameters must not be null"); } if (pidFile == null) { throw new NullPointerException("Pid file must not be null"); } return createProcessController(arguments, new PidFile(pidFile).readPid(timeout, unit)); }
private void validateProcessControllerFactory(boolean isAttachAPIFound) throws Exception { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertEquals(isAttachAPIFound, factory.isAttachAPIFound()); if (isAttachAPIFound) { final ProcessControllerParameters parms = new NullMBeanControllerParameters(); final ProcessController controller = factory.createProcessController(parms, ProcessUtils.identifyPid()); assertTrue(controller instanceof MBeanProcessController); } else { final ProcessControllerParameters parms = new NullFileControllerParameters(); final ProcessController controller = factory.createProcessController(parms, ProcessUtils.identifyPid()); assertTrue(controller instanceof FileProcessController); } }
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 e) { // failed to attach to locator JVM return createNoResponseState(e, "Failed to connect to locator with process id " + getPid()); } catch (IOException e) { // failed to open or read file or dir return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (MBeanInvocationFailedException e) { // MBean either doesn't exist or method or attribute don't exist return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (UnableToControlProcessException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return createNoResponseState(e, "Interrupted while trying to communicate with locator with process id " + getPid()); } catch (TimeoutException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + 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 e) { // failed to attach to locator JVM return createNoResponseState(e, "Failed to connect to locator with process id " + getPid()); } catch (IOException e) { // failed to open or read file or dir return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (MBeanInvocationFailedException e) { // MBean either doesn't exist or method or attribute don't exist return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (UnableToControlProcessException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return createNoResponseState(e, "Interrupted while trying to communicate with locator with process id " + getPid()); } catch (TimeoutException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } }
private LocatorState statusWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName()); parsedPid = controller.getProcessId();
private LocatorState statusWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); parsedPid = controller.getProcessId();
private ServerState statusWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); parsedPid = controller.getProcessId();
private ServerState stopWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); parsedPid = controller.getProcessId();
private LocatorState stopWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); parsedPid = controller.getProcessId();
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 e) { // failed to attach to locator JVM return createNoResponseState(e, "Failed to connect to locator with process id " + getPid()); } catch (IOException e) { // failed to open or read file or dir return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (MBeanInvocationFailedException e) { // MBean either doesn't exist or method or attribute don't exist return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (UnableToControlProcessException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } }
private ServerState stopWithPid() { try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); controller.stop(); return new ServerState(this, Status.STOPPED); } catch (ConnectionFailedException e) { // failed to attach to server JVM return createNoResponseState(e, "Failed to connect to server with process id " + getPid()); } catch (IOException e) { // failed to open or read file or dir return createNoResponseState(e, "Failed to communicate with server with process id " + getPid()); } catch (MBeanInvocationFailedException e) { // MBean either doesn't exist or method or attribute don't exist return createNoResponseState(e, "Failed to communicate with server with process id " + getPid()); } catch (UnableToControlProcessException e) { // TODO comment me return createNoResponseState(e, "Failed to communicate with server with process id " + getPid()); } }
private LocatorState stopWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName()); parsedPid = controller.getProcessId();
private ServerState stopWithWorkingDirectory() { int parsedPid = 0; try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName()); parsedPid = controller.getProcessId();
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 e) { // failed to attach to locator JVM return createNoResponseState(e, "Failed to connect to locator with process id " + getPid()); } catch (IOException e) { // failed to open or read file or dir return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (MBeanInvocationFailedException e) { // MBean either doesn't exist or method or attribute don't exist return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } catch (UnableToControlProcessException e) { return createNoResponseState(e, "Failed to communicate with locator with process id " + getPid()); } }
private ServerState stopWithPid() { try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); controller.stop();
private ServerState statusWithPid() { try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); final String statusJson = controller.status();
private ServerState statusWithPid() { try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); final String statusJson = controller.status();