This is exactly how I was thinking of implementing proxy support. I hadn't given the ReconnectingConnector much thought but I think this type of solution would work very well.

I think it does indeed make perfect sense.

-Mike

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

Reply via email to