Ken Michie
unread,Feb 26, 2013, 5:31:30 PM2/26/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to asyncht...@googlegroups.com
Solution found! In the event that someone else stumbles across this same symptom, the problem is that the Thread invoking the onThrowable callback has its Thread.interrupted flag set to 'true'. Therefore any blocking operation (Thread.sleep, Thread.wait, etc) will immediately throw an InterruptedException. In my case I was noticing bizarre behavior when logging a message that had a Gelf appender associated with the logger, ultimately destined for our Graylog server. When the UDP channel was used to send the message Graylog, the interrupted flag caused the channel to immediately close and throw an exception, leaving the channel forever-after closed.
The solution for me was to take the Throwable, and inside a try/catch, throw it. Upon catching the IOException, the interrupted flag was cleared and I could proceed with my normal behavior:
public void onThrowable(Throwable t) {
try {
throw t
} catch (IOException ioEx) {
log.warn("I can now log to Graylog via GELF!")
// Process the response
processResponse(t)
} catch (Exception e) {
log.error("Non IOException for reqId: ${request.reqId}", e)
} finally {
if (log.isTraceEnabled()) {
log.trace("onThrowable: Processed onThrowable $request, throwable: $t")
}
handleRequestResponseStatus()
}
This behavior would be nice to have some more documentation around it, or even fix it in a bug.