1.1.4 How does the Java Service Manager work?
On IBM i, the Java Service Manager is started using the STRJSM command on the JSM Menu which is described in Java Service Manager Administration for IBM i. The STRJSM command starts a JSM instance in the JSM subsystem. More than one JSM instance can be running. Each JSM instance has its own Java Virtual Machine. The Java Service Manager runs in the JSM subsystem waiting for service requests from a JSM Client.
On Windows, if the JSM Administrator service's Start-up Type is set to Automatic, Microsoft Service Control Manager will start the service automatically during system startup. If it is set to Manual, you need to use Microsoft Service Control Manager to start the JSM Administrator. JSM Administrator starts the Java Virtual Machine and launches the Java Service Manager. Once started, the JSM Administrator will wait for service requests from a JSM Client.
On Linux, the JSM Administrator is started with the strjsm program, which starts the Java Virtual Machine and launches the Java Service Manager. The Java Service Manager will then wait for service requests from a JSM Client.
The JSM Client begins by sending a request to open a connection to the Java Service Manager. If the JSM Client is a LANSA function, then the JSM_OPEN Built-In Function is used to open the connection. The Java Service Manager will start a new thread on the server. Each JSM Client has its own thread managed by the Java Service Manager.
The JSM Client can be a LANSA function or 3GL program. Using JSMDirect, the LANSA function can be invoked from a CGI program using an HTTP request from a client. JSMDirect allows the functions to execute over the Internet to support applications such as 2-way XML. The LANSA function to be executed is defined in the DC@W29 file on IBM i or in file dc_w29.txt on Windows or Linux. JSMDirect automatically handles the reading and writing of the data stream. (Refer to 1.1.3 What is JSMDirect?)
Once a thread is started, the JSM Client can issue a series of COMMANDS to load or unload specific service classes. Only one service class can be loaded at a time. The JSM_COMMAND BIF is also used to execute specific commands in the loaded service. For example, once the FTPService has been loaded, commands are used to LOGIN to the FTP server and GET or PUT files. The Java Service Manager interacts with the Java classes used by the service in order to perform the required FTP operations.
Once the JSM Client has finished, it will send a request to close the connection. The JSM_CLOSE BIF is used to close the connection.