add an exception if there is no master node set

This commit is contained in:
kimchy 2010-06-17 22:19:43 +03:00
parent 7b145fd4e1
commit f64b96e3c8
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.support.master;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.ElasticSearchIllegalStateException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.BaseAction;
@ -73,6 +74,9 @@ public abstract class TransportMasterNodeOperationAction<Request extends MasterN
}
});
} else {
if (nodes.masterNode() == null) {
throw new ElasticSearchIllegalStateException("No master node discovered or set");
}
transportService.sendRequest(nodes.masterNode(), transportAction(), request, new BaseTransportResponseHandler<Response>() {
@Override public Response newInstance() {
return newResponse();