public void onSuccess(CommandResponse response) { try { if (response.isError()) { handleError(response); } else { if (!deferred.isCancelled()) { for (CommandCallback callback : deferred.getCallbacks()) { try { callback.execute(response); } catch (Throwable t) { Log.logError("Command failed on success callback", t); } } } } } catch (Throwable t) { Log.logError("Command failed on success callback", t); } finally { decrementDispatched(); deferreds.remove(deferred); } }
public void onFailure(Throwable error) { try { boolean errorHandled = false; for (CommandCallback<?> callback : deferred.getCallbacks()) { if (callback instanceof CommunicationExceptionCallback) { try { ((CommunicationExceptionCallback) callback).onCommunicationException(error); } catch (Throwable t) { Log.logError("Command failed on error callback", t); } errorHandled = true; } } if (!errorHandled && deferred.isLogCommunicationExceptions()) { onCommunicationException(error); } } catch (Throwable t) { if (deferred.isLogCommunicationExceptions()) { Log.logError("Command failed on error callback", t); } } finally { decrementDispatched(); deferreds.remove(deferred); } }
for (CommandCallback callback : deferred.getCallbacks()) { if (callback instanceof CommandExceptionCallback) { try {