in core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java [178:213]
public void run() {
/** 64k receive buffer */
ByteBuffer rcvdBuffer = ByteBuffer.allocate(64 * 1024);
while (bound) {
// I/O !
rcvdBuffer.clear();
try {
SocketAddress from = channel.receive(rcvdBuffer);
BioUdpSession session = sessions.get(from);
if (session == null) {
// create the session
session = new BioUdpSession(from, BioUdpServer.this, idleChecker);
sessions.put(from, session);
session.getConfig().setIdleTimeInMillis(IdleStatus.READ_IDLE,
config.getIdleTimeInMillis(IdleStatus.READ_IDLE));
session.getConfig().setIdleTimeInMillis(IdleStatus.WRITE_IDLE,
config.getIdleTimeInMillis(IdleStatus.WRITE_IDLE));
idleChecker.sessionWritten(session, System.currentTimeMillis());
session.setConnected();
// fire open
session.processSessionOpen();
}
rcvdBuffer.flip();
session.processMessageReceived(rcvdBuffer);
// Update the session idle status
idleChecker.sessionRead(session, System.currentTimeMillis());
} catch (AsynchronousCloseException aec) {
LOG.debug("closed service");
break;
} catch (IOException e) {
LOG.error("Exception while reading", e);
}
}
}