"jmesnil" wrote : "timfox" wrote : More thoughts, how this might
look:
| |
| | abstract class Packet
| | {
| | long correlationID;
| | }
| |
| | interface Dispatcher
| | {
| | Handler registerHandler(int handlerID);
| |
| | void sendOneWay(Packet packet, int handlerID);
| |
| | void sendBlocking(Packet packet, int handlerID);
| | }
| |
| | interface Handler
| | {
| | void handle(Message message);
| | }
| |
|
| I have a simple prototype which is quite similar:
|
|
| | interface Packet
| | {
| | long correlationID;
| | String handlerID;
| | }
| |
| | class CreateSessionRequest extends Packet {
| | }
| | class CreateSessionResponse extends Packet {
| | }
| |
| | interface Client
| | {
| | Handler registerHandler(int handlerID, Handler handler);
| | void unregisterHandler(int handlerID);
| |
| | void sendOneWay(Packet packet);
| |
| | Packet sendBlocking(Packet packet);
| | }
| |
| | interface Handler
| | {
| | void handle(Packet packet);
| | }
| |
|
Sounds pretty much right to me :)
You could probably just use the current Dispatcher and change it to implement the new
Dispatcher interface.
You could also re-use the current requests and reponses (of course some won't be
appropriate any more) - these are the packets.
You would need to change the serverInvoker method of course to instead call back into the
Dispatcher, so the Dispatcher can notify the correct handlers.
A couple more things to think about:
1) How does the user configure the new transport?
The user needs to be able to choose from:
a) socket
b) ssl
c) http
each will have its own set of parameters
some config is appropriate for the server side and some for the client. e.g. thread pool
sizes and MINA threading model.
2) We need some kind of "heartbeat" functionality. I.e. periodically sending
ping messages on the connection, so the server knows if the client is still alive, and the
client knows if the connection is still alive.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102327#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...