It is impossible to call recover in SpySession.java

here is why:

 
   if ( transacted ) {
         throw new IllegalStateException( "The session is transacted" );
      }
   if ( !transacted ) {
            throw new IllegalStateException( "The session is not transacted"
);
         }

This obviously doesnt make sense. I need to call recover from a
nontransacted session and have my unacknowledged messages redelivered. Here
is the code that needs to be fixed:

============================================================================
=====

  //Rollback a transacted session
   public synchronized void rollback()
      throws JMSException {

      synchronized ( runLock ) {

         if ( spyXAResource != null ) {
            throw new javax.jms.TransactionInProgressException( "Should not
be call from a XASession" );
         }
         if ( closed ) {
            throw new IllegalStateException( "The session is closed" );
         }
         if ( !transacted ) {
            throw new IllegalStateException( "The session is not transacted"
);
         }

         // rollback transaction
         try {
            connection.spyXAResourceManager.endTx( currentTransactionId,
true );
            connection.spyXAResourceManager.rollback( currentTransactionId
);
         } catch ( javax.transaction.xa.XAException e ) {
            throw new SpyJMSException( "Could not rollback", e );
         } finally {
            try {
               currentTransactionId =
connection.spyXAResourceManager.startTx();
            } catch ( Exception ignore ) {
            }
         }

      }
   }


   public synchronized void recover()
      throws JMSException {
      if ( closed ) {
         throw new IllegalStateException( "The session is closed" );
      }
      if ( transacted ) {
         throw new IllegalStateException( "The session is transacted" );
      }

      rollback();

   }


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to