Project

General

Profile

« Previous | Next » 

Revision 5943

Added by berkley almost 14 years ago

think I fixed the connection problem. one connection in IdentifierManager was being leaked. added more debug info in case it happens again

View differences:

src/edu/ucsb/nceas/metacat/database/DBConnectionPool.java
259 259
            db.setCheckOutMethodName(methodName);
260 260
            db.setAutoCommit(true);
261 261
            //debug message
262
//            logMetacat.debug("DBConnectionPool.getDBConnection - The connection is checked out: " + db.getTag());
263
//            logMetacat.debug("DBConnectionPool.getDBConnection - The method for checking is: " + db.getCheckOutMethodName());
264
//            logMetacat.debug("DBConnectionPool.getDBConnection - The age is " + db.getAge());
265
//            logMetacat.debug("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
266
//            logMetacat.debug("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
262
            logMetacat.debug("DBConnectionPool.getDBConnection - The connection is checked out: " + db.getTag());
263
            logMetacat.debug("DBConnectionPool.getDBConnection - The method for checking is: " + db.getCheckOutMethodName());
264
            logMetacat.debug("DBConnectionPool.getDBConnection - The age is " + db.getAge());
265
            logMetacat.debug("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
266
            logMetacat.debug("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
267
            
268
            System.out.println("DBConnectionPool.getDBConnection - The connection is checked out: " + db.getTag());
269
            System.out.println("DBConnectionPool.getDBConnection - The method for checking is: " + db.getCheckOutMethodName());
270
            System.out.println("DBConnectionPool.getDBConnection - The age is " + db.getAge());
271
            System.out.println("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
272
            System.out.println("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
273
            
267 274
            //set check out time
268 275
            db.setCheckOutTime(System.currentTimeMillis());
269 276
            // set count of reach maximum 0 because it can check out
src/edu/ucsb/nceas/metacat/database/DBConnection.java
80 80
	}
81 81
	  
82 82
    conn = openConnection();
83
    if(conn == null)
84
    {
85
        System.out.println("connection is null.");
86
    }
83 87
    tag = conn.toString();
84 88
    status = 0;
85 89
    age = 0;
......
355 359
     // Load the Oracle JDBC driver
356 360
     try
357 361
     {
362
         System.out.println("db driver is " + dbDriver);
358 363
       Class.forName (dbDriver);
359 364
     }
360 365
     catch (ClassNotFoundException e)
src/edu/ucsb/nceas/metacat/IdentifierManager.java
820 820
    {
821 821
        ObjectList ol = new ObjectList();
822 822
        int total = 0;
823
        DBConnection dbConn = null;
824
        int serialNumber = -1;
823 825
        
824 826
        try
825 827
        {
......
876 878
                }
877 879
            }
878 880
            
879
            DBConnection dbConn = DBConnectionPool.getDBConnection("IdentifierManager.createMapping");
880
            int serialNumber = dbConn.getCheckOutSerialNumber();
881
            dbConn = DBConnectionPool.getDBConnection("IdentifierManager.querySystemMetadata");
882
            serialNumber = dbConn.getCheckOutSerialNumber();
881 883
            PreparedStatement stmt = dbConn.prepareStatement(sql);
882 884
            
883 885
            if(f1 && f2 && f3)
......
995 997
           e.printStackTrace();
996 998
           System.out.println("Error querying system metadata: " + e.getMessage());
997 999
        }
1000
        finally 
1001
        {
1002
            // Return database connection to the pool
1003
            DBConnectionPool.returnDBConnection(dbConn, serialNumber);
1004
        }
998 1005
        
999 1006
        ol.setStart(start);
1000 1007
        ol.setCount(ol.sizeObjectInfoList());

Also available in: Unified diff