public void run() {
int num_retries = 3;
while (m_accept) {
try {
accept();
} catch (Exception e) {
if (e instanceof SecurityException) {
DebugLog.stdoutPrintln("Security violation during " +
"socket operation.",
DebugLog.BSF_LOG_L0);
e.printStackTrace();
}
else if (e instanceof ProtocolException) {
DebugLog.stdoutPrintln("Client attempted to connect " +
"using unsupported protocol " +
"version",
DebugLog.BSF_LOG_L0);
}
else if (e instanceof IOException) {
DebugLog.stdoutPrintln("Reason: I/O error opening socket.",
DebugLog.BSF_LOG_L0);
}
else {
if (num_retries != 0) {
// Possible temporary problem
// Retry num_retries times...
DebugLog.stdoutPrintln("**** Error in accept() - " +
num_retries +
" retry attempts remaining.",
DebugLog.BSF_LOG_L0);
num_retries--;
}
else {
DebugLog.stdoutPrintln("**** accept() failure. " +
"Please correct error " +
"and restart server.",
DebugLog.BSF_LOG_L0);
DebugLog.stdoutPrintln(e.getMessage(),
DebugLog.BSF_LOG_L0);
m_accept = false;
}
}
}
}
}
|