Folks,

I think that the recent work on Holder support has revealed something worth 
discussing.

The OASIS specs define a specialized form of Java interface for service implementations that are asynchronous - ie where the response may be delivered from a separate thread long after the request has been received.

So, if we have a regular synchronous Java interface like this:

public interface StockQuote {
   float getPrice(String ticker);
}


then the equivalent async server form of the same interface looks like this:


@Requires("sca:asyncInvocation")
public interface StockQuote {
   void getPriceAsync(String ticker, ResponseDispatch<Float> dispatch);
}

- note the presence of the asyncInvocation intent, the addition of "Async" at the end of the method name and the addition of the ResponseDispatch object which is typed with the response.


Now, the async server form of an interface really expects there to be one object in the response - it is not expecting any of the input parameters to be used for returning anything - ie it does not allow for holders. This must be the case since the original invoked method returns absolutely nothing (it just hands over the request) and all the response is done through the service calling
ResponseDispatch<T>.sendResponse( T ).

At the moment, I'm for simply not supporting Holders when using the async service pattern. This is the simplest approach, I think. Anything else get very complex for no good reason.

The alternative implies that the ResponseDispatch will have to be typed by some kind of array object - and this would imply a lack of type safety. Then the application would have to build an array of response values and invoke sendResponse() with that array. Frankly it sounds easier to have a single response object which is a structure or Collection containing all the required elements of the response...


Thoughts?


Yours,  Mike.

Reply via email to