private static IoAcceptor setupAcceptor() {
if("NIODATAGRAM".equals(CONN_TYPE)) {
LOG.info("NioDatagramAcceptor is used for RemotePaging");
NioDatagramAcceptor datagramAcceptor = new NioDatagramAcceptor(); // connection less
DatagramSessionConfig config = datagramAcceptor.getSessionConfig();
config.setReuseAddress(true);
config.setReadBufferSize(1024);
config.setSendBufferSize(SND_BUFSIZE);
config.setBothIdleTime(SO_IDLETIME);
config.setWriteTimeout(SO_WRITE_TIMEOUT);
config.setBroadcast(false);
return datagramAcceptor;
} else {
final SocketAcceptor acceptor;
if("APRSOCKET".equals(CONN_TYPE)) {
LOG.info("AprSocketAcceptor is used for RemotePaging");
acceptor = new AprSocketAcceptor(NUM_IO_PROCESSORS);
} else {
LOG.info("NioSocketAcceptor is used for RemotePaging");
acceptor = new NioSocketAcceptor(NUM_IO_PROCESSORS);
}
SocketSessionConfig config = acceptor.getSessionConfig();
config.setReuseAddress(true);
config.setReadBufferSize(1024);
config.setSendBufferSize(SND_BUFSIZE);
config.setBothIdleTime(SO_IDLETIME);
config.setWriteTimeout(SO_WRITE_TIMEOUT);
//config.setTcpNoDelay(true); // Disable Nagle's algorithm
return acceptor;
}
}