mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <nik...@trillian.se>
Subject Re: Meta Transport: an idea on implementing reconnection and proxy
Date Tue, 02 Oct 2007 08:15:58 GMT
Trustin Lee wrote:
> Hi everyone,
> As you already noticed, I am working very hard to roll out MINA
> 2.0.0-M1 these days.  There are only 16 issues left now.  Any help is
> appreciated.
> The most challenging issues are reconnection and proxy.  Both are
> related with client-side applications.  I thought a lot of these
> issues and ended up to this idea: creating meta transports.
> A meta transport is a transport that wraps other transport
> implementation(s) to implement a certain additional feature.  For
> example, we could implement automatic reconnection like the following:
> SocketConnector c = new SocketConnector();
> c.setDefaultRemoteAddress(...);
> ReconnectingConnector connector = new ReconnectingConnector(c);
> For proxying:
> SocketConnector c = new SocketConnector();
> ProxyingConnector connector = new ProxyingConnector(
>         c, new InetSocketAddress("proxyserver", 8080));
> It's nothing more than just classic decorator pattern, but it has a
> big advantage than other approaches like defining additional extension
> point in that:
> * it's simple from user point of view
> * meta transport implementations can work virtually with any transports:
> ** proxy + NIO socket
> ** proxy + APR socket
> ** reconnect + proxy + NIO socket (meta-meta-transport)
> I didn't try to implement something yet, but considering our API
> flexibility, it shouldn't affect the core API at all.  WDYT?  Does it
> make perfect sense?
> Thanks for the feed back in advance,
> Trustin
Yes, I think this is the way to go about implementing this kinds of
things. This is similar to what was suggested the last time the proxy
issue came up on the mailing list

Now, one thing we should consider is whether we want to support
specifying proxyHost, proxyPort via system properties, just like Socket
does. In that case I don't think it will be as simple as wrapping like
suggested above. Maybe we could support this by having some kind of
factory which looks at the system properties?

Niklas Therning

View raw message