You need to use the Redundancy State Listener:
import com.inductiveautomation.ignition.gateway.redundancy.types.RedundancyState;
import com.inductiveautomation.ignition.gateway.redundancy.types.RedundancyStateListener;
code snippets:
@Override
public void redundancyStateChanged(RedundancyState redundancyState) {
logger.debug("Redundancy State Changed to %s",redundancyState.getActivityLevel().toString());
if(redundancyState.getActivityLevel().equals(ActivityLevel.Active)){
this.isActive = true;
}
else{
this.isActive = false;
}
}
@Override
public void redundancyConnStatusChanged(ClusterPeerConnectionStatus clusterPeerConnectionStatus) {
}
EDIT: You have to implement the logic internally but these hooks let you know what state the Gateway is in. This works well for my SNMP Driver that I wrote.