DO NOT REPLY [Bug 46373] New: tomcat6 cpu100%

2008-12-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46373

   Summary: tomcat6 cpu100%
   Product: Tomcat 6
   Version: 6.0.18
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: critical
  Priority: P1
 Component: Connectors
AssignedTo: dev@tomcat.apache.org
ReportedBy: [EMAIL PROTECTED]


sometimes ,server's cpu reaches 100%,and keep 100% all the time,until restart
the server.
there's about 100 servers using tomcat6.0.18(nio), and each server receives
more than 120 request per second, and the java version is 1.6.0_03.
i use ps -eL to find the nid which is using highest cpu%, 
here's the jstack infomation:
"http-8080-ClientPoller" daemon prio=10 tid=0x002aee1ca400 nid=0x4a21
runnable [0x40b39000..0x40b39c30]
   java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:184)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
- locked <0x002a9f6c1f98> (a sun.nio.ch.Util$1)
- locked <0x002a9f6c1f80> (a java.util.Collections$UnmodifiableSet)
- locked <0x002a9edd3488> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
at
org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1473)
at java.lang.Thread.run(Thread.java:619)

here's server.xml conf:



-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46373] tomcat6 cpu100%

2008-12-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46373


Filip Hanik <[EMAIL PROTECTED]> changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




--- Comment #1 from Filip Hanik <[EMAIL PROTECTED]>  2008-12-10 06:45:07 PST ---
What happens if you turn compression off?
There has been a bug reported to Sun about the selector waking up but reporting
no keys, causing the selector thread to spin. But we haven't got a reproducible
case yet.
Your jstack output shows the thread waiting in a select, and not spinning at
the very moment.

If you have more info, we would like to hear from you, to see if we can get a
reproducible test case

best
Filip


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



tomcat5.exe on Windows x64

2008-12-10 Thread George Sexton
Before I get flamed, I looked at a way to report this bug through 
bugzilla/jira and couldn't seem to find the right project...


I just went through a troubleshooting session getting tomcat5.exe to 
work on Windows 2008 x64 with x64 jre 1.6.0 Update 11. I was using the 
tomcat5.exe x64 binaries that I downloaded from svn.


The JVM the service was created with was "auto".

Attempts to start the service wrote:

[2008-12-10 10:04:24] [174  javajni.c] [error] The specified module 
could not be found.

[2008-12-10 10:04:24] [994  prunsrv.c] [error] Failed creating java
[2008-12-10 10:04:24] [1269 prunsrv.c] [error] ServiceStart returned 1


in the jakarta_server_x.log file.

After fooling around with it, I noticed that the jre installer created 
bad registry entries for


HKLM\Software\JavaSoft\Java Runtime Engine\1.6\RuntimeLib

the value was:

C:\Program Files\Java\jre6\bin\client\jvm.dll

The issue is that this file does not exist. Evidently, the Windows x64 
JRE does not include the client JVM, only the server jvm. The file:


C:\Program Files\Java\jre6\bin\server\jvm.dll

does exist. If I manually edit the registry entry, the service starts as 
expected.


I've submitted this as an installer bug to Sun.

It might be helpful if the code in tomcat5.exe actually checked for the 
existence of the jvm. It would have saved a lot of trouble if the log 
entry had actually said something like:


"Configured JVM: C:\Program Files\Java\jre6\bin\client\jvm.dll does not 
exist. Check the configured value for the JVM."


even:

"The specified module (C:\Program Files\Java\jre6\bin\client\jvm.dll) 
could not be found."


would be an improvement.

--
George Sexton
MH Software, Inc.
Voice: +1 303 438 9585
URL:   http://www.mhsoftware.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat5.exe on Windows x64

2008-12-10 Thread Mark Thomas
George Sexton wrote:
> Before I get flamed, I looked at a way to report this bug through
> bugzilla/jira and couldn't seem to find the right project...

Commons daemon - it is in JIRA although it really is a Sun bug and a
commons-daemon enhancement request.

Mark


> 
> I just went through a troubleshooting session getting tomcat5.exe to
> work on Windows 2008 x64 with x64 jre 1.6.0 Update 11. I was using the
> tomcat5.exe x64 binaries that I downloaded from svn.
> 
> The JVM the service was created with was "auto".
> 
> Attempts to start the service wrote:
> 
> [2008-12-10 10:04:24] [174  javajni.c] [error] The specified module
> could not be found.
> [2008-12-10 10:04:24] [994  prunsrv.c] [error] Failed creating java
> [2008-12-10 10:04:24] [1269 prunsrv.c] [error] ServiceStart returned 1
> 
> 
> in the jakarta_server_x.log file.
> 
> After fooling around with it, I noticed that the jre installer created
> bad registry entries for
> 
> HKLM\Software\JavaSoft\Java Runtime Engine\1.6\RuntimeLib
> 
> the value was:
> 
> C:\Program Files\Java\jre6\bin\client\jvm.dll
> 
> The issue is that this file does not exist. Evidently, the Windows x64
> JRE does not include the client JVM, only the server jvm. The file:
> 
> C:\Program Files\Java\jre6\bin\server\jvm.dll
> 
> does exist. If I manually edit the registry entry, the service starts as
> expected.
> 
> I've submitted this as an installer bug to Sun.
> 
> It might be helpful if the code in tomcat5.exe actually checked for the
> existence of the jvm. It would have saved a lot of trouble if the log
> entry had actually said something like:
> 
> "Configured JVM: C:\Program Files\Java\jre6\bin\client\jvm.dll does not
> exist. Check the configured value for the JVM."
> 
> even:
> 
> "The specified module (C:\Program Files\Java\jre6\bin\client\jvm.dll)
> could not be found."
> 
> would be an improvement.
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat5.exe on Windows x64

2008-12-10 Thread George Sexton
When I looked at the Commons-Daemon one, all of the entries were 3 or 
more years old, so I didn't think it was in use.


Mark Thomas wrote:

George Sexton wrote:

Before I get flamed, I looked at a way to report this bug through
bugzilla/jira and couldn't seem to find the right project...


Commons daemon - it is in JIRA although it really is a Sun bug and a
commons-daemon enhancement request.

Mark



I just went through a troubleshooting session getting tomcat5.exe to
work on Windows 2008 x64 with x64 jre 1.6.0 Update 11. I was using the
tomcat5.exe x64 binaries that I downloaded from svn.

The JVM the service was created with was "auto".

Attempts to start the service wrote:

[2008-12-10 10:04:24] [174  javajni.c] [error] The specified module
could not be found.
[2008-12-10 10:04:24] [994  prunsrv.c] [error] Failed creating java
[2008-12-10 10:04:24] [1269 prunsrv.c] [error] ServiceStart returned 1


in the jakarta_server_x.log file.

After fooling around with it, I noticed that the jre installer created
bad registry entries for

HKLM\Software\JavaSoft\Java Runtime Engine\1.6\RuntimeLib

the value was:

C:\Program Files\Java\jre6\bin\client\jvm.dll

The issue is that this file does not exist. Evidently, the Windows x64
JRE does not include the client JVM, only the server jvm. The file:

C:\Program Files\Java\jre6\bin\server\jvm.dll

does exist. If I manually edit the registry entry, the service starts as
expected.

I've submitted this as an installer bug to Sun.

It might be helpful if the code in tomcat5.exe actually checked for the
existence of the jvm. It would have saved a lot of trouble if the log
entry had actually said something like:

"Configured JVM: C:\Program Files\Java\jre6\bin\client\jvm.dll does not
exist. Check the configured value for the JVM."

even:

"The specified module (C:\Program Files\Java\jre6\bin\client\jvm.dll)
could not be found."

would be an improvement.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
George Sexton
MH Software, Inc.
Voice: +1 303 438 9585
URL:   http://www.mhsoftware.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat5.exe on Windows x64

2008-12-10 Thread George Sexton



George Sexton wrote:
When I looked at the Commons-Daemon one, all of the entries were 3 or 
more years old, so I didn't think it was in use.




At least the change log didn't have anything more current than 3 years...

--
George Sexton
MH Software, Inc.
Voice: +1 303 438 9585
URL:   http://www.mhsoftware.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725408 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 12:08:31 2008
New Revision: 725408

URL: http://svn.apache.org/viewvc?rev=725408&view=rev
Log:
Remove methods so that the caller knows what action is being taken

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=725408&r1=725407&r2=725408&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Dec 10 
12:08:31 2008
@@ -,21 +,7 @@
 }
 return false;
 }
-/**
- * Process given socket.
- */
-protected boolean processSocket(NioChannel socket) {
-return processSocket(socket,null);
-}
 
-
-/**
- * Process given socket for an event.
- */
-protected boolean processSocket(NioChannel socket, SocketStatus status) {
-return processSocket(socket,status,true);
-}
-
 protected boolean processSocket(NioChannel socket, SocketStatus status, 
boolean dispatch) {
 try {
 KeyAttachment attachment = 
(KeyAttachment)socket.getAttachment(false);
@@ -1409,13 +1395,12 @@
 processSocket(ka.getChannel(), status, false); //don't 
dispatch if the lines below are cancelling the key
 }
 }
-
+key.attach(null);
 if (ka!=null) handler.release(ka.getChannel());
 else handler.release((SocketChannel)key.channel());
 if (key.isValid()) key.cancel();
 if (key.channel().isOpen()) try {key.channel().close();}catch 
(Exception ignore){}
 try {ka.channel.close(true);}catch (Exception ignore){}
-key.attach(null);
 } catch (Throwable e) {
 if ( log.isDebugEnabled() ) log.error("",e);
 // Ignore
@@ -1539,12 +1524,12 @@
 //read goes before write
 if (sk.isReadable()) {
 //read notification
-if (!processSocket(channel, 
SocketStatus.OPEN))
-processSocket(channel, 
SocketStatus.DISCONNECT);
+if (!processSocket(channel, 
SocketStatus.OPEN, true))
+processSocket(channel, 
SocketStatus.DISCONNECT, true);
 } else {
 //future placement of a WRITE notif
-if (!processSocket(channel, 
SocketStatus.OPEN))
-processSocket(channel, 
SocketStatus.DISCONNECT);
+if (!processSocket(channel, 
SocketStatus.OPEN, true))
+processSocket(channel, 
SocketStatus.DISCONNECT, true);
 }
 } else {
 result = false;
@@ -1553,7 +1538,7 @@
 //later on, improve latch behavior
 if ( isWorkerAvailable() ) {
 unreg(sk, attachment,sk.readyOps());
-boolean close = (!processSocket(channel));
+boolean close = (!processSocket(channel, null, 
true));
 if (close) {
 
cancelledKey(sk,SocketStatus.DISCONNECT,false);
 }
@@ -1682,7 +1667,7 @@
 ka.setCometNotify(false);
 reg(key,ka,0);//avoid multiple calls, this gets 
reregistered after invokation
 //if (!processSocket(ka.getChannel(), 
SocketStatus.OPEN_CALLBACK)) processSocket(ka.getChannel(), 
SocketStatus.DISCONNECT);
-if (!processSocket(ka.getChannel(), 
SocketStatus.OPEN)) processSocket(ka.getChannel(), SocketStatus.DISCONNECT);
+if (!processSocket(ka.getChannel(), SocketStatus.OPEN, 
true)) processSocket(ka.getChannel(), SocketStatus.DISCONNECT, true);
 }else if ((ka.interestOps()&SelectionKey.OP_READ) == 
SelectionKey.OP_READ) {
 //only timeout sockets that we are waiting for a read 
from
 long delta = now - ka.getLastAccess();



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725417 - in /tomcat/trunk/java/org/apache/tomcat/util/net: NioChannel.java NioEndpoint.java SecureNioChannel.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 12:28:19 2008
New Revision: 725417

URL: http://svn.apache.org/viewvc?rev=725417&view=rev
Log:
implement timeout on sendfile write as wellimplement timeout on sendfile write 
as wellimplement timeout on sendfile write as wellimplement timeout on sendfile 
write as wellimplement timeout on sendfile write as wellimplement timeout on 
sendfile write as wellimplement timeout on sendfile write as wellimplement 
timeout on sendfile write as wellimplement timeout on sendfile write as well

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=725417&r1=725416&r2=725417&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java Wed Dec 10 
12:28:19 2008
@@ -199,8 +199,13 @@
 return 0;
 }
 
-public void flushOutbound() throws IOException {
-
+/**
+ * Return true if the buffer wrote data
+ * @return
+ * @throws IOException
+ */
+public boolean flushOutbound() throws IOException {
+return false;
 }
 
 public boolean isSendFile() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=725417&r1=725416&r2=725417&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Dec 10 
12:28:19 2008
@@ -1577,12 +1577,15 @@
 WritableByteChannel wc =(WritableByteChannel) ((sc instanceof 
SecureNioChannel)?sc:sc.getIOChannel());
 
 if (sc.getOutboundRemaining()>0) {
-sc.flushOutbound();
+if (sc.flushOutbound()) {
+attachment.access();
+}
 } else {
 long written = sd.fchannel.transferTo(sd.pos,sd.length,wc);
 if ( written > 0 ) {
 sd.pos += written;
 sd.length -= written;
+attachment.access();
 }
 }
 if ( sd.length <= 0 && sc.getOutboundRemaining()<=0) {
@@ -1662,13 +1665,14 @@
 if ( ka == null ) {
 cancelledKey(key, SocketStatus.ERROR,false); //we 
don't support any keys without attachments
 } else if ( ka.getError() ) {
-cancelledKey(key, SocketStatus.ERROR,true);
+cancelledKey(key, SocketStatus.ERROR,true);//TODO this 
is not yet being used
 } else if (ka.getComet() && ka.getCometNotify() ) {
 ka.setCometNotify(false);
 reg(key,ka,0);//avoid multiple calls, this gets 
reregistered after invokation
 //if (!processSocket(ka.getChannel(), 
SocketStatus.OPEN_CALLBACK)) processSocket(ka.getChannel(), 
SocketStatus.DISCONNECT);
 if (!processSocket(ka.getChannel(), SocketStatus.OPEN, 
true)) processSocket(ka.getChannel(), SocketStatus.DISCONNECT, true);
-}else if ((ka.interestOps()&SelectionKey.OP_READ) == 
SelectionKey.OP_READ) {
+}else if ((ka.interestOps()&SelectionKey.OP_READ) == 
SelectionKey.OP_READ ||
+  (ka.interestOps()&SelectionKey.OP_WRITE) == 
SelectionKey.OP_WRITE) {
 //only timeout sockets that we are waiting for a read 
from
 long delta = now - ka.getLastAccess();
 long timeout = (ka.getTimeout()==-1)?((long) 
socketProperties.getSoTimeout()):(ka.getTimeout());

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=725417&r1=725416&r2=725417&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Wed Dec 
10 12:28:19 2008
@@ -440,8 +440,11 @@
 }
 
 @Override
-public void flushOutbound() throws IOException {
+public boolean flushOutbound() throws IOException {
+int remaining = netOutBuffer.remaining();
 flush(netOutBuffer);

svn commit: r725443 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 13:29:10 2008
New Revision: 725443

URL: http://svn.apache.org/viewvc?rev=725443&view=rev
Log:
Reset the key to let go off references

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=725443&r1=725442&r2=725443&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Dec 10 
13:29:10 2008
@@ -1401,6 +1401,7 @@
 if (key.isValid()) key.cancel();
 if (key.channel().isOpen()) try {key.channel().close();}catch 
(Exception ignore){}
 try {ka.channel.close(true);}catch (Exception ignore){}
+ka.reset();
 } catch (Throwable e) {
 if ( log.isDebugEnabled() ) log.error("",e);
 // Ignore



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725474 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 14:43:30 2008
New Revision: 725474

URL: http://svn.apache.org/viewvc?rev=725474&view=rev
Log:
Make sure we check if the attachment is null

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=725474&r1=725473&r2=725474&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Dec 10 
14:43:30 2008
@@ -1400,8 +1400,8 @@
 else handler.release((SocketChannel)key.channel());
 if (key.isValid()) key.cancel();
 if (key.channel().isOpen()) try {key.channel().close();}catch 
(Exception ignore){}
-try {ka.channel.close(true);}catch (Exception ignore){}
-ka.reset();
+try {if (ka!=null) ka.channel.close(true);}catch (Exception 
ignore){}
+if (ka!=null) ka.reset();
 } catch (Throwable e) {
 if ( log.isDebugEnabled() ) log.error("",e);
 // Ignore



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725487 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java interceptor/SlowQueryReport.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 15:38:13 2008
New Revision: 725487

URL: http://svn.apache.org/viewvc?rev=725487&view=rev
Log:
refactor the slow query report a bit
also add the ability to remove a listener

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=725487&r1=725486&r2=725487&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Wed Dec 10 15:38:13 2008
@@ -263,6 +263,10 @@
 listeners.add(listener);
 }
 
+public void removeCloseListener(CloseListener listener) {
+listeners.remove(listener);
+}
+
 /**
  * Closes the pool and all disconnects all idle connections
  * Active connections will be closed upon the [EMAIL PROTECTED] 
java.sql.Connection#close close} method is called

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725487&r1=725486&r2=725487&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 15:38:13 2008
@@ -29,6 +29,8 @@
 import java.util.LinkedHashMap;
 import java.util.Map.Entry;
 
+import javax.management.openmbean.CompositeData;
+
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.jdbc.pool.ConnectionPool;
@@ -110,7 +112,7 @@
  */
 @Override
 public void closeInvoked() {
-// TODO Auto-generated method stub
+queries = null;
 
 }
 
@@ -187,6 +189,10 @@
 }
 this.pool = parent;
 }
+
+public void finalize() {
+if (pool!=null) pool.removeCloseListener(this);
+}
 
 
 public void poolClosed(ConnectionPool pool) {
@@ -194,6 +200,10 @@
 perPoolStats.remove(pool);
 }
 
+public CompositeData[] getSlowQueriesCD() {
+return null;
+}
+
 
 
 /**
@@ -326,29 +336,32 @@
 long delta = 
(process)?(System.currentTimeMillis()-start):Long.MIN_VALUE;
 //see if we meet the requirements to measure
 if (delta>threshold) {
-//extract the query string
-String sql = (query==null && args!=null &&  
args.length>0)?(String)args[0]:query;
-//if we do batch execution, then we name the query 'batch'
-if (sql==null && compare(executes[3],name)) {
-sql = "batch";
-}
-//if we have a query, record the stats
-if (sql!=null) {
-QueryStats qs = SlowQueryReport.this.queries.get(sql);
-if (qs == null) {
-qs = new QueryStats(sql);
-SlowQueryReport.this.queries.put((String)sql,qs);
-}
-qs.add(delta,start);
-}
+reportSlowQuery(args, name, start, delta);
 }
 //perform close cleanup
 if (close) {
 closed=true;
 delegate = null;
-queries = null;
 }
 return result;
 }
+
+protected void reportSlowQuery(Object[] args, final String name, long 
start, long delta) {
+//extract the query string
+String sql = (query==null && args!=null &&  
args.length>0)?(String)args[0]:query;
+//if we do batch execution, then we name the query 'batch'
+if (sql==null && compare(executes[3],name)) {
+sql = "batch";
+}
+//if we have a query, record the stats
+if (sql!=null) {
+QueryStats qs = SlowQueryReport.this.queries.get(sql);
+if (qs == null) {
+qs = new QueryStats(sql);
+SlowQueryReport.this.queries.put((String)sql,qs);
+}
+qs.add(delta,start);
+}
+}
 }
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED

svn commit: r725564 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java PoolProperties.java PooledConnection.java interceptor/SlowQueryReport.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 19:40:13 2008
New Revision: 725564

URL: http://svn.apache.org/viewvc?rev=725564&view=rev
Log:
get rid of closeListener, it turns into spaghetti code

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=725564&r1=725563&r2=725564&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Wed Dec 10 19:40:13 2008
@@ -58,18 +58,12 @@
  */
 
 public class ConnectionPool {
-public static interface CloseListener {
-void poolClosed(ConnectionPool pool);
-}
-
 //logger
 protected static Log log = LogFactory.getLog(ConnectionPool.class);
 
 
//===
 // INSTANCE/QUICK ACCESS VARIABLE
 
//===
-protected ConcurrentLinkedQueue listeners = new 
ConcurrentLinkedQueue();
-
 /**
  * All the information about the connection pool
  */
@@ -259,14 +253,6 @@
 close(true);
 }
 
-public void addCloseListener(CloseListener listener) {
-listeners.add(listener);
-}
-
-public void removeCloseListener(CloseListener listener) {
-listeners.remove(listener);
-}
-
 /**
  * Closes the pool and all disconnects all idle connections
  * Active connections will be closed upon the [EMAIL PROTECTED] 
java.sql.Connection#close close} method is called
@@ -306,10 +292,6 @@
 size.set(0);
 if (this.getPoolProperties().isJmxEnabled()) stopJmx();
 
-while (listeners.size()>0) {
-CloseListener listener = listeners.poll();
-if (listener!=null) listener.poolClosed(this);
-}
 } //closePool
 
 

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=725564&r1=725563&r2=725564&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 Wed Dec 10 19:40:13 2008
@@ -54,7 +54,7 @@
 protected int removeAbandonedTimeout = 60;
 protected boolean logAbandoned = false;
 protected int loginTimeout = 1;
-protected String name = "Tomcat Connection 
Pool["+(poolCounter.addAndGet(1))+"]";
+protected String name = "Tomcat Connection 
Pool["+(poolCounter.addAndGet(1))+","+System.identityHashCode(PoolProperties.class)+"]";
 protected String password;
 protected String username;
 protected long validationInterval = 3;

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java?rev=725564&r1=725563&r2=725564&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
 Wed Dec 10 19:40:13 2008
@@ -117,7 +117,7 @@
 
 
 //
-// com.filip.util.IPoolObject methods
+// 
 //
 
 public long getAbandonTimeout() {

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725564&r1=725563&r2=725564&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 19

svn commit: r725565 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java JdbcInterceptor.java ProxyConnection.java interceptor/SlowQueryReport.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 19:51:10 2008
New Revision: 725565

URL: http://svn.apache.org/viewvc?rev=725565&view=rev
Log:
remove more code not needed

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=725565&r1=725564&r2=725565&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Wed Dec 10 19:51:10 2008
@@ -64,6 +64,7 @@
 
//===
 // INSTANCE/QUICK ACCESS VARIABLE
 
//===
+
 /**
  * All the information about the connection pool
  */

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java?rev=725565&r1=725564&r2=725565&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
 Wed Dec 10 19:51:10 2008
@@ -74,7 +74,7 @@
  * @param con - the pooled connection
  */
 public abstract void reset(ConnectionPool parent, PooledConnection con);
-
+
 public List getProperties() {
 return properties;
 }

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java?rev=725565&r1=725564&r2=725565&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
 Wed Dec 10 19:51:10 2008
@@ -84,7 +84,7 @@
 if (isClosed()) throw new SQLException("Connection has already been 
closed.");
 return method.invoke(connection.getConnection(),args);
 }
-
+
 public boolean isClosed() {
 return connection==null || connection.isDiscarded();
 }

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725565&r1=725564&r2=725565&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 19:51:10 2008
@@ -53,8 +53,8 @@
 /**
  * we will be keeping track of query stats on a per pool basis, do we want 
this, or global?
  */
-protected static 
IdentityHashMap> perPoolStats = 
-new IdentityHashMap>();
+protected static HashMap> perPoolStats = 
+new HashMap>();
 /**
  * the queries that are used for this interceptor.
  */
@@ -69,11 +69,6 @@
 protected int  maxQueries= 1000; //don't store more than this amount of 
queries
 
 /**
- * The pool that is associated with this interceptor so that we can clean 
up
- */
-private ConnectionPool pool = null;
-
-/**
  * Returns the query stats for a given pool
  * @param pool - the pool we want to retrieve stats for
  * @return a hash map containing statistics for 0 to maxQueries 
@@ -115,8 +110,6 @@
 public void closeInvoked() {
 try {
 queries = null;
-finalize();
-pool = null;
 }catch (Exception x) {
 log.debug(x);
 }
@@ -190,14 +183,10 @@
 }
 
 };
-perPoolStats.put(parent, queries);
+perPoolStats.put(parent.getName(), queries);
 }
-this.pool = parent;
 }
 
-public void finalize() {
-}
-
 public CompositeData[] getSlowQueriesCD() {
 return null;
 

svn commit: r725575 - in /tomcat/trunk/modules/jdbc-pool: java/org/apache/tomcat/jdbc/pool/PoolProperties.java java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java test/org/apache/tomcat/

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 20:58:11 2008
New Revision: 725575

URL: http://svn.apache.org/viewvc?rev=725575&view=rev
Log:
Refactor a bit

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=725575&r1=725574&r2=725575&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 Wed Dec 10 20:58:11 2008
@@ -54,7 +54,7 @@
 protected int removeAbandonedTimeout = 60;
 protected boolean logAbandoned = false;
 protected int loginTimeout = 1;
-protected String name = "Tomcat Connection 
Pool["+(poolCounter.addAndGet(1))+","+System.identityHashCode(PoolProperties.class)+"]";
+protected String name = "Tomcat Connection 
Pool["+(poolCounter.addAndGet(1))+":"+System.identityHashCode(PoolProperties.class)+"]";
 protected String password;
 protected String username;
 protected long validationInterval = 3;

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725575&r1=725574&r2=725575&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 20:58:11 2008
@@ -24,10 +24,8 @@
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.management.openmbean.CompositeData;
 
@@ -53,12 +51,12 @@
 /**
  * we will be keeping track of query stats on a per pool basis, do we want 
this, or global?
  */
-protected static HashMap> perPoolStats = 
-new HashMap>();
+protected static 
ConcurrentHashMap> perPoolStats = 
+new ConcurrentHashMap>();
 /**
  * the queries that are used for this interceptor.
  */
-protected HashMap queries = null;
+protected ConcurrentHashMap queries = null;
 /**
  * The threshold in milliseconds. If the query is faster than this, we 
don't measure it
  */
@@ -73,8 +71,8 @@
  * @param pool - the pool we want to retrieve stats for
  * @return a hash map containing statistics for 0 to maxQueries 
  */
-public static HashMap getPoolStats(ConnectionPool pool) 
{
-return perPoolStats.get(pool);
+public static ConcurrentHashMap getPoolStats(String 
poolname) {
+return perPoolStats.get(poolname);
 }
 
 /**
@@ -171,19 +169,18 @@
  */
 public void reset(ConnectionPool parent, PooledConnection con) {
 //see if we already created a map for this pool
-queries = SlowQueryReport.perPoolStats.get(parent);
+queries = SlowQueryReport.perPoolStats.get(parent.getName());
 if (queries==null) {
 //create the map to hold our stats
 //however TODO we need to improve the eviction
 //selection
-queries = new LinkedHashMap() {
-@Override
-protected boolean removeEldestEntry(Entry 
eldest) {
-return size()>maxQueries;
-}
-
+queries = new ConcurrentHashMap() {
+
 };
-perPoolStats.put(parent.getName(), queries);
+if (perPoolStats.putIfAbsent(parent.getName(), queries)!=null) {
+//there already was one
+queries = SlowQueryReport.perPoolStats.get(parent.getName());
+}
 }
 }
 
@@ -206,6 +203,7 @@
 private long minInvocationTime = Long.MAX_VALUE;
 private long minInvocationDate;
 private long totalInvocationTime;
+private volatile long lastInvocation = 0;
 
 public String toString() {
 StringBuffer buf = new StringBuffer("QueryStats[query:");
@@ -244,6 +242,7 @@
 }
 nrOfInvocations++;
 totalInvocationTime+=invocationTime;
+lastInvocation = now;
   

svn commit: r725584 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java PoolProperties.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 21:17:19 2008
New Revision: 725584

URL: http://svn.apache.org/viewvc?rev=725584&view=rev
Log:
Refactor interceptor instantiation a bit

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=725584&r1=725583&r2=725584&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Wed Dec 10 21:17:19 2008
@@ -202,11 +202,10 @@
 PoolProperties.InterceptorDefinition[] proxies = 
getPoolProperties().getJdbcInterceptorsAsArray();
 for (int i=proxies.length-1; i>=0; i--) {
 try {
-JdbcInterceptor interceptor =
-(JdbcInterceptor) 
Class.forName(proxies[i].getClassName(), true, 
Thread.currentThread().getContextClassLoader()).newInstance(); //should this be 
the class loader?
+JdbcInterceptor interceptor = 
proxies[i].getInterceptorClass().newInstance();
 interceptor.setProperties(proxies[i].getProperties());
 interceptor.setNext(handler);
-interceptor.reset(this, con); //initialize
+interceptor.reset(this, con);
 handler = interceptor;
 }catch(Exception x) {
 SQLException sx = new SQLException("Unable to instantiate 
interceptor chain.");

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=725584&r1=725583&r2=725584&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 Wed Dec 10 21:17:19 2008
@@ -431,7 +431,7 @@
 public static class InterceptorDefinition {
 protected String className;
 protected List properties = new 
ArrayList();
-
+protected volatile Class clazz = null;
 public InterceptorDefinition(String className) {
 this.className = className;
 }
@@ -451,6 +451,13 @@
 public List getProperties() {
 return properties;
 }
+
+public Class getInterceptorClass() throws 
ClassNotFoundException {
+if (clazz==null) {
+clazz = Class.forName(getClassName(), true, 
JdbcInterceptor.class.getClassLoader());
+}
+return clazz;
+}
 } 
 
 public static class InterceptorProperty {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725586 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java JdbcInterceptor.java PoolProperties.java interceptor/SlowQueryReport.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 21:49:10 2008
New Revision: 725586

URL: http://svn.apache.org/viewvc?rev=725586&view=rev
Log:
Implemented closure notification. Turns out generics only work on an instance 
level, so you cant use static methods without having to use reflection.


Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=725586&r1=725585&r2=725586&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Wed Dec 10 21:49:10 2008
@@ -291,7 +291,14 @@
 }
 size.set(0);
 if (this.getPoolProperties().isJmxEnabled()) stopJmx();
-
+PoolProperties.InterceptorDefinition[] proxies = 
getPoolProperties().getJdbcInterceptorsAsArray();
+for (int i=0; ihttp://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java?rev=725586&r1=725585&r2=725586&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
 Wed Dec 10 21:49:10 2008
@@ -90,4 +90,14 @@
 public void setUseEquals(boolean useEquals) {
 this.useEquals = useEquals;
 }
+
+/**
+ * This method is invoked by a connection pool when the pool is closed.
+ * Interceptor classes can override this method if they keep static
+ * variables or other tracking means around.
+ * This method is only invoked on a single instance of the interceptor, 
and not on every instance created.
+ * @param pool - the pool that is being closed.
+ */
+public void poolClosed(ConnectionPool pool) {
+}
 }

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=725586&r1=725585&r2=725586&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 Wed Dec 10 21:49:10 2008
@@ -454,9 +454,9 @@
 
 public Class getInterceptorClass() throws 
ClassNotFoundException {
 if (clazz==null) {
-clazz = Class.forName(getClassName(), true, 
JdbcInterceptor.class.getClassLoader());
+clazz = Class.forName(getClassName(), true, 
this.getClass().getClassLoader());
 }
-return clazz;
+return (Class)clazz;
 }
 } 
 

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725586&r1=725585&r2=725586&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 21:49:10 2008
@@ -184,6 +184,16 @@
 }
 }
 
+
+/**
+ * [EMAIL PROTECTED]
+ */
+@Override
+public void poolClosed(ConnectionPool pool) {
+perPoolStats.remove(pool.getName());
+super.poolClosed(pool);
+}
+
 public CompositeData[] getSlowQueriesCD() {
 return null;
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r725592 - /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

2008-12-10 Thread fhanik
Author: fhanik
Date: Wed Dec 10 22:04:31 2008
New Revision: 725592

URL: http://svn.apache.org/viewvc?rev=725592&view=rev
Log:
minor cleanup

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=725592&r1=725591&r2=725592&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Wed Dec 10 22:04:31 2008
@@ -27,8 +27,6 @@
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.management.openmbean.CompositeData;
-
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.jdbc.pool.ConnectionPool;
@@ -48,8 +46,9 @@
  */
 protected static final Constructor[] constructors = 
 new Constructor[AbstractCreateStatementInterceptor.statements.length];
+
 /**
- * we will be keeping track of query stats on a per pool basis, do we want 
this, or global?
+ * we will be keeping track of query stats on a per pool basis
  */
 protected static 
ConcurrentHashMap> perPoolStats = 
 new ConcurrentHashMap>();
@@ -194,12 +193,6 @@
 super.poolClosed(pool);
 }
 
-public CompositeData[] getSlowQueriesCD() {
-return null;
-}
-
-
-
 /**
  * 
  * @author fhanik



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]