commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bali...@apache.org
Subject cvs commit: jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl JDBMPersistenceManagerFactory.java MetaClassImpl.java
Date Sat, 13 Apr 2002 21:51:44 GMT
baliuka     02/04/13 14:51:44

  Modified:    simplestore/src/java/org/apache/commons/simplestore/jdbc
                        ConnectionWrapper.java DriverDataSource.java
               simplestore/src/java/org/apache/commons/simplestore/persistence
                        MetaClass.java
               simplestore/src/java/org/apache/commons/simplestore/persistence/impl
                        JDBMPersistenceManagerFactory.java
                        MetaClassImpl.java
  Log:
  
  
  Revision  Changes    Path
  1.2       +4 -4      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/jdbc/ConnectionWrapper.java
  
  Index: ConnectionWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/jdbc/ConnectionWrapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionWrapper.java	8 Mar 2002 20:23:01 -0000	1.1
  +++ ConnectionWrapper.java	13 Apr 2002 21:51:44 -0000	1.2
  @@ -61,14 +61,14 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: ConnectionWrapper.java,v 1.1 2002/03/08 20:23:01 baliuka Exp $
  + *@version    $Id: ConnectionWrapper.java,v 1.2 2002/04/13 21:51:44 baliuka Exp $
    *
    */
   public interface ConnectionWrapper extends Connection {
   
  -    public boolean isUsed();
  -    public void   release();
  -    public void    setUsed(boolean flag);
  +    public boolean isLocked();
  +    public void    release();
  +    public void    lock();
      
   
   }
  
  
  
  1.11      +12 -11    jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/jdbc/DriverDataSource.java
  
  Index: DriverDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/jdbc/DriverDataSource.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DriverDataSource.java	13 Apr 2002 13:28:09 -0000	1.10
  +++ DriverDataSource.java	13 Apr 2002 21:51:44 -0000	1.11
  @@ -78,7 +78,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: DriverDataSource.java,v 1.10 2002/04/13 13:28:09 baliuka Exp $
  + *@version    $Id: DriverDataSource.java,v 1.11 2002/04/13 21:51:44 baliuka Exp $
    *
    */
   public class DriverDataSource implements ConnectionFactory {
  @@ -222,7 +222,7 @@
               int i = 0;
               while ( true ) { //  must loop and wait not used connection
                   if (connection[i] != null) {           
  -                    if (!connection[i].isUsed()) {    
  +                    if (!connection[i].isLocked()) {    
                           counter = i;                  
                           
                           if (connection[ i ].isClosed()) { // expired ?
  @@ -243,7 +243,7 @@
                           connection[i] = newConnection();
                           break;
                       }
  -                i = ( i + 1 ) % maxConnections;
  +                i = ( i + 1 ) % connection.length;
                   try{
                       
                       if( i == 0  ) {
  @@ -256,7 +256,7 @@
               }
               
               
  -            connection[i].setUsed(true);
  +            connection[i].lock();
               
               return connection[i];
           }
  @@ -306,7 +306,7 @@
       }
       public Object invoke(Object object,java.lang.reflect.Method method,Object[] args)
         throws Throwable{
  -       
  +       try{
            if( method.getName().equals("close")  ) {
              used = null;
               synchronized( ds ){ 
  @@ -317,7 +317,7 @@
            }else if (method.getName().equals("release")){
                connection.close();
                return null;     
  -         }else if (method.getName().equals("isUsed")){
  +         }else if (method.getName().equals("isLocked")){
                
                return ( used == null || !used.isAlive() || 
                          used == Thread.currentThread()  
  @@ -325,14 +325,15 @@
                      ) ? Boolean.FALSE : Boolean.TRUE ;
                
                
  -         }else if (method.getName().equals("setUsed")){
  -            if( ((Boolean) args[0] ).booleanValue()){
  +         }else if (method.getName().equals("lock")){
  +            
                 used = Thread.currentThread();
  -            }else{
  -              used = null;
  -            }
  +            
               return null;
            }else  return method.invoke(connection,args) ;
  +       }catch( java.lang.reflect.InvocationTargetException ite ){
  +         throw ite.getTargetException().fillInStackTrace();
  +       }
       }
      public static  ConnectionWrapper create(Connection connection, ConnectionFactory ds){
          return (ConnectionWrapper)
  
  
  
  1.9       +3 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/MetaClass.java
  
  Index: MetaClass.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/MetaClass.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MetaClass.java	1 Apr 2002 17:08:09 -0000	1.8
  +++ MetaClass.java	13 Apr 2002 21:51:44 -0000	1.9
  @@ -61,10 +61,12 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *     baliuka@mwm.lt</a>
  - *@version    $Id: MetaClass.java,v 1.8 2002/04/01 17:08:09 baliuka Exp $
  + *@version    $Id: MetaClass.java,v 1.9 2002/04/13 21:51:44 baliuka Exp $
    */
   
   public interface MetaClass extends Spi{
  +    
  +    public MetaClass[] classes();
   
       public java.beans.PropertyDescriptor [] getProperties();
       
  
  
  
  1.2       +2 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/JDBMPersistenceManagerFactory.java
  
  Index: JDBMPersistenceManagerFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/JDBMPersistenceManagerFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JDBMPersistenceManagerFactory.java	24 Mar 2002 06:27:35 -0000	1.1
  +++ JDBMPersistenceManagerFactory.java	13 Apr 2002 21:51:44 -0000	1.2
  @@ -81,7 +81,7 @@
    * soft reference cache and XML metadata
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: JDBMPersistenceManagerFactory.java,v 1.1 2002/03/24 06:27:35 baliuka
Exp $
  + *@version    $Id: JDBMPersistenceManagerFactory.java,v 1.2 2002/04/13 21:51:44 baliuka
Exp $
    */
   public class JDBMPersistenceManagerFactory implements PersistenceManagerFactory{
       
  @@ -129,6 +129,7 @@
               }
               return pm;
           }catch( Exception e) {
  +            e.fillInStackTrace();
               throw new SimplestoreException(e.getClass()+":"+e.getMessage());
           }
       }
  
  
  
  1.15      +6 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/MetaClassImpl.java
  
  Index: MetaClassImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/MetaClassImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MetaClassImpl.java	19 Mar 2002 15:03:57 -0000	1.14
  +++ MetaClassImpl.java	13 Apr 2002 21:51:44 -0000	1.15
  @@ -65,7 +65,7 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *     baliuka@mwm.lt</a>
  - *@version    $Id: MetaClassImpl.java,v 1.14 2002/03/19 15:03:57 baliuka Exp $
  + *@version    $Id: MetaClassImpl.java,v 1.15 2002/04/13 21:51:44 baliuka Exp $
    */
   public class MetaClassImpl implements MetaClass, org.apache.commons.simplestore.tools.Constants
 {
       
  @@ -649,6 +649,11 @@
          
          return  getField(index).getReferenceClass();
         
  +    }
  +    
  +    public MetaClass[] classes() {
  +      return (MetaClass[])persitentClasses.values()
  +               .toArray( new MetaClass[]{});        
       }
       
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message