protected void executeCloseListenersAfterSessionFlushed() { if (closeListeners != null) { try { for (CommandContextCloseListener listener : closeListeners) { listener.afterSessionsFlush(this); } } catch (Throwable exception) { exception(exception); } } }
@Override public <T> T execute(CommandConfig config, Command<T> command) { if (calledInsideTransaction()) { LOGGER.trace("Called inside transaction, skipping the retry interceptor."); return next.execute(config, command); } else { return super.execute(config, command); } }
protected void executeCloseListenersCloseFailure() { if (closeListeners != null) { try { for (CommandContextCloseListener listener : closeListeners) { listener.closeFailure(this); } } catch (Throwable exception) { exception(exception); } } }
public CommandContext createCommandContext(Command<?> cmd) { CommandContext commandContext = new CommandContext(cmd); commandContext.setSessionFactories(sessionFactories); return commandContext; }
public CommandConfig transactionRequired() { CommandConfig config = new CommandConfig(this); config.propagation = TransactionPropagation.REQUIRED; return config; }
private void doBegin() { try { transactionManager.begin(); } catch (NotSupportedException e) { throw new TransactionException("Unable to begin transaction", e); } catch (SystemException e) { throw new TransactionException("Unable to begin transaction", e); } }
public void initCommandContextFactory() { if (commandContextFactory == null) { commandContextFactory = new CommandContextFactory(); } }
public void initCommandInvoker() { if (commandInvoker == null) { commandInvoker = new DefaultCommandInvoker(); } }
@Override public <T> T execute(CommandConfig config, Command<T> command) { return first.execute(config, command); }
@Override public <T> T execute(final CommandConfig config, final Command<T> command) { final CommandContext commandContext = Context.getCommandContext(); T result = command.execute(commandContext); return result; }
public void initSchemaCommandConfig() { if (schemaCommandConfig == null) { schemaCommandConfig = new CommandConfig(); } }
private boolean isExisting() { try { return transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION; } catch (SystemException e) { throw new TransactionException("Unable to retrieve transaction status", e); } }
public CommandConfig setContextReusePossible(boolean contextReusePossible) { CommandConfig config = new CommandConfig(this); config.contextReusePossible = contextReusePossible; return config; }
private Transaction doSuspend() { try { return transactionManager.suspend(); } catch (SystemException e) { throw new TransactionException("Unable to suspend transaction", e); } }
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; } }