Refine search
public CommandConfig transactionRequired() { CommandConfig config = new CommandConfig(this); config.propagation = TransactionPropagation.REQUIRED; return config; }
CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW); commandExecutor.execute(commandConfig, new Command<Void>() { @Override public Void execute(CommandContext commandContext) {
@Override public <T> T execute(CommandConfig config, Command<T> command) { LOGGER.debug("Running command with propagation {}", config.getTransactionPropagation()); if (config.getTransactionPropagation() == TransactionPropagation.NOT_SUPPORTED) { return next.execute(config, command); boolean requiresNew = config.getTransactionPropagation() == TransactionPropagation.REQUIRES_NEW; Transaction oldTx = null; try {
if (!config.isContextReusePossible() || commandContext == null || commandContext.getException() != null) { commandContext = commandContextFactory.createCommandContext(command); commandContext.setEngineConfigurations(engineConfigurations);
@Override 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 openTransaction = !config.getTransactionPropagation().equals(TransactionPropagation.NOT_SUPPORTED) && transactionContextFactory != null && !commandContext.isReused(); boolean isContextSet = false; try { if (openTransaction) { TransactionContext transactionContext = (TransactionContext) transactionContextFactory.openTransactionContext(commandContext); Context.setTransactionContext(transactionContext); isContextSet = true; commandContext.addCloseListener(new TransactionCommandContextCloseListener(transactionContext)); } return next.execute(config, command); } finally { if (openTransaction && isContextSet) { Context.removeTransactionContext(); } } }
public void initSchemaCommandConfig() { if (schemaCommandConfig == null) { schemaCommandConfig = new CommandConfig(); } }
public CommandConfig setContextReusePossible(boolean contextReusePossible) { CommandConfig config = new CommandConfig(this); config.contextReusePossible = contextReusePossible; return config; }
public CommandConfig transactionRequiresNew() { CommandConfig config = new CommandConfig(); config.contextReusePossible = false; config.propagation = TransactionPropagation.REQUIRES_NEW; return config; }
public void initDefaultCommandConfig() { if (defaultCommandConfig == null) { defaultCommandConfig = new CommandConfig(); } }
public CommandConfig transactionNotSupported() { CommandConfig config = new CommandConfig(); config.contextReusePossible = false; config.propagation = TransactionPropagation.NOT_SUPPORTED; return config; } }