To turn your server application into an NT service, first ensure that your image holds the IBM ST: Server Workbench, Base feature and the application you want to deploy as an NT service. With the feature and your application loaded, complete the following steps:
The first method, which goes in your application class, provides an entry point into the application. This method should complete the start up of your service application by immediately sending the following message:
AbtNtServiceInterface default registerService: aClassName stopSelector: aSelector
aClassName is the class that implements aSelector. This selector's method will be invoked when the Windows NT Service Control Manager sends a SERVICE_STOP message to the service. A sample VisualAge NT service application provided with the Server Workbench feature, AbtNtServiceExampleApp, sends the following method:
AbtNtServiceInterface default registerService: self name stopSelector: #stopping.
Registering the stop selector also tells the SCM that the service has started. Failure to send the message immediately may result in an error in starting the service as the SCM might time out waiting for notification that the service has started.
The second method, a class method aSelector in the class aClassName, should stop your application's processing in an orderly manner. When this method returns, VisualAge Smalltalk will exit with a return code of 0.
For more information about installing your application as an NT service, refer to the VisualAge Smalltalk User's Guide.