IBM WebSphere Multichannel Bank Transformation Toolkit, Version 7.1

Sample method to access the services

The following is a sample method that a service invoker uses to get a service requester, and then access a service object through the service holder using the service requester.
/**
* Access a sample service and a Poolable sample service. 
*/
public void accessService() {

try {
    /* Poolable sample service */
    // Get a poolable sample service requester from the service requester factory
    SamplePooledServiceRequester pooledService =
            (SamplePooledServiceRequester)BTTServiceRequesterFactory.getServiceRequester("SamplePoolService");
    System.out.println("Output1: "+pooledService.addCounter(200)+
                  ", in ServiceID:"+pooledService.getServiceID()+
                  " , Pool Id:"+pooledService.getPoolId());
    BTTServiceRequesterFactory.releaseServiceRequester(pooledService.getServiceID());

    /* Non-Poolable sample service */
    // Get a sample service requester from the service requester factory
    SampleServiceRequester service =
            (SampleServiceRequester)BTTServiceRequesterFactory.getServiceRequester("SampleService");
    System.out.println("Output2: "+service.addCounter(400)+", in ServiceID:"+service.getServiceID());
    BTTServiceRequesterFactory.releaseServiceRequester(service.getServiceID());

} catch (Exception e) {

    // print out the exception to the system console
    e.printStackTrace();
}


Feedback