use of org.wildfly.clustering.dispatcher.CommandResponse in project wildfly by wildfly.
the class ChannelCommandDispatcher method executeOnCluster.
@Override
public <R> Map<Node, CommandResponse<R>> executeOnCluster(Command<R, ? super C> command, Node... excludedNodes) throws CommandDispatcherException {
Message message = this.createMessage(command);
RequestOptions options = this.createRequestOptions(excludedNodes);
try {
Map<Address, Rsp<R>> responses = this.dispatcher.castMessage(null, message, options);
Map<Node, CommandResponse<R>> results = new HashMap<>();
for (Map.Entry<Address, Rsp<R>> entry : responses.entrySet()) {
Address address = entry.getKey();
Rsp<R> response = entry.getValue();
if (response.wasReceived() && !response.wasSuspected()) {
results.put(this.factory.createNode(address), createCommandResponse(response));
}
}
return results;
} catch (Exception e) {
throw new CommandDispatcherException(e);
}
}
Aggregations