@Override public void rollback() { context.rollbackTransaction(); } }
@Override public void rollback() { if (this.transaction != null) { this.transaction.rollbackTransaction(); } }
@Override protected Object innerCall() throws Exception { TransactionContext transactionContext = endpoint.getTransactionContext(parameters.transactionId); transactionContext.rollbackTransaction(); endpoint.removeTransactionContext(parameters.transactionId); return null; }
@Override protected Object innerCall() throws Exception { TransactionContext transactionContext = endpoint.getTransactionContext(parameters.transactionId); transactionContext.rollbackTransaction(); endpoint.removeTransactionContext(parameters.transactionId); return null; }
private void closeTransactionContextAfterFailedBegin(HazelcastTransactionObject txObject) { if (txObject.isNewTransactionContextHolder()) { TransactionContext context = txObject.getTransactionContextHolder().getContext(); try { context.rollbackTransaction(); } catch (Throwable ex) { logger.debug("Could not rollback Hazelcast transaction after failed transaction begin", ex); } txObject.setTransactionContextHolder(null, false); } }
private void closeTransactionContextAfterFailedBegin(HazelcastTransactionObject txObject) { if (txObject.isNewTransactionContextHolder()) { TransactionContext context = txObject.getTransactionContextHolder().getContext(); try { context.rollbackTransaction(); } catch (Throwable ex) { logger.debug("Could not rollback Hazelcast transaction after failed transaction begin", ex); } txObject.setTransactionContextHolder(null, false); } }
private void closeTransactionContextAfterFailedBegin(HazelcastTransactionObject txObject) { if (txObject.isNewTransactionContextHolder()) { TransactionContext context = txObject.getTransactionContextHolder().getContext(); try { context.rollbackTransaction(); } catch (Throwable ex) { logger.debug("Could not rollback Hazelcast transaction after failed transaction begin", ex); } txObject.setTransactionContextHolder(null, false); } }
@Override public void rollback() { if (isTransacted()) { contextLock.lock(); try { txnContext.rollbackTransaction(); // It appears that Hazelcast doesn't allow a transaction context // to be reused so we'll recreate the context after commit. txnContext = config.getHazelcastInstance().newTransactionContext(); txnContext.beginTransaction(); } finally { contextLock.unlock(); } } }
@Override public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException { final TransactionContext context = newTransactionContext(options); context.beginTransaction(); try { final T value = task.execute(context); context.commitTransaction(); return value; } catch (Throwable e) { context.rollbackTransaction(); if (e instanceof TransactionException) { throw (TransactionException) e; } if (e.getCause() instanceof TransactionException) { throw (TransactionException) e.getCause(); } if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new TransactionException(e); } }
@Override protected void doRollback(DefaultTransactionStatus status) throws TransactionException { HazelcastTransactionObject txObject = (HazelcastTransactionObject) status.getTransaction(); if (status.isDebug()) { logger.debug("Rolling back Hazelcast transaction on TransactionContext [" + txObject.getTransactionContextHolder().getContext() + "]"); } TransactionContext tx = txObject.getTransactionContextHolder().getContext(); tx.rollbackTransaction(); }
public void rollback() throws ResourceException { factory.logHzConnectionEvent(this, HzConnectionEvent.TX_COMPLETE); log(Level.FINEST, "rollback"); if (txContext == null) { throw new ResourceException("Invalid transaction context;" + " rollback operation invoked without an active transaction context"); } txContext.rollbackTransaction(); fireConnectionEvent(ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK); txContext = null; }
@Override protected void doRollback(DefaultTransactionStatus status) throws TransactionException { HazelcastTransactionObject txObject = (HazelcastTransactionObject) status.getTransaction(); if (status.isDebug()) { logger.debug("Rolling back Hazelcast transaction on TransactionContext [" + txObject.getTransactionContextHolder().getContext() + "]"); } TransactionContext tx = txObject.getTransactionContextHolder().getContext(); tx.rollbackTransaction(); }
@Override protected void doRollback(DefaultTransactionStatus status) throws TransactionException { HazelcastTransactionObject txObject = (HazelcastTransactionObject) status.getTransaction(); if (status.isDebug()) { logger.debug("Rolling back Hazelcast transaction on TransactionContext [" + txObject.getTransactionContextHolder().getContext() + "]"); } TransactionContext tx = txObject.getTransactionContextHolder().getContext(); tx.rollbackTransaction(); }
@Override public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException { checkNotNull(task, "TransactionalTask is required!"); TransactionContext context = newTransactionContext(options); context.beginTransaction(); try { T value = task.execute(context); context.commitTransaction(); return value; } catch (Throwable e) { context.rollbackTransaction(); if (e instanceof TransactionException) { throw (TransactionException) e; } if (e.getCause() instanceof TransactionException) { throw (TransactionException) e.getCause(); } if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new TransactionException(e); } }
@Override public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException { checkNotNull(task, "TransactionalTask is required!"); TransactionContext context = newTransactionContext(options); context.beginTransaction(); try { T value = task.execute(context); context.commitTransaction(); return value; } catch (Throwable e) { context.rollbackTransaction(); if (e instanceof TransactionException) { throw (TransactionException) e; } if (e.getCause() instanceof TransactionException) { throw (TransactionException) e.getCause(); } if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw new TransactionException(e); } }
@Override protected void releaseResource( HazelcastTransactionContextHolder resourceHolder, HazelcastInstance resourceKey) { log.finest("In HazelcastTransactionSynchronization::" + "releaseResource"); super.releaseResource(resourceHolder, resourceKey); if (resourceHolder.isTransactionActive()) { resourceHolder.getTransactionContext().rollbackTransaction(); } resourceHolder.clear(); } }
public void destroy() throws LoginException { clearAllListeners(); nodeEngine.onClientDisconnected(getUuid()); LoginContext lc = loginContext; if (lc != null) { lc.logout(); } for (TransactionContext context : transactionContextMap.values()) { if (context instanceof XATransactionContextImpl) { continue; } try { context.rollbackTransaction(); } catch (HazelcastInstanceNotActiveException e) { logger.finest(e); } catch (Exception e) { logger.warning(e); } } authenticated = false; }
@Override protected void doRollback(DefaultTransactionStatus status) throws TransactionException { HazelcastTransactionObject txObject = (HazelcastTransactionObject) status. getTransaction(); TransactionContext con = txObject.getTransactionContextHolder(). getTransactionContext(); if (status.isDebug() && log.isFinestEnabled()) { log.finest(format("Rolling back Hazelcast transaction on " + "TransactionContext [%s].", con)); } try { con.rollbackTransaction(); } catch (com.hazelcast.transaction.TransactionException ex) { throw new TransactionSystemException( "Could not roll back Hazelcast transaction", ex); } }
public static void main(String[] args) throws Exception { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); TransactionOptions txOptions = new TransactionOptions().setTimeout(10, TimeUnit.SECONDS); TransactionContext txCxt = hz.newTransactionContext(txOptions); txCxt.beginTransaction(); TransactionalMap<String, String> map = txCxt.getMap("map"); try { map.put("1", "1"); map.put("2", "2"); txCxt.commitTransaction(); } catch (RuntimeException t) { txCxt.rollbackTransaction(); throw t; } System.out.println("Finished"); Hazelcast.shutdownAll(); } }
public void destroy() throws LoginException { clearAllListeners(); nodeEngine.onClientDisconnected(getUuid()); LoginContext lc = loginContext; if (lc != null) { lc.logout(); } for (TransactionContext context : transactionContextMap.values()) { if (context instanceof XATransactionContextImpl) { continue; } try { context.rollbackTransaction(); } catch (HazelcastInstanceNotActiveException e) { getLogger().finest(e); } catch (Exception e) { getLogger().warning(e); } } authenticated = false; }