Package com.orientechnologies.orient.server.distributed

Examples of com.orientechnologies.orient.server.distributed.ODistributedServerManager


   protected void replicationDatabase() throws IOException {
     setDataCommandInfo("Replication command");

     final ODocument request = new ODocument(channel.readBytes());

     final ODistributedServerManager dManager = server.getDistributedManager();
     if (dManager == null)
       throw new OConfigurationException("No distributed manager configured");

     final String operation = request.field("operation");

     ODocument response = null;

     if (operation.equals("start")) {
       checkServerAccess("server.replication.start");

     } else if (operation.equals("stop")) {
       checkServerAccess("server.replication.stop");

     } else if (operation.equals("config")) {
       checkServerAccess("server.replication.config");

       response = new ODocument().fromJSON(dManager.getDatabaseConfiguration((String) request.field("db")).serialize()
           .toJSON("prettyPrint"));

     }

     sendResponse(response);
View Full Code Here


    return server;
  }

  public void waitNodeIsOnline() throws OTimeoutException {
    // WAIT THE NODE IS ONLINE AGAIN
    final ODistributedServerManager mgr = server.getDistributedManager();
    if (mgr != null && mgr.isEnabled() && mgr.isOffline()) {
      for (int retry = 0; retry < MAX_RETRIES; ++retry) {
        if (mgr != null && mgr.isOffline()) {
          // NODE NOT ONLINE YET, REFUSE THE CONNECTION
          OLogManager.instance().info(this, "Node is not online yet (status=%s), blocking the command until it's online %d/%d",
              mgr.getNodeStatus(), retry + 1, MAX_RETRIES);
          pauseCurrentThread(300);
        } else
          // OK, RETURN
          return;
      }

      // TIMEOUT
      throw new OTimeoutException("Cannot execute operation while the node is not online (status=" + mgr.getNodeStatus() + ")");
    }
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.server.distributed.ODistributedServerManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.