@Override public void onError(TransportMessage message, Exception e) { if (message == null) return; AsyncToken token = tokensMap.remove(message.getId()); if (token == null) return; token.dispatchFailure(e); if (timer != null) timer.purge(); // Must purge to cleanup timer references to AsyncToken }
@Override public void onError(TransportMessage message, Exception e) { if (message != null) { AsyncToken token = tokensMap.remove(message.getId()); if (token != null) { token.dispatchFailure(e); if (timer != null) timer.purge(); // Must purge to cleanup timer references to AsyncToken } } }
@Override public void onError(TransportMessage message, Exception e) { if (message == null) return; AsyncToken token = tokensMap.remove(message.getId()); if (token == null) return; token.dispatchFailure(e); if (timer != null) timer.purge(); // Must purge to cleanup timer references to AsyncToken }
@Override public ResponseMessageFuture send(RequestMessage request, ResponseListener... listeners) { if (request == null) throw new NullPointerException("request cannot be null"); if (!start()) throw new RuntimeException("Channel not started"); AsyncToken token = new AsyncToken(request, listeners); request.setTimestamp(System.currentTimeMillis()); if (request.getTimeToLive() <= 0L) request.setTimeToLive(defaultTimeToLive); try { timer.schedule(token, request.getRemainingTimeToLive()); tokensQueue.add(token); } catch (Exception e) { log.error(e, "Could not add token to queue: %s", token); token.dispatchFailure(e); return new ImmediateFailureResponseMessageFuture(e); } return token; }
@Override public ResponseMessageFuture send(RequestMessage request, ResponseListener... listeners) { if (request == null) throw new NullPointerException("request cannot be null"); if (!start()) throw new RuntimeException("Channel not started"); AsyncToken token = new AsyncToken(request, listeners); request.setTimestamp(System.currentTimeMillis()); if (request.getTimeToLive() <= 0L) request.setTimeToLive(defaultTimeToLive); try { timer.schedule(token, request.getRemainingTimeToLive()); tokensQueue.add(token); } catch (Exception e) { log.error(e, "Could not add token to queue: %s", token); token.dispatchFailure(e); return new ImmediateFailureResponseMessageFuture(e); } return token; }
@Override public ResponseMessageFuture send(RequestMessage request, ResponseListener... listeners) { if (request == null) throw new NullPointerException("request cannot be null"); if (!start()) throw new RuntimeException("Channel not started"); AsyncToken token = new AsyncToken(request, listeners); request.setTimestamp(System.currentTimeMillis()); if (request.getTimeToLive() <= 0L) request.setTimeToLive(defaultTimeToLive); try { timer.schedule(token, request.getRemainingTimeToLive()); tokensQueue.add(token); } catch (Exception e) { log.error(e, "Could not add token to queue: %s", token); token.dispatchFailure(e); return new ImmediateFailureResponseMessageFuture(e); } return token; }
break; default: token.dispatchFailure(new RuntimeException("Unknown message type: " + response)); break; token.dispatchFailure(e);
dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); dependentToken.dispatchFailure((Exception)e.getCause()); else dependentToken.dispatchFailure(e); dependentToken.dispatchFailure(e);
break; default: token.dispatchFailure(new RuntimeException("Unknown message type: " + response)); break; token.dispatchFailure(e);
dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); dependentToken.dispatchFailure((Exception)e.getCause()); else dependentToken.dispatchFailure(e); dependentToken.dispatchFailure(e);
dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); return null; dependentToken.dispatchFailure(e); dependentToken.dispatchFailure((Exception)e.getCause()); else dependentToken.dispatchFailure(e); dependentToken.dispatchFailure(e);
token.dispatchFailure(e); if (timer != null)
token.dispatchFailure(e); if (timer != null)
token.dispatchFailure(e); if (timer != null)
break; default: token.dispatchFailure(new RuntimeException("Unknown message type: " + response)); break;