Package com.ms.service |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public abstract class Service { // Fields protected static boolean disableassassin; public static final int START_PENDING = 2; public static final int STOP_PENDING = 3; public static final int RUNNING = 4; public static final int CONTINUE_PENDING = 5; public static final int PAUSE_PENDING = 6; public static final int PAUSE = 7; public static final int ACCEPT_STOP = 1; public static final int ACCEPT_PAUSE_CONTINUE = 2; public static final int ACCEPT_SHUTDOWN = 4; // Constructor protected Service(); // Methods public boolean setAutoDumpErr(boolean autodump); public static boolean setAutoDumpOut(boolean autodump); protected boolean setServiceStatus(ServiceStatus newstatus) public ServiceStatus getServiceStatus(); protected void CheckPoint(); protected void CheckPoint(int waithint); protected void setRunning (); protected void setRunning(int controls); protected void setPausing(int waithint); protected void setPaused(); protected void setContinuing(int waithint); protected void setStopping(int waithint); public int getCurrentState(); public int getControlsAccepted(); public boolean canStop(); public boolean canPause(); public boolean canShutdown(); public int getCheckPoint(); public int getWaitHint(); protected boolean handleStop(); protected boolean handleInterrogate(); protected boolean handlePause(); protected boolean handleContinue(); protected boolean handleShutdown(); protected void StopServiceEventHandler(int waithint); }
protected Service();Constructs a new service.
Note Because Service is an abstract class, you need to derive your own class from it rather than creating an instance of it.
protected void CheckPoint();Increments the current checkpoint value.
Return Value:
No return value.
Remarks:
During a pending operation, the service should call the CheckPoint method to indicate that it has made progress toward a non-pending state (that is, changing state from pending to start, stop, continue, or paused).
protected void CheckPoint(int waithint);Sets the checkpoint to the specified value.
Parameter Description checkpoint Value of the checkpoint.
public boolean canPause();Indicates whether the service can be paused.
Return Value:
Returns true if the service can be paused (ACCEPT_PAUSE_CONTINUE); otherwise, returns false.
public boolean canShutdown();Indicates whether the service should be notified when the system shuts down.
Return Value:
Returns true if the service can accept shutdown requests (ACCEPT_SHUTDOWN); otherwise, returns false.
public boolean canStop();Indicates whether the service can be stopped.
Return Value:
Returns true if the service can be stopped (ACCEPT_STOP); otherwise, returns false.
public int getCheckPoint();Determines the service's checkpoint.
Return Value:
Returns the current checkpoint value.
public int getControlsAccepted();Indicates the control codes that the service will accept and process.
Return Value:
Returns flags indicating which controls the service will accept.
public int getCurrentState();Determines the service's state.
Return Value:
Returns the system's current state.
public ServiceStatus getServiceStatus();Determines the service's status.
Return Value:
Returns a copy of the service's ServiceStatus.
public int getWaitHint();Determines the wait hint.
Return Value:
Returns the service's wait hint.
Remarks:
The wait hint value specifies the amount of time (in milliseconds) the service expects to be in the current pending state. If this value is exceeded by the service, the service is terminated.
protected boolean handleContinue();Handles the continue request.
Return Value:
Returns true if the service should shut down; otherwise, it returns false.
protected boolean handleInterrogate();Handles the interrogate request.
Return Value:
Returns true if the service should shut down; otherwise, it returns false.
protected boolean handlePause();Handles the pause request.
Return Value:
Returns true if the service should shut down; otherwise, it returns false.
protected boolean handleShutdown();Handles the shutdown request.
Return Value:
Returns true if the service should shut down; otherwise, it returns false.
protected boolean handleStop();Handles the stop request.
Return Value:
Returns true if the service should shut down; otherwise, it returns false.
public boolean setAutoDumpErr(boolean autodump);Changes when errors are flushed to the event log.
Return Value:
Returns the previous auto-flush state.
Parameter Description autodump Set to true to automatically flush to the Windows NT® event log whenever a new line is written. Set to false to enable the writing of multiline error messages. You must manage the flushing of the stream by calling System.err.flush().
public boolean setAutoDumpOut(boolean autodump);Return Value:
Returns the previous auto-flush state.
Parameter Description autodump Set to true to automatically flush to the Windows NT® event log whenever a new line is written. Set to false to enable the writing of multiline log messages. You must manage the flushing of the stream by calling System.out.flush().
protected void setContinuing (int waithint);Sets the service to CONTINUE_PENDING.
Return Value:
No return value.
Parameter Description waithint Value to set waithint (estimate of the time in milliseconds to reach the continued state).
protected void setPaused();Sets the service to the PAUSED state.
Return Value:
No return value.
protected void setPausing(int waithint);Sets the service to PAUSE_PENDING and the wait hint to waithint.
Return Value:
No return value.
Parameter Description waithint Value to set waithint (estimate of the time in milliseconds to reach the PAUSED state).
protected void setRunning();Sets the service to RUNNING.
Return Value:
No return value.
protected void setRunning(int controls);Sets the service to RUNNING, and sets the ControlsAccepted field in the ServiceStatus object to the specified controls value.
Return Value:
No return value.
Parameter Description controls The controls to set ControlsAccepted to.
protected boolean setServiceStatus(ServiceStatus newstatus);Changes the value of the service's ServiceStatus.
Return Value:
Returns true if the status was updated; false if the newstatus parameter is not correct.
Parameter Description newstatus Value to set the service's status to. The state in newstatus is copied to the current status.
protected void setStopping(int waithint);Sets the service to STOP_PENDING and wait hint to waithint.
Return Value:
No return value.
Parameter Description waithint Value to set wait hint to (estimate of the time in milliseconds to reach the STOPPED state).
protected void StopServiceEventHandler(int waithint);Internally stops the service. Sets the service to STOP_PENDING and the wait hint to waithint. No more control commands will be dispatched.
Return Value:
No return value
Parameter Description waithint Value to set wait hint (estimate of the time in milliseconds for the service to shut down).
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.