use of com.orientechnologies.orient.server.distributed.impl.task.OHeartbeatTask in project orientdb by orientechnologies.
the class OClusterHealthChecker method checkServerInStall.
private void checkServerInStall() {
if (manager.getNodeStatus() != ODistributedServerManager.NODE_STATUS.ONLINE)
// ONLY ONLINE NODE CAN CHECK FOR OTHERS
return;
for (String dbName : manager.getMessageService().getDatabases()) {
final ODistributedServerManager.DB_STATUS localNodeStatus = manager.getDatabaseStatus(manager.getLocalNodeName(), dbName);
if (localNodeStatus != ODistributedServerManager.DB_STATUS.ONLINE)
// ONLY ONLINE NODE/DB CAN CHECK FOR OTHERS
continue;
final List<String> servers = manager.getOnlineNodes(dbName);
servers.remove(manager.getLocalNodeName());
if (servers.isEmpty())
continue;
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog.debug(this, manager.getLocalNodeName(), servers.toString(), ODistributedServerLog.DIRECTION.OUT, "Sending heartbeat message to servers (db=%s)", dbName);
try {
final ODistributedResponse response = manager.sendRequest(dbName, null, servers, new OHeartbeatTask(), manager.getNextMessageIdCounter(), ODistributedRequest.EXECUTION_MODE.RESPONSE, null, null);
final Object payload = response != null ? response.getPayload() : null;
if (payload instanceof Map) {
final Map<String, Object> responses = (Map<String, Object>) payload;
servers.removeAll(responses.keySet());
}
} catch (ODistributedOperationException e) {
// NO SERVER RESPONDED, THE SERVER COULD BE ISOLATED: SET ALL THE SERVER AS OFFLINE
}
for (String server : servers) {
setDatabaseOffline(dbName, server);
}
}
}
Aggregations