On 8/2/06, Niklas Therning <[EMAIL PROTECTED]> wrote:

>> BTW, what do you and others think about adding a setDefaultConfig() to
>> the various acceptors and connectors (adding it to the IoService
>> interface will loose type safety so I don't think that's a good idea)
>> and setSessionConfig() to the various acceptor config and connector
>> config classes (like SocketAcceptorConfig)? I realize that this will
>> probably only be useful for users using Spring and other DI containers
>> but for those users it will simplify things a lot. WDYT?
>>
>
> I think it would be a good idea. Generally spoken it would be a good
> idea to implement always setter / getter pairs whereever it is
> possible and useful to simplify the things. WDYT?
I will add a JIRA issue for this. Also, with Spring 2.0 coming out very
soon we should look into simplifying the Spring integration using
Spring's custom XML configuration feature. It would make life a lot
simpler for Spring users.


What do you think about changing the API a little bit radically?  Let's
assume that we cannot bind more than one port per acceptor.  Then we don't
need IoServiceConfig and default properties such as default filter chain.
Here's an example code:

SocketAcceptor acceptor = new SocketAcceptor();

acceptor.setBindAddress(new InetSocketAddress(8080));
acceptor.setHandler(myIoHandler);
acceptor.setReuseAddress(true);
...
acceptor.start(); // acceptor.stop() will unbind

Collection<IoSession> sessions = acceptor.getManagedSessions(); // no more
additional params!

The same policy could be applied to the connectors:

SocketConnector connector = new SocketConnector();
connector.setRemoteAddress(new InetSocketAddress("example.com", 8080));
connector.setLocalAddress(....);
connector.setTcpNoDelay(true);
connector.setHandler(...);
connector.start(); // connector.stop() will disconnect the session.

WDYT?

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to