distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/OCommandExecutorSQLHASyncCluster.java
public Object execute(final Map<Object, Object> iArgs) {
    final ODatabaseDocumentInternal database = getDatabase();
    database.checkSecurity(ORule.ResourceGeneric.CLUSTER, "sync", ORole.PERMISSION_UPDATE);

    if (!(database instanceof ODatabaseDocumentDistributed)) {
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");
    }

    final OHazelcastPlugin dManager = (OHazelcastPlugin) ((ODatabaseDocumentDistributed) database).getDistributedManager();
    if (dManager == null || !dManager.isEnabled())
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");

    final String databaseName = database.getName();

    try {
      if (this.parsedStatement.modeFull) {
        return replaceCluster(dManager, database, dManager.getServerInstance(), databaseName, this.parsedStatement.clusterName.getStringValue());
      }
      // else {
      // int merged = 0;
      // return String.format("Merged %d records", merged);
      // }
    } catch (Exception e) {
      throw OException.wrapException(new OCommandExecutionException("Cannot execute synchronization of cluster"), e);
    }

    return "Mode not supported";
  }
public Object execute(final Map<Object, Object> iArgs) {
    final ODatabaseDocumentInternal database = getDatabase();
    database.checkSecurity(ORule.ResourceGeneric.CLUSTER, "sync", ORole.PERMISSION_UPDATE);

    if (!(database instanceof ODatabaseDocumentDistributed)) {
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");
    }

    final OHazelcastPlugin dManager = (OHazelcastPlugin) ((ODatabaseDocumentDistributed) database).getDistributedManager();
    if (dManager == null || !dManager.isEnabled())
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");

    final String databaseName = database.getName();

    try {
      if (this.parsedStatement.modeFull) {
        return replaceCluster(dManager, database, dManager.getServerInstance(), databaseName, this.parsedStatement.clusterName.getStringValue());
      }
      // else {
      // int merged = 0;
      // return String.format("Merged %d records", merged);
      // }
    } catch (Exception e) {
      throw OException.wrapException(new OCommandExecutionException("Cannot execute synchronization of cluster"), e);
    }

    return "Mode not supported";
  }
public Object execute ( final Map < Object , Object > iArgs ) { final ODatabaseDocumentInternal database = getDatabase ( ) ; database . checkSecurity ( ORule . ResourceGeneric . CLUSTER , "sync" , ORole . PERMISSION_UPDATE ) ; if ( ! ( database instanceof ODatabaseDocumentDistributed ) ) { throw new OCommandExecutionException ( "OrientDB is not started in distributed mode" ) ; } final OHazelcastPlugin dManager = ( OHazelcastPlugin ) ( ( ODatabaseDocumentDistributed ) database ) . getDistributedManager ( ) ; if ( dManager == null || ! dManager . isEnabled ( ) ) throw new OCommandExecutionException ( "OrientDB is not started in distributed mode" ) ; final String databaseName = database . getName ( ) ; try { if ( this . parsedStatement . modeFull ) { return replaceCluster ( dManager , database , dManager . getServerInstance ( ) , databaseName , this . parsedStatement . clusterName . getStringValue ( ) ) ; } // else { // int merged = 0; // return String.format("Merged %d records", merged); // } } catch ( Exception e ) { throw OException . wrapException ( new OCommandExecutionException ( "Cannot execute synchronization of cluster" ) , e ) ; } return "Mode not supported" ; }
Execute the SYNC CLUSTER.
Execute the SYNC CLUSTER .