[jboss-dev-forums] [JBoss Remoting Development] - Remoting 3 protocol SPI
ron.sigal@jboss.com
do-not-reply at jboss.com
Mon Nov 23 14:33:30 EST 2009
Some discussion about protocol independent proxies in the thread "Naming over Remoting 3" in the JBoss AS Development forum (http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266845#4266845) has suggested to me the following idea. I'd like to be able to do something like
| ...
| Endpoint clientEndpoint = Remoting.createEndpoint("clientEndpoint");
| Protocol protocol = Remoting.getProtocol(url.getProtocol());
| protocol.registerClientTransport(clientEndpoint, clientExecutor, "localhost");
| Connection connection = clientEndpoint.connect(url), OptionMap.EMPTY).get();
| Client<String, String> client = connection.openClient("servicetype", "group", String.class, String.class).get();
|
The idea is that
1. the protocol class hides the details involved in endowing an endpoint with the ability to communicate over a particular protocol, and
2. making the protocol class accessible this way would facilitate protocol neutral code.
The org.jboss.remoting3.samples.socket.SocketProtocol class, for example, which is based on a similar class from an earlier sample protocol, looks more or less like this:
| public class SocketProtocol {
|
| /**
| * Register ConnectionProvider.
| * This endpoint can be a socket transport client.
| */
| static public <T, I, O> void registerClientTransport(final Endpoint endpoint, final Executor executor, final String host) {
| ...
| }
|
| /**
| * Register ConnectionProvider and start its listening facility.
| * This endpoint can be both a client and server for the socket transport.
| */
| static public <T, I, O> Cancellable registerServerTransport(Endpoint endpoint, Executor executor, final String host, final int port) {
| ...
| }
|
| /**
| * Register a service with an endpoint.
| * This endpoint must be acting as a socket transport server.
| */
| static public <I, O> void startService(Endpoint endpoint, Executor executor, SocketServiceConfiguration<I, O> socketConfig, final RequestListener<I, O> requestListener) throws IOException; {
| ...
| }
| }
|
So, I'm suggesting abstracting that to an interface.
WDYT?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267127#4267127
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267127
More information about the jboss-dev-forums
mailing list