Globus Toolkit 4: Programming Java Services

In this chapter we will see the two lifecycle management solutions offered by the WS-ResourceLifetime specification. Since lifecycle management mainly makes sense when we have several resources, the examples will focus on explaining what modifications are necessary to the example seen in Chapter 8 (the factory/instance example). The version of that example with the lifecycle modifications can be found in directory EXAMPLES_DIR/org/globus/examples/services/core/rl/
Immediate destruction is the simplest type of lifecycle management. It allows us to request that a resource be destroyed immediately by invoking a destroy operation in the instance service. Notice how, even though the factory service is responsible for creating the resources, destruction must be requested to each individual resource through the instance service.
To add immediate destruction to our service, we simply need to extend from the standard WSRF ImmediateResourceTermination portType. This portType adds a destroy operation to our portType that will instruct the current resource to terminate itself immediately.
<a name="412"></a><a name="page178"></a>
To be able to do this, we must remember to declare the WS-ResourceLifetime namespace, and import its WSDL file:
| Remember | This is part of file $EXAMPLES_DIR/schema/MathService_instance_rl/Math.wsdl |
Next, we need to add the Globus-supplied DestroyProvider operation provider to the instance service. This provider implements the destroy operation mentioned above.
?xml> share/schema/examples/MathService_instance_rl/Math_ service.wsdl <a name="414"></a><a name="page180"></a> share/schema/examples/FactoryService/Factory_ ...