Submit a operations. Throw a run time exception if the operations is
already submitted

@param operation The asynchronous operations to submit
@param requestId Id of the request
966912
public synchronized void submitOperation(int requestId, AsyncOperation operation) {
        if(this.operations.containsKey(requestId))
            throw new VoldemortException("Request " + requestId
                                         + " already submitted to the system");

        this.operations.put(requestId, operation);
        scheduler.scheduleNow(operation);
        logger.debug("Handling async operation " + requestId);
    }
609264
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.setConstraintIsReq(MPSConstants.DELETE_CONSTRAINT, true);
		id_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString sessionid_validator = new MPSString();
		sessionid_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		sessionid_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		sessionid_validator.validate(operationType, sessionid, "\"sessionid\"");
		
		MPSString username_validator = new MPSString();
		username_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		username_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		username_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		username_validator.validate(operationType, username, "\"username\"");
		
		MPSIPAddress ip_address_validator = new MPSIPAddress();
		ip_address_validator.validate(operationType, ip_address, "\"ip_address\"");
		
		MPSInt port_validator = new MPSInt();
		port_validator.validate(operationType, port, "\"port\"");
		
		MPSInt session_timeout_validator = new MPSInt();
		session_timeout_validator.validate(operationType, session_timeout, "\"session_timeout\"");
		
		MPSInt login_time_validator = new MPSInt();
		login_time_validator.validate(operationType, login_time, "\"login_time\"");
		
		MPSInt last_activity_time_validator = new MPSInt();
		last_activity_time_validator.validate(operationType, last_activity_time, "\"last_activity_time\"");
		
		MPSInt expire_after_validator = new MPSInt();
		expire_after_validator.validate(operationType, expire_after, "\"expire_after\"");
		
		MPSBoolean is_self_validator = new MPSBoolean();
		is_self_validator.validate(operationType, is_self, "\"is_self\"");
		
	}
42737
public void performWithLock (final NodeObject.Lock lock, final LockedOperation operation)
    {
        acquireLock(lock, new ResultListener<String>() {
            public void requestCompleted (String nodeName) {
                if (getNodeObject().nodeName.equals(nodeName)) {
                    // lock acquired successfully - perform the operation, and release the lock.
                    try {
                        operation.run();
                    } finally {
                        releaseLock(lock, new ResultListener.NOOP<String>());
                    }
                } else {
                    // some other peer beat us to it
                    operation.fail(nodeName);
                    if (nodeName == null) {
                        log.warning("Lock acquired by null?", "lock", lock);
                    }
                }
            }
            public void requestFailed (Exception cause) {
                log.warning("Lock acquisition failed", "lock", lock, cause);
                operation.fail(null);
            }
        });
    }
102295
private void run(ReportOperation operation) throws ReportException {
        Set<String> executedPlugins = new HashSet<>();
        run(selectedReportPlugins, operation, executedPlugins);
        run(defaultReportPlugins, operation, executedPlugins);
    }
907147
@JmxOperation
    public String stopAsyncOperation(int requestId) {
        try {
            stopOperation(requestId);
        } catch(VoldemortException e) {
            return e.getMessage();
        }

        return "Stopping operation " + requestId;
    }
1299907
public synchronized boolean isComplete(int requestId, boolean remove) {
        if (!operations.containsKey(requestId))
            throw new VoldemortException("No operation with id " + requestId + " found");

        if (operations.get(requestId).getStatus().isComplete()) {
            if (logger.isDebugEnabled())
                logger.debug("Operation complete " + requestId);

            if (remove)
                operations.remove(requestId);

            return true;
        }

        return false;
    }
166656
private <T extends OperationRequest, U extends OperationResponse> void invoke(OperationAttempt<T, U> attempt) {
    if (state.getState() == PrimitiveState.CLOSED) {
      attempt.fail(new PrimitiveException.ClosedSession("session closed"));
    } else {
      attempts.put(attempt.sequence, attempt);
      attempt.send();
      attempt.future.whenComplete((r, e) -> attempts.remove(attempt.sequence));
    }
  }
327138
public void submit(Task task,Integer index) {
        task.activate(false);
        taskQueues[index].accept(task);
    }
356022
private void submit(final Level level, final Object message, final Throwable t) {
        if (!m_logger.isEnabledFor(level)) return;

        if (m_asynchLoggerPool == null) {
            m_logger.log(level, message, t);
            return;
        }

        final Runnable runnableLoggingTask = createRunnableLoggingTask(level, message, t);
        try {
            m_asynchLoggerPool.submit(runnableLoggingTask).get();
        } catch (Exception e) {
            Throwables.propagate(e);
        }
    }
501659
public <T> T runUnchecked(Retryable<T> operation) throws RuntimeException
	{
		try
		{
			return run(operation);
		}
		catch (RuntimeException e)
		{
			throw e;
		}
		catch (Exception e)
		{
			throw new RuntimeException("Retryable " + operation + " failed: " + e.getMessage(), e);
		}
	}
742990
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSInt ica_license_in_use_validator = new MPSInt();
		ica_license_in_use_validator.validate(operationType, ica_license_in_use, "\"ica_license_in_use\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
606568
void acceptOperation(StreamSegmentSealOperation operation) throws MetadataUpdateException {
        ensureSegmentId(operation);
        if (operation.getStreamSegmentOffset() < 0) {
            throw new MetadataUpdateException(containerId,
                    "StreamSegmentSealOperation cannot be accepted if it hasn't been pre-processed: " + operation);
        }

        this.sealed = true;
        this.isChanged = true;
    }
533192
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		id_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString name_validator = new MPSString();
		name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		name_validator.validate(operationType, name, "\"name\"");
		
		MPSString executed_by_validator = new MPSString();
		executed_by_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		executed_by_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		executed_by_validator.validate(operationType, executed_by, "\"executed_by\"");
		
		MPSInt starttime_validator = new MPSInt();
		starttime_validator.validate(operationType, starttime, "\"starttime\"");
		
		MPSInt endtime_validator = new MPSInt();
		endtime_validator.validate(operationType, endtime, "\"endtime\"");
		
		MPSString status_validator = new MPSString();
		status_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		status_validator.validate(operationType, status, "\"status\"");
		
	}
1314079
public void validateOperations(final List<ModelNode> operations) {
        if (operations == null) {
            return;
        }

        for (ModelNode operation : operations) {
            try {
                validateOperation(operation);
            } catch (RuntimeException e) {
                if (exitOnError) {
                    throw e;
                } else {
                    System.out.println("---- Operation validation error:");
                    System.out.println(e.getMessage());
                }

            }
        }
    }
181472
public void submitSynchronous(Runnable task) {
        lock.writeLock().lock();
        try {
            awaitInner();
            task.run();
        } catch (InterruptedException e) {
            Log.error(e, "Task queue isolated submission interrupted");
            throw new RuntimeException(e);
        } catch (Exception e) {
            Log.error(e, "Task queue isolated submission failed");
            throw new RuntimeException(e);
        } finally {
            lock.writeLock().unlock();
        }
    }
439549
private void acknowledgeAlreadyProcessedOperation(SegmentOperation operation) throws DataCorruptionException {
        if (operation instanceof MergeSegmentOperation) {
            // Only MergeSegmentOperations need special handling. Others, such as StreamSegmentSealOperation, are not
            // needed since they're handled in the initialize() method. Ensure that the DataSource is aware of this
            // (since after recovery, it may not know that a merge has been properly completed).
            MergeSegmentOperation mergeOp = (MergeSegmentOperation) operation;
            try {
                updateMetadataForTransactionPostMerger(this.dataSource.getStreamSegmentMetadata(mergeOp.getSourceSegmentId()), mergeOp.getStreamSegmentId());
            } catch (Throwable ex) {
                // Something really weird must have happened if we ended up in here. To prevent any (further) damage, we need
                // to stop the Segment Container right away.
                throw new DataCorruptionException(String.format("Unable to acknowledge already processed operation '%s'.", operation), ex);
            }
        }
    }
945546
function doOperation(operation) {
        if (operation.ops.length > 0) {
            try {
                $(exports).triggerHandler('beforeExecuteOperation', [operation]);
                _applyOperation(operation);
                if (operation.bypass !== true) {
                    _undoStack.push(operation);
                    _redoStack.clear();
                    $(exports).triggerHandler('operationExecuted', [operation]);
                }
            } catch (err) {
                console.error(err);
            }
        }
    }