On Nov 16, 2010, at 7:22 PM, Tom Mueller wrote:
> The conclusion regarding this thread from the admin iteam meeting is that we will be looking into the ability to store the initial state of an instance appropriately, so that if an instance has never been started, such that we know that it is down, then replication will be skipped for that instance, so there will be no message for the instance.
In case it helps, you might be able use GMS for this:
@Inject
GMSAdapterService gmsAdapterService;
someMethod() {
GMSAdapter gmsAdapter = gmsAdapterService.getGMSAdapterByName(clusterName);
if (gmsAdapter != null) {
HealthHistory history = gmsAdapter.getHealthHistory();
InstanceHealth ih = getHealthByInstance(instanceName);
if (ih.state == HealthHistory.STATE.NOT_RUNNING) {
// instance hasn't been started or stopped.
}
}
}
ih.state will return the current state of the instance, and the enum STATE values are NOT_RUNNING, RUNNING, REJOINED, FAILURE, and SHUTDOWN. If it's NOT_RUNNING, then the instance has never been started.
The only limitation I know is that the DAS loses FAILURE/SHUTDOWN info when the DAS is restarted (but not other info). So if the states for n1 and n2 are started/stopped respectively, then after a DAS restart the states will be started/not_running. This is because GMS keeps broadcasting the state of running instances, but doesn't constantly rebroadcast shutdowns/failures. As I recall....
Cheers,
Bobby