public class W32Service
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
(package private) Winsvc.SC_HANDLE |
_handle |
Constructor and Description |
---|
W32Service(Winsvc.SC_HANDLE handle)
Win32 Service
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close service.
|
void |
continueService()
Continue service.
|
Winsvc.ENUM_SERVICE_STATUS[] |
enumDependentServices(int dwServiceState)
Retrieves the name and status of each service that depends on the
specified service; that is, the specified service must be running before
the dependent services can run.
|
Winsvc.SERVICE_FAILURE_ACTIONS |
getFailureActions()
Get the failure actions of the specified service.
|
boolean |
getFailureActionsFlag()
Get the failure actions flag of the specified service.
|
Winsvc.SC_HANDLE |
getHandle()
Gets the service handle.
|
void |
pauseService()
Pause service.
|
Winsvc.SERVICE_STATUS_PROCESS |
queryStatus()
Retrieves the current status of the specified service based on the
specified information level.
|
(package private) int |
sanitizeWaitTime(int dwWaitHint)
do not wait longer than the wait hint.
|
void |
setFailureActions(java.util.List<Winsvc.SC_ACTION> actions,
int resetPeriod,
java.lang.String rebootMsg,
java.lang.String command)
Set the failure actions of the specified service.
|
void |
setFailureActionsFlag(boolean flagValue)
Set the failure action flag of the specified service.
|
void |
startService() |
void |
stopService()
Stop service.
|
void |
stopService(long timeout)
Stop service.
|
void |
waitForNonPendingState()
Wait for the state to change to something other than a pending state.
|
Winsvc.SC_HANDLE _handle
public W32Service(Winsvc.SC_HANDLE handle)
handle
- A handle to the service. This handle is returned by the
CreateService or OpenService function, and it must have the
SERVICE_QUERY_STATUS access right.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void setFailureActions(java.util.List<Winsvc.SC_ACTION> actions, int resetPeriod, java.lang.String rebootMsg, java.lang.String command)
public Winsvc.SERVICE_FAILURE_ACTIONS getFailureActions()
public void setFailureActionsFlag(boolean flagValue)
public boolean getFailureActionsFlag()
public Winsvc.SERVICE_STATUS_PROCESS queryStatus()
public void startService()
public void stopService()
public void stopService(long timeout)
timeout
- timeout in ms until the service must report to be stoppedpublic void continueService()
public void pauseService()
int sanitizeWaitTime(int dwWaitHint)
public void waitForNonPendingState()
public Winsvc.SC_HANDLE getHandle()
public Winsvc.ENUM_SERVICE_STATUS[] enumDependentServices(int dwServiceState)
dwServiceState
- The state of the services to be enumerated. This
parameter can be one of the following values.
Value | Meaning |
---|---|
Winsvc.SERVICE_ACTIVE | Enumerates services that
are in the following states:
Winsvc.SERVICE_START_PENDING , Winsvc.SERVICE_STOP_PENDING , Winsvc.SERVICE_RUNNING , Winsvc.SERVICE_CONTINUE_PENDING , Winsvc.SERVICE_PAUSE_PENDING ,
and Winsvc.SERVICE_PAUSED . |
Winsvc.SERVICE_INACTIVE | Enumerates services that
are in the Winsvc.SERVICE_STOPPED state. |
Winsvc.SERVICE_STATE_ALL | Combines the following
states: Winsvc.SERVICE_ACTIVE and
Winsvc.SERVICE_INACTIVE . |