distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java
@Override
  public String electNewLockManager() {
    if (hazelcastInstance == null)
      throw new HazelcastInstanceNotActiveException();

    final ILock lock = hazelcastInstance.getLock("orientdb.lockManagerElection");
    lock.lock();
    try {

      // TRY ALL THE SERVERS IN ORDER (ALL THE SERVERS HAVE THE SAME LIST)
      String lockManagerServer = getLockManagerRequester().getServer();

      // PROTECT FROM DOUBLE LOCK MANAGER ELECTION IN CASE OF REMOVE OF LOCK MANAGER
      if (lockManagerServer != null && getActiveServers().contains(lockManagerServer))
        return lockManagerServer;

      final String originalLockManager = lockManagerServer;

      ODistributedServerLog
          .debug(this, nodeName, originalLockManager, DIRECTION.OUT, "lock '%s' is unreachable, electing a new lock...",
              originalLockManager);

      int lockManagerServerId = -1;
      if (lockManagerServer != null && registeredNodeByName.containsKey(lockManagerServer))
        lockManagerServerId = registeredNodeByName.get(lockManagerServer);

      String newServer = null;

      int currIndex = lockManagerServerId;
      for (int i = 0; i < registeredNodeById.size(); ++i) {
        currIndex++;
        if (currIndex >= registeredNodeById.size())
          // RESTART FROM THE FIRST
          currIndex = 0;

        newServer = registeredNodeById.get(currIndex);
        if (newServer == null)
          throw new OConfigurationException("Found null server at index " + currIndex + " of server list " + registeredNodeById);

        if (newServer.equalsIgnoreCase(getLocalNodeName()) || activeNodes.containsKey(newServer)) {
          // TODO: IMPROVE ELECTION BY CHECKING AL THE NODES AGREE ON IT

          ODistributedServerLog
              .debug(this, nodeName, newServer, DIRECTION.OUT, "Trying to elected server '%s' as new lock (old=%s)...", newServer,
                  originalLockManager);

          try {
            getLockManagerRequester().setServer(newServer);

            configurationMap.put(CONFIG_LOCKMANAGER, getLockManagerRequester().getServer());

            ODistributedServerLog
                .info(this, nodeName, newServer, DIRECTION.OUT, "Elected server '%s' as new lock (old=%s)", newServer,
                    originalLockManager);

            break;

          } catch (Exception e) {
            // NO SERVER RESPONDED, THE SERVER COULD BE ISOLATED, GO AHEAD WITH THE NEXT IN THE LIST
            ODistributedServerLog
                .info(this, nodeName, newServer, DIRECTION.OUT, "Error on electing server '%s' as new lock (error: %s)", newServer,
                    e);
          }
        }
      }

      return newServer;

    } finally {
      lock.unlock();
    }
  }
@Override
  public String electNewLockManager() {
    if (hazelcastInstance == null)
      throw new HazelcastInstanceNotActiveException();

    final ILock lock = hazelcastInstance.getLock("orientdb.lockManagerElection");
    lock.lock();
    try {

      // TRY ALL THE SERVERS IN ORDER (ALL THE SERVERS HAVE THE SAME LIST)
      String lockManagerServer = getLockManagerRequester().getServer();

      // PROTECT FROM DOUBLE LOCK MANAGER ELECTION IN CASE OF REMOVE OF LOCK MANAGER
      if (lockManagerServer != null && getActiveServers().contains(lockManagerServer))
        return lockManagerServer;

      final String originalLockManager = lockManagerServer;

      ODistributedServerLog
          .debug(this, nodeName, originalLockManager, DIRECTION.OUT, "lock '%s' is unreachable, electing a new lock...",
              originalLockManager);

      int lockManagerServerId = -1;
      if (lockManagerServer != null && registeredNodeByName.containsKey(lockManagerServer))
        lockManagerServerId = registeredNodeByName.get(lockManagerServer);

      String newServer = null;

      int currIndex = lockManagerServerId;
      for (int i = 0; i < registeredNodeById.size(); ++i) {
        currIndex++;
        if (currIndex >= registeredNodeById.size())
          // RESTART FROM THE FIRST
          currIndex = 0;

        newServer = registeredNodeById.get(currIndex);
        if (newServer == null)
          throw new OConfigurationException("Found null server at index " + currIndex + " of server list " + registeredNodeById);

        if (newServer.equalsIgnoreCase(getLocalNodeName()) || activeNodes.containsKey(newServer)) {
          // TODO: IMPROVE ELECTION BY CHECKING AL THE NODES AGREE ON IT

          ODistributedServerLog
              .debug(this, nodeName, newServer, DIRECTION.OUT, "Trying to elected server '%s' as new lock (old=%s)...", newServer,
                  originalLockManager);

          try {
            getLockManagerRequester().setServer(newServer);

            configurationMap.put(CONFIG_LOCKMANAGER, getLockManagerRequester().getServer());

            ODistributedServerLog
                .info(this, nodeName, newServer, DIRECTION.OUT, "Elected server '%s' as new lock (old=%s)", newServer,
                    originalLockManager);

            break;

          } catch (Exception e) {
            // NO SERVER RESPONDED, THE SERVER COULD BE ISOLATED, GO AHEAD WITH THE NEXT IN THE LIST
            ODistributedServerLog
                .info(this, nodeName, newServer, DIRECTION.OUT, "Error on electing server '%s' as new lock (error: %s)", newServer,
                    e);
          }
        }
      }

      return newServer;

    } finally {
      lock.unlock();
    }
  }
Elects a new server as coordinator. The election browse the ordered server list.