Package javax.transaction

Examples of javax.transaction.TransactionManager


      super.startService();

      try
      {
         TransactionManager tm = getTransactionManagerReference();

         ServerPeer serverPeer = (ServerPeer)server.getAttribute(serverPeerObjectName, "Instance");
         MessageStore ms = serverPeer.getMessageStore();
         TransactionRepository tr = serverPeer.getTxRepository();
         PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
View Full Code Here


     
      super.startService();
     
      try
     
         TransactionManager tm = getTransactionManagerReference();
        
         ServerPeer serverPeer = (ServerPeer)server.getAttribute(serverPeerObjectName, "Instance");
        
         MessageStore ms = serverPeer.getMessageStore();
        
View Full Code Here

  
   protected boolean checkNoBindingData() throws Exception
   {
      InitialContext ctx = new InitialContext();

      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
     
      javax.transaction.Transaction txOld = mgr.suspend();
      mgr.begin();
     
      java.sql.Connection conn = null;
     
      PreparedStatement ps = null;
     
      ResultSet rs = null;

      try
      {
         conn = ds.getConnection();
         String sql = "SELECT * FROM JBM_POSTOFFICE";
         ps = conn.prepareStatement(sql);
        
         rs = ps.executeQuery();
        
         return rs.next();
      }
      finally
      {
         if (rs != null) rs.close();
        
         if (ps != null) ps.close();
        
         if (conn != null) conn.close();
        
         mgr.commit();

         if (txOld != null)
         {
            mgr.resume(txOld);
         }
                 
      }
   }
View Full Code Here

         return false;
      }
     
      InitialContext ctx = new InitialContext();

      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
     
      javax.transaction.Transaction txOld = mgr.suspend();
      mgr.begin();
     
      java.sql.Connection conn = null;
     
      PreparedStatement ps = null;
     
      ResultSet rs = null;

      try
      {
         conn = ds.getConnection();
         String sql = "SELECT * FROM JBM_MSG_REF";
         ps = conn.prepareStatement(sql);
        
         rs = ps.executeQuery();
        
         boolean exists = rs.next();
        
         if (!exists)
         {
            rs.close();
           
            ps.close();
           
            ps = conn.prepareStatement("SELECT * FROM JBM_MSG");
           
            rs = ps.executeQuery();
          
            exists = rs.next();
         }
        
         return exists;
      }
      finally
      {
         if (rs != null) rs.close();
        
         if (ps != null) ps.close();
        
         if (conn != null) conn.close();
        
         mgr.commit();

         if (txOld != null)
         {
            mgr.resume(txOld);
         }
                 
      }
   }
View Full Code Here

     
      super.startService();
     
      try
     
         TransactionManager tm = getTransactionManagerReference();
        
         persistenceManager =
            new JDBCPersistenceManager(ds, tm, sqlProperties,
                                       createTablesOnStartup, usingBatchUpdates,
                                       usingBinaryStream, usingTrailingByte, maxParams);
View Full Code Here

   public void method()
   {
      System.out.println("*** POJO method");     
      try
      {
         TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
         if (tm.getTransaction() == null) throw new RuntimeException("method() has no tx set");
      }
      catch (Exception e)
      {
         // AutoGenerated
         throw new RuntimeException(e);
View Full Code Here

   public void method()
   {
      System.out.println("*** POJO method");     
      try
      {
         TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
         if (tm.getTransaction() == null) throw new RuntimeException("method() has no tx set");
      }
      catch (Exception e)
      {
         // AutoGenerated
         throw new RuntimeException(e);
View Full Code Here

      public void run()
      {
         try
         {
            complete = true;
            TransactionManager tm = getTransactionManager();
            Transaction tx = tm.getTransaction();
            tx.enlistResource(this);
         }
         catch (Exception e)
         {
            this.e = e;
View Full Code Here

         if (con.getBeanMetaData().isBeanManagedTx())
            throw new IllegalStateException("getRollbackOnly() not allowed for BMT beans.");

         try
         {
            TransactionManager tm = con.getTransactionManager();

            // The getRollbackOnly and setRollBackOnly method of the SessionContext interface should be used
            // only in the session bean methods that execute in the context of a transaction.
            if (tm.getTransaction() == null)
               throw new IllegalStateException("getRollbackOnly() not allowed without a transaction.");

            // JBAS-3847, consider an asynchronous rollback due to timeout
            int status = tm.getStatus();
            return TxUtils.isRollback(status);
         }
         catch (SystemException e)
         {
            log.warn("failed to get tx manager status; ignoring", e);
View Full Code Here

         if (con.getBeanMetaData().isBeanManagedTx())
            throw new IllegalStateException("setRollbackOnly() not allowed for BMT beans.");

         try
         {
            TransactionManager tm = con.getTransactionManager();

            // The getRollbackOnly and setRollBackOnly method of the SessionContext interface should be used
            // only in the session bean methods that execute in the context of a transaction.
            if (tm.getTransaction() == null)
               throw new IllegalStateException("setRollbackOnly() not allowed without a transaction.");

            tm.setRollbackOnly();
         }
         catch (SystemException e)
         {
            log.warn("failed to set rollback only; ignoring", e);
         }
View Full Code Here

TOP

Related Classes of javax.transaction.TransactionManager

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.