+

Search Tips   |   Advanced Search

 

Writing command interfaces

 

The command package can be used by distributed applications to reduce the number of remote invocations that a client makes. The base interface for all commands is the Command interface.

 

Overview

Distributed applications are defined by the ability to utilize remote resources as if they were local, but this remote work affects the performance of distributed applications. Distributed applications can improve performance by using remote calls sparingly. For example, if a server does several tasks for a client, the application can run more quickly if the client bundles requests together, reducing the number of individual remote calls. The command package provides a mechanism for collecting sets of requests to be submitted as a unit.

In addition, the command package provides a generic way of making requests. A client instantiates the command, sets its input data, and tells it to run. The command infrastructure determines the target server and passes a copy of the command to it. The server runs the command, sets any output data, and copies it back to the client. The package provides a common way to issue a command, locally or remotely, and independently of the server’s implementation. Any server (an enterprise bean, a Java Database Connectivity (JDBC) server, a servlet, and so on) can be a target of a command if the server supports Java access to its resources and provides a way to copy the command between the client’s Java Virtual Machine (JVM) and its own JVM. The command facility is implemented in the com.ibm.websphere.command Java package. The classes and interfaces in the command package fall into four general categories:

 

Procedure



TargetableCommand interface

CompensableCommand interface

Implementing command interfaces

Use a command

Interfaces for creating commands

Facilities for implementing commands

Exceptions in the command package

Targets and target policies

Writing a command target (server)

 

Related tasks


Setting and determining targets
Use application clients