[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool ConnectionPool.java,1.79,1.80 ProxoolFacad
UNMAINTAINED!
Brought to you by:
billhorsman
From: <bil...@us...> - 2005-09-26 09:54:22
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionPool.java ProxoolFacade.java Log Message: Avoid suspected deadlock when getting a detailed snapshot. Only attempt to get the concurrent lock for 10 seconds before giving up. Index: ConnectionPool.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPool.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** ConnectionPool.java 4 May 2005 16:26:31 -0000 1.79 --- ConnectionPool.java 26 Sep 2005 09:54:14 -0000 1.80 *************** *** 850,853 **** --- 850,854 ---- ci.setProxyHashcode(connectionInfo.getProxyHashcode()); ci.setDelegateHashcode(connectionInfo.getDelegateHashcode()); + ci.setLastSqlCall(connectionInfo.getLastSqlCall()); cis.add(ci); } *************** *** 1085,1091 **** protected void acquireConnectionStatusReadLock() { try { - // LOG.debug("About to acquire connectionStatus read lock"); connectionStatusReadWriteLock.readLock().acquire(); - // LOG.debug("Acquired connectionStatus read lock"); } catch (InterruptedException e) { log.error("Couldn't acquire connectionStatus read lock", e); --- 1086,1090 ---- *************** *** 1093,1096 **** --- 1092,1104 ---- } + protected boolean attemptConnectionStatusReadLock(long msecs) { + try { + return connectionStatusReadWriteLock.readLock().attempt(msecs); + } catch (InterruptedException e) { + log.error("Couldn't acquire connectionStatus read lock", e); + return false; + } + } + protected void releaseConnectionStatusReadLock() { connectionStatusReadWriteLock.readLock().release(); *************** *** 1106,1109 **** --- 1114,1120 ---- Revision history: $Log$ + Revision 1.80 2005/09/26 09:54:14 billhorsman + Avoid suspected deadlock when getting a detailed snapshot. Only attempt to get the concurrent lock for 10 seconds before giving up. + Revision 1.79 2005/05/04 16:26:31 billhorsman Only add a new connection if the definition matches Index: ProxoolFacade.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxoolFacade.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** ProxoolFacade.java 4 May 2005 16:32:31 -0000 1.82 --- ProxoolFacade.java 26 Sep 2005 09:54:14 -0000 1.83 *************** *** 695,706 **** if (detail) { try { ! cp.acquireConnectionStatusReadLock(); ! LOG.debug("Starting snapshot"); ! snapshot = Admin.getSnapshot(cp, cp.getDefinition(), cp.getConnectionInfos()); ! LOG.debug("Finishing snapshot"); } finally { cp.releaseConnectionStatusReadLock(); } ! } else { snapshot = Admin.getSnapshot(cp, cp.getDefinition(), null); } --- 695,710 ---- if (detail) { try { ! // Only try for 10 seconds! ! long start = System.currentTimeMillis(); ! if (cp.attemptConnectionStatusReadLock(10000)) { ! snapshot = Admin.getSnapshot(cp, cp.getDefinition(), cp.getConnectionInfos()); ! } else { ! LOG.warn("Give up waiting for detailed snapshot after " + (System.currentTimeMillis() - start) + " milliseconds. Serving standard snapshot instead."); ! } } finally { cp.releaseConnectionStatusReadLock(); } ! } ! if (snapshot == null) { snapshot = Admin.getSnapshot(cp, cp.getDefinition(), null); } *************** *** 818,821 **** --- 822,828 ---- Revision history: $Log$ + Revision 1.83 2005/09/26 09:54:14 billhorsman + Avoid suspected deadlock when getting a detailed snapshot. Only attempt to get the concurrent lock for 10 seconds before giving up. + Revision 1.82 2005/05/04 16:32:31 billhorsman Clone the definition when redefining or updating the pool. |