@Override
  public Integer call() throws Exception {
    final ODistributedServerManager dManager = getDistributedServerManager();

    if (aligned == -1) {
      // ALIGNMENT POSTPONED
      OLogManager.instance()
          .warn(this, "DISTRIBUTED <-[%s/%s] alignment postponed", nodeSource, databaseName);

      dManager.postponeAlignment(nodeSource, databaseName);

    } else {
      // ALIGNMENT DONE
      OLogManager.instance()
          .warn(
              this,
              "DISTRIBUTED <-[%s/%s] alignment ended: %d operation(s)",
              nodeSource,
              databaseName,
              aligned);

      dManager.endAlignment(nodeSource, databaseName);
    }
    return null;
  }
Ejemplo n.º 2
0
  public Object execute(
      ODistributedRequestId requestId,
      final OServer iServer,
      ODistributedServerManager iManager,
      final ODatabaseDocumentInternal database)
      throws Exception {
    ODistributedServerLog.debug(
        this,
        iManager.getLocalNodeName(),
        getNodeSource(),
        DIRECTION.IN,
        "execute command=%s db=%s",
        text.toString(),
        database.getName());

    final OCommandRequest cmd = database.command(new OCommandScript(text));

    final Object res;
    if (params != null)
      // EXECUTE WITH PARAMETERS
      res = cmd.execute(params);
    else res = cmd.execute();

    return res;
  }