org.zeroturnaround.process
Class Java8Process

java.lang.Object
  extended by org.zeroturnaround.process.AbstractProcess
      extended by org.zeroturnaround.process.JavaProcess
          extended by org.zeroturnaround.process.Java8Process
All Implemented Interfaces:
SystemProcess

public class Java8Process
extends JavaProcess

Wrapper for Process since Java 8.

Java 8 added following methods:


Field Summary
 
Fields inherited from class org.zeroturnaround.process.JavaProcess
process
 
Constructor Summary
Java8Process(Process process)
           
 
Method Summary
protected  boolean canDestroy(boolean forceful)
           
protected  void invokeDestroy(boolean forceful)
           
 Process invokeDestroyForcibly()
           
 boolean isAlive()
          Tests whether this process is alive.
static boolean isSupported()
           
 boolean waitFor(long timeout, TimeUnit unit)
          Causes the current thread to wait, if necessary, until the process handled by this killer has terminated, or the specified waiting time elapses.
 
Methods inherited from class org.zeroturnaround.process.JavaProcess
destroy, getDescription, getProcess, waitFor
 
Methods inherited from class org.zeroturnaround.process.AbstractProcess
destroyForcefully, destroyGracefully, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Java8Process

public Java8Process(Process process)
Method Detail

isSupported

public static boolean isSupported()

canDestroy

protected boolean canDestroy(boolean forceful)
Overrides:
canDestroy in class JavaProcess
Returns:
true if JavaProcess.invokeDestroy(boolean) is supported with the given forceful flag on the given system.

invokeDestroy

protected void invokeDestroy(boolean forceful)
Overrides:
invokeDestroy in class JavaProcess

invokeDestroyForcibly

public Process invokeDestroyForcibly()

isAlive

public boolean isAlive()
Description copied from interface: SystemProcess
Tests whether this process is alive.

This operation may also take some time to finish.

Specified by:
isAlive in interface SystemProcess
Overrides:
isAlive in class JavaProcess
Returns:
true if this process is alive, false if it is finished or not found.

waitFor

public boolean waitFor(long timeout,
                       TimeUnit unit)
                throws InterruptedException
Description copied from class: AbstractProcess
Causes the current thread to wait, if necessary, until the process handled by this killer has terminated, or the specified waiting time elapses.

If the process has already terminated then this method returns immediately with the value true. If the process has not terminated and the timeout value is less than, or equal to, zero, then this method returns immediately with the value false.

Specified by:
waitFor in interface SystemProcess
Overrides:
waitFor in class AbstractProcess
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
true if the process has exited and false if the waiting time elapsed before the process has exited.
Throws:
InterruptedException


Copyright © 2015 ZeroTurnaround. All rights reserved.