use of com.hazelcast.spi.impl.AllowedDuringPassiveState in project hazelcast by hazelcast.
the class Invocation method engineActive.
private boolean engineActive() {
NodeState state = context.node.getState();
if (state == NodeState.ACTIVE) {
return true;
}
boolean allowed = state == NodeState.PASSIVE && (op instanceof AllowedDuringPassiveState);
if (!allowed) {
notifyError(new HazelcastInstanceNotActiveException("State: " + state + " Operation: " + op.getClass()));
remote = false;
}
return allowed;
}
use of com.hazelcast.spi.impl.AllowedDuringPassiveState in project hazelcast by hazelcast.
the class OperationRunnerImpl method checkNodeState.
private void checkNodeState(Operation op) {
NodeState state = node.getState();
if (state == NodeState.ACTIVE) {
return;
}
Address localAddress = node.getThisAddress();
if (state == NodeState.SHUT_DOWN) {
throw new HazelcastInstanceNotActiveException("Member " + localAddress + " is shut down! Operation: " + op);
}
if (op instanceof AllowedDuringPassiveState) {
return;
}
// Cluster is in passive state. There is no need to retry.
if (nodeEngine.getClusterService().getClusterState() == ClusterState.PASSIVE) {
throw new IllegalStateException("Cluster is in " + ClusterState.PASSIVE + " state! Operation: " + op);
}
// Operation will fail since node is shutting down or cluster is passive.
if (op.getPartitionId() < 0) {
throw new HazelcastInstanceNotActiveException("Member " + localAddress + " is currently passive! Operation: " + op);
}
// Since operation has a partition id, it must be retried on another node.
throw new RetryableHazelcastException("Member " + localAddress + " is currently shutting down! Operation: " + op);
}
Aggregations