portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb PBTransaction.java PBStore.java
Date Mon, 08 Mar 2004 19:07:22 GMT
weaver      2004/03/08 11:07:22

  Modified:    components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb
                        PBTransaction.java PBStore.java
  Log:
  Found more places where pb timeout was an issue
  
  Revision  Changes    Path
  1.3       +13 -18    jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb/PBTransaction.java
  
  Index: PBTransaction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb/PBTransaction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PBTransaction.java	8 Mar 2004 16:32:39 -0000	1.2
  +++ PBTransaction.java	8 Mar 2004 19:07:22 -0000	1.3
  @@ -20,18 +20,17 @@
   import org.apache.jetspeed.components.persistence.store.Transaction;
   import org.apache.jetspeed.components.persistence.store.TransactionEventListener;
   import org.apache.jetspeed.components.persistence.store.impl.TransactionEventInvoker;
  -import org.apache.ojb.broker.PersistenceBroker;
   public class PBTransaction implements Transaction
   {
   
       private List eventListeners;
       private TransactionEventInvoker invoker;
  -    private PersistenceBroker pb;
  +    
       private PBStore store;
   
  -    public PBTransaction(PersistenceBroker pb, PBStore store)
  +    public PBTransaction(PBStore store)
       {
  -        this.pb = pb;
  +        
           this.store = store;
           eventListeners = new ArrayList();
           invoker = new TransactionEventInvoker(eventListeners, store);
  @@ -43,12 +42,11 @@
        * @see org.apache.jetspeed.components.persistence.store.Transaction#begin()
        */
       public void begin()
  -    {
  -        store.checkBroker();
  -        if (!pb.isInTransaction())
  +    {        
  +        if (!store.getBroker().isInTransaction())
           {
               invoker.beforeBegin();
  -            pb.beginTransaction();
  +            store.getBroker().beginTransaction();
               invoker.afterBegin();
           }
       }
  @@ -59,15 +57,14 @@
        * @see org.apache.jetspeed.components.persistence.store.Transaction#commit()
        */
       public void commit()
  -    {
  -        store.checkBroker();
  +    {        
           invoker.beforeCommit();
           Iterator itr = store.toBeStored.iterator();
           while(itr.hasNext())
           {
               store.store(itr.next());
           }
  -        pb.commitTransaction();
  +        store.getBroker().commitTransaction();
           invoker.afterCommit();
       }
   
  @@ -77,10 +74,9 @@
        * @see org.apache.jetspeed.components.persistence.store.Transaction#rollback()
        */
       public void rollback()
  -    {
  -        store.checkBroker();
  +    {        
           invoker.beforeRollback();
  -        pb.abortTransaction();
  +        store.getBroker().abortTransaction();
           invoker.afterRollback();
       }
   
  @@ -106,9 +102,8 @@
        * @see org.apache.jetspeed.components.persistence.store.Transaction#isOpen()
        */
       public boolean isOpen()
  -    {
  -        store.checkBroker();
  -        return pb.isInTransaction();
  +    {        
  +        return store.getBroker().isInTransaction();
       }
   
       /*
  @@ -118,7 +113,7 @@
        */
       public Object getWrappedTransaction()
       {
  -        return pb;
  +        return store.getBroker();
       }
   
       /*
  
  
  
  1.5       +16 -2     jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb/PBStore.java
  
  Index: PBStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/pb/PBStore.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PBStore.java	8 Mar 2004 16:32:39 -0000	1.4
  +++ PBStore.java	8 Mar 2004 19:07:22 -0000	1.5
  @@ -165,11 +165,25 @@
        */
       protected void checkBroker()
       {
  -        if(pb.isClosed())
  +        try
  +        {
  +            if (pb.isClosed())
  +            {
  +                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  +            }
  +        } 
  +        catch (IllegalStateException e)
           {
  +            // This happens sometimes when we check pb.isClosed()
               pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
           }
       }
  +    
  +    protected PersistenceBroker getBroker()
  +    {
  +        checkBroker();
  +        return pb;
  +    }
   
       /* (non-Javadoc)
        * @see org.apache.jetspeed.components.persistence.store.PersistenceStore#getCollectionByQuery(java.lang.Object,
int)
  @@ -279,7 +293,7 @@
        */
       public Transaction getTransaction()
       {
  -        return new PBTransaction(pb, this);
  +        return new PBTransaction(this);
       }
   
       /* (non-Javadoc)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message