Examples of OSQLCommandTask


Examples of com.orientechnologies.orient.server.distributed.task.OSQLCommandTask

     final OCommandExecutor exec = executor instanceof OCommandExecutorSQLDelegate ? ((OCommandExecutorSQLDelegate) executor)
         .getDelegate() : executor;

     try {
       final OSQLCommandTask task = new OSQLCommandTask(iCommand);

       Object result = null;
       OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE executionMode = OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE.LOCAL;
       if (OScenarioThreadLocal.INSTANCE.get() != RUN_MODE.RUNNING_DISTRIBUTED) {
         if (exec instanceof OCommandDistributedReplicateRequest)
           executionMode = ((OCommandDistributedReplicateRequest) exec).getDistributedExecutionMode();
       }

       switch (executionMode) {
       case LOCAL:
         return wrapped.command(iCommand);

       case REPLICATE: {
         // REPLICATE IT, GET ALL THE INVOLVED NODES
         final Collection<String> involvedClusters = exec.getInvolvedClusters();
         final Collection<String> nodes;

         task.setResultStrategy(OAbstractRemoteTask.RESULT_STRATEGY.ANY);

         nodes = dbCfg.getServers(involvedClusters);
         if (iCommand instanceof ODistributedCommand)
           nodes.removeAll(((ODistributedCommand) iCommand).nodesToExclude());

         result = dManager.sendRequest(getName(), involvedClusters, nodes, task, EXECUTION_MODE.RESPONSE);
         break;
       }

       case SHARDED: {
         // SHARDED, GET ONLY ONE NODE PER INVOLVED CLUSTER
         final Collection<String> involvedClusters = exec.getInvolvedClusters();
         final Collection<String> nodes;

         task.setResultStrategy(OAbstractRemoteTask.RESULT_STRATEGY.UNION);

         nodes = dbCfg.getOneServerPerCluster(involvedClusters, dManager.getLocalNodeName());

         if (iCommand instanceof ODistributedCommand)
           nodes.removeAll(((ODistributedCommand) iCommand).nodesToExclude());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.