We will have a pair of methods on the DispatchAsync similar to sendMessage(Message m), where the message could be a StartBatchingMessage for instance.This can be more complicated, but the more I think about it, the more I believe it is the best option.
The top-level dispatch will propagate these messages to the implementations which will in turn react ( or not )
2. Controller-based implementation
The root idea is pass in some sort of control object into the implementation via the constructor. class BatchDispatchAsyncController { private final BatchDispatchAsync batchDispatchAsync; BatchDispatchAsyncController(BatchDispatchAsync batchDispatchAsync) { this.batchDispatchAsync = batchDispatchAsync; } void startBatch() { batchDispatchAsync.startBatch(); } void stopBatch(); batchDispatchAsync.stopBatch(); } } BatchDispatchAsync batchDispatcher = new BatchDispatchAsync(new SecureDispatchAsync()); DispatchAsync dispatcher = new ProgressReportDispatchAsync(batchDispatcher); BatchDispatchAsyncController batchController = new BatchDispatchAsyncController(batchDispatcher); Now inject both the dispatcher and the batchController and start stop batching using batchController.startBatch(); batchController.stopBatch();
Robert
--
Sent from my (old) computer
Robert
--
I've read through the discussions and get the gist, but I'm not sure of the "why?". Understand, I'm not criticizing the ideas. My assumption is there's a hole in my understanding of web-apps.It seems like this is trying to address a request volume issue. It's not "(n) requests x (n) clients" hammering the server: that's a server-side issue. It seems like it has to be "(n) requests x (a bunch) within 1 client". Seems like that's an application design issue, client-side storage thing, or a "throw up a spinner and let 'em wait" thing. Am I way off target on this?
- there are many options and levels for caching of server side data
- JDBC and ORM solutions can handle huge volumes of data
- application servers, alone or clustered, with or without being fronted by Apache, can handle enormous request volumes
- one could argue the above applies to the size of the data transfer packets between client and server as well
- AJAX and the higher degree of sophistication in the client frameworks facilitates splitting out client-side reference data loads
- there's various ways of leveraging client-side data storage/caching
Having said the above, I would lobby for two approaches: Event driven and/or Filters. It seems the former could be implemented and integrated with existing code with "minimal" change to existing code. Provide an optional default BatchingSubscriber and it's an easy configuration item for us "users". The latter, well, I'm in love with http://mina.apache.org/'s Filters. As with an Event driven solution, a default BatchingFilter could be supplied.Personally, I prefer the Filter approach as I can see where it would provide us "users" with the bigger benefit. But, either way, I can think of a bunch of different reasons to tap into a "dispatch" filter chain/event bus, all of which I could unit test.
Brian, thanks for the references.
When I'll be back to working with GWT I'll be sure to take a look at
the Mina filter mechanism.
Robert