Package javax.transaction

Examples of javax.transaction.Synchronization.beforeCompletion()


      // Call synchronization in a new thread, to simulate a synchronization
      // triggered by a new remote call from a remote transaction coordinator.
      Thread synch = new Thread() {
        public void run() {
          synchronization.beforeCompletion();
          synchronization.afterCompletion(Status.STATUS_COMMITTED);
        }
      };
      synch.start();
      synch.join();
View Full Code Here


    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    tmControl.replay();
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    tmControl.verify();
  }

  public void testClobStringTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    tmControl.replay();
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    tmControl.verify();
  }

  public void testBlobStringTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    tmControl.replay();
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    tmControl.verify();
  }

  public void testBlobByteArrayTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    tmControl.replay();
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    tmControl.verify();
  }

  public void testBlobSerializableTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

                } else {
                    synch = (Synchronization) syncList.get(i++);
                }
            }
            try {
                synch.beforeCompletion();
            } catch (Exception e) {
                log.warn("Unexpected exception from beforeCompletion; transaction will roll back", e);
                synchronized (this) {
                    status = Status.STATUS_MARKED_ROLLBACK;
                }
View Full Code Here

                    return;
                }
                synch = (Synchronization) syncList.get(i++);
            }
            try {
                synch.beforeCompletion();
            } catch (Exception e) {
                log.warn("Unexpected exception from beforeCompletion; transaction will roll back", e);
                synchronized (this) {
                    status = Status.STATUS_MARKED_ROLLBACK;
                }
View Full Code Here

        interceptor.processInvocation(context);

        // commit
        for (Synchronization synchronization : synchronizations) {
            synchronization.beforeCompletion();
        }
        for (Synchronization synchronization : synchronizations) {
            synchronization.afterCompletion(Status.STATUS_COMMITTED);
        }
        synchronizations.clear();
View Full Code Here

        // Regular syncs first then the interposed syncs
        Enumeration e = syncs.elements();
        while (e.hasMoreElements()) {
            Synchronization sync = (Synchronization) e.nextElement();
            try {
                sync.beforeCompletion();
            } catch (RuntimeException rex) {
                try {
                    state.setRollbackOnly();
                } catch (Exception ex1) {
        _logger.log(Level.WARNING,
View Full Code Here

        }
        Enumeration e1 = interposedSyncs.elements();
        while (e1.hasMoreElements()) {
            Synchronization sync = (Synchronization) e1.nextElement();
            try {
                sync.beforeCompletion();
            } catch (RuntimeException rex) {
                try {
                    state.setRollbackOnly();
                } catch (Exception ex1) {
        _logger.log(Level.WARNING,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.