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 16:32:39 GMT
weaver      2004/03/08 08:32:39

  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.2       +6 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PBTransaction.java	4 Mar 2004 21:20:07 -0000	1.1
  +++ PBTransaction.java	8 Mar 2004 16:32:39 -0000	1.2
  @@ -44,7 +44,8 @@
        */
       public void begin()
       {
  -        if (!pb.isClosed() && !pb.isInTransaction())
  +        store.checkBroker();
  +        if (!pb.isInTransaction())
           {
               invoker.beforeBegin();
               pb.beginTransaction();
  @@ -59,6 +60,7 @@
        */
       public void commit()
       {
  +        store.checkBroker();
           invoker.beforeCommit();
           Iterator itr = store.toBeStored.iterator();
           while(itr.hasNext())
  @@ -76,6 +78,7 @@
        */
       public void rollback()
       {
  +        store.checkBroker();
           invoker.beforeRollback();
           pb.abortTransaction();
           invoker.afterRollback();
  @@ -88,6 +91,7 @@
        */
       public void checkpoint()
       {
  +        store.checkBroker();
           Iterator itr = store.toBeStored.iterator();
           while(itr.hasNext())
           {
  @@ -103,6 +107,7 @@
        */
       public boolean isOpen()
       {
  +        store.checkBroker();
           return pb.isInTransaction();
       }
   
  
  
  
  1.4       +25 -33    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PBStore.java	5 Mar 2004 17:04:27 -0000	1.3
  +++ PBStore.java	8 Mar 2004 16:32:39 -0000	1.4
  @@ -30,7 +30,6 @@
   import org.apache.jetspeed.components.persistence.store.impl.StoreEventInvoker;
   import org.apache.jetspeed.components.persistence.store.ojb.CriteriaFilter;
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.PBFactoryException;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  @@ -116,6 +115,7 @@
        */
       public void deletePersistent(Object obj) throws LockFailedException
       {
  +        checkBroker();
           invoker.beforeDeletePersistent();        
           pb.delete(obj);
           invoker.afterDeletePersistent();
  @@ -127,6 +127,7 @@
        */
       public void deleteAll(Object query) throws LockFailedException
       {
  +        checkBroker();
           Collection deletes = pb.getCollectionByQuery((Query) query);
           Iterator itr = deletes.iterator();
           while(itr.hasNext())
  @@ -146,10 +147,7 @@
           invoker.beforeLookup();
           try
           {
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               return pb.getCollectionByQuery((Query) query);
           }
           finally
  @@ -158,6 +156,21 @@
           }
       }
   
  +    /**
  +     * <p>
  +     *  checkBroker
  +     * </p>
  +     * 
  +     * 
  +     */
  +    protected void checkBroker()
  +    {
  +        if(pb.isClosed())
  +        {
  +            pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  +        }
  +    }
  +
       /* (non-Javadoc)
        * @see org.apache.jetspeed.components.persistence.store.PersistenceStore#getCollectionByQuery(java.lang.Object,
int)
        */
  @@ -175,10 +188,7 @@
           invoker.beforeLookup();
           try
           {
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               return pb.getObjectByQuery((Query) query);
           }
           finally
  @@ -203,10 +213,7 @@
           invoker.beforeLookup();
           try
           {
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               return pb.getObjectByIdentity(new Identity(object, pb));
           }
           finally
  @@ -229,10 +236,7 @@
        */
       public int getCount(Object query)
       {
  -        if (pb.isClosed())
  -        {
  -            pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -        }
  +        checkBroker();
           return pb.getCount((Query) query);
          
       }
  @@ -245,10 +249,7 @@
           invoker.beforeLookup();
           try
           {
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               return pb.getIteratorByQuery((Query) query);
           }
           finally
  @@ -343,10 +344,7 @@
           try
           {
               invoker.beforeMakePersistent();
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               pb.store(obj);
               invoker.afterMakePersistent();
           }
  @@ -381,10 +379,7 @@
           invoker.beforeLookup();
           try
           {
  -            if(pb.isClosed())
  -            {
  -                pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -            }
  +            checkBroker();
               return pb.getCollectionByQuery(QueryFactory.newQuery(clazz, new Criteria()));
           }
           finally
  @@ -405,10 +400,7 @@
        */
       public void invalidateAll() throws LockFailedException
       {
  -        if(pb.isClosed())
  -        {
  -            pb = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  -        }
  +        checkBroker();
           pb.clearCache();
       }
       
  
  
  

---------------------------------------------------------------------
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