* channel returns an EOF condition, it is closed here, which
* automatically invalidates the associated key. The selector
* will then de-register the channel on the next select call.
*/
protected void readDataFromSocket(SelectionKey key) throws Exception {
TcpReplicationThread worker = (TcpReplicationThread) pool.getWorker();
if (worker == null) {
// No threads available, do nothing, the selection
// loop will keep calling this method until a
// thread becomes available.
// FIXME: This design could be improved.
if (log.isDebugEnabled())
log.debug("No TcpReplicationThread available");
} else {
// invoking this wakes up the worker thread then returns
worker.serviceChannel(key);
}
}