Package org.springframework.transaction.support

Examples of org.springframework.transaction.support.TransactionCallbackWithoutResult


    public boolean isXidUnique(String xid, int excludeId) {
        return isXidUnique(xid, excludeId, "graphicalViews");
    }

    public void saveView(final GraphicalView view) {
        getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                // Decide whether to insert or update.
                if (view.getId() == Common.NEW_ID)
                    insertView(view);
View Full Code Here


    TransactionTemplate tt = new TransactionTemplate(jiniTM);

    assertSynchronizationManager();
   
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("Has thread session",
            TransactionSynchronizationManager.hasResource(space));

        spaceTemplate.write(entry, Lease.FOREVER);
View Full Code Here

    assertSynchronizationManager();

    final RuntimeException testException = new RuntimeException();
    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(
            TransactionStatus status) {
          assertTrue("Has thread session",
              TransactionSynchronizationManager
                  .hasResource(space));
View Full Code Here

    TransactionTemplate tt = new TransactionTemplate(jiniTM);

    assertSynchronizationManager();

    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("Has thread session",
            TransactionSynchronizationManager.hasResource(space));

        spaceTemplate.execute(new JavaSpaceCallback() {
View Full Code Here

       
    assertSynchronizationManager();
   
        tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
        try {
            tt.execute(new TransactionCallbackWithoutResult() {
                protected void doInTransactionWithoutResult(TransactionStatus status) {
                    assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(space));
                    spaceTemplate.execute(new JavaSpaceCallback() {
                      public Object doInSpace(JavaSpace js, Transaction transaction) throws RemoteException, TransactionException, UnusableEntryException, InterruptedException {
                        return null;
View Full Code Here

   
      TransactionSynchronizationManager.bindResource(space, holder);
     
      assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(space));
       
        tt.execute(new TransactionCallbackWithoutResult() {
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(space));
                spaceTemplate.execute(new JavaSpaceCallback() {
                  public Object doInSpace(JavaSpace js, Transaction transaction) throws RemoteException, TransactionException, UnusableEntryException, InterruptedException {
                  return null;
View Full Code Here

   
      TransactionSynchronizationManager.bindResource(space, holder);
     
      assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(space));
       
        tt.execute(new TransactionCallbackWithoutResult() {
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(space));
                spaceTemplate.execute(new JavaSpaceCallback() {
                  public Object doInSpace(JavaSpace js, Transaction transaction) throws RemoteException, TransactionException, UnusableEntryException, InterruptedException {
                  return null;
View Full Code Here

  public void testSimpleTransaction() throws Exception {
    assertNotNull(txTemplate);
    final Entry myEntry = new Entry() {
    };
    txTemplate.execute(new TransactionCallbackWithoutResult() {

      protected void doInTransactionWithoutResult(TransactionStatus status) {
        // we need to pass in a tx
        assertNotNull("no tx started", JiniUtils.getTransaction(space));
      }
View Full Code Here

    assertNull(spaceTemplate.read(template, timeout));
    final RuntimeException EXCEPTION = new RuntimeException("intentional exception");

    try {
      txTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(TransactionStatus status) {
          spaceTemplate.execute(new JavaSpaceCallback() {
            public Object doInSpace(JavaSpace js, Transaction transaction)
                throws RemoteException, TransactionException, UnusableEntryException,
View Full Code Here

    final RuntimeException EXCEPTION = new RuntimeException("intentional exception");

    try {
      // start tx (REQUIRED)
      txTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(final TransactionStatus status) {
          spaceTemplate.execute(new JavaSpaceCallback() {
            public Object doInSpace(JavaSpace js, final Transaction transaction)
                throws RemoteException, TransactionException, UnusableEntryException,
                InterruptedException {
              // check that we have a tx
              assertNotNull("no tx started", transaction);
              Object result = js.read(template, transaction, timeout);
              assertNull(result);
              // write
              js.write(template, transaction, Lease.ANY);

              notSupportedTransaction.execute(new TransactionCallbackWithoutResult() {
                protected void doInTransactionWithoutResult(final TransactionStatus status2) {
                  spaceTemplate.execute(new JavaSpaceCallback() {
                    public Object doInSpace(JavaSpace js2, Transaction transaction2)
                        throws RemoteException, TransactionException,
                        UnusableEntryException, InterruptedException {
                      // NOT_SUPPORTED means tx was suspended
                      assertNull(transaction2);
                     
                      assertSame(transaction2, JiniUtils.getTransaction(space));
                     
                      js2.write(anotherTemplate, transaction2, Lease.ANY);
                      // check object from
                      // find the object in the parent transaction
                      Object rez = js2.read(template, transaction, timeout);
                      assertNotNull(rez);
                      // but not in child transaction (NOT_SUPPORTED)
                      rez = js2.read(template, transaction2, timeout);
                      assertNull(rez);
                      rez = js2.read(anotherTemplate, transaction2, timeout);
                      assertNotNull(rez);
                      return null;
                    }
                  });

                }
              });
              // find the template
              result = js.read(template, transaction, timeout);
              assertNotNull(result);
              result = js.read(anotherTemplate, transaction, timeout);
              assertNotNull(result);

              return mandatoryTransaction.execute(new TransactionCallbackWithoutResult() {
                protected void doInTransactionWithoutResult(TransactionStatus status) {
                  Transaction tx = JiniUtils.getTransaction(space);
                  assertSame(transaction ,tx);
                  assertNotNull(spaceTemplate.readIfExists(template,timeout));
                  throw EXCEPTION;
View Full Code Here

TOP

Related Classes of org.springframework.transaction.support.TransactionCallbackWithoutResult

Copyright © 2018 www.massapicom. 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.