public class SystemService extends Object
init
services.Modifier and Type | Class and Description |
---|---|
static class |
SystemService.State
State of a known
init service. |
Constructor and Description |
---|
SystemService() |
Modifier and Type | Method and Description |
---|---|
static SystemService.State |
getState(String service)
Return current state of given service.
|
static boolean |
isRunning(String service)
Check if given service is
SystemService.State.RUNNING . |
static boolean |
isStopped(String service)
Check if given service is
SystemService.State.STOPPED . |
static void |
restart(String name)
Request that the init daemon restart a named service.
|
static void |
start(String name)
Request that the init daemon start a named service.
|
static void |
stop(String name)
Request that the init daemon stop a named service.
|
static void |
waitForAnyStopped(String... services)
Wait until any of given services enters
SystemService.State.STOPPED . |
static void |
waitForState(String service,
SystemService.State state,
long timeoutMillis)
Wait until given service has entered specific state.
|
public static void start(String name)
public static void stop(String name)
public static void restart(String name)
public static SystemService.State getState(String service)
public static boolean isStopped(String service)
SystemService.State.STOPPED
.public static boolean isRunning(String service)
SystemService.State.RUNNING
.public static void waitForState(String service, SystemService.State state, long timeoutMillis) throws TimeoutException
TimeoutException
public static void waitForAnyStopped(String... services)
SystemService.State.STOPPED
.