return new NioSocketAcceptor();
}
protected void configure(IoAcceptor acceptor) {
if (acceptor instanceof NioSocketAcceptor) {
final NioSocketAcceptor nio = (NioSocketAcceptor) acceptor;
nio.setReuseAddress(reuseAddress);
nio.setBacklog(backlog);
// MINA itself forces our socket receive buffer to 1024 bytes
// by default, despite what the operating system defaults to.
// This limits us to about 3 MB/s incoming data transfer. By
// forcing back to the operating system default we can get a
// decent transfer rate again.
//
final Socket s = new Socket();
try {
try {
nio.getSessionConfig().setReceiveBufferSize(s.getReceiveBufferSize());
} finally {
s.close();
}
} catch (IOException e) {
log.warn("cannot adjust SO_RCVBUF back to system default", e);