public List<String> getHealthyInstances() {
final int INITIAL_CAPACITY = 10;
final int INCREMENTAL = 5;
Vector healthyInstances = new Vector(INITIAL_CAPACITY,INCREMENTAL);
final long startTime = System.currentTimeMillis();
GroupHandle groupHandle = gmsEventListenerImpl.getGroupManagementService().getGroupHandle();
List<String> coreMembers = groupHandle.getCurrentCoreMembers();
for (String core : coreMembers) {
//Changing such that threshold of 6 seconds and
//timeout of 0 seconds is used. This will ensure value
//is returned from maintained GMS state cache.
//These values will later be used as default and this
//change will be reverted back
MemberStates state = groupHandle.getMemberState(core,
6000L, 0L);
if (state == MemberStates.ALIVEANDREADY
|| state == MemberStates.READY) {
healthyInstances.add(core);
} else if (state == MemberStates.UNKNOWN) {
MemberStates pollState = groupHandle.getMemberState(core, 6000L, 3000L);
if ( pollState == MemberStates.ALIVEANDREADY || pollState == MemberStates.READY) {
healthyInstances.add(core);
} else {
long duration = System.currentTimeMillis() - startTime;
if (logger.isLoggable(Level.FINER)) {
logger.finer("DCU getHealthyInstances: getMemberState(" + core + ", 6 secs, 3 secs) hb only state=" + state +
" poll state=" + pollState + " getHealthyInstances current duration(in ms)=" + duration);
}
}
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "clb.gms_module_core_members", new Object[] {
clusterName, groupHandle.getAllCurrentMembers().toString()
});
logger.log(Level.FINE, "clb.gms_module_core_current_members", new Object[] {
clusterName, coreMembers.toString()
});
logger.log(Level.FINE, "clb.gms_module_current_healthy_members", new Object[] {