Overview
The acscallbacks module provides utilities for an easy usage of Callbacks.
In the current version, only Java implementations are supported. The Java utility classes are:
alma.acs.callbacks. ...
RequesterUtil
ResponderUtil
ResponseReceiver
They are all contained in the archive
acsCallbacksSupport.jar
.
Special Notes
Various types of callback return values are supported: int, int[], double, double[], String, String[]
-
In the implementation of ResponseReceiver above,
you could instead of overriding the generic method
incomingResponse(Object x)
equivalently override the specialized method
incomingResponse(String x)
This will save you a type cast - but will make your ResponseReceiver implementation less flexible for use with other
callbacks
- To invoke a method responder.giveStringLength(String text, CBlong cb, CBDescIn descIn),
where the return value is of type CBlong instead of CBstring, you would in the DemoRequester code above write
- RequesterUtil.giveCBLong(cs, rere)
and, according to the previous point, optionally implement:
- incomingResponse(int x){ System.out.println(x); }
Finally, in the EasyResponderImpl you'd write
- ResponderUtil.respond (length, cb, descIn);
Examples in the ALMA CVS Repository
Keywords: Callbacks, Asynchronous, Java