/** * Removes all callbacks for a given channel. Registered callbacks will receive a failure response containing a * {@link CommandBusConnectorCommunicationException}. * * @param channelId the channel identifier */ public void cancelCallbacks(A channelId) { Iterator<CommandCallbackWrapper> callbacks = this.callbacks.values().iterator(); while (callbacks.hasNext()) { CommandCallbackWrapper wrapper = callbacks.next(); if (wrapper.getChannelIdentifier().equals(channelId)) { wrapper.reportResult(asCommandResultMessage(new CommandBusConnectorCommunicationException( String.format("Connection error while waiting for a response on command %s", wrapper.getMessage().getCommandName())))); callbacks.remove(); } } }
/** * Removes all callbacks for a given channel. Registered callbacks will receive a failure response containing a * {@link CommandBusConnectorCommunicationException}. * * @param channelId the channel identifier */ public void cancelCallbacks(A channelId) { Iterator<CommandCallbackWrapper> callbacks = this.callbacks.values().iterator(); while (callbacks.hasNext()) { CommandCallbackWrapper wrapper = callbacks.next(); if (wrapper.getChannelIdentifier().equals(channelId)) { wrapper.fail(new CommandBusConnectorCommunicationException( String.format("Connection error while waiting for a response on command %s", wrapper.getMessage().getCommandName()))); callbacks.remove(); } } }
/** * Removes all callbacks for a given channel. Registered callbacks will receive a failure response containing a * {@link CommandBusConnectorCommunicationException}. * * @param channelId the channel identifier */ public void cancelCallbacks(A channelId) { Iterator<CommandCallbackWrapper> callbacks = this.callbacks.values().iterator(); while (callbacks.hasNext()) { CommandCallbackWrapper wrapper = callbacks.next(); if (wrapper.getChannelIdentifier().equals(channelId)) { wrapper.reportResult(asCommandResultMessage(new CommandBusConnectorCommunicationException( String.format("Connection error while waiting for a response on command %s", wrapper.getMessage().getCommandName())))); callbacks.remove(); } } }