|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcsp.win32.NTService
public abstract class NTService
Abstract class for declaring an NT service. A Java implementation of a service must declare the
startService and stopService methods. startService must run the
actual service and must block until the service is ready to terminate. For example it may sit in a loop
servicing requests. stopService will be called when startService is expected
to stop blocking and return. The stopService method should return promptly. Any time
consuming shutdown code should be done asynchronously (for example in the startService
thread) before startService returns.
For example:
public class MyService extends NTService {
boolean running = true;
protected void startService () {
while (running) {
System.beep ();
Thread.sleep (1000);
}
}
protected void stopService () {
running = false;
}
private MyService () {
super ("MyService");
}
public static void main (String[] args) {
new MyService ().run ();
}
}
| Constructor Summary | |
|---|---|
protected |
NTService(String serviceName)
Creates a new NT service wrapper with the given name. |
| Method Summary | |
|---|---|
protected void |
run()
Runs the service, registering it with the NT service dispatcher. |
protected abstract void |
startService()
This will be called when the service is started and must block until the service completes. |
protected abstract void |
stopService()
This will be called when the service is stopped and the startService method must
terminate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected NTService(String serviceName)
| Method Detail |
|---|
protected abstract void startService()
protected abstract void stopService()
startService method must
terminate.
protected final void run()
StarterThread and StopperThread objects
and threads internal to the DLL.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||