@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertTrue(factory.isAttachAPIFound()); } });
public ProcessController createProcessController(final ProcessControllerParameters arguments, final File pidFile) throws IOException { return createProcessController(arguments, readPid(pidFile)); }
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 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); } }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final int pid) { if (arguments == null) { throw new NullPointerException("ProcessControllerParameters must not be null"); } if (pid < 1) { throw new IllegalArgumentException("Invalid pid '" + pid + "' specified"); } try { if (isAttachAPIFound()) { return new MBeanProcessController((MBeanControllerParameters)arguments, pid); } else { return new FileProcessController((FileControllerParameters)arguments, pid); } } catch (final ExceptionInInitializerError e) { //LOGGER.warn("Attach API class not found", e); } return null; }
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)); }
return readPid(files[0]);
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()); } }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final int pid) { if (pid < 1) { throw new IllegalArgumentException("Invalid pid '" + pid + "' specified"); } try { if (isAttachAPIFound()) { return new MBeanProcessController((MBeanControllerParameters)arguments, pid); } else { return new FileProcessController((FileControllerParameters)arguments, pid); } } catch (final ExceptionInInitializerError e) { //LOGGER.warn("Attach API class not found", e); } return null; }
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)); }
@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertTrue(factory.isAttachAPIFound()); } });
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()); } }
public ProcessController createProcessController(final ProcessControllerParameters arguments, final File directory, final String pidFilename) throws IOException { return createProcessController(arguments, readPid(directory, pidFilename)); }
@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertTrue(factory.isAttachAPIFound()); } });
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()); } }
@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertTrue(factory.isAttachAPIFound()); } });
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()); } }
@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertFalse(factory.isAttachAPIFound()); } });
private ServerState stopWithPid() { try { final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, getPid()); controller.checkPidSupport(); controller.stop();
@Override public void run() { final ProcessControllerFactory factory = new ProcessControllerFactory(); assertFalse(factory.isAttachAPIFound()); } });