public T doInTransaction(TransactionStatus status) { return next.execute(config, command); } });
public CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { if (chain == null || chain.isEmpty()) { throw new ActivitiException("invalid command interceptor chain configuration: " + chain); } for (int i = 0; i < chain.size() - 1; i++) { chain.get(i).setNext(chain.get(i + 1)); } return chain.get(0); }
public ProcessEngineConfigurationImpl findProcessEngineConfigurationImpl() { if(processEngineConfiguration != null) return processEngineConfiguration; CommandInterceptor temp = (CommandInterceptor)commandExecutor; do { if(temp instanceof CommandContextInterceptor) { this.processEngineConfiguration = ((CommandContextInterceptor)temp).getProcessEngineConfiguration(); break; } temp = (CommandInterceptor)temp.getNext(); }while(temp !=null); return processEngineConfiguration; } }
protected CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { if (chain==null || chain.isEmpty()) { throw new ActivitiException("invalid command interceptor chain configuration: "+chain); } for (int i = 0; i < chain.size()-1; i++) { chain.get(i).setNext( chain.get(i+1) ); } return chain.get(0); }
@Override public <T> T execute(CommandConfig config, Command<T> command) { return first.execute(config, command); }
protected CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { if (chain == null || chain.isEmpty()) { throw new ActivitiException("invalid command interceptor chain configuration: " + chain); } for (int i = 0; i < chain.size() - 1; i++) { chain.get(i).setNext(chain.get(i + 1)); } return chain.get(0); }
public <T> T execute(CommandConfig config, Command<T> command) { if (!log.isDebugEnabled()) { // do nothing here if we cannot log return next.execute(config, command); } log.debug("\n"); log.debug("--- starting {} --------------------------------------------------------", command.getClass().getSimpleName()); try { return next.execute(config, command); } finally { log.debug("--- {} finished --------------------------------------------------------", command.getClass().getSimpleName()); log.debug("\n"); } } }
public CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { if (chain == null || chain.isEmpty()) { throw new ActivitiException("invalid command interceptor chain configuration: " + chain); } for (int i = 0; i < chain.size() - 1; i++) { chain.get(i).setNext(chain.get(i + 1)); } return chain.get(0); }
@Override public <T> T execute(CommandConfig config, Command<T> command) { if (calledInsideTransaction()) { log.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(config, command); } else { return super.execute(config, command); } }
public <T> T execute(CommandConfig config, Command<T> command) { long waitTime = waitTimeInMs; int failedAttempts = 0; do { if (failedAttempts > 0) { log.info("Waiting for {}ms before retrying the command.", waitTime); waitBeforeRetry(waitTime); waitTime *= waitIncreaseFactor; } try { // try to execute the command return next.execute(config, command); } catch (ActivitiOptimisticLockingException e) { log.info("Caught optimistic locking exception: " + e); } failedAttempts++; } while (failedAttempts <= numOfRetries); throw new ActivitiException(numOfRetries + " retries failed with ActivitiOptimisticLockingException. Giving up."); }
public <T> T execute(CommandConfig config, Command<T> command) { ProfileSession currentProfileSession = activitiProfiler.getCurrentProfileSession(); if (currentProfileSession != null) { String className = command.getClass().getName(); CommandExecutionResult commandExecutionResult = new CommandExecutionResult(); currentProfileSession.setCurrentCommandExecution(commandExecutionResult); commandExecutionResult.setCommandFqn(className); long start = System.currentTimeMillis(); T result = next.execute(config, command); long end = System.currentTimeMillis(); long totalTime = end - start; commandExecutionResult.setTotalTimeInMs(totalTime); currentProfileSession.addCommandExecution(className, commandExecutionResult); currentProfileSession.clearCurrentCommandExecution(); return result; } else { return next.execute(config, command); } }
public <T> T execute(CommandConfig config, Command<T> command) { CommandContext commandContext = Context.getCommandContext(); // Storing it in a variable, to reference later (it can change during command execution) boolean isReused = commandContext.isReused(); try { if (transactionContextFactory != null && !isReused) { TransactionContext transactionContext = transactionContextFactory.openTransactionContext(commandContext); Context.setTransactionContext(transactionContext); commandContext.addCloseListener(new TransactionCommandContextCloseListener(transactionContext)); } return next.execute(config, command); } finally { if (transactionContextFactory != null && !isReused) { Context.removeTransactionContext(); } } }
return next.execute(config, command);
@Override public T doInTransaction(TransactionStatus status) { return next.execute(config, command); } });
@Override public <T> T execute(CommandConfig config, Command<T> command) { return first.execute(config, command); }
@Override public <T> T execute(CommandConfig config, Command<T> command) { return first.execute(config, command); }
public <T> T execute(CommandConfig config, Command<T> command) { if (!log.isDebugEnabled()) { // do nothing here if we cannot log return next.execute(config, command); } log.debug("\n"); log.debug("--- starting {} --------------------------------------------------------", command.getClass().getSimpleName()); try { return next.execute(config, command); } finally { log.debug("--- {} finished --------------------------------------------------------", command.getClass().getSimpleName()); log.debug("\n"); } } }