use of org.apache.ignite.internal.visor.query.VisorQueryCancelOnInitiatorTaskArg in project ignite by apache.
the class KillCommand method parseArguments.
/**
* {@inheritDoc}
*/
@Override
public void parseArguments(CommandArgIterator argIter) {
KillSubcommand cmd;
try {
cmd = KillSubcommand.valueOf(argIter.nextArg("Expected type of resource to kill.").toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Expected type of resource to kill.");
}
switch(cmd) {
case COMPUTE:
taskArgs = new VisorComputeCancelSessionTaskArg(IgniteUuid.fromString(argIter.nextArg("Expected compute task id.")));
taskName = VisorComputeCancelSessionTask.class.getName();
nodeId = null;
break;
case SERVICE:
taskArgs = new VisorCancelServiceTaskArg(argIter.nextArg("Expected service name."));
taskName = VisorCancelServiceTask.class.getName();
nodeId = null;
break;
case TRANSACTION:
String xid = argIter.nextArg("Expected transaction id.");
taskArgs = new VisorTxTaskArg(VisorTxOperation.KILL, null, null, null, null, null, null, xid, null, null, null);
taskName = VisorTxTask.class.getName();
nodeId = null;
break;
case SQL:
T2<UUID, Long> ids = parseGlobalQueryId(argIter.nextArg("Expected SQL query id."));
if (ids == null)
throw new IllegalArgumentException("Expected global query id. " + EXPECTED_GLOBAL_QRY_ID_FORMAT);
taskArgs = new VisorQueryCancelOnInitiatorTaskArg(ids.get1(), ids.get2());
taskName = VisorQueryCancelOnInitiatorTask.class.getName();
nodeId = null;
break;
case SCAN:
String originNodeIsStr = argIter.nextArg("Expected query originating node id.");
UUID originNodeId = UUID.fromString(originNodeIsStr);
String cacheName = argIter.nextArg("Expected cache name.");
long qryId = Long.parseLong(argIter.nextArg("Expected query identifier."));
taskArgs = new VisorScanQueryCancelTaskArg(originNodeId, cacheName, qryId);
taskName = VisorScanQueryCancelTask.class.getName();
nodeId = null;
break;
case CONTINUOUS:
taskArgs = new VisorContinuousQueryCancelTaskArg(UUID.fromString(argIter.nextArg("Expected query originating node id.")), UUID.fromString(argIter.nextArg("Expected continuous query id.")));
taskName = VisorContinuousQueryCancelTask.class.getName();
nodeId = null;
break;
case SNAPSHOT:
taskArgs = argIter.nextArg("Expected snapshot name.");
taskName = VisorSnapshotCancelTask.class.getName();
nodeId = null;
break;
case CONSISTENCY:
taskName = VisorConsistencyCancelTask.class.getName();
taskArgs = null;
nodeId = BROADCAST_UUID;
break;
default:
throw new IllegalArgumentException("Unknown kill subcommand: " + cmd);
}
}
Aggregations