+ x.getMessage());
}
if (state == BINDING) {
// bind timeout has expired
LOGGER.debug("Bind timeout.");
exitEvent = new ReceiverExitEvent(this, null, state);
((ReceiverExitEvent) exitEvent).setReason(
ReceiverExitEvent.BIND_TIMEOUT);
setState(UNBOUND);
} else {
eventDispatcher.notifyObservers(this,
new ReceiverExceptionEvent(this, x));
}
continue;
} catch (IOException x) {
LOGGER.warn("I/O Exception caught", x);
ReceiverExceptionEvent ev = new ReceiverExceptionEvent(
this, x, state);
eventDispatcher.notifyObservers(this, ev);
smppEx++;
if (smppEx > tooManyIOEx) {
LOGGER.warn("Too many IOExceptions in receiver thread", x);
throw x;
}
continue;
}
// Reset smppEx back to zero if we reach here, as packet
// reception was successful.
smppEx = 0;
// Tell all the observers about the new packet
LOGGER.info("Notifying observers of packet received");
eventDispatcher.notifyObservers(this, pak);
} // end while
if (exitEvent == null) {
// Notify observers that the thread is exiting with no error..
exitEvent = new ReceiverExitEvent(this, null, state);
}
} catch (Exception x) {
LOGGER.debug("Fatal exception in receiver thread: " + x.getMessage(), x);
exitEvent = new ReceiverExitEvent(this, x, state);
setState(UNBOUND);
} finally {
// make sure other code doesn't try to restart the rcvThread..
rcvThread = null;
}