super(name);
this.tcpServer = tcpServer;
}
public final void run() {
Socket socket;
try {
loop:
while (running) {
canStop = true;
try {
ServerSocket listen = tcpServer.getListen();
if (listen != null) {
socket = listen.accept();
canStop = false;
} else {
break loop;
}
} catch (IOException exc) {
if (running) {
Trace.logger.log(
BasicLevel.ERROR,
this.getName() +
", error during accept", exc);
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {}
continue loop;
}
break loop;
}
if (! running) break loop;
if (Trace.logger.isLoggable(BasicLevel.DEBUG)) {
Trace.logger.log(
BasicLevel.DEBUG,
this.getName() + ", connection from " +
socket.getInetAddress() + ':' +
socket.getPort());
}
try {
IOControl ioCtrl = new IOControl(socket);
int rid = ioCtrl.readInt();