jakarta-slide-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-slide/src/share/org/apache/slide/store AbstractStore.java
Date Sat, 20 Jan 2001 20:46:09 GMT
remm        01/01/20 12:46:09

  Modified:    src/share/org/apache/slide/store AbstractStore.java
  Log:
  - If enlistment fails, transaction should also be put in rollbcak only mode.
  
  Revision  Changes    Path
  1.8       +22 -6     jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java
  
  Index: AbstractStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractStore.java	2001/01/20 20:06:59	1.7
  +++ AbstractStore.java	2001/01/20 20:46:08	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v
1.7 2001/01/20 20:06:59 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/01/20 20:06:59 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v
1.8 2001/01/20 20:46:08 remm Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/01/20 20:46:08 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public abstract class AbstractStore extends AbstractSimpleService
       implements Store {
  @@ -1077,8 +1077,9 @@
               }
           }
           if (!enlisted) {
  -            String exMessage = Messages.message
  -                (AbstractStore.class.getName() + ".enlistFail");
  +            String exMessage = Messages.format
  +                (AbstractStore.class.getName() + ".enlistFail", service);
  +            setRollbackOnly();
               throw new ServiceAccessException(this, exMessage);
           }
       }
  @@ -1120,6 +1121,21 @@
           } catch (Exception e) {
               // Something went wrong.
               throw new ServiceAccessException(this, e.getMessage());
  +        }
  +    }
  +    
  +    
  +    /**
  +     * Mark transaction as rollback in case of enlistment failure.
  +     */
  +    protected void setRollbackOnly() {
  +        try {
  +            Transaction transaction = 
  +                namespace.getTransactionManager().getTransaction();
  +            if (transaction == null)
  +                return;
  +            transaction.setRollbackOnly();
  +        } catch (Exception e) {
           }
       }
       
  
  
  

Mime
View raw message