Trustin Lee wrote:
On 10/19/06, Niklas Therning <[EMAIL PROTECTED]> wrote:

I like this change a lot because (as you've already metioned) it
simplifies configuration a lot, especially when using Spring. My only
concern is that it won't be as straight forward to setup connectors
using Spring. I guess one approach would be to have a factory for each
type of IoConnector. E.g.:

public class SocketConnectorFactory implements IoConnectorFactory {
    SocketConnector createConnector(SocketAddress addr);
    void setFilters(...);
    void setConnectTimeout(...);
    ... other relevant properties
}


What is the advantage of having a factory for connector?  Connector
implementations already provide all properties you can configure.
Ok, let me explain a little further. Today I configure two SocketConnectors using Spring, one for plain text connections and one for SSL connections. The app is a kind of proxy. When my acceptor has accepted a connection my code will determine which remote host to connect to and whether the connection should be encrypted or not and use the appropriate connector configured using Spring.

My concern is that I'd like to be able to keep the configuration of the outgoing connections (in particular the filter chains) in Spring but I'm not sure whether that will be as easy with these new connectors? But maybe I have totally misunderstood the changes?

With the SocketConnectorFactory I would just setup one which has no SSLFilter in its filter chain and one which has and then configure my code with these. Then in my code I would do:

IoConnector connector = null;
if (useSSL) {
 connector = sslConnectorFactory.create();
} else {
 connector = connectorFactory.create();
}
connector.setRemoteAddress(address);
connector.connect();

whenever I need to establish a new outgoing connection.

--
Niklas Therning
www.spamdrain.net

Reply via email to