JadeMethodContext Class

The JadeMethodContext class provides a framework to enable a task to be split into subtasks, which are processed in parallel. A subtask is essentially a method call that is to be executed asynchronously by a worker application. The JadeMethodContext instance is configured with the method call, the receiver, any required parameters, and the name of a worker application. A pool of one or more worker applications with the specified name must be running, to handle any asynchronous method calls.

When the invoke method is called on the JadeMethodContext instance, a request is queued and the method call is executed by the first worker application that becomes available. The queuing of JadeMethodContext invocation requests is handled internally by the JADE messaging framework.

The other way to execute a subtask in parallel with the main process is to use the startApplication, startAppMethod, startAppMethodWithString, startApplicationWithParameter, or startApplicationWithString method of the Application class. However, the applications started in this way would have to be specifically designed to carry out the subtask and would carry a greater overhead, whereas the asynchronous worker applications can carry out any subtask because the details of the method call are in the JadeMethodContext instance.

The main advantage of the JadeMethodContext approach is that the application that invokes the asynchronous method calls in the worker processes can more easily rendezvous with its worker processes; that is, obtain the results from the worker processes and know when it is safe to continue. The waitForMethods method on the Process class enables an application to wait for the completion of the asynchronous method calls and to obtain the results without having to return to an idle state. The alternative approach using a startApplication method to launch specifically designed applications would require the application to enter an idle state and wait for and handle notifications that the subtasks have been completed.

The JadeMethodContext class is also used to implement asynchronous Web service method calls.

For details about making asynchronous method calls, see in Chapter 16, "Using Asynchronous Method Calls", of the JADE Developer’s Reference. For details about constants, properties, and methods defined in the JadeMethodContext class, see "JadeMethodContext Class Constants", "JadeMethodContext Properties", and "JadeMethodContext Methods", later in this section.

Object

(None)