When creating headless applications, you should include a System exit in your application. You can use the System exit either in the application itself or in the Application Entry Point startup code. The System exit lets the runtime environment know that the user application is finished processing.
![]() |
The traditional and standard lightweight sysadmin graceful process termination mechanism on UNIX platforms has long been the sending of a SIGTERM signal. When the Smalltalk virtual machine receives this signal, it causes the directed message residing in the class variable TerminateMessage of the class EmSystemConfiguration to be sent. By default, this will execute System exit. You can override this behavior to add shutdown code that is specific to your application by executing System terminateMessage: yourDirectedMessage. Typically, when you customize your own TerminateMessage, its last statement will be System exit.
|
|
Use the UNIX kill command line utility to send the SIGTERM signal to your Smalltalk process. The kill command needs only one argument when sending SIGTERM -- the process ID (pid) of the process to be signalled. The Smalltalk VM will print out its pid to the standard output stream when it comes up. For example, if the pid of your Smalltalk VM is 12345, you can gracefully bring this VM down from a UNIX shell prompt with the command: kill 12345 |
Because only headless applications can run in the native server environments, you must make or modify your server applications so they contain no Smalltalk code or VisualAge visual parts which provide a UI.
This means that your server applications cannot have UI applications as prerequisites. Examples of UI applications are AbtRunViewsApp and CommonWidgets.
When you create an application in the VisualAge Organizer, it will name AbtViewApplication as a prerequisite. If you intend to package this application with the Server Workbench feature, you must change the prerequisite to AbtRunPartsApp. By doing so, you can only create nonvisual parts, Smalltalk classes, and Smalltalk extensions in your application. Attempting to use visual parts will result in messages to the Transcript indicating undefined references to applications outside the prerequisite chain.
This also means that your server applications cannot contain code that provides a UI.
Because your server applications must be headless, the applications must obtain any input from users through means such as the following:
Generally, your applications will obtain user input from client code. To obtain such input, your applications must provide interfaces that let client applications supply any needed information to your server applications.
If you intend to translate your server applications, you must also externalize strings in your applications. To do this, follow the steps outlined in materials on National Language Support (NLS) in the VisualAge Smalltalk User's Guide. The steps explain how to add methods such as abtExternalizedStringBuildingInfo to an application class, build message and pool repository (.mpr) files, and bind image strings using menu choices available from the NLS menu choice of the Transcript's Tools menu.
When packaging server applications which use .mpr files, you may want to remove externalized strings from the .mpr files and include them in the packaged image.
To do this, when at the Modify Instructions step during packaging, select the Dumper policy type from the Policies panel. For more information on packaging, see Packaging a Smalltalk image.