getservicestate

Description

Returns the state of service components executing in the server.

Syntax

Local mode support: No.

Command line:

getservicestate connect-args servicename

Ant build file:

<jag_getsevicestate servicename=”servicename

Option

Description

Required

connect-args

Arguments to specify a connection to the server. See “Using connected mode”.

Yes

servicename

The name of the service to query, or all to list the state of all services. jagtool fails with an error message if you specify the name of a service that is not installed or that does not implement the interface CtsServices::ExtendedService.

Yes

Returns

Return value

Indicates

0

The command ran successfully; the result is true/success.

1

The command ran successfully; the result is false/failure.

2

The command did not run successfully; an exception was thrown.

Usage

This command prints the service state, using the terms listed in Table 12-5.

Table 12-5: Service states

State

Description

UNKNOWN

The state is unknown because the service does not implement the CtsServices::ExtendedService interface.

STARTING

The service is starting. The start method has been called, but has not returned.

STARTED

The service is started, but not yet running. The start method has returned, but run has not been called.

RUNNING

The service is running, that is, executing the run method.

FINISHED

The service is finished processing. The run method has returned. This state applies only to services that do not run continuously until stopped.

STOPPING

The service is stopping. The stop method has been called, and is still running.

STOPPED

The service is stopped. The stop method has been called and has returned.

For example, this is the typical output for a server where the message service is not installed:

jagtool getservicestate all
JaguarServlet/ServletService's state is RUNNING
CosNaming/JNameService's state is FINISHED

This command is useful when running jagtool or jagant from scripts that start or restart the server. You can check the output to determine if the required service is running. For example, components should not be deployed before the name service has finished, and JMS entities cannot be created before the message service is running.

See also

Chapter 33, “Creating Service Components,” in the EAServer Programmer’s Guide.