User-defined start classes

You can define start classes that are loaded automatically when the server is started. The purpose of this feature is to allow you to write Java code that executes at the time the MobiLink server starts the Java VM—before the first synchronization. This means you can create connections or cache data before a user synchronization request.

You do this with the DMLStartClasses option of the mlsrv12 -sl java option. For example, the following is part of a mlsrv12 command line. It causes mycl1 and mycl2 to be loaded as start classes.

-sl java(-DMLStartClasses=com.test.mycl1,com.test.mycl2)

Classes are loaded in the order in which they are listed. If the same class is listed more than once, more than one instance is created.

All start classes must be public and must have a public constructor that either accepts no arguments or accepts one argument of type ianywhere.ml.script.ServerContext.

The names of loaded start classes are output to the MobiLink log with the message "Loaded JAVA start class: classname".

For more information about Java VM options, see -sl java mlsrv12 option.

To see the start classes that are constructed at server start time, see getStartClassInstances method.

 Example