private void performResponseTimeoutHandler(final IHttpResponseHandler handler, final SocketTimeoutException ste) {
final ResponseHandlerInfo responseHandlerInfo = AbstractHttpConnection.getResponseHandlerInfo(handler);
Runnable responseTimeoutHandlerCaller = new Runnable() {
public void run() {
try {
if ( responseHandlerInfo.isSocketTimeoutHandler()) {
IHttpSocketTimeoutHandler hdl = (IHttpSocketTimeoutHandler) handler;
hdl.onException(ste);
} else {
handler.onException(ste);
}
} catch (Exception e) {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("[" +getId() + "] error occured by calling on request " + handler + " " + e.toString());
}
throw new RuntimeException(e);
} finally {
destroy();
}
}
};
// ... and perform the handler
if (responseHandlerInfo.isSocketTimeoutHandlerMultithreaded()) {
getExecutor().processMultithreaded(responseTimeoutHandlerCaller);
} else {
getExecutor().processNonthreaded(responseTimeoutHandlerCaller);
}