/** * Add a set of new root-procedure to the executor. * @param procs the new procedures to execute. */ // TODO: Do we need to take nonces here? public void submitProcedures(Procedure<TEnvironment>[] procs) { Preconditions.checkArgument(lastProcId.get() >= 0); if (procs == null || procs.length <= 0) { return; } // Prepare procedure for (int i = 0; i < procs.length; ++i) { prepareProcedure(procs[i]).setProcId(nextProcId()); } // Commit the transaction store.insert(procs); if (LOG.isDebugEnabled()) { LOG.debug("Stored " + Arrays.toString(procs)); } // Add the procedure to the executor for (int i = 0; i < procs.length; ++i) { pushProcedure(procs[i]); } }
private void updateStoreOnExec(RootProcedureState<TEnvironment> procStack, Procedure<TEnvironment> procedure, Procedure<TEnvironment>[] subprocs) { if (subprocs != null && !procedure.isFailed()) { if (LOG.isTraceEnabled()) { LOG.trace("Stored " + procedure + ", children " + Arrays.toString(subprocs)); } store.insert(procedure, subprocs); } else { LOG.trace("Store update {}", procedure); if (procedure.isFinished() && !procedure.hasParent()) { // remove child procedures final long[] childProcIds = procStack.getSubprocedureIds(); if (childProcIds != null) { store.delete(procedure, childProcIds); for (int i = 0; i < childProcIds.length; ++i) { procedures.remove(childProcIds[i]); } } else { store.update(procedure); } } else { store.update(procedure); } } }
/** * Add a new root-procedure to the executor. * @param proc the new procedure to execute. * @param nonceKey the registered unique identifier for this operation from the client or process. * @return the procedure id, that can be used to monitor the operation */ @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH", justification = "FindBugs is blind to the check-for-null") public long submitProcedure(Procedure<TEnvironment> proc, NonceKey nonceKey) { Preconditions.checkArgument(lastProcId.get() >= 0); prepareProcedure(proc); final Long currentProcId; if (nonceKey != null) { currentProcId = nonceKeysToProcIdsMap.get(nonceKey); Preconditions.checkArgument(currentProcId != null, "Expected nonceKey=" + nonceKey + " to be reserved, use registerNonce(); proc=" + proc); } else { currentProcId = nextProcId(); } // Initialize the procedure proc.setNonceKey(nonceKey); proc.setProcId(currentProcId.longValue()); // Commit the transaction store.insert(proc, null); LOG.debug("Stored {}", proc); // Add the procedure to the executor return pushProcedure(proc); }
procStore.insert(new TestProcedure(11), null); fail("Inserting into Procedure Store should have failed"); } catch (Exception ex) {
private void updateStoreOnExec(final RootProcedureState procStack, final Procedure procedure, final Procedure[] subprocs) { if (subprocs != null && !procedure.isFailed()) { if (LOG.isTraceEnabled()) { LOG.trace("Stored " + procedure + ", children " + Arrays.toString(subprocs)); } store.insert(procedure, subprocs); } else { if (LOG.isTraceEnabled()) { LOG.trace("Store update " + procedure); } if (procedure.isFinished() && !procedure.hasParent()) { // remove child procedures final long[] childProcIds = procStack.getSubprocedureIds(); if (childProcIds != null) { store.delete(procedure, childProcIds); for (int i = 0; i < childProcIds.length; ++i) { procedures.remove(childProcIds[i]); } } else { store.update(procedure); } } else { store.update(procedure); } } }
/** * Add a set of new root-procedure to the executor. * @param procs the new procedures to execute. */ // TODO: Do we need to take nonces here? public void submitProcedures(Procedure<TEnvironment>[] procs) { Preconditions.checkArgument(lastProcId.get() >= 0); if (procs == null || procs.length <= 0) { return; } // Prepare procedure for (int i = 0; i < procs.length; ++i) { prepareProcedure(procs[i]).setProcId(nextProcId()); } // Commit the transaction store.insert(procs); if (LOG.isDebugEnabled()) { LOG.debug("Stored " + Arrays.toString(procs)); } // Add the procedure to the executor for (Procedure<TEnvironment> proc : procs) { pushProcedure(proc); } }
/** * Add a set of new root-procedure to the executor. * @param procs the new procedures to execute. */ // TODO: Do we need to take nonces here? public void submitProcedures(final Procedure[] procs) { Preconditions.checkArgument(lastProcId.get() >= 0); Preconditions.checkArgument(isRunning(), "executor not running"); if (procs == null || procs.length <= 0) { return; } // Prepare procedure for (int i = 0; i < procs.length; ++i) { prepareProcedure(procs[i]).setProcId(nextProcId()); } // Commit the transaction store.insert(procs); if (LOG.isDebugEnabled()) { LOG.debug("Stored " + Arrays.toString(procs)); } // Add the procedure to the executor for (int i = 0; i < procs.length; ++i) { pushProcedure(procs[i]); } }
private void updateStoreOnExec(RootProcedureState<TEnvironment> procStack, Procedure<TEnvironment> procedure, Procedure<TEnvironment>[] subprocs) { if (subprocs != null && !procedure.isFailed()) { if (LOG.isTraceEnabled()) { LOG.trace("Stored " + procedure + ", children " + Arrays.toString(subprocs)); } store.insert(procedure, subprocs); } else { LOG.trace("Store update {}", procedure); if (procedure.isFinished() && !procedure.hasParent()) { // remove child procedures final long[] childProcIds = procStack.getSubprocedureIds(); if (childProcIds != null) { store.delete(procedure, childProcIds); for (int i = 0; i < childProcIds.length; ++i) { procedures.remove(childProcIds[i]); } } else { store.update(procedure); } } else { store.update(procedure); } } }
/** * Add a new root-procedure to the executor. * @param proc the new procedure to execute. * @param nonceKey the registered unique identifier for this operation from the client or process. * @return the procedure id, that can be used to monitor the operation */ @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH", justification = "FindBugs is blind to the check-for-null") public long submitProcedure(Procedure<TEnvironment> proc, NonceKey nonceKey) { Preconditions.checkArgument(lastProcId.get() >= 0); prepareProcedure(proc); final Long currentProcId; if (nonceKey != null) { currentProcId = nonceKeysToProcIdsMap.get(nonceKey); Preconditions.checkArgument(currentProcId != null, "Expected nonceKey=" + nonceKey + " to be reserved, use registerNonce(); proc=" + proc); } else { currentProcId = nextProcId(); } // Initialize the procedure proc.setNonceKey(nonceKey); proc.setProcId(currentProcId.longValue()); // Commit the transaction store.insert(proc, null); LOG.debug("Stored {}", proc); // Add the procedure to the executor return pushProcedure(proc); }
store.insert(proc, null); if (LOG.isDebugEnabled()) { LOG.debug("Stored " + proc);
store.insert(proc, null); if (LOG.isDebugEnabled()) { LOG.debug("Procedure " + proc + " added to the store.");
procStore.insert(new TestProcedure(11), null); fail("Inserting into Procedure Store should have failed"); } catch (Exception ex) {
LOG.trace("Store add " + procedure + " children " + Arrays.toString(subprocs)); store.insert(procedure, subprocs); } else { if (LOG.isTraceEnabled()) {