public void setMaxReconnectAttempts(int maxReconnectAttempts) {
this.maxReconnectAttempts = maxReconnectAttempts;
}
public void oneway(Object o) throws IOException {
final Command command = (Command)o;
try {
synchronized (reconnectMutex) {
// Wait for transport to be connected.
while (connectedCount < minAckCount && !disposed && connectionFailure == null) {
LOG.debug("Waiting for at least " + minAckCount + " transports to be connected.");
reconnectMutex.wait(1000);
}
// Still not fully connected.
if (connectedCount < minAckCount) {
Exception error;
// Throw the right kind of error..
if (disposed) {
error = new IOException("Transport disposed.");
} else if (connectionFailure != null) {
error = connectionFailure;
} else {
error = new IOException("Unexpected failure.");
}
if (error instanceof IOException) {
throw (IOException)error;
}
throw IOExceptionSupport.create(error);
}
// If it was a request and it was not being tracked by
// the state tracker,
// then hold it in the requestMap so that we can replay
// it later.
boolean fanout = isFanoutCommand(command);
if (stateTracker.track(command) == null && command.isResponseRequired()) {
int size = fanout ? minAckCount : 1;
requestMap.put(new Integer(command.getCommandId()), new RequestCounter(command, size));
}
// Send the message.
if (fanout) {
for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {