svn commit: r1360372 - /tomcat/trunk/webapps/docs/aio.xml
Author: fhanik Date: Wed Jul 11 19:51:57 2012 New Revision: 1360372 URL: http://svn.apache.org/viewvc?rev=1360372view=rev Log: Clarify documentation around send file Modified: tomcat/trunk/webapps/docs/aio.xml Modified: tomcat/trunk/webapps/docs/aio.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/aio.xml?rev=1360372r1=1360371r2=1360372view=diff == --- tomcat/trunk/webapps/docs/aio.xml (original) +++ tomcat/trunk/webapps/docs/aio.xml Wed Jul 11 19:51:57 2012 @@ -343,6 +343,11 @@ public class ChatServlet licodeorg.apache.tomcat.sendfile.start/code: Start offset as a Long/li licodeorg.apache.tomcat.sendfile.end/code: End offset as a Long/li /ul + p +In addition to setting these parameters it is necessary to set the content-length header. +or set a transfer-encoding like chunked. +Tomcat will not do that for you, since you may have already written data to the + /p /section - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1360393 - /tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java
Author: fhanik Date: Wed Jul 11 20:51:13 2012 New Revision: 1360393 URL: http://svn.apache.org/viewvc?rev=1360393view=rev Log: Cleanup and better file naming Modified: tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java Modified: tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java?rev=1360393r1=1360392r2=1360393view=diff == --- tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java (original) +++ tomcat/trunk/test/org/apache/catalina/connector/TestSendFile.java Wed Jul 11 20:51:13 2012 @@ -48,38 +48,45 @@ public class TestSendFile extends Tomcat @Test public void testSendFile() throws Exception { + Tomcat tomcat = getTomcatInstance(); Context root = tomcat.addContext(, TEMP_DIR); File[] files = new File[ITERATIONS]; for (int i=0; iITERATIONS; i++) { -files[i] = generateFile(TEMP_DIR, EXPECTED_CONTENT_LENGTH * (i+1)); +files[i] = generateFile(TEMP_DIR, -+i, EXPECTED_CONTENT_LENGTH * (i+1)); } +try { -for (int i=0; iITERATIONS; i++) { -WritingServlet servlet = new WritingServlet(files[i]); -Tomcat.addServlet(root, servlet + i, servlet); -root.addServletMapping(/servlet + i, servlet + i); -} +for (int i=0; iITERATIONS; i++) { +WritingServlet servlet = new WritingServlet(files[i]); +Tomcat.addServlet(root, servlet + i, servlet); +root.addServletMapping(/servlet + i, servlet + i); +} -tomcat.start(); +tomcat.start(); -ByteChunk bc = new ByteChunk(); -MapString, ListString respHeaders = new HashMapString, ListString(); -for (int i=0; iITERATIONS; i++) { -long start = System.currentTimeMillis(); -int rc = getUrl(http://localhost:; + getPort() + /servlet + i, bc, null, respHeaders); -assertEquals(HttpServletResponse.SC_OK, rc); -System.out.println(Client received +bc.getLength() + bytes in +(System.currentTimeMillis()-start)+ ms.); -assertEquals(EXPECTED_CONTENT_LENGTH * (i+1), bc.getLength()); +ByteChunk bc = new ByteChunk(); +MapString, ListString respHeaders = new HashMapString, ListString(); +for (int i=0; iITERATIONS; i++) { +long start = System.currentTimeMillis(); +int rc = getUrl(http://localhost:; + getPort() + /servlet + i, bc, null, respHeaders); +assertEquals(HttpServletResponse.SC_OK, rc); +System.out.println(Client received +bc.getLength() + bytes in +(System.currentTimeMillis()-start)+ ms.); +assertEquals(EXPECTED_CONTENT_LENGTH * (i+1), bc.getLength()); -bc.recycle(); +bc.recycle(); +} +} finally { +for (File f : files) { +f.delete(); +} } } -public File generateFile(String dir, int size) throws IOException { -String name = testSendFile-+System.currentTimeMillis()+.txt; +public File generateFile(String dir, String suffix, int size) throws IOException { +String name = testSendFile-+System.currentTimeMillis()+suffix+.txt; File f = new File(dir,name); FileWriter fw = new FileWriter(f, false); BufferedWriter w = new BufferedWriter(fw); @@ -93,6 +100,7 @@ public class TestSendFile extends Tomcat } w.flush(); w.close(); +System.out.println(Created file:+f.getAbsolutePath()+ with +f.length()+ bytes.); return f; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1360408 - /tomcat/trunk/webapps/docs/aio.xml
Author: fhanik Date: Wed Jul 11 21:24:18 2012 New Revision: 1360408 URL: http://svn.apache.org/viewvc?rev=1360408view=rev Log: correct the sentence. chunked will not work, as the length is fixed and not encoding is added during send file Modified: tomcat/trunk/webapps/docs/aio.xml Modified: tomcat/trunk/webapps/docs/aio.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/aio.xml?rev=1360408r1=1360407r2=1360408view=diff == --- tomcat/trunk/webapps/docs/aio.xml (original) +++ tomcat/trunk/webapps/docs/aio.xml Wed Jul 11 21:24:18 2012 @@ -345,7 +345,6 @@ public class ChatServlet /ul p In addition to setting these parameters it is necessary to set the content-length header. -or set a transfer-encoding like chunked. Tomcat will not do that for you, since you may have already written data to the /p - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1360433 - in /tomcat/trunk: build.properties.default build.xml
Author: fhanik Date: Wed Jul 11 22:01:17 2012 New Revision: 1360433 URL: http://svn.apache.org/viewvc?rev=1360433view=rev Log: Add IPv4Stack flag one can control from build.properties and build.properties.default default value is false but can be overridden even from command line default compile source/target is 1.7, but has to be changed in build.properties.default to take into effect Modified: tomcat/trunk/build.properties.default tomcat/trunk/build.xml Modified: tomcat/trunk/build.properties.default URL: http://svn.apache.org/viewvc/tomcat/trunk/build.properties.default?rev=1360433r1=1360432r2=1360433view=diff == --- tomcat/trunk/build.properties.default (original) +++ tomcat/trunk/build.properties.default Wed Jul 11 22:01:17 2012 @@ -203,3 +203,5 @@ dojo-js.home=${base.path}/dojo-release-1 dojo-js.loc=http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1.tar.gz dojo-js.jar=${dojo-js.home}/dojo/dojo.js +# - JVM settings for unit tests +java.net.preferIPv4Stack=false \ No newline at end of file Modified: tomcat/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1360433r1=1360432r2=1360433view=diff == --- tomcat/trunk/build.xml (original) +++ tomcat/trunk/build.xml Wed Jul 11 22:01:17 2012 @@ -74,9 +74,9 @@ !-- build output directory for jdbc-pool -- property name=tomcat.pool value=${tomcat.output}/jdbc-pool/ - !-- Servlet 3.0 spec requires 1.6+ -- - property name=compile.source value=1.6/ - property name=compile.target value=1.6/ + !-- Servlet 3.1 spec requires 1.7+ - these get overriden by build.properties(.default)-- + property name=compile.source value=1.7/ + property name=compile.target value=1.7/ !-- Locations to create the JAR artifacts -- !-- Standard JARs -- @@ -1197,6 +1197,8 @@ jvmarg value=${test.jvmarg.egd}/ jvmarg value=-Djava.library.path=${test.apr.loc}/ jvmarg value=${test.formatter}/ +jvmarg value=-Djava.net.preferIPv4Stack=${java.net.preferIPv4Stack}/ +jvmarg value=-Dorg.apache.tomcat.util.net.NioSelectorShared=${org.apache.tomcat.util.net.NioSelectorShared}/ classpath refid=tomcat.test.classpath / - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1360449 - /tomcat/trunk/webapps/docs/aio.xml
Author: fhanik Date: Wed Jul 11 22:29:08 2012 New Revision: 1360449 URL: http://svn.apache.org/viewvc?rev=1360449view=rev Log: fix sentence Modified: tomcat/trunk/webapps/docs/aio.xml Modified: tomcat/trunk/webapps/docs/aio.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/aio.xml?rev=1360449r1=1360448r2=1360449view=diff == --- tomcat/trunk/webapps/docs/aio.xml (original) +++ tomcat/trunk/webapps/docs/aio.xml Wed Jul 11 22:29:08 2012 @@ -345,7 +345,7 @@ public class ChatServlet /ul p In addition to setting these parameters it is necessary to set the content-length header. -Tomcat will not do that for you, since you may have already written data to the +Tomcat will not do that for you, since you may have already written data to the output stream. /p /section - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1359705 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Tue Jul 10 14:47:07 2012 New Revision: 1359705 URL: http://svn.apache.org/viewvc?rev=1359705view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=53526 Use proper comparison of objects Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1359705r1=1359704r2=1359705view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Jul 10 14:47:07 2012 @@ -834,7 +834,7 @@ public class ConnectionPool { */ protected boolean terminateTransaction(PooledConnection con) { try { -if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE) { +if (Boolean.FALSE.equals(con.getPoolProperties().getDefaultAutoCommit())) { if (this.getPoolProperties().getRollbackOnReturn()) { boolean autocommit = con.getConnection().getAutoCommit(); if (!autocommit) con.getConnection().rollback(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1359362 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java
Author: fhanik Date: Mon Jul 9 19:39:51 2012 New Revision: 1359362 URL: http://svn.apache.org/viewvc?rev=1359362view=rev Log: fix doc according to https://issues.apache.org/bugzilla/show_bug.cgi?id=53523 Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java?rev=1359362r1=1359361r2=1359362view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java Mon Jul 9 19:39:51 2012 @@ -796,7 +796,7 @@ public interface PoolConfiguration { /** * Set to true if you want the connection pool to commit any pending transaction when a connection is returned. * The default value is false, as this could result in committing data. - * This parameter is only looked at if the {@link java.sql.Connection#getAutoCommit()} returns false + * This parameter is only looked at if the {@link #getDefaultAutoCommit()} returns false * @param commitOnReturn set to true if the pool should call {@link java.sql.Connection#commit()} when a connection is returned to the pool. * Default is false */ @@ -810,7 +810,7 @@ public interface PoolConfiguration { /** * Set to true if you want the connection pool to rollback any pending transaction when a connection is returned. * The default value is false, as this could result in committing data. - * This parameter is only looked at if the {@link java.sql.Connection#getAutoCommit()} returns false + * This parameter is only looked at if the {@link #getDefaultAutoCommit()} returns false * @param rollbackOnReturn set to true if the pool should call {@link java.sql.Connection#rollback()} when a connection is returned to the pool. * Default is false */ - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1358057 - in /tomcat/trunk: java/org/apache/catalina/connector/Connector.java webapps/docs/changelog.xml webapps/docs/config/http.xml
Author: fhanik Date: Fri Jul 6 07:01:22 2012 New Revision: 1358057 URL: http://svn.apache.org/viewvc?rev=1358057view=rev Log: Change the default connector for Tomcat 8 Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/http.xml Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1358057r1=1358056r2=1358057view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Fri Jul 6 07:01:22 2012 @@ -551,7 +551,7 @@ public class Connector extends Lifecycle */ public String getProtocol() { -if (org.apache.coyote.http11.Http11Protocol.equals +if (org.apache.coyote.http11.Http11NioProtocol.equals (getProtocolHandlerClassName()) || org.apache.coyote.http11.Http11AprProtocol.equals (getProtocolHandlerClassName())) { @@ -590,7 +590,7 @@ public class Connector extends Lifecycle } else { if (HTTP/1.1.equals(protocol)) { setProtocolHandlerClassName -(org.apache.coyote.http11.Http11Protocol); +(org.apache.coyote.http11.Http11NioProtocol); } else if (AJP/1.3.equals(protocol)) { setProtocolHandlerClassName (org.apache.coyote.ajp.AjpProtocol); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1358057r1=1358056r2=1358057view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Fri Jul 6 07:01:22 2012 @@ -85,6 +85,10 @@ subsection name=Coyote changelog scode +The default connector is now the Java NIO connector +even when specifying HTTP/1.1 as protocol (fhanik) + /scode + scode Update default value of pollerThreadCount for the NIO connector. The new default value will never go above 2 regardless of available processors. (fhanik) Modified: tomcat/trunk/webapps/docs/config/http.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1358057r1=1358056r2=1358057view=diff == --- tomcat/trunk/webapps/docs/config/http.xml (original) +++ tomcat/trunk/webapps/docs/config/http.xml Fri Jul 6 07:01:22 2012 @@ -157,7 +157,7 @@ attribute name=protocol required=false pSets the protocol to handle incoming traffic. The default value is codeHTTP/1.1/code which uses an auto-switching mechanism to select -either a blocking Java based connector or an APR/native based connector. +either a non blocking Java based connector or an APR/native based connector. If the codePATH/code (Windows) or codeLD_LIBRARY_PATH/code (on most unix systems) environment variables contain the Tomcat native library, the APR/native connector will be used. If the native library - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1358271 - in /tomcat/trunk/java/org/apache: catalina/connector/CoyoteAdapter.java catalina/core/AsyncContextImpl.java coyote/http11/Http11NioProcessor.java tomcat/util/net/SocketStatus.ja
Author: fhanik Date: Fri Jul 6 15:40:14 2012 New Revision: 1358271 URL: http://svn.apache.org/viewvc?rev=1358271view=rev Log: Add in the ability to catch non blocking read and write errors and propagate that to the servlet Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1358271r1=1358270r2=1358271view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Fri Jul 6 15:40:14 2012 @@ -293,6 +293,22 @@ public class CoyoteAdapter implements Ad if (!asyncConImpl.timeout()) { asyncConImpl.setErrorState(null); } +} else if (status==SocketStatus.ASYNC_READ_ERROR) { +success = true; +Throwable t = (Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION); +req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION); +asyncConImpl.notifyReadError(t); +if (t != null) { +asyncConImpl.setErrorState(t); +} +} else if (status==SocketStatus.ASYNC_WRITE_ERROR) { +success = true; +Throwable t = (Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION); +req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION); +asyncConImpl.notifyWriteError(t); +if (t != null) { +asyncConImpl.setErrorState(t); +} } Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1358271r1=1358270r2=1358271view=diff == --- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Fri Jul 6 15:40:14 2012 @@ -135,6 +135,32 @@ public class AsyncContextImpl implements return true; } +public boolean notifyWriteError(Throwable error) { +if (request.getResponse().getCoyoteResponse().getWriteListener()==null) return false; +ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); +ClassLoader newCL = request.getContext().getLoader().getClassLoader(); +try { +Thread.currentThread().setContextClassLoader(newCL); + request.getResponse().getCoyoteResponse().getWriteListener().onError(error); +return true; +} finally { +Thread.currentThread().setContextClassLoader(oldCL); +} +} + +public boolean notifyReadError(Throwable error) { +if (request.getCoyoteRequest().getReadListener()==null) return false; +ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); +ClassLoader newCL = request.getContext().getLoader().getClassLoader(); +try { +Thread.currentThread().setContextClassLoader(newCL); +request.getCoyoteRequest().getReadListener().onError(error); +return true; +} finally { +Thread.currentThread().setContextClassLoader(oldCL); +} +} + public boolean timeout() throws IOException { AtomicBoolean result = new AtomicBoolean(); request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1358271r1=1358270r2=1358271view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Fri Jul 6 15:40:14 2012 @@ -24,6 +24,7 @@ import java.util.concurrent.atomic.Atomi import javax.net.ssl.SSLEngine; import javax.servlet.ReadListener; +import javax.servlet.RequestDispatcher; import javax.servlet.WriteListener; import org.apache.coyote.ActionCode; @@ -192,14 +193,15 @@ public class Http11NioProcessor extends } }catch (IOException x) { if (log.isDebugEnabled()) log.debug(Unable to write async data.,x); -//TODO FIXME-- fix - so we can
svn commit: r1358287 - in /tomcat/trunk: java/org/apache/coyote/AsyncStateMachine.java test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java test/org/apache/catalina/startup/TomcatBaseTest.java
Author: fhanik Date: Fri Jul 6 16:01:36 2012 New Revision: 1358287 URL: http://svn.apache.org/viewvc?rev=1358287view=rev Log: Add in test for write error Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1358287r1=1358286r2=1358287view=diff == --- tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java (original) +++ tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java Fri Jul 6 16:01:36 2012 @@ -296,7 +296,8 @@ public class AsyncStateMachineS { public synchronized void asyncError() { if (state == AsyncState.DISPATCHED || -state == AsyncState.TIMING_OUT) { +state == AsyncState.TIMING_OUT || +state == AsyncState.READ_WRITE_OP) { state = AsyncState.ERROR; } else { throw new IllegalStateException( Modified: tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java?rev=1358287r1=1358286r2=1358287view=diff == --- tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java (original) +++ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java Fri Jul 6 16:01:36 2012 @@ -16,7 +16,12 @@ */ package org.apache.catalina.nonblocking; +import java.io.BufferedInputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -133,6 +138,69 @@ public class TestNonBlockingAPI extends Assert.assertEquals(HttpServletResponse.SC_OK, rc); } + +@Test +public void testNonBlockingWriteError() throws Exception { +String bind = localhost; +// Configure a context with digest auth and a single protected resource +Tomcat tomcat = getTomcatInstance(); +// Must have a real docBase - just use temp +StandardContext ctx = (StandardContext) tomcat.addContext(, System.getProperty(java.io.tmpdir)); + +NBWriteServlet servlet = new NBWriteServlet(); +String servletName = NBWriteServlet.class.getName(); +Wrapper servletWrapper = tomcat.addServlet(ctx, servletName, servlet); +ctx.addServletMapping(/, servletName); +tomcat.getConnector().setProperty(socket.txBufSize, 1024); +tomcat.getConnector().setProperty(address, bind); +System.out.println(tomcat.getConnector().getProperty(address)); +tomcat.start(); + +MapString, ListString resHeaders = new HashMapString, ListString(); +ByteChunk slowReader = new ByteChunk(); +slowReader.setLimit(1); // FIXME BUFFER IS BROKEN, 0 doesn't work +slowReader.setByteOutputChannel(new ByteOutputChannel() { +long counter = 0; +long delta = 0; + +@Override +public void realWriteBytes(byte[] cbuf, int off, int len) throws IOException { +try { +if (len == 0) +return; +counter += len; +delta += len; +if (counter bytesToDownload) { +System.out.println(ERROR Downloaded more than expected ERROR); +} else if (counter == bytesToDownload) { +System.out.println(Download complete( + bytesToDownload + bytes)); +// } else if (counter (1966086)) { +// System.out.println(Download almost complete, missing bytes (+counter+)); +} else if (delta (bytesToDownload / 16)) { +System.out.println(Read + counter + bytes.); +delta = 0; +Thread.currentThread().sleep(500); +} +} catch (Exception x) { +throw new IOException(x); +} +} +}); +int rc = postUrlWithDisconnect(true, new DataWriter(0), http://; + bind + : + getPort() + /, slowReader, resHeaders, +null); +slowReader.flushBuffer(); +Assert.assertEquals(HttpServletResponse.SC_OK, rc); +try { +//allow the listeners to finish up +Thread.sleep(1000); +} catch (Exception e) { +} +Assert.assertTrue(Error listener should have been invoked
svn commit: r1356849 - /tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
Author: fhanik Date: Tue Jul 3 17:54:25 2012 New Revision: 1356849 URL: http://svn.apache.org/viewvc?rev=1356849view=rev Log: Allow servlets to specify async support as annotation when added programatically Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1356849r1=1356848r2=1356849view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Tue Jul 3 17:54:25 2012 @@ -29,6 +29,7 @@ import java.util.logging.Logger; import javax.servlet.Servlet; import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; import org.apache.catalina.Container; import org.apache.catalina.Context; @@ -801,11 +802,25 @@ public class Tomcat { @SuppressWarnings(deprecation) public ExistingStandardWrapper( Servlet existing ) { this.existing = existing; +this.asyncSupported = isAsyncSupported(); if (existing instanceof javax.servlet.SingleThreadModel) { singleThreadModel = true; instancePool = new StackServlet(); } +this.asyncSupported = hasAsync(); } + +public boolean hasAsync() { +if (isAsyncSupported()) return true; +boolean result = false; +Class clazz = existing.getClass(); +if (clazz.isAnnotationPresent(WebServlet.class)) { +WebServlet ws = (WebServlet)clazz.getAnnotation(WebServlet.class); +result = ws.asyncSupported(); +} +return result; +} + @Override public synchronized Servlet loadServlet() throws ServletException { if (singleThreadModel) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1356852 - in /tomcat/trunk/test/org/apache/catalina/startup: BytesStreamer.java TomcatBaseTest.java
Author: fhanik Date: Tue Jul 3 17:55:09 2012 New Revision: 1356852 URL: http://svn.apache.org/viewvc?rev=1356852view=rev Log: With async and non block unit tests we need a way to stream data up to the client, byte streamer offers an easy way to do that Added: tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java (with props) Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Added: tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java?rev=1356852view=auto == --- tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java (added) +++ tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java Tue Jul 3 17:55:09 2012 @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.startup; + +/** + * + * Used by {@link TomcatBaseTest} + * + * + */ +public interface BytesStreamer { +/** + * Returns the length of the content about to be streamed. + * Return -1 if length is unknown and chunked encoding should be used + * @return the length if known - otherwise -1 + */ +int getLength(); + +/** + * return the number of bytes available in next chunk + * @return + */ +int available(); + +/** + * returns the next byte to write. + * if {@link #available()} method returns 0 + * @return + */ +byte[] next(); +} Propchange: tomcat/trunk/test/org/apache/catalina/startup/BytesStreamer.java -- svn:eol-style = native Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1356852r1=1356851r2=1356852view=diff == --- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Tue Jul 3 17:55:09 2012 @@ -285,9 +285,36 @@ public abstract class TomcatBaseTest ext return postUrl(body, path, out, null, resHead); } -public static int postUrl(byte[] body, String path, ByteChunk out, +public static int postUrl(final byte[] body, String path, ByteChunk out, MapString, ListString reqHead, MapString, ListString resHead) throws IOException { +BytesStreamer s = new BytesStreamer() { +boolean done = false; +@Override +public byte[] next() { +done = true; +return body; + +} + +@Override +public int getLength() { +return body.length; +} + +@Override +public int available() { +if (done) return 0; +else return body.length; +} +}; +return postUrl(false,s,path,out,reqHead,resHead); +} + + +public static int postUrl(boolean stream, BytesStreamer streamer, String path, ByteChunk out, +MapString, ListString reqHead, +MapString, ListString resHead) throws IOException { URL url = new URL(path); HttpURLConnection connection = @@ -307,15 +334,26 @@ public abstract class TomcatBaseTest ext valueList.toString()); } } +if (streamer != null stream) { +if (streamer.getLength()0) { +connection.setFixedLengthStreamingMode(streamer.getLength()); +} else { +connection.setChunkedStreamingMode(1024); +} +} + connection.connect(); // Write the request body OutputStream os = null; try { os = connection.getOutputStream(); -if (body != null) { -os.write(body, 0, body.length); +while (streamer!=null streamer.available()0) { +byte[] next
svn commit: r1356877 - /tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
Author: fhanik Date: Tue Jul 3 19:25:32 2012 New Revision: 1356877 URL: http://svn.apache.org/viewvc?rev=1356877view=rev Log: remove line not needed Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1356877r1=1356876r2=1356877view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Tue Jul 3 19:25:32 2012 @@ -802,7 +802,6 @@ public class Tomcat { @SuppressWarnings(deprecation) public ExistingStandardWrapper( Servlet existing ) { this.existing = existing; -this.asyncSupported = isAsyncSupported(); if (existing instanceof javax.servlet.SingleThreadModel) { singleThreadModel = true; instancePool = new StackServlet(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1356880 - /tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
Author: fhanik Date: Tue Jul 3 19:29:17 2012 New Revision: 1356880 URL: http://svn.apache.org/viewvc?rev=1356880view=rev Log: Fix where body can be null Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1356880r1=1356879r2=1356880view=diff == --- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Tue Jul 3 19:29:17 2012 @@ -299,13 +299,13 @@ public abstract class TomcatBaseTest ext @Override public int getLength() { -return body.length; +return body!=null?body.length:0; } @Override public int available() { -if (done || body == null) return 0; -else return body.length; +if (done) return 0; +else return getLength(); } }; return postUrl(false,s,path,out,reqHead,resHead); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1356898 - /tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
Author: fhanik Date: Tue Jul 3 20:00:40 2012 New Revision: 1356898 URL: http://svn.apache.org/viewvc?rev=1356898view=rev Log: both timeout and complete, as with all container callbacks must be invoked with the right context Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1356898r1=1356897r2=1356898view=diff == --- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Tue Jul 3 20:00:40 2012 @@ -110,21 +110,30 @@ public class AsyncContextImpl implements request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); if (result.get()) { -boolean listenerInvoked = false; -ListAsyncListenerWrapper listenersCopy = -new ArrayListAsyncListenerWrapper(); -listenersCopy.addAll(listeners); -for (AsyncListenerWrapper listener : listenersCopy) { -listener.fireOnTimeout(event); -listenerInvoked = true; -} -if (listenerInvoked) { -request.getCoyoteRequest().action( -ActionCode.ASYNC_IS_TIMINGOUT, result); -return !result.get(); -} else { -// No listeners, container calls complete -complete(); + +ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); +ClassLoader newCL = request.getContext().getLoader().getClassLoader(); +try { +Thread.currentThread().setContextClassLoader(newCL); +boolean listenerInvoked = false; +ListAsyncListenerWrapper listenersCopy = +new ArrayListAsyncListenerWrapper(); +listenersCopy.addAll(listeners); +for (AsyncListenerWrapper listener : listenersCopy) { +listener.fireOnTimeout(event); +listenerInvoked = true; +} +if (listenerInvoked) { +request.getCoyoteRequest().action( +ActionCode.ASYNC_IS_TIMINGOUT, result); +return !result.get(); +} else { +// No listeners, container calls complete +complete(); +} + +} finally { +Thread.currentThread().setContextClassLoader(oldCL); } } return true; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1357039 - in /tomcat/trunk: java/javax/servlet/ java/org/apache/catalina/connector/ java/org/apache/catalina/core/ java/org/apache/coyote/ java/org/apache/coyote/http11/ java/org/apache/t
Author: fhanik Date: Wed Jul 4 01:56:46 2012 New Revision: 1357039 URL: http://svn.apache.org/viewvc?rev=1357039view=rev Log: First revision of an example non blocking read operation. The servlet specification, and discussions on the expert group are quite contradictory. According to the specification request response object can only live during service() or when an AsyncContext is present. but the NIO api is written with examples of bypassing both. So for this iteration, we are working with the assumption that NIO is only allowed during async operations, otherwise there is no point to NIO. This is because 'polling' was not allowed, so there is no point to have NIO when the thread is present Added: tomcat/trunk/test/org/apache/catalina/nonblocking/ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java (with props) Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java tomcat/trunk/java/javax/servlet/ServletOutputStream.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java tomcat/trunk/java/org/apache/coyote/ActionCode.java tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java tomcat/trunk/java/org/apache/coyote/Request.java tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletInputStream.java?rev=1357039r1=1357038r2=1357039view=diff == --- tomcat/trunk/java/javax/servlet/ServletInputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletInputStream.java Wed Jul 4 01:56:46 2012 @@ -94,8 +94,11 @@ public abstract class ServletInputStream * @return */ public abstract boolean isFinished(); + /** * TODO SERVLET 3.1 + * If this returns false, the container will invoke + * {@link ReadListener#onDataAvailable()} when data is available. * @return */ public abstract boolean isReady(); Modified: tomcat/trunk/java/javax/servlet/ServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletOutputStream.java?rev=1357039r1=1357038r2=1357039view=diff == --- tomcat/trunk/java/javax/servlet/ServletOutputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletOutputStream.java Wed Jul 4 01:56:46 2012 @@ -273,6 +273,8 @@ public abstract class ServletOutputStrea } /** + * If this returns false, it will cause a callback to + * {@link WriteListener#onWritePossible()} when the buffer has emptied * TODO SERVLET 3.1 * @return */ Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1357039r1=1357038r2=1357039view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Wed Jul 4 01:56:46 2012 @@ -20,6 +20,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.EnumSet; +import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.RequestDispatcher; import javax.servlet.SessionTrackingMode; @@ -293,6 +294,22 @@ public class CoyoteAdapter implements Ad asyncConImpl.setErrorState(null); } } + + +if (!request.isAsyncDispatching() request.isAsync()) { +AtomicBoolean result = new AtomicBoolean(true); +req.action(ActionCode.ASYNC_DISPATCH_FOR_OPERATION, this); +if (result.get()) { +if (status==SocketStatus.OPEN_WRITE) { +//TODO Notify write listener +} else if (status==SocketStatus.OPEN) { +//TODO Notify read listener +asyncConImpl.canRead(); +} +success = true
svn commit: r1357040 - in /tomcat/trunk/java/org/apache: catalina/connector/ coyote/ajp/ coyote/http11/ tomcat/util/net/
Author: fhanik Date: Wed Jul 4 01:59:47 2012 New Revision: 1357040 URL: http://svn.apache.org/viewvc?rev=1357040view=rev Log: rename OPEN to OPEN_READ since we have two different types of operations Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/SocketStatus.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1357040r1=1357039r2=1357040view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Wed Jul 4 01:59:47 2012 @@ -155,7 +155,7 @@ public class CoyoteAdapter implements Ad boolean error = false; boolean read = false; try { -if (status == SocketStatus.OPEN) { +if (status == SocketStatus.OPEN_READ) { if (response.isClosed()) { // The event has been closed asynchronously, so call end instead of // read to cleanup the pipeline @@ -219,7 +219,7 @@ public class CoyoteAdapter implements Ad connector.getService().getContainer().getPipeline().getFirst().event(request, response, request.getEvent()); } if (response.isClosed() || !request.isComet()) { -if (status==SocketStatus.OPEN +if (status==SocketStatus.OPEN_READ request.getEvent().getEventType() != EventType.END) { //CometEvent.close was called during an event other than END request.getEvent().setEventType(CometEvent.EventType.END); @@ -302,7 +302,7 @@ public class CoyoteAdapter implements Ad if (result.get()) { if (status==SocketStatus.OPEN_WRITE) { //TODO Notify write listener -} else if (status==SocketStatus.OPEN) { +} else if (status==SocketStatus.OPEN_READ) { //TODO Notify read listener asyncConImpl.canRead(); } @@ -324,7 +324,7 @@ public class CoyoteAdapter implements Ad if (!response.isClosed() !response.isError()) { if (request.getAvailable() || (request.getContentLength() 0 (!request.isParametersParsed( { // Invoke a read event right away if there are available bytes -if (event(req, res, SocketStatus.OPEN)) { +if (event(req, res, SocketStatus.OPEN_READ)) { comet = true; res.action(ActionCode.COMET_BEGIN, null); } @@ -427,7 +427,7 @@ public class CoyoteAdapter implements Ad if (!response.isClosed() !response.isError()) { if (request.getAvailable() || (request.getContentLength() 0 (!request.isParametersParsed( { // Invoke a read event right away if there are available bytes -if (event(req, res, SocketStatus.OPEN)) { +if (event(req, res, SocketStatus.OPEN_READ)) { comet = true; res.action(ActionCode.COMET_BEGIN, null); } Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1357040r1=1357039r2=1357040view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed Jul 4 01:59:47 2012 @@ -261,7 +261,7 @@ public class AjpAprProcessor extends Abs if (actionCode == ActionCode.ASYNC_COMPLETE) { if (asyncStateMachine.asyncComplete()) { ((AprEndpoint)endpoint).processSocketAsync(this.socket
svn commit: r1355615 - in /tomcat/trunk: java/org/apache/catalina/realm/JNDIRealm.java webapps/docs/config/realm.xml
Author: fhanik Date: Sat Jun 30 01:04:59 2012 New Revision: 1355615 URL: http://svn.apache.org/viewvc?rev=1355615view=rev Log: With more and more use of RFC 2307 http://tools.ietf.org/html/rfc2307 There is a new way to search for roles using the memberUid that can contain the value of another attribute within the users directory entry. This may not be very specific to 2307, but that is where I see this combination of role searches occur the most. Example: http://www.openldap.org/lists/openldap-technical/200904/msg00024.html Modified: tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java tomcat/trunk/webapps/docs/config/realm.xml Modified: tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=1355615r1=1355614r2=1355615view=diff == --- tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original) +++ tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java Sat Jun 30 01:04:59 2012 @@ -126,8 +126,9 @@ import org.ietf.jgss.GSSCredential; * property./li * liThe coderoleSearch/code pattern optionally includes pattern * replacements {0} for the distinguished name, and/or {1} for - * the username, of the authenticated user for which roles will be - * retrieved./li + * the username, and/or {2} the value of the userRoleAttribute + * attribute from the users entry, of the authenticated user + * for which roles will be retrieved./li * liThe coderoleBase/code property can be set to the element that * is the base of the search for matching roles. If not specified, * the entire context will be searched./li @@ -292,6 +293,14 @@ public class JNDIRealm extends RealmBase */ protected String userPassword = null; +/** + * The name of the attribute inside the users + * directory entry where the value will be + * taken to search for roles + * This attribute is not used during a nested search + */ +protected String userRoleAttribute = null; + /** * A string of LDAP user patterns or paths, :-separated @@ -829,6 +838,14 @@ public class JNDIRealm extends RealmBase } +public String getUserRoleAttribute() { +return userRoleAttribute; +} + +public void setUserRoleAttribute(String userRoleAttribute) { +this.userRoleAttribute = userRoleAttribute; +} + /** * Return the message format pattern for selecting users in this Realm. */ @@ -839,6 +856,8 @@ public class JNDIRealm extends RealmBase } + + /** * Set the message format pattern for selecting users in this Realm. * This may be one simple pattern, or multiple patterns to be tried, @@ -1230,6 +1249,9 @@ public class JNDIRealm extends RealmBase list.add(userPassword); if (userRoleName != null) list.add(userRoleName); +if (userRoleAttribute != null) { +list.add(userRoleAttribute); +} String[] attrIds = new String[list.size()]; list.toArray(attrIds); @@ -1265,7 +1287,7 @@ public class JNDIRealm extends RealmBase // If no attributes are requested, no need to look for them if (attrIds == null || attrIds.length == 0) { -return new User(username, dn, null, null); +return new User(username, dn, null, null,null); } // Get required attributes from user entry @@ -1283,12 +1305,17 @@ public class JNDIRealm extends RealmBase if (userPassword != null) password = getAttributeValue(userPassword, attrs); +String userRoleAttrValue = null; +if (userRoleAttribute != null) { +userRoleAttrValue = getAttributeValue(userRoleAttribute, attrs); +} + // Retrieve values of userRoleName attribute ArrayListString roles = null; if (userRoleName != null) roles = addAttributeValues(userRoleName, attrs, roles); -return new User(username, dn, password, roles); +return new User(username, dn, password, roles, userRoleAttrValue); } @@ -1427,12 +1454,17 @@ public class JNDIRealm extends RealmBase if (userPassword != null) password = getAttributeValue(userPassword, attrs); +String userRoleAttrValue = null; +if (userRoleAttribute != null) { +userRoleAttrValue = getAttributeValue(userRoleAttribute, attrs); +} + // Retrieve values of userRoleName attribute ArrayListString roles = null; if (userRoleName != null) roles = addAttributeValues(userRoleName, attrs, roles); -return new User(username, dn, password, roles); +return new User(username, dn, password, roles, password); } @@ -1675,6 +1707,7
svn commit: r1355617 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/realm/JNDIRealm.java webapps/docs/changelog.xml webapps/docs/config/realm.xml
Author: fhanik Date: Sat Jun 30 01:08:37 2012 New Revision: 1355617 URL: http://svn.apache.org/viewvc?rev=1355617view=rev Log: With more and more use of RFC 2307 http://tools.ietf.org/html/rfc2307 There is a new way to search for roles using the memberUid that can contain the value of another attribute within the users directory entry. This may not be very specific to 2307, but that is where I see this combination of role searches occur the most. Example: http://www.openldap.org/lists/openldap-technical/200904/msg00024.html Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml tomcat/tc7.0.x/trunk/webapps/docs/config/realm.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=1355617r1=1355616r2=1355617view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java Sat Jun 30 01:08:37 2012 @@ -126,8 +126,9 @@ import org.ietf.jgss.GSSCredential; * property./li * liThe coderoleSearch/code pattern optionally includes pattern * replacements {0} for the distinguished name, and/or {1} for - * the username, of the authenticated user for which roles will be - * retrieved./li + * the username, and/or {2} the value of the userRoleAttribute + * attribute from the users entry, of the authenticated user + * for which roles will be retrieved./li * liThe coderoleBase/code property can be set to the element that * is the base of the search for matching roles. If not specified, * the entire context will be searched./li @@ -298,6 +299,14 @@ public class JNDIRealm extends RealmBase */ protected String userPassword = null; +/** + * The name of the attribute inside the users + * directory entry where the value will be + * taken to search for roles + * This attribute is not used during a nested search + */ +protected String userRoleAttribute = null; + /** * A string of LDAP user patterns or paths, :-separated @@ -835,6 +844,14 @@ public class JNDIRealm extends RealmBase } +public String getUserRoleAttribute() { +return userRoleAttribute; +} + +public void setUserRoleAttribute(String userRoleAttribute) { +this.userRoleAttribute = userRoleAttribute; +} + /** * Return the message format pattern for selecting users in this Realm. */ @@ -845,6 +862,8 @@ public class JNDIRealm extends RealmBase } + + /** * Set the message format pattern for selecting users in this Realm. * This may be one simple pattern, or multiple patterns to be tried, @@ -1249,6 +1268,9 @@ public class JNDIRealm extends RealmBase list.add(userPassword); if (userRoleName != null) list.add(userRoleName); +if (userRoleAttribute != null) { +list.add(userRoleAttribute); +} String[] attrIds = new String[list.size()]; list.toArray(attrIds); @@ -1284,7 +1306,7 @@ public class JNDIRealm extends RealmBase // If no attributes are requested, no need to look for them if (attrIds == null || attrIds.length == 0) { -return new User(username, dn, null, null); +return new User(username, dn, null, null,null); } // Get required attributes from user entry @@ -1302,12 +1324,17 @@ public class JNDIRealm extends RealmBase if (userPassword != null) password = getAttributeValue(userPassword, attrs); +String userRoleAttrValue = null; +if (userRoleAttribute != null) { +userRoleAttrValue = getAttributeValue(userRoleAttribute, attrs); +} + // Retrieve values of userRoleName attribute ArrayListString roles = null; if (userRoleName != null) roles = addAttributeValues(userRoleName, attrs, roles); -return new User(username, dn, password, roles); +return new User(username, dn, password, roles, userRoleAttrValue); } @@ -1446,12 +1473,17 @@ public class JNDIRealm extends RealmBase if (userPassword != null) password = getAttributeValue(userPassword, attrs); +String userRoleAttrValue = null; +if (userRoleAttribute != null) { +userRoleAttrValue = getAttributeValue(userRoleAttribute, attrs); +} + // Retrieve values of userRoleName attribute ArrayListString roles = null; if (userRoleName != null) roles = addAttributeValues(userRoleName, attrs, roles); -return new User(username, dn, password, roles
svn commit: r1355042 - in /tomcat/trunk/java: javax/servlet/ServletInputStream.java org/apache/catalina/connector/CoyoteInputStream.java
Author: fhanik Date: Thu Jun 28 15:22:48 2012 New Revision: 1355042 URL: http://svn.apache.org/viewvc?rev=1355042view=rev Log: Add another method found in spec Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletInputStream.java?rev=1355042r1=1355041r2=1355042view=diff == --- tomcat/trunk/java/javax/servlet/ServletInputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletInputStream.java Thu Jun 28 15:22:48 2012 @@ -86,6 +86,13 @@ public abstract class ServletInputStream * TODO SERVLET 3.1 * @return */ +public abstract int dataAvailable(); + + +/** + * TODO SERVLET 3.1 + * @return + */ public abstract boolean isFinished(); /** * TODO SERVLET 3.1 Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=1355042r1=1355041r2=1355042view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Thu Jun 28 15:22:48 2012 @@ -251,14 +251,16 @@ public class CoyoteInputStream return false; } +@Override +public int dataAvailable() { +// TODO Auto-generated method stub +return 0; +} + -/** - * TODO SERVLET 3.1 - */ @Override public boolean isReady() { -// TODO Auto-generated method stub -return false; +return dataAvailable()0; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1354641 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java
Author: fhanik Date: Wed Jun 27 17:36:05 2012 New Revision: 1354641 URL: http://svn.apache.org/viewvc?rev=1354641view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53416 Make sure we retain the domain if the registration comes from Tomcat Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java?rev=1354641r1=1354640r2=1354641view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java Wed Jun 27 17:36:05 2012 @@ -118,7 +118,9 @@ public class DataSource extends DataSour String origDomain = original.getDomain(); properties.put(type, ConnectionPool); properties.put(class, this.getClass().getName()); -if (original.getKeyProperty(path)!=null) { +if (original.getKeyProperty(path)!=null || properties.get(context)!=null) { +//this ensures that if the registration came from tomcat, we're not losing +//the unique domain, but putting that into as an engine attribute properties.put(engine, origDomain); } ObjectName name = new ObjectName(domain,properties); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1354642 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Wed Jun 27 17:38:08 2012 New Revision: 1354642 URL: http://svn.apache.org/viewvc?rev=1354642view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53416 Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Wed Jun 27 17:38:08 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1354176 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1354641 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1354642r1=1354641r2=1354642view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jun 27 17:38:08 2012 @@ -141,6 +141,10 @@ bug53445/bug (rev1354173/rev): Allow configurable name for SlowQueryReportJmx (fhanik) /fix + fix +bug53416/bug (rev1354641/rev): +Multiple pools with the same name should register under JMX (fhanik) + /fix /changelog /subsection subsection name=Other - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1354112 - in /tomcat/trunk/java/javax/servlet: ./ http/
Author: fhanik Date: Tue Jun 26 17:07:22 2012 New Revision: 1354112 URL: http://svn.apache.org/viewvc?rev=1354112view=rev Log: In preparation for next servlet revision Align with the servlet specification signatures as they are defined by the spec itself. These do not represent any functional changes Most of these are just ordering of methods, others are runtime exception that are defined differently in the method signatures As an fyi, the easiest way to compare signatures between two libraries is to use javap and diff on the output, that's how I found these changes, verified them against the javadoc and implemented into tomcat Modified: tomcat/trunk/java/javax/servlet/AsyncContext.java tomcat/trunk/java/javax/servlet/RequestDispatcher.java tomcat/trunk/java/javax/servlet/ServletContext.java tomcat/trunk/java/javax/servlet/ServletRequest.java tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java tomcat/trunk/java/javax/servlet/ServletSecurityElement.java tomcat/trunk/java/javax/servlet/http/Cookie.java tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java Modified: tomcat/trunk/java/javax/servlet/AsyncContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/AsyncContext.java?rev=1354112r1=1354111r2=1354112view=diff == --- tomcat/trunk/java/javax/servlet/AsyncContext.java (original) +++ tomcat/trunk/java/javax/servlet/AsyncContext.java Tue Jun 26 17:07:22 2012 @@ -73,12 +73,12 @@ public interface AsyncContext { throws ServletException; /** - * Get timeout in milliseconds. 0 or less indicates no timeout. + * Set timeout in milliseconds. 0 or less indicates no timeout. */ -long getTimeout(); +void setTimeout(long timeout); /** - * Set timeout in milliseconds. 0 or less indicates no timeout. + * Get timeout in milliseconds. 0 or less indicates no timeout. */ -void setTimeout(long timeout); +long getTimeout(); } Modified: tomcat/trunk/java/javax/servlet/RequestDispatcher.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/RequestDispatcher.java?rev=1354112r1=1354111r2=1354112view=diff == --- tomcat/trunk/java/javax/servlet/RequestDispatcher.java (original) +++ tomcat/trunk/java/javax/servlet/RequestDispatcher.java Tue Jun 26 17:07:22 2012 @@ -39,22 +39,22 @@ import java.io.IOException; */ public interface RequestDispatcher { +static final String FORWARD_REQUEST_URI = javax.servlet.forward.request_uri; +static final String FORWARD_CONTEXT_PATH = javax.servlet.forward.context_path; +static final String FORWARD_PATH_INFO = javax.servlet.forward.path_info; +static final String FORWARD_SERVLET_PATH = javax.servlet.forward.servlet_path; +static final String FORWARD_QUERY_STRING = javax.servlet.forward.query_string; +static final String INCLUDE_REQUEST_URI = javax.servlet.include.request_uri; +static final String INCLUDE_CONTEXT_PATH = javax.servlet.include.context_path; +static final String INCLUDE_PATH_INFO = javax.servlet.include.path_info; +static final String INCLUDE_SERVLET_PATH = javax.servlet.include.servlet_path; +static final String INCLUDE_QUERY_STRING = javax.servlet.include.query_string; public static final String ERROR_EXCEPTION = javax.servlet.error.exception; public static final String ERROR_EXCEPTION_TYPE = javax.servlet.error.exception_type; public static final String ERROR_MESSAGE = javax.servlet.error.message; public static final String ERROR_REQUEST_URI = javax.servlet.error.request_uri; public static final String ERROR_SERVLET_NAME = javax.servlet.error.servlet_name; public static final String ERROR_STATUS_CODE = javax.servlet.error.status_code; -public static final String FORWARD_CONTEXT_PATH = javax.servlet.forward.context_path; -public static final String FORWARD_PATH_INFO = javax.servlet.forward.path_info; -public static final String FORWARD_QUERY_STRING = javax.servlet.forward.query_string; -public static final String FORWARD_REQUEST_URI = javax.servlet.forward.request_uri; -public static final String FORWARD_SERVLET_PATH = javax.servlet.forward.servlet_path; -public static final String INCLUDE_CONTEXT_PATH = javax.servlet.include.context_path; -public static final String INCLUDE_PATH_INFO = javax.servlet.include.path_info; -public static final String INCLUDE_QUERY_STRING = javax.servlet.include.query_string; -public static final String INCLUDE_REQUEST_URI = javax.servlet.include.request_uri; -public static final String INCLUDE_SERVLET_PATH = javax.servlet.include.servlet_path; /** * Forwards a request from a servlet to another resource (servlet, JSP file
svn commit: r1354158 - in /tomcat/trunk/java: javax/servlet/ javax/servlet/http/ org/apache/catalina/connector/ org/apache/catalina/filters/ org/apache/catalina/ssi/ org/apache/jasper/tagplugins/jstl/
Author: fhanik Date: Tue Jun 26 18:38:09 2012 New Revision: 1354158 URL: http://svn.apache.org/viewvc?rev=1354158view=rev Log: Add in stub methods from servlet draft per http://java.net/projects/servlet-spec/lists/jsr340-experts/archive/2012-06/message/9 Note this may change at which point we will change it accordingly Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java tomcat/trunk/java/javax/servlet/ServletOutputStream.java tomcat/trunk/java/javax/servlet/ServletRequest.java tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java tomcat/trunk/java/javax/servlet/ServletResponse.java tomcat/trunk/java/javax/servlet/ServletResponseWrapper.java tomcat/trunk/java/javax/servlet/http/HttpServlet.java tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java tomcat/trunk/java/org/apache/catalina/connector/CoyoteOutputStream.java tomcat/trunk/java/org/apache/catalina/connector/Request.java tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java tomcat/trunk/java/org/apache/catalina/connector/Response.java tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java tomcat/trunk/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java Modified: tomcat/trunk/java/javax/servlet/ServletInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletInputStream.java?rev=1354158r1=1354157r2=1354158view=diff == --- tomcat/trunk/java/javax/servlet/ServletInputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletInputStream.java Tue Jun 26 18:38:09 2012 @@ -81,4 +81,21 @@ public abstract class ServletInputStream } return count 0 ? count : -1; } + +/** + * TODO SERVLET 3.1 + * @return + */ +public abstract boolean isFinished(); +/** + * TODO SERVLET 3.1 + * @return + */ +public abstract boolean isReady(); + +/** + * TODO SERVLET 3.1 + * @return + */ +public abstract void setReadListener(javax.servlet.ReadListener listener); } Modified: tomcat/trunk/java/javax/servlet/ServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletOutputStream.java?rev=1354158r1=1354157r2=1354158view=diff == --- tomcat/trunk/java/javax/servlet/ServletOutputStream.java (original) +++ tomcat/trunk/java/javax/servlet/ServletOutputStream.java Tue Jun 26 18:38:09 2012 @@ -271,4 +271,15 @@ public abstract class ServletOutputStrea print(d); println(); } -} + +/** + * TODO SERVLET 3.1 + * @return + */ +public abstract boolean canWrite(); + +/** + * TODO SERVLET 3.1 + * @return + */ +public abstract void setWriteListener(javax.servlet.WriteListener listener);} Modified: tomcat/trunk/java/javax/servlet/ServletRequest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletRequest.java?rev=1354158r1=1354157r2=1354158view=diff == --- tomcat/trunk/java/javax/servlet/ServletRequest.java (original) +++ tomcat/trunk/java/javax/servlet/ServletRequest.java Tue Jun 26 18:38:09 2012 @@ -110,6 +110,12 @@ public interface ServletRequest { public int getContentLength(); /** + * TODO SERVLET 3.1 + * @return + */ +public long getContentLengthLong(); + +/** * Returns the MIME type of the body of the request, or codenull/code if * the type is not known. For HTTP servlets, same as the value of the CGI * variable CONTENT_TYPE. Modified: tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java?rev=1354158r1=1354157r2=1354158view=diff == --- tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java (original) +++ tomcat/trunk/java/javax/servlet/ServletRequestWrapper.java Tue Jun 26 18:38:09 2012 @@ -113,6 +113,11 @@ public class ServletRequestWrapper imple return this.request.getContentLength(); } +@Override +public long getContentLengthLong() { +return this.request.getContentLengthLong(); +} + /** * The default behavior of this method is to return getContentType() on the * wrapped request object. Modified: tomcat/trunk/java/javax/servlet/ServletResponse.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletResponse.java
svn commit: r1354166 - in /tomcat/trunk/java/javax/servlet: ReadListener.java WriteListener.java http/ProtocolHandler.java http/WebConnection.java
Author: fhanik Date: Tue Jun 26 18:56:52 2012 New Revision: 1354166 URL: http://svn.apache.org/viewvc?rev=1354166view=rev Log: Add missing classes Added: tomcat/trunk/java/javax/servlet/ReadListener.java (with props) tomcat/trunk/java/javax/servlet/WriteListener.java (with props) tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java (with props) tomcat/trunk/java/javax/servlet/http/WebConnection.java (with props) Added: tomcat/trunk/java/javax/servlet/ReadListener.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ReadListener.java?rev=1354166view=auto == --- tomcat/trunk/java/javax/servlet/ReadListener.java (added) +++ tomcat/trunk/java/javax/servlet/ReadListener.java Tue Jun 26 18:56:52 2012 @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.servlet; +/** + * TODO SERVLET 3.1 + * @author filip + * + */ +public interface ReadListener extends java.util.EventListener{ +public abstract void onDataAvailable(); +public abstract void onAllDataRead(); +public abstract void onError(java.lang.Throwable throwable); +} Propchange: tomcat/trunk/java/javax/servlet/ReadListener.java -- svn:eol-style = native Added: tomcat/trunk/java/javax/servlet/WriteListener.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/WriteListener.java?rev=1354166view=auto == --- tomcat/trunk/java/javax/servlet/WriteListener.java (added) +++ tomcat/trunk/java/javax/servlet/WriteListener.java Tue Jun 26 18:56:52 2012 @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package javax.servlet; + +/** + * TODO SERVLET 3.1 + * @author filip + * + */ +public interface WriteListener extends java.util.EventListener{ +public void onWritePossible(); +public void onError(java.lang.Throwable throwable); +} \ No newline at end of file Propchange: tomcat/trunk/java/javax/servlet/WriteListener.java -- svn:eol-style = native Added: tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java?rev=1354166view=auto == --- tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java (added) +++ tomcat/trunk/java/javax/servlet/http/ProtocolHandler.java Tue Jun 26 18:56:52 2012 @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions
svn commit: r1354173 - in /tomcat/trunk/modules/jdbc-pool: doc/ src/main/java/org/apache/tomcat/jdbc/pool/ src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ src/test/java/org/apache/tomcat/jdbc/t
Author: fhanik Date: Tue Jun 26 19:08:27 2012 New Revision: 1354173 URL: http://svn.apache.org/viewvc?rev=1354173view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53445 by allowing a) override the getObjectName method of the SlowQueryReportJmx class b) specify the objectName=xxx attribute in the configuration Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1354173r1=1354172r2=1354173view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Jun 26 19:08:27 2012 @@ -617,6 +617,12 @@ The default value is codetrue/code. /p /attribute + attribute name=objectName required=false +p(String) Define a valid codejavax.management.ObjectName/code string that will be used to register this object with the platform mbean server + The default value is codenull/code and the object will be registered using + tomcat.jdbc:type=org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx,name=the-name-of-the-pool +/p + /attribute /attributes /subsection subsection name=org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1354173r1=1354172r2=1354173view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Jun 26 19:08:27 2012 @@ -54,10 +54,15 @@ import org.apache.juli.logging.LogFactor */ public class ConnectionPool { + +/** + * Default domain for objects registering with an mbean server + */ +public static final String POOL_JMX_DOMAIN = tomcat.jdbc; /** * Prefix type for JMX registration */ -public static final String POOL_JMX_TYPE_PREFIX = tomcat.jdbc:type=; +public static final String POOL_JMX_TYPE_PREFIX = POOL_JMX_DOMAIN+:type=; /** * Logger Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java?rev=1354173r1=1354172r2=1354173view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java Tue Jun 26 19:08:27 2012 @@ -113,7 +113,7 @@ public class DataSource extends DataSour * @throws MalformedObjectNameException */ public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException { -String domain = tomcat.jdbc; +String domain = ConnectionPool.POOL_JMX_DOMAIN; HashtableString,String properties = original.getKeyPropertyList(); String origDomain = original.getDomain(); properties.put(type, ConnectionPool); Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java?rev=1354173r1=1354172r2=1354173view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java Tue Jun 26 19:08:27 2012 @@ -58,6 +58,8 @@ public class SlowQueryReportJmx extends public static final String SLOW_QUERY_NOTIFICATION = SLOW QUERY; public static final String FAILED_QUERY_NOTIFICATION = FAILED QUERY; +public static final String objectNameAttribute = objectName; + protected static CompositeType SLOW_QUERY_TYPE; private static final Log
svn commit: r1354174 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Tue Jun 26 19:12:07 2012 New Revision: 1354174 URL: http://svn.apache.org/viewvc?rev=1354174view=rev Log: Fixed https://issues.apache.org/bugzilla/show_bug.cgi?id=53445 Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Jun 26 19:12:07 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1350020 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1354173 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1354174r1=1354173r2=1354174view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jun 26 19:12:07 2012 @@ -123,6 +123,14 @@ /fix /changelog /subsection +subsection name=jdbc-pool +changelog + fix +bug53445/bug (rev1354173/rev): +Allow configurable name for SlowQueryReportJmx (fhanik) + /fix +/changelog + /subsection subsection name=Other changelog fix - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1354178 - in /tomcat/trunk: test/org/apache/catalina/filters/TesterResponse.java webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java
Author: fhanik Date: Tue Jun 26 19:15:32 2012 New Revision: 1354178 URL: http://svn.apache.org/viewvc?rev=1354178view=rev Log: Add in test and examples to compile with 3.1 additions Modified: tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java Modified: tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java?rev=1354178r1=1354177r2=1354178view=diff == --- tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java (original) +++ tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java Tue Jun 26 19:15:32 2012 @@ -213,4 +213,10 @@ public class TesterResponse @Override @Deprecated public void setStatus(int status, String message) {/* NOOP */} + + +@Override +public void setContentLengthLong(long length) {/* NOOP */} + + } Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java?rev=1354178r1=1354177r2=1354178view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java Tue Jun 26 19:15:32 2012 @@ -21,6 +21,7 @@ import java.io.OutputStream; import java.util.zip.GZIPOutputStream; import javax.servlet.ServletOutputStream; +import javax.servlet.WriteListener; /** * Implementation of bServletOutputStream/b that works with @@ -264,6 +265,27 @@ public class CompressionResponseStream e } + +/** + * TODO SERVLET 3.1 + */ +@Override +public boolean canWrite() { +// TODO Auto-generated method stub +return false; +} + + +/** + * TODO SERVLET 3.1 + */ +@Override +public void setWriteListener(WriteListener listener) { +// TODO Auto-generated method stub + +} + + /** * Write codelen/code bytes from the specified byte array, starting * at the specified offset, to our output stream. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1350022 - /tomcat/tc7.0.x/trunk/modules/
Author: fhanik Date: Wed Jun 13 21:24:00 2012 New Revision: 1350022 URL: http://svn.apache.org/viewvc?rev=1350022view=rev Log: Make sure that the revisions are up to date prior to tagging Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Wed Jun 13 21:24:00 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1348056 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1350020 jdbc-pool - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1350027 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Wed Jun 13 21:34:14 2012 New Revision: 1350027 URL: http://svn.apache.org/viewvc?rev=1350027view=rev Log: votes Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1350027r1=1350026r2=1350027view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Jun 13 21:34:14 2012 @@ -203,7 +203,7 @@ PATCHES PROPOSED TO BACKPORT: Patch: http://people.apache.org/~kkolinko/patches/2012-06-06_tc6_Generator.patch (backport of r1347100 in Tomcat 7, r1346885 in trunk) - +1: kkolinko, schultz + +1: kkolinko, schultz, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52996 @@ -215,7 +215,7 @@ PATCHES PROPOSED TO BACKPORT: It is backport of r723889 from trunk. https://issues.apache.org/bugzilla/attachment.cgi?id=28907 (patch) http://svn.apache.org/viewvc?view=revisionrevision=1348105 (documentation update) - +1: kkolinko + +1: kkolinko, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53047 @@ -227,6 +227,7 @@ PATCHES PROPOSED TO BACKPORT: at least set required=false on roleNameCol, userRoleTable in config/realm.html) -1: + * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53071 Use the message from the Throwable for the error report if none was specified via sendError() - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1346691 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java PooledConnection.java
Author: fhanik Date: Wed Jun 6 01:02:41 2012 New Revision: 1346691 URL: http://svn.apache.org/viewvc?rev=1346691view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=53367 Avoid pool hanging when database fails Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1346691r1=1346690r2=1346691view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Jun 6 01:02:41 2012 @@ -750,7 +750,19 @@ public class ConnectionPool { if (!con.isDiscarded() !con.isInitialized()) { //attempt to connect -con.connect(); +try { +con.connect(); +} catch (Exception x) { +release(con); +setToNull = true; +if (x instanceof SQLException) { +throw (SQLException)x; +} else { +SQLException ex = new SQLException(x.getMessage()); +ex.initCause(x); +throw ex; +} +} } if (usercheck) { Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java?rev=1346691r1=1346690r2=1346691view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java Wed Jun 6 01:02:41 2012 @@ -238,10 +238,14 @@ public class PooledConnection { protected void connectUsingDriver() throws SQLException { try { -if (driver==null) +if (driver==null) { +if (log.isDebugEnabled()) { +log.debug(Instantiating driver using class: +poolProperties.getDriverClassName()+ [url=+poolProperties.getUrl()+]); +} driver = (java.sql.Driver) Class.forName(poolProperties.getDriverClassName(), true, PooledConnection.class.getClassLoader() ).newInstance(); +} } catch (java.lang.Exception cn) { if (log.isDebugEnabled()) { log.debug(Unable to instantiate JDBC driver., cn); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1346693 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Wed Jun 6 01:13:06 2012 New Revision: 1346693 URL: http://svn.apache.org/viewvc?rev=1346693view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53367 Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Wed Jun 6 01:13:06 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1342500 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1346691 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1346693r1=1346692r2=1346693view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jun 6 01:13:06 2012 @@ -319,6 +319,10 @@ /subsection subsection name=jdbc-pool changelog + update +bug53367/bug (rev1346691/rev): +Prevent pool from hanging during database failure (fhanik) + /update add bug53254/bug (rev1340160/rev): Add in the ability to purge connections from the pool (fhanik) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1340133 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Fri May 18 15:38:22 2012 New Revision: 1340133 URL: http://svn.apache.org/viewvc?rev=1340133view=rev Log: When a connection is disconnected, make sure we reset the cached values. This can happen during a failed validation when reconnect() is called. Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Fri May 18 15:38:22 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1311844 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1335546 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1340133r1=1340132r2=1340133view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri May 18 15:38:22 2012 @@ -182,6 +182,11 @@ /subsection subsection name=jdbc-pool changelog + update + When a connection is reconnected due to failed validation + make sure the ConnectionState is reset or it will assume + incorrect values (fhanik) + /update fix bug50864/bug (rev1311844/rev): JMX enable most pool properties (fhanik) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1340160 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ main/java/org/apache/tomcat/jdbc/pool/jmx/ test/java/org/apache/tomcat/jdbc/test/
Author: fhanik Date: Fri May 18 16:28:33 2012 New Revision: 1340160 URL: http://svn.apache.org/viewvc?rev=1340160view=rev Log: Add in ability to purge the pool https://issues.apache.org/bugzilla/show_bug.cgi?id=53254 Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolPurgeTest.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1340160r1=1340159r2=1340160view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Fri May 18 16:28:33 2012 @@ -39,6 +39,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -120,6 +121,8 @@ public class ConnectionPool { */ private AtomicInteger waitcount = new AtomicInteger(0); +private AtomicLong poolVersion = new AtomicLong(Long.MIN_VALUE); + //=== // PUBLIC METHODS //=== @@ -438,6 +441,8 @@ public class ConnectionPool { if (properties.isFairQueue()) { idle = new FairBlockingQueuePooledConnection(); //idle = new MultiLockFairBlockingQueuePooledConnection(); +//idle = new LinkedTransferQueuePooledConnection(); +//idle = new ArrayBlockingQueuePooledConnection(properties.getMaxActive(),false); } else { idle = new ArrayBlockingQueuePooledConnection(properties.getMaxActive(),properties.isFairQueue()); } @@ -836,6 +841,7 @@ public class ConnectionPool { * @return true if the connection should be closed */ protected boolean shouldClose(PooledConnection con, int action) { +if (con.getConnectionVersion() getPoolVersion()) return true; if (con.isDiscarded()) return true; if (isClosed()) return true; if (!con.validate(action)) return true; @@ -954,11 +960,16 @@ public class ConnectionPool { * {@link PoolProperties#maxIdle}, {@link PoolProperties#minIdle}, {@link PoolProperties#minEvictableIdleTimeMillis} */ public void checkIdle() { +checkIdle(false); +} + +public void checkIdle(boolean ignoreMinSize) { + try { if (idle.size()==0) return; long now = System.currentTimeMillis(); IteratorPooledConnection unlocked = idle.iterator(); -while ( (idle.size()=getPoolProperties().getMinIdle()) unlocked.hasNext()) { +while ( (ignoreMinSize || (idle.size()=getPoolProperties().getMinIdle())) unlocked.hasNext()) { PooledConnection con = unlocked.next(); boolean setToNull = false; try { @@ -967,7 +978,7 @@ public class ConnectionPool { if (busy.contains(con)) continue; long time = con.getTimestamp(); -if ((con.getReleaseTime()0) ((now - time) con.getReleaseTime()) (getSize()getPoolProperties().getMinIdle())) { +if (shouldReleaseIdle(now, con, time)) { release(con); idle.remove(con); setToNull = true; @@ -988,6 +999,12 @@ public class ConnectionPool { } + +protected boolean shouldReleaseIdle(long now, PooledConnection con, long time) { +if (con.getConnectionVersion() getPoolVersion()) return true; +else return (con.getReleaseTime()0) ((now - time) con.getReleaseTime()) (getSize()getPoolProperties().getMinIdle()); +} + /** * Forces a validation of all idle connections if {@link PoolProperties#testWhileIdle} is set. */ @@ -1058,6 +1075,27 @@ public class ConnectionPool { } /** + * Purges all connections
svn commit: r1340164 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Fri May 18 16:37:29 2012 New Revision: 1340164 URL: http://svn.apache.org/viewvc?rev=1340164view=rev Log: Add in ability to purge the pool https://issues.apache.org/bugzilla/show_bug.cgi?id=53254 Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Fri May 18 16:37:29 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1335546 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1340160 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1340164r1=1340163r2=1340164view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri May 18 16:37:29 2012 @@ -182,6 +182,10 @@ /subsection subsection name=jdbc-pool changelog + fix +bug53254/bug (rev1340160/rev): +Add in the ability to purge connections from the pool (fhanik) + /fix update When a connection is reconnected due to failed validation make sure the ConnectionState is reset or it will assume - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1340215 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: fhanik Date: Fri May 18 19:23:12 2012 New Revision: 1340215 URL: http://svn.apache.org/viewvc?rev=1340215view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52858 https://issues.apache.org/bugzilla/show_bug.cgi?id=53138 Fix broken NIO sendfile download Fix high CPU usage due to registered OP_READ for sendfile processes 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=1340215r1=1340214r2=1340215view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Fri May 18 19:23:12 2012 @@ -1278,9 +1278,13 @@ public class NioEndpoint extends Abstrac public boolean processSendfile(SelectionKey sk, KeyAttachment attachment, boolean reg, boolean event) { NioChannel sc = null; +if (log.isTraceEnabled()) { +log.trace([+new java.sql.Date(System.currentTimeMillis()).toGMTString()+] Processing send file. [+sk+] ); +} try { unreg(sk, attachment, sk.readyOps()); SendfileData sd = attachment.getSendfileData(); +//setup the file channel if ( sd.fchannel == null ) { File f = new File(sd.fileName); if ( !f.exists() ) { @@ -1289,10 +1293,14 @@ public class NioEndpoint extends Abstrac } sd.fchannel = new FileInputStream(f).getChannel(); } + +//configure output channel sc = attachment.getChannel(); sc.setSendFile(true); +//ssl channel is slightly different WritableByteChannel wc = ((sc instanceof SecureNioChannel)?sc:sc.getIOChannel()); +//we still have data in the buffer if (sc.getOutboundRemaining()0) { if (sc.flushOutbound()) { attachment.access(); @@ -1322,7 +1330,6 @@ public class NioEndpoint extends Abstrac } catch (Exception ignore) { } if ( sd.keepAlive ) { -if (reg) { if (log.isDebugEnabled()) { log.debug(Connection is keep alive, registering back for OP_READ); } @@ -1331,7 +1338,6 @@ public class NioEndpoint extends Abstrac } else { reg(sk,attachment,SelectionKey.OP_READ); } -} } else { if (log.isDebugEnabled()) { log.debug(Send file connection is being closed); @@ -1339,7 +1345,7 @@ public class NioEndpoint extends Abstrac cancelledKey(sk,SocketStatus.STOP); return false; } -} else if ( attachment.interestOps() == 0 reg ) { +} else { //if ( attachment.interestOps() == 0 reg ) { if (log.isDebugEnabled()) { log.debug(OP_WRITE for sendilfe:+sd.fileName); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1340218 - in /tomcat/tc7.0.x/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml
Author: fhanik Date: Fri May 18 19:28:30 2012 New Revision: 1340218 URL: http://svn.apache.org/viewvc?rev=1340218view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53138 https://issues.apache.org/bugzilla/show_bug.cgi?id=52858 Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1340218r1=1340217r2=1340218view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Fri May 18 19:28:30 2012 @@ -1278,9 +1278,13 @@ public class NioEndpoint extends Abstrac public boolean processSendfile(SelectionKey sk, KeyAttachment attachment, boolean reg, boolean event) { NioChannel sc = null; +if (log.isTraceEnabled()) { +log.trace([+new java.sql.Date(System.currentTimeMillis()).toGMTString()+] Processing send file. [+sk+] ); +} try { unreg(sk, attachment, sk.readyOps()); SendfileData sd = attachment.getSendfileData(); +//setup the file channel if ( sd.fchannel == null ) { File f = new File(sd.fileName); if ( !f.exists() ) { @@ -1289,10 +1293,14 @@ public class NioEndpoint extends Abstrac } sd.fchannel = new FileInputStream(f).getChannel(); } + +//configure output channel sc = attachment.getChannel(); sc.setSendFile(true); +//ssl channel is slightly different WritableByteChannel wc = ((sc instanceof SecureNioChannel)?sc:sc.getIOChannel()); +//we still have data in the buffer if (sc.getOutboundRemaining()0) { if (sc.flushOutbound()) { attachment.access(); @@ -1322,7 +1330,6 @@ public class NioEndpoint extends Abstrac } catch (Exception ignore) { } if ( sd.keepAlive ) { -if (reg) { if (log.isDebugEnabled()) { log.debug(Connection is keep alive, registering back for OP_READ); } @@ -1331,7 +1338,6 @@ public class NioEndpoint extends Abstrac } else { reg(sk,attachment,SelectionKey.OP_READ); } -} } else { if (log.isDebugEnabled()) { log.debug(Send file connection is being closed); @@ -1339,7 +1345,7 @@ public class NioEndpoint extends Abstrac cancelledKey(sk,SocketStatus.STOP,false); return false; } -} else if ( attachment.interestOps() == 0 reg ) { +} else { //if ( attachment.interestOps() == 0 reg ) { if (log.isDebugEnabled()) { log.debug(OP_WRITE for sendilfe:+sd.fileName); } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1340218r1=1340217r2=1340218view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri May 18 19:28:30 2012 @@ -117,6 +117,14 @@ subsection name=Coyote changelog fix +bug52858/bug: Correct fix for high CPU load +(fhanik) + /fix + fix +bug53138/bug: Broken Sendfile on SSL introduced in 7.0.27 +(fhanik) + /fix + fix bug52055/bug: Additional fix required to ensure that codeInputFilter/codes are recycled between requests. (markt) /fix - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1335546 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
Author: fhanik Date: Tue May 8 14:17:43 2012 New Revision: 1335546 URL: http://svn.apache.org/viewvc?rev=1335546view=rev Log: When a connection is disconnected, make sure we reset the cached values. This can happen during a failed validation when reconnect() is called. Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java?rev=1335546r1=1335545r2=1335546view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java Tue May 8 14:17:43 2012 @@ -110,6 +110,19 @@ public class ConnectionState extends Jdb } + +@Override +public void disconnected(ConnectionPool parent, PooledConnection con, boolean finalizing) { +//we are resetting, reset our defaults +autoCommit = null; +transactionIsolation = null; +readOnly = null; +catalog = null; +super.disconnected(parent, con, finalizing); +} + + + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1333114 - in /tomcat/trunk: java/org/apache/coyote/ java/org/apache/tomcat/util/net/ java/org/apache/tomcat/util/threads/ webapps/docs/ webapps/docs/config/
Author: fhanik Date: Wed May 2 17:12:48 2012 New Revision: 1333114 URL: http://svn.apache.org/viewvc?rev=1333114view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=53173 Properly handle count down of maxConnections latch when entering edge cases. Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/threads/LimitLatch.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/ajp.xml tomcat/trunk/webapps/docs/config/http.xml Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1333114r1=1333113r2=1333114view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Wed May 2 17:12:48 2012 @@ -541,6 +541,12 @@ public abstract class AbstractProtocol i SocketStatus status) { ProcessorS processor = connections.remove(socket.getSocket()); +if (status == SocketStatus.DISCONNECT processor == null) { +//nothing more to be done endpoint requested a close +//and there are no object associated with this connection +return SocketState.CLOSED; +} + socket.setAsync(false); try { @@ -555,7 +561,9 @@ public abstract class AbstractProtocol i SocketState state = SocketState.CLOSED; do { -if (processor.isAsync() || state == SocketState.ASYNC_END) { +if (status == SocketStatus.DISCONNECT) { +//do nothing here, just wait for it to get recycled +} else if (processor.isAsync() || state == SocketState.ASYNC_END) { state = processor.asyncDispatch(status); } else if (processor.isComet()) { state = processor.event(status); Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1333114r1=1333113r2=1333114view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Wed May 2 17:12:48 2012 @@ -163,7 +163,12 @@ public abstract class AbstractEndpoint { LimitLatch latch = this.connectionLimitLatch; if (latch != null) { // Update the latch that enforces this +if (maxCon == -1) +releaseConnectionLatch(); +else latch.setLimit(maxCon); +} else if (maxCon 0) { +initializeConnectionLatch(); } } @@ -655,6 +660,7 @@ public abstract class AbstractEndpoint { public abstract boolean getUsePolling(); protected LimitLatch initializeConnectionLatch() { +if (maxConnections==-1) return null; if (connectionLimitLatch==null) { connectionLimitLatch = new LimitLatch(getMaxConnections()); } @@ -668,11 +674,13 @@ public abstract class AbstractEndpoint { } protected void countUpOrAwaitConnection() throws InterruptedException { +if (maxConnections==-1) return; LimitLatch latch = connectionLimitLatch; if (latch!=null) latch.countUpOrAwait(); } protected long countDownConnection() { +if (maxConnections==-1) return -1; LimitLatch latch = connectionLimitLatch; if (latch!=null) { long result = latch.countDown(); Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1333114r1=1333113r2=1333114view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed May 2 17:12:48 2012 @@ -995,6 +995,8 @@ public class AprEndpoint extends Abstrac // socket socket = Socket.accept(serverSock); } catch (Exception e) { +//we didn't get a socket +countDownConnection(); // Introduce delay if necessary
svn commit: r1333116 - in /tomcat/tc7.0.x/trunk: java/org/apache/coyote/ java/org/apache/tomcat/util/net/ java/org/apache/tomcat/util/threads/ webapps/docs/config/
Author: fhanik Date: Wed May 2 17:15:46 2012 New Revision: 1333116 URL: http://svn.apache.org/viewvc?rev=1333116view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=53173 Properly count down maxConnections Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/threads/LimitLatch.java tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1333116r1=1333115r2=1333116view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java Wed May 2 17:15:46 2012 @@ -541,6 +541,12 @@ public abstract class AbstractProtocol i SocketStatus status) { ProcessorS processor = connections.remove(socket.getSocket()); +if (status == SocketStatus.DISCONNECT processor == null) { +//nothing more to be done endpoint requested a close +//and there are no object associated with this connection +return SocketState.CLOSED; +} + socket.setAsync(false); try { @@ -555,7 +561,9 @@ public abstract class AbstractProtocol i SocketState state = SocketState.CLOSED; do { -if (processor.isAsync() || state == SocketState.ASYNC_END) { +if (status == SocketStatus.DISCONNECT) { +//do nothing here, just wait for it to get recycled +} else if (processor.isAsync() || state == SocketState.ASYNC_END) { state = processor.asyncDispatch(status); } else if (processor.isComet()) { state = processor.event(status); Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1333116r1=1333115r2=1333116view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Wed May 2 17:15:46 2012 @@ -163,7 +163,12 @@ public abstract class AbstractEndpoint { LimitLatch latch = this.connectionLimitLatch; if (latch != null) { // Update the latch that enforces this +if (maxCon == -1) +releaseConnectionLatch(); +else latch.setLimit(maxCon); +} else if (maxCon 0) { +initializeConnectionLatch(); } } @@ -655,6 +660,7 @@ public abstract class AbstractEndpoint { public abstract boolean getUsePolling(); protected LimitLatch initializeConnectionLatch() { +if (maxConnections==-1) return null; if (connectionLimitLatch==null) { connectionLimitLatch = new LimitLatch(getMaxConnections()); } @@ -668,11 +674,13 @@ public abstract class AbstractEndpoint { } protected void countUpOrAwaitConnection() throws InterruptedException { +if (maxConnections==-1) return; LimitLatch latch = connectionLimitLatch; if (latch!=null) latch.countUpOrAwait(); } protected long countDownConnection() { +if (maxConnections==-1) return -1; LimitLatch latch = connectionLimitLatch; if (latch!=null) { long result = latch.countDown(); Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1333116r1=1333115r2=1333116view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed May 2 17:15:46 2012 @@ -991,6 +991,8 @@ public class AprEndpoint extends Abstrac // socket socket = Socket.accept(serverSock); } catch (Exception e) { +//we didn't get a socket +countDownConnection
svn commit: r1333118 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Author: fhanik Date: Wed May 2 17:16:24 2012 New Revision: 1333118 URL: http://svn.apache.org/viewvc?rev=1333118view=rev Log: update changelog for https://issues.apache.org/bugzilla/show_bug.cgi?id=53173 fix Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1333118r1=1333117r2=1333118view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed May 2 17:16:24 2012 @@ -82,6 +82,14 @@ /update /changelog /subsection + subsection name=Coyote +changelog + fix +bug53173/bug (rev1333116/rev) : +Properly count down maxConnections (fhanik) + /fix +/changelog + /subsection subsection name=Cluster changelog fix - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1333218 - in /tomcat/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml webapps/docs/config/http.xml
Author: fhanik Date: Wed May 2 21:33:43 2012 New Revision: 1333218 URL: http://svn.apache.org/viewvc?rev=1333218view=rev Log: Modify the default pollerThreadCount as processors go, it gets very polluting and resource wasting to have 24,48 or 64 and more poller threads Very hard for applications to see a performance benefit of more than 2 pollers Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/http.xml 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=1333218r1=1333217r2=1333218view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed May 2 21:33:43 2012 @@ -333,7 +333,7 @@ public class NioEndpoint extends Abstrac /** * Poller thread count. */ -protected int pollerThreadCount = Runtime.getRuntime().availableProcessors(); +protected int pollerThreadCount = Math.min(2,Runtime.getRuntime().availableProcessors()); public void setPollerThreadCount(int pollerThreadCount) { this.pollerThreadCount = pollerThreadCount; } public int getPollerThreadCount() { return pollerThreadCount; } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1333218r1=1333217r2=1333218view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed May 2 21:33:43 2012 @@ -72,6 +72,15 @@ /fix /changelog /subsection + subsection name=Coyote +changelog + scode +Update default value of pollerThreadCount for the NIO connector. +The new default value will never go above 2 regardless of +available processors. (fhanik) + /scode +/changelog + /subsection subsection name=Tribes changelog scode Modified: tomcat/trunk/webapps/docs/config/http.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1333218r1=1333217r2=1333218view=diff == --- tomcat/trunk/webapps/docs/config/http.xml (original) +++ tomcat/trunk/webapps/docs/config/http.xml Wed May 2 21:33:43 2012 @@ -608,8 +608,15 @@ attribute name=pollerThreadCount required=false p(int)The number of threads to be used to run for the polling events. -Default value is code1/code per processor. Can't see a reason to go -above that. But experiment and find your own results./p +Default value is code1/code per processor up to and including version 7.0.27. +Default value as of version 7.0.28 is code1/code per processor but not more than 2.br/ +When accepting a socket, the operating system holds a global lock. So the benefit of +going above 2 threads diminishes rapidly. Having more than one thread is for +system that need to accept connections very rapidly. However usually just +increasing codeacceptCount/code will solve that problem. +Increasing this value may also be beneficial when a large amount of send file +operations are going on. +/p /attribute attribute name=pollerThreadPriority required=false - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1333221 - in /tomcat/tc7.0.x/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml webapps/docs/config/http.xml
Author: fhanik Date: Wed May 2 21:36:44 2012 New Revision: 1333221 URL: http://svn.apache.org/viewvc?rev=1333221view=rev Log: Modify the default pollerThreadCount as processors go, it gets very polluting and resource wasting to have 24,48 or 64 and more poller threads Very hard for applications to see a performance benefit of more than 2 pollers Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1333221r1=1333220r2=1333221view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed May 2 21:36:44 2012 @@ -333,7 +333,7 @@ public class NioEndpoint extends Abstrac /** * Poller thread count. */ -protected int pollerThreadCount = Runtime.getRuntime().availableProcessors(); +protected int pollerThreadCount = Math.min(2,Runtime.getRuntime().availableProcessors()); public void setPollerThreadCount(int pollerThreadCount) { this.pollerThreadCount = pollerThreadCount; } public int getPollerThreadCount() { return pollerThreadCount; } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1333221r1=1333220r2=1333221view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed May 2 21:36:44 2012 @@ -88,6 +88,11 @@ bug53173/bug (rev1333116/rev) : Properly count down maxConnections (fhanik) /fix + update +Update default value of pollerThreadCount for the NIO connector. +The new default value will never go above 2 regardless of +available processors. (fhanik) + /update /changelog /subsection subsection name=Cluster Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml?rev=1333221r1=1333220r2=1333221view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml Wed May 2 21:36:44 2012 @@ -608,8 +608,15 @@ attribute name=pollerThreadCount required=false p(int)The number of threads to be used to run for the polling events. -Default value is code1/code per processor. Can't see a reason to go -above that. But experiment and find your own results./p +Default value is code1/code per processor up to and including version 7.0.27. +Default value as of version 7.0.28 is code1/code per processor but not more than 2.br/ +When accepting a socket, the operating system holds a global lock. So the benefit of +going above 2 threads diminishes rapidly. Having more than one thread is for +system that need to accept connections very rapidly. However usually just +increasing codeacceptCount/code will solve that problem. +Increasing this value may also be beneficial when a large amount of send file +operations are going on. +/p /attribute attribute name=pollerThreadPriority required=false - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1311841 - in /tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test: BorrowWaitTest.java DefaultProperties.java TestInterceptorShortName.java
Author: fhanik Date: Tue Apr 10 16:28:31 2012 New Revision: 1311841 URL: http://svn.apache.org/viewvc?rev=1311841view=rev Log: fix unit tests Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestInterceptorShortName.java Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java?rev=1311841r1=1311840r2=1311841view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java Tue Apr 10 16:28:31 2012 @@ -27,21 +27,21 @@ public class BorrowWaitTest extends Defa } public void testWaitTime() throws Exception { + int wait = 1; this.init(); this.datasource.setMaxActive(1); this.datasource.setMaxWait(wait); Connection con = datasource.getConnection(); +long start = System.currentTimeMillis(); try { Connection con2 = datasource.getConnection(); assertFalse(This should not happen, connection should be unavailable.,true); con2.close(); }catch (SQLException x) { -long delta = System.currentTimeMillis(); -boolean inrange = Math.abs(wait-delta) 1000; -assertTrue( -Connection should have been acquired within +/- 1 second., -inrange); +long delta = System.currentTimeMillis() - start; +boolean inrange = Math.abs(wait-delta) = 1000; +assertTrue(Connection should have been acquired within +/- 1 second, but was +(wait-delta)+ ms.,inrange); } con.close(); } Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java?rev=1311841r1=1311840r2=1311841view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java Tue Apr 10 16:28:31 2012 @@ -29,7 +29,7 @@ public class DefaultProperties extends P private static final long serialVersionUID = 1L; public DefaultProperties() { -dbProperties = new Properties(); +setDbProperties(new Properties()); //mysql //url = System.getProperty(url,jdbc:mysql://localhost:3306/mysql?autoReconnect=true); @@ -39,38 +39,38 @@ public class DefaultProperties extends P //url = System.getProperty(url,jdbc:derby:derbyDB;create=true); //driverClassName = System.getProperty(driverClassName,org.apache.derby.jdbc.EmbeddedDriver); -url = System.getProperty(url,jdbc:h2:~/.h2/test;QUERY_TIMEOUT=0;DB_CLOSE_ON_EXIT=FALSE); -driverClassName = System.getProperty(driverClassName,org.h2.Driver); + setUrl(System.getProperty(url,jdbc:h2:~/.h2/test;QUERY_TIMEOUT=0;DB_CLOSE_ON_EXIT=FALSE)); + setDriverClassName(System.getProperty(driverClassName,org.h2.Driver)); System.setProperty(h2.serverCachedObjects, 1); -password = System.getProperty(password,password); -username = System.getProperty(username,root); +setPassword(System.getProperty(password,password)); +setUsername(System.getProperty(username,root)); -validationQuery = System.getProperty(validationQuery,SELECT 1); -defaultAutoCommit = Boolean.TRUE; -defaultReadOnly = Boolean.FALSE; -defaultTransactionIsolation = DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION; -connectionProperties = null; -defaultCatalog = null; -initialSize = 10; -maxActive = 100; -maxIdle = initialSize; -minIdle = initialSize; -maxWait = 1; - -testOnBorrow = true; -testOnReturn = false; -testWhileIdle = true; -timeBetweenEvictionRunsMillis = 5000; -numTestsPerEvictionRun = 0; -minEvictableIdleTimeMillis = 1000; -removeAbandoned = true; -removeAbandonedTimeout = 5000; -logAbandoned = true; -validationInterval = 0; //always validate -initSQL = null; -testOnConnect = false; -dbProperties.setProperty(user,username); -dbProperties.setProperty(password
svn commit: r1311844 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java PoolProperties.java jmx/ConnectionPool.java
Author: fhanik Date: Tue Apr 10 16:29:42 2012 New Revision: 1311844 URL: http://svn.apache.org/viewvc?rev=1311844view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=50864 Add in the ability to configure most pool properties even while the pool is running Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1311844r1=1311843r2=1311844view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Apr 10 16:29:42 2012 @@ -442,11 +442,7 @@ public class ConnectionPool { idle = new ArrayBlockingQueuePooledConnection(properties.getMaxActive(),properties.isFairQueue()); } -//if the evictor thread is supposed to run, start it now -if (properties.isPoolSweeperEnabled()) { -poolCleaner = new PoolCleaner(this, properties.getTimeBetweenEvictionRunsMillis()); -poolCleaner.start(); -} //end if +initializePoolCleaner(properties); //create JMX MBean if (this.getPoolProperties().isJmxEnabled()) createMBean(); @@ -496,6 +492,15 @@ public class ConnectionPool { } +public void initializePoolCleaner(PoolConfiguration properties) { +//if the evictor thread is supposed to run, start it now +if (properties.isPoolSweeperEnabled()) { +poolCleaner = new PoolCleaner(this, properties.getTimeBetweenEvictionRunsMillis()); +poolCleaner.start(); +} //end if +} + + //=== // CONNECTION POOLING IMPL LOGIC //=== Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1311844r1=1311843r2=1311844view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Tue Apr 10 16:29:42 2012 @@ -42,55 +42,55 @@ public class PoolProperties implements P public static final int DEFAULT_MAX_ACTIVE = 100; protected static AtomicInteger poolCounter = new AtomicInteger(0); -protected Properties dbProperties = new Properties(); -protected String url = null; -protected String driverClassName = null; -protected Boolean defaultAutoCommit = null; -protected Boolean defaultReadOnly = null; -protected int defaultTransactionIsolation = DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION; -protected String defaultCatalog = null; -protected String connectionProperties; -protected int initialSize = 10; -protected int maxActive = DEFAULT_MAX_ACTIVE; -protected int maxIdle = maxActive; -protected int minIdle = initialSize; -protected int maxWait = 3; -protected String validationQuery; -protected String validatorClassName; -protected Validator validator; -protected boolean testOnBorrow = false; -protected boolean testOnReturn = false; -protected boolean testWhileIdle = false; -protected int timeBetweenEvictionRunsMillis = 5000; -protected int numTestsPerEvictionRun; -protected int minEvictableIdleTimeMillis = 6; -protected final boolean accessToUnderlyingConnectionAllowed = true; -protected boolean removeAbandoned = false; -protected int removeAbandonedTimeout = 60; -protected boolean logAbandoned = false; -protected String name = Tomcat Connection Pool[+(poolCounter.addAndGet(1))+-+System.identityHashCode(PoolProperties.class)+]; -protected String password; -protected String username; -protected long validationInterval = 3; -protected boolean jmxEnabled = true; -protected String initSQL; -protected boolean testOnConnect =false; -protected String jdbcInterceptors=null; -protected boolean fairQueue = true; -protected boolean useEquals = true; -protected int abandonWhenPercentageFull = 0; -protected long maxAge = 0; -protected boolean
svn commit: r1311848 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Tue Apr 10 16:33:15 2012 New Revision: 1311848 URL: http://svn.apache.org/viewvc?rev=1311848view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=50864 Allow most pool properties be configured using JMX Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Apr 10 16:33:15 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1306946 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1311844 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1311848r1=1311847r2=1311848view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Apr 10 16:33:15 2012 @@ -79,6 +79,15 @@ /fix /changelog /subsection + subsection name=jdbc-pool +changelog + fix +bug50864/bug (rev1311844/rev): +JMX enable most pool properties (fhanik) + /fix +/changelog + /subsection + /section section name=Tomcat 7.0.27 (markt) rtext=released 2012-04-05 subsection name=Catalina - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1306946 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java
Author: fhanik Date: Thu Mar 29 16:02:26 2012 New Revision: 1306946 URL: http://svn.apache.org/viewvc?rev=1306946view=rev Log: Per http://tomcat.markmail.org/thread/j7jk7xalhs7t7op7 Threads in the connection pool should not be created using the context loader, but rather the loader that loaded the pool Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1306946r1=1306945r2=1306946view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Mar 29 16:02:26 2012 @@ -1217,13 +1217,16 @@ public class ConnectionPool { unregisterCleaner(cleaner); cleaners.add(cleaner); if (poolCleanTimer == null) { -poolCleanTimer = new Timer(PoolCleaner[ -+ System.identityHashCode(ConnectionPool.class -.getClassLoader()) + : -+ System.currentTimeMillis() + ], true); +ClassLoader loader = Thread.currentThread().getContextClassLoader(); +try { + Thread.currentThread().setContextClassLoader(ConnectionPool.class.getClassLoader()); +poolCleanTimer = new Timer(PoolCleaner[+ System.identityHashCode(ConnectionPool.class.getClassLoader()) + :+ + System.currentTimeMillis() + ], true); +}finally { +Thread.currentThread().setContextClassLoader(loader); +} } -poolCleanTimer.scheduleAtFixedRate(cleaner, cleaner.sleepTime, -cleaner.sleepTime); +poolCleanTimer.scheduleAtFixedRate(cleaner, cleaner.sleepTime,cleaner.sleepTime); } private static synchronized void unregisterCleaner(PoolCleaner cleaner) { Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java?rev=1306946r1=1306945r2=1306946view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java Thu Mar 29 16:02:26 2012 @@ -17,6 +17,8 @@ package org.apache.tomcat.jdbc.test; +import java.util.Map; + import org.apache.tomcat.jdbc.pool.ConnectionPool; import org.apache.tomcat.jdbc.pool.DataSource; @@ -26,19 +28,33 @@ public class PoolCleanerTest extends Def super(name); } +private int countPoolCleanerThreads() { +MapThread, StackTraceElement[] threadmap = Thread.getAllStackTraces(); +int result = 0; +for (Thread t : threadmap.keySet()) { +if (t.getName().startsWith(PoolCleaner[)) result++; +} +return result; +} + public void testPoolCleaner() throws Exception { datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(2000); datasource.getPoolProperties().setTestWhileIdle(true); assertEquals(Pool cleaner should not be started yet.,0,ConnectionPool.getPoolCleaners().size() ); assertNull(Pool timer should be null, ConnectionPool.getPoolTimer()); +assertEquals(Pool cleaner threads should not be present.,0, countPoolCleanerThreads()); datasource.getConnection().close(); assertEquals(Pool cleaner should have 1 cleaner.,1,ConnectionPool.getPoolCleaners().size() ); assertNotNull(Pool timer should not be null, ConnectionPool.getPoolTimer()); +assertEquals(Pool cleaner threads should be 1.,1, countPoolCleanerThreads()); datasource.close(); assertEquals(Pool shutdown, no cleaners should be present.,0,ConnectionPool.getPoolCleaners().size() ); assertNull(Pool timer should be null after shutdown, ConnectionPool.getPoolTimer()); +assertEquals(Pool cleaner threads should not be present after close.,0, countPoolCleanerThreads()); + + } public void test2PoolCleaners() throws Exception { @@ -49,11 +65,13 @@ public class PoolCleanerTest extends Def assertEquals(Pool cleaner should not be started yet.,0,ConnectionPool.getPoolCleaners().size() ); assertNull(Pool timer should be null, ConnectionPool.getPoolTimer
svn commit: r1306955 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Thu Mar 29 16:12:56 2012 New Revision: 1306955 URL: http://svn.apache.org/viewvc?rev=1306955view=rev Log: http://markmail.org/message/j7jk7xalhs7t7op7 Correct class loader to load pool threads, to avoid the leak detector Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Thu Mar 29 16:12:56 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1306410 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1306946 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1306955r1=1306954r2=1306955view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Mar 29 16:12:56 2012 @@ -234,6 +234,10 @@ /subsection subsection name=jdbc-pool changelog + update +Pool cleaner thread should be created using the classloader +that loaded the pool, not the context loader (fhanik) + /update fix bug52804/bug: Make pool properties serializable and cloneable. (fhanik) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1306410 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Wed Mar 28 15:23:41 2012 New Revision: 1306410 URL: http://svn.apache.org/viewvc?rev=1306410view=rev Log: Per http://markmail.org/message/nhfcvvyvvhtzvaxq Since the method that gets interrupted does something like if (Thread.interrupted()) throw new InterruptedException(); The flag is actually cleared by the method itself. If we wish to propagate the interrupt we have to set the flag again Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1306410r1=1306409r2=1306410view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Mar 28 15:23:41 2012 @@ -381,7 +381,9 @@ public class ConnectionPool { } } //while } catch (InterruptedException ex) { -if (!getPoolProperties().getPropagateInterruptState()) { +if (getPoolProperties().getPropagateInterruptState()) { +Thread.currentThread().interrupt(); +} else { Thread.interrupted(); } } @@ -628,7 +630,9 @@ public class ConnectionPool { //retrieve an existing connection con = idle.poll(timetowait, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { -if (!getPoolProperties().getPropagateInterruptState()) { +if (getPoolProperties().getPropagateInterruptState()) { +Thread.currentThread().interrupt(); +} else { Thread.interrupted(); } SQLException sx = new SQLException(Pool wait interrupted.); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1306413 - /tomcat/tc7.0.x/trunk/modules/
Author: fhanik Date: Wed Mar 28 15:27:26 2012 New Revision: 1306413 URL: http://svn.apache.org/viewvc?rev=1306413view=rev Log: Since the method that gets interrupted does something like if (Thread.interrupted()) throw new InterruptedException(); The flag is actually cleared by the method itself. If we wish to propagate the interrupt we have to set the flag again Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Wed Mar 28 15:27:26 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1305966 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1306410 jdbc-pool - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305859 - /tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
Author: fhanik Date: Tue Mar 27 14:59:03 2012 New Revision: 1305859 URL: http://svn.apache.org/viewvc?rev=1305859view=rev Log: Account for known missing properties Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=1305859r1=1305858r2=1305859view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java Tue Mar 27 14:59:03 2012 @@ -87,9 +87,16 @@ public class DefaultTestCase extends Tes get = PoolProperties.class.getMethod(name, new Class[0]); }catch (NoSuchMethodException x) { try { -get = PoolProperties.class.getMethod(bname, new Class[0]); +get = PoolProperties.class.getMethod(bname, new Class[0]); }catch (NoSuchMethodException x2) { -System.err.println(x2.getMessage()); +String msg = x2.getMessage(); +if (msg.indexOf(isPoolPreparedStatements)=0) { +//noop - ignore known missing properties +} else if (msg.indexOf(isMaxOpenPreparedStatements)=0) { +//noop - ignore known missing properties +} else { +System.err.println(Missing property:+x2.getMessage()); +} } } if (get!=null) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305861 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: DisposableConnectionFacade.java JdbcInterceptor.java PoolProperties.java
Author: fhanik Date: Tue Mar 27 15:04:29 2012 New Revision: 1305861 URL: http://svn.apache.org/viewvc?rev=1305861view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52002 Improvements to the pool - the default should be that multi thread close should not affect the connection isValid should return false if a connection has been closed Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java?rev=1305861r1=1305860r2=1305861view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java Tue Mar 27 15:04:29 2012 @@ -48,6 +48,9 @@ public class DisposableConnectionFacade if (compare(CLOSE_VAL, method) getNext() == null) { return null; } +if (compare(ISVALID_VAL, method) getNext() == null) { +return Boolean.FALSE; +} try { return super.invoke(proxy, method, args); @@ -56,7 +59,7 @@ public class DisposableConnectionFacade if (compare(TOSTRING_VAL, method)) { return DisposableConnectionFacade[null]; } -throw new SQLException(Connection has already been closed.); +throw new SQLException(PooledConnection has already been closed.); } throw e; Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java?rev=1305861r1=1305860r2=1305861view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java Tue Mar 27 15:04:29 2012 @@ -61,6 +61,10 @@ public abstract class JdbcInterceptor im */ public static final String ISWRAPPERFOR_VAL = isWrapperFor; +/** + * {@link java.sql.Connection#isValid(boolean)} method name + */ +public static final String ISVALID_VAL = isValid; /** * Properties for this interceptor. Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1305861r1=1305860r2=1305861view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Tue Mar 27 15:04:29 2012 @@ -86,7 +86,7 @@ public class PoolProperties implements P protected boolean alternateUsernameAllowed = false; protected boolean commitOnReturn = false; protected boolean rollbackOnReturn = false; -protected boolean useDisposableConnectionFacade = false; +protected boolean useDisposableConnectionFacade = true; protected boolean logValidationErrors = false; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305862 - /tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
Author: fhanik Date: Tue Mar 27 15:05:31 2012 New Revision: 1305862 URL: http://svn.apache.org/viewvc?rev=1305862view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52002 Documentation change to reflect the new default value Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1305862r1=1305861r2=1305862view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Mar 27 15:05:31 2012 @@ -456,7 +456,7 @@ /attribute attribute name=useDisposableConnectionFacade required=false p(boolean) Set this to true if you wish to put a facade on your connection so that it cannot be reused after it has been closed. This prevents a thread holding on to a - reference of a connection it has already called closed on, to execute queries on it. Default value is codefalse/code for backwards compatibility. + reference of a connection it has already called closed on, to execute queries on it. Default value is codetrue/code. /p /attribute attribute name=logValidationErrors required=false - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305866 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Tue Mar 27 15:12:13 2012 New Revision: 1305866 URL: http://svn.apache.org/viewvc?rev=1305866view=rev Log: Complete the fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=52002 useDisposableConnectionFacade is by default true Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Mar 27 15:12:13 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1303096 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1305863 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1305866r1=1305865r2=1305866view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Mar 27 15:12:13 2012 @@ -223,7 +223,9 @@ /fix fix bug52002/bug (rev1302948/rev): -Add in configuration option to disallow connection reuse. (fhanik) +Add in configuration option to disallow connection reuse. +(rev1305862/rev): +useDisposableConnectionFacade is by default enabled (fhanik) /fix fix bug52493/bug (rev1302969/rev): - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305921 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java
Author: fhanik Date: Tue Mar 27 17:32:49 2012 New Revision: 1305921 URL: http://svn.apache.org/viewvc?rev=1305921view=rev Log: simplify logic, less comparisons on each call Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java?rev=1305921r1=1305920r2=1305921view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java Tue Mar 27 17:32:49 2012 @@ -42,14 +42,16 @@ public class DisposableConnectionFacade @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { -if (compare(ISCLOSED_VAL, method) getNext() == null) { -return Boolean.TRUE; -} -if (compare(CLOSE_VAL, method) getNext() == null) { -return null; -} -if (compare(ISVALID_VAL, method) getNext() == null) { -return Boolean.FALSE; +if (getNext()==null) { +if (compare(ISCLOSED_VAL, method)) { +return Boolean.TRUE; +} +else if (compare(CLOSE_VAL, method)) { +return null; +} +else if (compare(ISVALID_VAL, method)) { +return Boolean.FALSE; +} } try { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305931 - in /tomcat/trunk/modules/jdbc-pool: doc/ src/main/java/org/apache/tomcat/jdbc/pool/ src/main/java/org/apache/tomcat/jdbc/pool/jmx/
Author: fhanik Date: Tue Mar 27 17:55:41 2012 New Revision: 1305931 URL: http://svn.apache.org/viewvc?rev=1305931view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52066 Add in a configuration attribute to allow a thread interrupt state to be retained for the calling library to see Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1305931r1=1305930r2=1305931view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Mar 27 17:55:41 2012 @@ -463,6 +463,11 @@ p(boolean) Set this to true to log errors during the validation phase to the log file. If set to true, errors will be logged as SEVERE. Default value is codefalse/code for backwards compatibility. /p /attribute +attribute name=propagateInterruptState required=false + p(boolean) Set this to true to propagate the interrupt state for a thread that has been interrupted (not clearing the interrupt state). Default value is codefalse/code for backwards compatibility. + /p +/attribute + /attributes /subsection /section Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1305931r1=1305930r2=1305931view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Mar 27 17:55:41 2012 @@ -381,7 +381,9 @@ public class ConnectionPool { } } //while } catch (InterruptedException ex) { -Thread.interrupted(); +if (!getPoolProperties().getPropagateInterruptState()) { +Thread.interrupted(); +} } if (pool.size()==0 force pool!=busy) pool = busy; } @@ -626,7 +628,9 @@ public class ConnectionPool { //retrieve an existing connection con = idle.poll(timetowait, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { -Thread.interrupted();//clear the flag, and bail out +if (!getPoolProperties().getPropagateInterruptState()) { +Thread.interrupted(); +} SQLException sx = new SQLException(Pool wait interrupted.); sx.initCause(ex); throw sx; Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1305931r1=1305930r2=1305931view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 27 17:55:41 2012 @@ -1268,4 +1268,20 @@ public class DataSourceProxy implements return getPoolProperties().getLogValidationErrors(); } +/** + * {@inheritDoc} + */ +@Override +public boolean getPropagateInterruptState() { +return getPoolProperties().getPropagateInterruptState(); +} + +/** + * {@inheritDoc} + */ +@Override +public void setPropagateInterruptState(boolean propagateInterruptState) { + getPoolProperties().setPropagateInterruptState(propagateInterruptState); +} + } Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java?rev=1305931r1=1305930r2=1305931view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool
svn commit: r1305933 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Tue Mar 27 17:58:41 2012 New Revision: 1305933 URL: http://svn.apache.org/viewvc?rev=1305933view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52066 Add in configuration option to allow a thread to retain its interrupt state. Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Mar 27 17:58:41 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1305863 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1305931 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1305933r1=1305932r2=1305933view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Mar 27 17:58:41 2012 @@ -239,6 +239,11 @@ bug50860/bug (rev1303031/rev): Add in option to configure logging for validation errors. (fhanik) /fix + fix +bug52066/bug (rev1305931/rev): +Add in configuration option, progagateInterruptState, to allow threads to +retain the interrupt state. (fhanik) + /fix /changelog /subsection subsection name=Other - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1305383 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Mon Mar 26 15:04:33 2012 New Revision: 1305383 URL: http://svn.apache.org/viewvc?rev=1305383view=rev Log: vote Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1305383r1=1305382r2=1305383view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Mar 26 15:04:33 2012 @@ -141,7 +141,7 @@ PATCHES PROPOSED TO BACKPORT: * Update to Eclipse JDT Compiler 3.7.2. https://issues.apache.org/bugzilla/show_bug.cgi?id=52805 Patch: https://issues.apache.org/bugzilla/attachment.cgi?id=28478 - +1: kkolinko, markt + +1: kkolinko, markt, fhanik -1: * Update Apache Commons Daemon to 1.0.10. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302901 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Tue Mar 20 14:01:45 2012 New Revision: 1302901 URL: http://svn.apache.org/viewvc?rev=1302901view=rev Log: easily readable, dont line break on paranthesis Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1302901r1=1302900r2=1302901view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Mar 20 14:01:45 2012 @@ -656,10 +656,8 @@ public class ConnectionPool { protected PooledConnection createConnection(long now, PooledConnection notUsed, String username, String password) throws SQLException { //no connections where available we'll create one PooledConnection con = create(false); -if (username!=null) con.getAttributes().put( -PooledConnection.PROP_USER, username); -if (password!=null) con.getAttributes().put( -PooledConnection.PROP_PASSWORD, password); +if (username!=null) con.getAttributes().put(PooledConnection.PROP_USER, username); +if (password!=null) con.getAttributes().put(PooledConnection.PROP_PASSWORD, password); boolean error = false; try { //connect and validate the connection - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302902 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
Author: fhanik Date: Tue Mar 20 14:02:18 2012 New Revision: 1302902 URL: http://svn.apache.org/viewvc?rev=1302902view=rev Log: fix bug https://issues.apache.org/bugzilla/show_bug.cgi?id=51237 align implementation with the documentation Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=1302902r1=1302901r2=1302902view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Tue Mar 20 14:02:18 2012 @@ -84,6 +84,9 @@ public class SlowQueryReport extends Abs long delta = now - start; QueryStats qs = this.getQueryStats(sql); qs.failure(delta, now); +if (log.isWarnEnabled()) { +log.warn(Failed Query Report SQL=+sql+; time=+delta+ ms;); +} } return sql; } @@ -94,6 +97,9 @@ public class SlowQueryReport extends Abs if (this.maxQueries 0 ) { QueryStats qs = this.getQueryStats(sql); qs.add(delta, start); +if (log.isWarnEnabled()) { +log.warn(Slow Query Report SQL=+sql+; time=+delta+ ms;); +} } return sql; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302948 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ main/java/org/apache/tomcat/jdbc/pool/jmx/ test/java/org/apache/tomcat/jdbc/test/
Author: fhanik Date: Tue Mar 20 15:45:19 2012 New Revision: 1302948 URL: http://svn.apache.org/viewvc?rev=1302948view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52002 add in ability to configure pool so that connections can not be reused Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/MultipleCloseTest.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1302948r1=1302947r2=1302948view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Mar 20 15:45:19 2012 @@ -312,7 +312,12 @@ public class ConnectionPool { getProxyConstructor(con.getXAConnection() != null); //create the proxy //TODO possible optimization, keep track if this connection was returned properly, and don't generate a new facade -Connection connection = (Connection)proxyClassConstructor.newInstance(new Object[] { handler }); +Connection connection = null; +if (getPoolProperties().getUseDisposableConnectionFacade() ) { +connection = (Connection)proxyClassConstructor.newInstance(new Object[] { new DisposableConnectionFacade(handler) }); +} else { +connection = (Connection)proxyClassConstructor.newInstance(new Object[] {handler}); +} //return the connection return connection; }catch (Exception x) { Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1302948r1=1302947r2=1302948view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 20 15:45:19 2012 @@ -1226,4 +1226,20 @@ public class DataSourceProxy implements return getPoolProperties().getRollbackOnReturn(); } +/** + * {@inheritDoc} + */ +@Override +public void setUseDisposableConnectionFacade(boolean useDisposableConnectionFacade) { + getPoolProperties().setUseDisposableConnectionFacade(useDisposableConnectionFacade); +} + +/** + * {@inheritDoc} + */ +@Override +public boolean getUseDisposableConnectionFacade() { +return getPoolProperties().getUseDisposableConnectionFacade(); +} + } Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java?rev=1302948view=auto == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DisposableConnectionFacade.java Tue Mar 20 15:45:19 2012 @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES
svn commit: r1302965 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Author: fhanik Date: Tue Mar 20 16:14:07 2012 New Revision: 1302965 URL: http://svn.apache.org/viewvc?rev=1302965view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52327 Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1302965r1=1302964r2=1302965view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 20 16:14:07 2012 @@ -47,7 +47,7 @@ public class DataSourceProxy implements protected volatile ConnectionPool pool = null; -protected PoolConfiguration poolProperties = null; +protected volatile PoolConfiguration poolProperties = null; public DataSourceProxy() { this(new PoolProperties()); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302968 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Author: fhanik Date: Tue Mar 20 16:16:00 2012 New Revision: 1302968 URL: http://svn.apache.org/viewvc?rev=1302968view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52327 Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1302968r1=1302967r2=1302968view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 20 16:16:00 2012 @@ -19,9 +19,11 @@ package org.apache.tomcat.jdbc.pool; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; import java.util.Iterator; import java.util.Properties; import java.util.concurrent.Future; +import java.util.logging.Logger; import javax.sql.XAConnection; @@ -535,6 +537,14 @@ public class DataSourceProxy implements /** * no-op + * {@link javax.sql.DataSource#getParentLogger} + */ +public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException(); +} + +/** + * no-op * {@link javax.sql.DataSource#getLogWriter} */ public PrintWriter getLogWriter() throws SQLException { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302969 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Author: fhanik Date: Tue Mar 20 16:17:49 2012 New Revision: 1302969 URL: http://svn.apache.org/viewvc?rev=1302969view=rev Log: tabs to spaces Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1302969r1=1302968r2=1302969view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 20 16:17:49 2012 @@ -540,7 +540,7 @@ public class DataSourceProxy implements * {@link javax.sql.DataSource#getParentLogger} */ public Logger getParentLogger() throws SQLFeatureNotSupportedException { - throw new SQLFeatureNotSupportedException(); +throw new SQLFeatureNotSupportedException(); } /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302974 - /tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
Author: fhanik Date: Tue Mar 20 16:24:13 2012 New Revision: 1302974 URL: http://svn.apache.org/viewvc?rev=1302974view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52654 Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1302974r1=1302973r2=1302974view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Mar 20 16:24:13 2012 @@ -135,7 +135,8 @@ codeorg.apache.tomcat.jdbc.pool.DataSource/code object will then register the actual connection pool MBean. If you're running outside of a container, you can register the DataSource yourself under any object name you specify, - and it propagates the registration to the underlying pool. + and it propagates the registration to the underlying pool. To do this you would call codemBeanServer.registerMBean(dataSource.getPool().getJmxPool(),objectname)/code. + Prior to this call, ensure that the pool has been created by calling codedataSource.createPool()/code. /p /subsection - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1302990 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java PoolExhaustedException.java jmx/ConnectionPool.java
Author: fhanik Date: Tue Mar 20 16:44:17 2012 New Revision: 1302990 URL: http://svn.apache.org/viewvc?rev=1302990view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51893 add notification that the pool has been exhausted Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolExhaustedException.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1302990r1=1302989r2=1302990view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Mar 20 16:44:17 2012 @@ -634,13 +634,19 @@ public class ConnectionPool { waitcount.decrementAndGet(); } if (maxWait==0 con == null) { //no wait, return one if we have one -throw new SQLException([ + Thread.currentThread().getName()+] + +if (jmxPool!=null) { + jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.POOL_EMPTY, Pool empty - no wait.); +} +throw new PoolExhaustedException([ + Thread.currentThread().getName()+] + NoWait: Pool empty. Unable to fetch a connection, none available[+busy.size()+ in use].); } //we didn't get a connection, lets see if we timed out if (con == null) { if ((System.currentTimeMillis() - now) = maxWait) { -throw new SQLException([ + Thread.currentThread().getName()+] + +if (jmxPool!=null) { + jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.POOL_EMPTY, Pool empty - timeout.); +} +throw new PoolExhaustedException([ + Thread.currentThread().getName()+] + Timeout: Pool empty. Unable to fetch a connection in + (maxWait / 1000) + seconds, none available[size:+size.get() +; busy:+busy.size()+; idle:+idle.size()+; lastwait:+timetowait+].); } else { Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolExhaustedException.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolExhaustedException.java?rev=1302990view=auto == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolExhaustedException.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolExhaustedException.java Tue Mar 20 16:44:17 2012 @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.jdbc.pool; + +import java.sql.SQLException; + +public class PoolExhaustedException extends SQLException { + +public PoolExhaustedException() { +} + +public PoolExhaustedException(String reason) { +super(reason); +} + +public PoolExhaustedException(Throwable cause) { +super(cause); +} + +public PoolExhaustedException(String reason, String SQLState) { +super(reason, SQLState); +} + +public PoolExhaustedException(String reason, Throwable cause) { +super(reason, cause); +} + +public PoolExhaustedException(String reason, String SQLState, int vendorCode) { +super(reason, SQLState, vendorCode); +} + +public PoolExhaustedException(String reason, String sqlState, Throwable cause) { +super(reason, sqlState, cause); +} + +public PoolExhaustedException(String reason, String sqlState, int vendorCode
svn commit: r1302991 - /tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
Author: fhanik Date: Tue Mar 20 16:48:20 2012 New Revision: 1302991 URL: http://svn.apache.org/viewvc?rev=1302991view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52518 Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1302991r1=1302990r2=1302991view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Mar 20 16:48:20 2012 @@ -46,13 +46,13 @@ licommons-dbcp is complex, over 60 classes. tomcat-jdbc-pool, core is 8 classes, hence modifications for future requirement will require much less changes. This is all you need to run the connection pool itself, the rest is gravy./li licommons-dbcp uses static interfaces. This means you can't compile it with JDK 1.6, or if you run on JDK 1.6/1.7 you will get - NoSuchMethodException for all the methods not implemented, even if the driver supports it. /li + codeNoSuchMethodException/code for all the methods not implemented, even if the driver supports it. /li liThe commons-dbcp has become fairly stagnant. Sparse updates, releases, and new feature support./li liIt's not worth rewriting over 60 classes, when something as a connection pool can be accomplished with as a much simpler implementation./li liTomcat jdbc pool implements a fairness option not available in commons-dbcp and still performs faster than commons-dbcp/li liTomcat jdbc pool implements the ability retrieve a connection asynchronously, without adding additional threads to the library itself/li liTomcat jdbc pool is a Tomcat module, it depends on Tomcat JULI, a simplified logging framework used in Tomcat./li - liRetrieve the underlying connection using the javax.sql.PooledConnection interface./li + liRetrieve the underlying connection using the codejavax.sql.PooledConnection/code interface./li liStarvation proof. If a pool is empty, and threads are waiting for a connection, when a connection is returned, the pool will awake the correct thread waiting. Most pools will simply starve./li /ol @@ -61,7 +61,7 @@ pFeatures added over other connection pool implementations ol liSupport for highly concurrent environments and multi core/cpu systems./li - liDynamic implementation of interface, will support java.sql and javax.sql interfaces for + liDynamic implementation of interface, will support codejava.sql/code and codejavax.sql/code interfaces for your runtime environment (as long as your JDBC driver does the same), even when compiled with a lower version of the JDK./li liValidation intervals - we don't have to validate every single time we use the connection, we can do this when we borrow or return the connection, just not more frequent than an interval we can configure./li @@ -70,18 +70,19 @@ liAbility to configure custom interceptors. This allows you to write custom interceptors to enhance the functionality. You can use interceptors to gather query stats, cache session states, reconnect the connection upon failures, retry queries, cache query results, and so on. - Your options are endless and the interceptors are dynamic, not tied to a JDK version of a java.sql/javax.sql interface./li + Your options are endless and the interceptors are dynamic, not tied to a JDK version of a + codejava.sql/code/codejavax.sql/code interface./li liHigh performance - we will show some differences in performance later on/li liExtremely simple, due to the very simplified implementation, the line count and source file count are very low, compare with c3p0 that has over 200 source files(last time we checked), Tomcat jdbc has a core of 8 files, the connection pool itself is about half that. As bugs may occur, they will be faster to track down, and easier to fix. Complexity reduction has been a focus from inception./li - liAsynchronous connection retrieval - you can queue your request for a connection and receive a Futurelt;Connectiongt; back./li + liAsynchronous connection retrieval - you can queue your request for a connection and receive a codeFuturelt;Connectiongt;/code back./li liBetter idle connection handling. Instead of closing connections directly, it can still pool connections and sizes the idle pool with a smarter algorithm./li liYou can decide at what moment connections are considered abandoned, is it when the pool is full, or directly at a timeout by specifying a pool usage threshold. /li liThe abandon connection timer will reset upon a statement/query activity
svn commit: r1303031 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: DataSourceProxy.java PoolConfiguration.java PoolProperties.java PooledConnection.java jmx/Connectio
Author: fhanik Date: Tue Mar 20 17:32:47 2012 New Revision: 1303031 URL: http://svn.apache.org/viewvc?rev=1303031view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=50860 add option to log validation errors Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1303031r1=1303030r2=1303031view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue Mar 20 17:32:47 2012 @@ -1252,4 +1252,20 @@ public class DataSourceProxy implements return getPoolProperties().getUseDisposableConnectionFacade(); } +/** + * {@inheritDoc} + */ +@Override +public void setLogValidationErrors(boolean logValidationErrors) { +getPoolProperties().setLogValidationErrors(logValidationErrors); +} + +/** + * {@inheritDoc} + */ +@Override +public boolean getLogValidationErrors() { +return getPoolProperties().getLogValidationErrors(); +} + } Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java?rev=1303031r1=1303030r2=1303031view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolConfiguration.java Tue Mar 20 17:32:47 2012 @@ -835,4 +835,16 @@ public interface PoolConfiguration { */ public boolean getUseDisposableConnectionFacade(); +/** + * Set to true if you wish that errors from validation should be logged as error messages. + * @param logValidationErrors set to true to log validation errors + */ +public void setLogValidationErrors(boolean logValidationErrors); + +/** + * Returns true if errors that happen during validation will be logged + * @return true if errors that happen during validation will be logged + */ +public boolean getLogValidationErrors(); + } Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1303031r1=1303030r2=1303031view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Tue Mar 20 17:32:47 2012 @@ -86,7 +86,8 @@ public class PoolProperties implements P protected boolean alternateUsernameAllowed = false; protected boolean commitOnReturn = false; protected boolean rollbackOnReturn = false; -protected boolean useDisposableConnectionFacade; +protected boolean useDisposableConnectionFacade = false; +protected boolean logValidationErrors = false; /** @@ -1212,6 +1213,22 @@ public class PoolProperties implements P return useDisposableConnectionFacade; } +/** + * {@inheritDoc} + */ +@Override +public void setLogValidationErrors(boolean logValidationErrors) { +this.logValidationErrors = logValidationErrors; +} + +/** + * {@inheritDoc} + */ +@Override +public boolean getLogValidationErrors() { +return this.logValidationErrors; +} + @Override protected Object clone() throws CloneNotSupportedException { // TODO Auto-generated method stub Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java?rev=1303031r1=1303030r2=1303031view=diff == --- tomcat
svn commit: r1303046 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Tue Mar 20 17:51:47 2012 New Revision: 1303046 URL: http://svn.apache.org/viewvc?rev=1303046view=rev Log: Bug fixes to jdbc pool Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Mar 20 17:51:47 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1295768 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1303044 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1303046r1=1303045r2=1303046view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Mar 20 17:51:47 2012 @@ -193,6 +193,11 @@ bug52804/bug: Make pool properties serializable and cloneable. (fhanik) /fix + fixbug51237/bugrev1302902/rev Slow Query Report should log using WARN level when queries are slow and within the threshold of caching it/fix + fixbug52002/bugrev1302948/rev Add in configuration option to disallow connection reuse/fix + fixbug52493/bugrev1302969/rev Java 7 DataSource method addition/fix + fixbug51893/bugrev1302990/rev Throw an error and notification when pool is exhausted/fix + fixbug50860/bugrev1303031/rev Add in option to configure logging for validation errors/fix /changelog /subsection subsection name=Other - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1303066 - /tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
Author: fhanik Date: Tue Mar 20 18:14:28 2012 New Revision: 1303066 URL: http://svn.apache.org/viewvc?rev=1303066view=rev Log: update documentation with new attributes Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1303066r1=1303065r2=1303066view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Mar 20 18:14:28 2012 @@ -446,11 +446,21 @@ /p /attribute attribute name=dataSource required=false - p(javax.sql.DataSource) + p(javax.sql.DataSource) Inject a data source to the connection pool, and the pool will use the data source to retrieve connections instead of establishing them using the codejava.sql.Driver/code interface. + This is useful when you wish to pool XA connections or connections established using a data source instead of a connection string. Default value is codenull/code /p /attribute attribute name=dataSourceJNDI required=false - p(String) + p(String) The JNDI name for a data source to be looked up in JNDI and then used to establish connections to the database. See the codedataSource/code attribute. Default value is codenull/code + /p +/attribute +attribute name=useDisposableConnectionFacade required=false + p(boolean) Set this to true if you wish to put a facade on your connection so that it cannot be reused after it has been closed. This prevents a thread holding on to a + reference of a connection it has already called closed on, to execute queries on it. Default value is codefalse/code for backwards compatibility. + /p +/attribute +attribute name=logValidationErrors required=false + p(boolean) Set this to true to log errors during the validation phase to the log file. If set to true, errors will be logged as SEVERE. Default value is codefalse/code for backwards compatibility. /p /attribute /attributes - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1303067 - /tomcat/tc7.0.x/trunk/modules/
Author: fhanik Date: Tue Mar 20 18:15:33 2012 New Revision: 1303067 URL: http://svn.apache.org/viewvc?rev=1303067view=rev Log: documentation update of jdbc-pool Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Mar 20 18:15:33 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1303060 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1303066 jdbc-pool - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1300999 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Thu Mar 15 14:23:29 2012 New Revision: 1300999 URL: http://svn.apache.org/viewvc?rev=1300999view=rev Log: Bug fix for send file CPU usage Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1300999r1=1300998r2=1300999view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Mar 15 14:23:29 2012 @@ -173,6 +173,11 @@ PATCHES PROPOSED TO BACKPORT: +1: markt -1: +* Fix bug https://issues.apache.org/bugzilla/show_bug.cgi?id=52858 + http://svn.apache.org/viewvc?rev=1300948view=rev + +1: fhanik + -1: + PATCHES/ISSUES THAT ARE STALLED - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1301027 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Thu Mar 15 15:07:22 2012 New Revision: 1301027 URL: http://svn.apache.org/viewvc?rev=1301027view=rev Log: votes Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1301027r1=1301026r2=1301027view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Mar 15 15:07:22 2012 @@ -66,18 +66,18 @@ PATCHES PROPOSED TO BACKPORT: HTTP response code when rejecting denied request. E.g. 404 instead of 403. http://people.apache.org/~kkolinko/patches/2011-11-16_tc6_RequestFilterValve_denyStatus.patch (r1202565 in trunk, r1202570 in TC7) - +1: kkolinko, rjung + +1: kkolinko, rjung, fhanik -1: * Reduce overhead from exception handling in UDecoder http://people.apache.org/~kkolinko/patches/2011-11-17_tc6_UDecoder.patch (r1203054 in TC7) - +1: kkolinko,funkman + +1: kkolinko,funkman, fhanik -1: * Align %2f handling between implementations of UDecoder.convert() http://svn.apache.org/viewvc?rev=1203091view=rev - +1: kkolinko,funkman + +1: kkolinko,funkman, fhanik -1: * Backport SetCharacterEncodingFilter @@ -119,13 +119,13 @@ PATCHES PROPOSED TO BACKPORT: This fix does not reintroduce issue BZ51400. This fix avoids http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6196991. https://issues.apache.org/bugzilla/attachment.cgi?id=28274 - +1: kfujino - -1: + +1: kfujino, fhanik + -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52606 Ensure replayed POST bodies are available when using AJP http://svn.apache.org/viewvc?rev=1241985view=rev - +1: markt, kfujino + +1: markt, kfujino, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51477 @@ -134,36 +134,37 @@ PATCHES PROPOSED TO BACKPORT: http://svn.apache.org/viewvc?rev=1145209view=rev TC 6 patch: http://people.apache.org/~rjung/patches/tc6-apr-all-sslprotocol-r1145209.patch - +1: rjung, mturk + +1: rjung, mturk, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52719 Correct theoretical resource leak during Jar validation http://svn.apache.org/viewvc?rev=1298143view=rev - +1: markt + +1: markt, fhanik -1: * Replicate Principal in ClusterSingleSignOn. http://svn.apache.org/viewvc?view=revisionrevision=1298299 - +1: kfujino + +1: kfujino, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52500 Add configurable mechanism to retrieve user names from X509 client certificates. trunk patch: http://svn.apache.org/viewvc?view=revisionrevision=r1298476 - +1: schultz + +1: schultz. fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52723 Correct theoretical resource leak in StandardManager http://svn.apache.org/viewvc?rev=1299036view=rev - +1: markt + +1: markt, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52830 Lookups using javax.naming.Name fail http://svn.apache.org/viewvc?rev=1298635view=rev +1: markt + +1: fhanik - would have been easier to read if 90% of the patch wasn't document/formatting related -1: * https://issues.apache.org/bugzilla/show_bug.cgi?id=52811 @@ -171,6 +172,7 @@ PATCHES PROPOSED TO BACKPORT: http://svn.apache.org/viewvc?rev=1300155view=rev (new HTTP header parser) http://svn.apache.org/viewvc?rev=1300161view=rev (the actual fix) +1: markt + 0: fhanik - introducing a new parser this late into a release seems too risky for 6 -1: * Fix bug https://issues.apache.org/bugzilla/show_bug.cgi?id=52858 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1301042 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Thu Mar 15 15:23:07 2012 New Revision: 1301042 URL: http://svn.apache.org/viewvc?rev=1301042view=rev Log: votes Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1301042r1=1301041r2=1301042view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Mar 15 15:23:07 2012 @@ -180,6 +180,10 @@ PATCHES PROPOSED TO BACKPORT: +1: fhanik -1: +* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52918 + Add WebSocket support to Tomcat 6 + +1: fhanik + PATCHES/ISSUES THAT ARE STALLED - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1295724 - in /tomcat/trunk/webapps/examples/WEB-INF: classes/websocket/EchoMessage.java web.xml
Author: fhanik Date: Thu Mar 1 18:27:56 2012 New Revision: 1295724 URL: http://svn.apache.org/viewvc?rev=1295724view=rev Log: Allow the examples to configure the buffer on the fly Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java tomcat/trunk/webapps/examples/WEB-INF/web.xml Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java?rev=1295724r1=1295723r2=1295724view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java Thu Mar 1 18:27:56 2012 @@ -20,6 +20,8 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.CharBuffer; +import javax.servlet.ServletException; + import org.apache.catalina.websocket.MessageInbound; import org.apache.catalina.websocket.StreamInbound; import org.apache.catalina.websocket.WebSocketServlet; @@ -28,13 +30,40 @@ import org.apache.catalina.websocket.Web public class EchoMessage extends WebSocketServlet { private static final long serialVersionUID = 1L; +private volatile int byteBufSize; +private volatile int charBufSize; + +@Override +public void init() throws ServletException { +super.init(); +byteBufSize = getInitParameterIntValue(byteBufferMaxSize, 2097152); +charBufSize = getInitParameterIntValue(charBufferMaxSize, 2097152); +} + +public int getInitParameterIntValue(String name, int defaultValue) { +String val = this.getInitParameter(name); +int result = defaultValue; +try { +result = Integer.parseInt(val); +}catch (Exception x) { +} +return result; +} + + @Override protected StreamInbound createWebSocketInbound(String subProtocol) { -return new EchoMessageInbound(); +return new EchoMessageInbound(byteBufSize,charBufSize); } private static final class EchoMessageInbound extends MessageInbound { + +public EchoMessageInbound(int byteBufferMaxSize, int charBufferMaxSize) { +super(); +setByteBufferMaxSize(byteBufferMaxSize); +setCharBufferMaxSize(charBufferMaxSize); +} @Override protected void onBinaryMessage(ByteBuffer message) throws IOException { Modified: tomcat/trunk/webapps/examples/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/web.xml?rev=1295724r1=1295723r2=1295724view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/web.xml (original) +++ tomcat/trunk/webapps/examples/WEB-INF/web.xml Thu Mar 1 18:27:56 2012 @@ -359,6 +359,8 @@ servlet servlet-namewsEchoMessage/servlet-name servlet-classwebsocket.EchoMessage/servlet-class + init-paramparam-namebyteBufferMaxSize/param-nameparam-value20971520/param-value/init-param + init-paramparam-namecharBufferMaxSize/param-nameparam-value20971520/param-value/init-param /servlet servlet-mapping servlet-namewsEchoMessage/servlet-name - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1295768 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
Author: fhanik Date: Thu Mar 1 20:15:24 2012 New Revision: 1295768 URL: http://svn.apache.org/viewvc?rev=1295768view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52804 Implement useful interfaces for storing and copying the properties Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1295768r1=1295767r2=1295768view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Thu Mar 1 20:15:24 2012 @@ -19,6 +19,7 @@ package org.apache.tomcat.jdbc.pool; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.Serializable; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -33,7 +34,7 @@ import org.apache.juli.logging.LogFactor * @author Filip Hanik * */ -public class PoolProperties implements PoolConfiguration { +public class PoolProperties implements PoolConfiguration, Cloneable, Serializable { private static final Log log = LogFactory.getLog(PoolProperties.class); public static final int DEFAULT_MAX_ACTIVE = 100; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java
Author: fhanik Date: Thu Mar 1 23:05:51 2012 New Revision: 1295978 URL: http://svn.apache.org/viewvc?rev=1295978view=rev Log: Fix WebSocket's non blocking call http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978r1=1295977r2=1295978view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar 1 23:05:51 2012 @@ -296,12 +296,7 @@ public class Http11NioProtocol extends A protected void upgradePoll(SocketWrapperNioChannel socket, ProcessorNioChannel processor) { connections.put(socket.getSocket(), processor); - -SelectionKey key = socket.getSocket().getIOChannel().keyFor( -socket.getSocket().getPoller().getSelector()); -key.interestOps(SelectionKey.OP_READ); -((KeyAttachment) socket).interestOps( -SelectionKey.OP_READ); +socket.getSocket().getPoller().add(socket.getSocket()); } } } Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978r1=1295977r2=1295978view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Mar 1 23:05:51 2012 @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends @Override public int read(boolean block, byte[] bytes, int off, int len) throws IOException { -// TODO Implement non-blocking reads. Should be as simple as replacing -// true with block in the two lines below if (len maxRead) { -return readSocket(true, bytes, off, maxRead); +return readSocket(block, bytes, off, maxRead); } else { -return readSocket(true, bytes, off, len); +return readSocket(block, bytes, off, len); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1295998 - /tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
Author: fhanik Date: Thu Mar 1 23:46:09 2012 New Revision: 1295998 URL: http://svn.apache.org/viewvc?rev=1295998view=rev Log: Fix access to poller registration Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295998r1=1295997r2=1295998view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar 1 23:46:09 2012 @@ -253,11 +253,7 @@ public class Http11NioProtocol extends A // - this is comet request // - the request line/headers have not been completely //read -SelectionKey key = socket.getSocket().getIOChannel().keyFor( -socket.getSocket().getPoller().getSelector()); -key.interestOps(SelectionKey.OP_READ); -((KeyAttachment) socket).interestOps( -SelectionKey.OP_READ); +socket.getSocket().getPoller().add(socket.getSocket()); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1243655 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/interceptor/ test/java/org/apache/tomcat/jdbc/bugs/ test/java/org/apache/tomcat/jdbc/pool/intercept
Author: fhanik Date: Mon Feb 13 19:07:30 2012 New Revision: 1243655 URL: http://svn.apache.org/viewvc?rev=1243655view=rev Log: Fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=51582 Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/InduceSlowQuery.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=1243655r1=1243654r2=1243655view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Mon Feb 13 19:07:30 2012 @@ -49,7 +49,7 @@ public class SlowQueryReport extends Abs /** * the queries that are used for this interceptor. */ -protected ConcurrentHashMapString,QueryStats queries = null; +protected volatile ConcurrentHashMapString,QueryStats queries = null; /** * Maximum number of queries we will be storing */ @@ -104,7 +104,7 @@ public class SlowQueryReport extends Abs */ @Override public void closeInvoked() { -queries = null; + } @Override @@ -186,6 +186,8 @@ public class SlowQueryReport extends Abs super.reset(parent, con); if (parent!=null) queries = SlowQueryReport.perPoolStats.get(parent.getName()); +else +queries = null; } Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java?rev=1243655view=auto == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java Mon Feb 13 19:07:30 2012 @@ -0,0 +1,121 @@ +package org.apache.tomcat.jdbc.bugs; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tomcat.jdbc.pool.ConnectionPool; +import org.apache.tomcat.jdbc.pool.PoolConfiguration; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.apache.tomcat.jdbc.test.DefaultProperties; + + +public class Bug51582 +{ + + /** + * @param args + * @throws SQLException + */ + public static void main(String[] args) throws SQLException + { +org.apache.tomcat.jdbc.pool.DataSource datasource = null; +PoolConfiguration p = new DefaultProperties(); + +p.setJmxEnabled(true); +p.setTestOnBorrow(false); +p.setTestOnReturn(false); +p.setValidationInterval(1000); +p.setTimeBetweenEvictionRunsMillis(2000); + +p.setMaxWait(2000); +p.setMinEvictableIdleTimeMillis(1000); + +datasource = new org.apache.tomcat.jdbc.pool.DataSource(); +datasource.setPoolProperties(p); + datasource.setJdbcInterceptors(org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx(threshold=200)); +ConnectionPool pool = datasource.createPool(); + + +Connection con = pool.getConnection(); +Statement st = con.createStatement(); +try { +st.execute(DROP ALIAS SLEEP); +}catch (Exception ignore) {} +st.execute(CREATE ALIAS SLEEP AS $$\nboolean sleep() {\ntry {\n Thread.sleep(1);\nreturn true;} catch (Exception x) {\nreturn false;\n}\n}\n$$;); +st.close(); +con.close(); +int iter = 0; +while ((iter++) 10) +{ + final Connection connection = pool.getConnection(); + final CallableStatement s = connection.prepareCall({CALL SLEEP()}); + + ListThread threadList = new ArrayListThread(); + + for (int l = 0; l 3; l++) + { +final int i = l; + +Thread thread = new Thread() +{ + @Override + public void run() + { +try +{ + if (i == 0) + { +Thread.sleep(1000); +s.cancel(); + } + else if (i == 1) + { +//or use some other statement which will block for a longer time +long start
svn commit: r1243682 - in /tomcat/tc7.0.x/trunk: modules/ webapps/docs/changelog.xml
Author: fhanik Date: Mon Feb 13 20:37:30 2012 New Revision: 1243682 URL: http://svn.apache.org/viewvc?rev=1243682view=rev Log: Fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=51582 Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Mon Feb 13 20:37:30 2012 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1232867 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1243655 jdbc-pool Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1243682r1=1243681r2=1243682view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Feb 13 20:37:30 2012 @@ -204,6 +204,9 @@ Fix code style issues and enable Checkstyle checks for jdbc-pool when it is built within Tomcat. (kkolinko) /fix + fix +bug51582/bug Correct set and reset the query cache to avoid NPE (fhanik) + /fix /changelog /subsection /section - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1207850 - /tomcat/tc7.0.x/trunk/modules/
Author: fhanik Date: Tue Nov 29 12:52:05 2011 New Revision: 1207850 URL: http://svn.apache.org/viewvc?rev=1207850view=rev Log: attempting to set externals Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Nov 29 12:52:05 2011 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1201562 jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1207712 modules/jdbc-pool - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1207852 - in /tomcat/trunk/modules/jdbc-pool: ./ doc/changelog.xml
Author: fhanik Date: Tue Nov 29 12:56:02 2011 New Revision: 1207852 URL: http://svn.apache.org/viewvc?rev=1207852view=rev Log: update propset, try 2 Modified: tomcat/trunk/modules/jdbc-pool/ (props changed) tomcat/trunk/modules/jdbc-pool/doc/changelog.xml Propchange: tomcat/trunk/modules/jdbc-pool/ -- --- svn:externals (added) +++ svn:externals Tue Nov 29 12:56:02 2011 @@ -0,0 +1 @@ +^/tomcat/trunk/modules/jdbc-pool@1207712 jdbc-pool Modified: tomcat/trunk/modules/jdbc-pool/doc/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/changelog.xml?rev=1207852r1=1207851r2=1207852view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/changelog.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/changelog.xml Tue Nov 29 12:56:02 2011 @@ -31,6 +31,7 @@ section name=Tomcat JDBC Connection Pool 1.1.0.0 subsection name=pool changelog + addrev1207712/rev Pool cleaner should be a global thread, not spawn one thread per connection pool. (fhanik)/add fixrev1073531/rev bug50805/bug Only initialize connections once when async (fhanik)/fix fixrev1076380/rev bug50857/bug Correctly handle timeouts when the pool is busy when async (fhanik)/fix addAdded QueryTimeoutInterceptor to be able to configure timeouts on running queries automatically./add - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1207856 - /tomcat/tc7.0.x/trunk/modules/
Author: fhanik Date: Tue Nov 29 13:00:18 2011 New Revision: 1207856 URL: http://svn.apache.org/viewvc?rev=1207856view=rev Log: maybe this time Modified: tomcat/tc7.0.x/trunk/modules/ (props changed) Propchange: tomcat/tc7.0.x/trunk/modules/ -- --- svn:externals (original) +++ svn:externals Tue Nov 29 13:00:18 2011 @@ -1 +1 @@ -^/tomcat/trunk/modules/jdbc-pool@1207712 modules/jdbc-pool +^/tomcat/trunk/modules/jdbc-pool@1207712 jdbc-pool - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1207712 - in /tomcat/trunk/modules/jdbc-pool: doc/jdbc-pool.xml src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.jav
Author: fhanik Date: Tue Nov 29 00:05:43 2011 New Revision: 1207712 URL: http://svn.apache.org/viewvc?rev=1207712view=rev Log: Conserve threads by allowing multiple pools in the same classloader to share a pool cleaner thread Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/PoolCleanerTest.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1207712r1=1207711r2=1207712view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Nov 29 00:05:43 2011 @@ -281,7 +281,8 @@ p(int) The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread. This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, and how often we validate idle connections. - The default value is code5000/code (5 seconds)./p + The default value is code5000/code (5 seconds). br/ + /p /attribute attribute name=numTestsPerEvictionRun required=false @@ -816,6 +817,9 @@ ant test (runs tests, expects a test database to be setup) /source /p +p + The system is structured for a Maven build, but does generate release artifacts. Just the library itself. +/p /subsection /section /body Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1207712r1=1207711r2=1207712view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Nov 29 00:05:43 2011 @@ -21,8 +21,14 @@ import java.lang.reflect.InvocationHandl import java.lang.reflect.Proxy; import java.sql.Connection; import java.sql.SQLException; +import java.util.Collections; import java.util.ConcurrentModificationException; +import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; @@ -785,13 +791,12 @@ public class ConnectionPool { protected boolean terminateTransaction(PooledConnection con) { try { if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE) { -boolean autocommit = con.getConnection().getAutoCommit(); -if (!autocommit) { -if (this.getPoolProperties().getRollbackOnReturn()) { -con.getConnection().rollback(); -} else if (this.getPoolProperties().getCommitOnReturn()) { -con.getConnection().commit(); -} +if (this.getPoolProperties().getRollbackOnReturn()) { +boolean autocommit = con.getConnection().getAutoCommit(); +if (!autocommit) con.getConnection().rollback(); +} else if (this.getPoolProperties().getCommitOnReturn()) { +boolean autocommit = con.getConnection().getAutoCommit(); +if (!autocommit) con.getConnection().commit(); } } return true; @@ -1185,14 +1190,54 @@ public class ConnectionPool { } } + + + +private static volatile Timer poolCleanTimer = null; +private static HashSetPoolCleaner cleaners = new HashSetPoolCleaner(); + +private static synchronized void registerCleaner(PoolCleaner cleaner) { +unregisterCleaner(cleaner); +cleaners.add(cleaner); +if (poolCleanTimer == null) { +poolCleanTimer = new Timer(PoolCleaner[ ++ System.identityHashCode(ConnectionPool.class +.getClassLoader()) + : ++ System.currentTimeMillis() + ], true); +} +poolCleanTimer.scheduleAtFixedRate(cleaner, cleaner.sleepTime, +cleaner.sleepTime); +} + +private static synchronized void unregisterCleaner(PoolCleaner cleaner) { +boolean removed = cleaners.remove(cleaner); +if (removed) { +cleaner.cancel(); +if (poolCleanTimer != null) { +poolCleanTimer.purge
svn commit: r1207726 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Author: fhanik Date: Tue Nov 29 01:07:49 2011 New Revision: 1207726 URL: http://svn.apache.org/viewvc?rev=1207726view=rev Log: update changelog Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1207726r1=1207725r2=1207726view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Nov 29 01:07:49 2011 @@ -86,6 +86,11 @@ /update /changelog /subsection + subsection name=jdbc-pool +changelog + addrev1207712/rev Pool cleaner should be a global thread, not spawn one thread per connection pool. (fhanik)/add +/changelog + /subsection subsection name=Other changelog fix - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1205441 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Wed Nov 23 15:29:01 2011 New Revision: 1205441 URL: http://svn.apache.org/viewvc?rev=1205441view=rev Log: Only apply the commitOnReturn and rollbackOnReturn if the default auto commit value is false. getAutoCommit is a call to the DB for many drivers and doesn't perform well Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1205441r1=1205440r2=1205441view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Nov 23 15:29:01 2011 @@ -784,12 +784,14 @@ public class ConnectionPool { */ protected boolean terminateTransaction(PooledConnection con) { try { -boolean autocommit = con.getConnection().getAutoCommit(); -if (!autocommit) { -if (this.getPoolProperties().getRollbackOnReturn()) { -con.getConnection().rollback(); -} else if (this.getPoolProperties().getCommitOnReturn()) { -con.getConnection().commit(); +if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE) { +boolean autocommit = con.getConnection().getAutoCommit(); +if (!autocommit) { +if (this.getPoolProperties().getRollbackOnReturn()) { +con.getConnection().rollback(); +} else if (this.getPoolProperties().getCommitOnReturn()) { +con.getConnection().commit(); +} } } return true; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1189978 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
Author: fhanik Date: Thu Oct 27 19:56:30 2011 New Revision: 1189978 URL: http://svn.apache.org/viewvc?rev=1189978view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51582 Fix NPE when the query is not available. This is a temporary work around until we know why SQL is null Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=1189978r1=1189977r2=1189978view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Thu Oct 27 19:56:30 2011 @@ -149,6 +149,7 @@ public class SlowQueryReport extends Abs } protected QueryStats getQueryStats(String sql) { +if (sql==null) sql = ; ConcurrentHashMapString,QueryStats queries = SlowQueryReport.this.queries; if (queries==null) return null; QueryStats qs = queries.get(sql); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1172661 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Mon Sep 19 15:30:06 2011 New Revision: 1172661 URL: http://svn.apache.org/viewvc?rev=1172661view=rev Log: votes Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1172661r1=1172660r2=1172661view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Sep 19 15:30:06 2011 @@ -72,14 +72,14 @@ PATCHES PROPOSED TO BACKPORT: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51550 Display error page rather than an empty response for an IllegalStateException https://issues.apache.org/bugzilla/attachment.cgi?id=27434 - +1: markt, kkolinko + +1: markt, kkolinko, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51758 Correct logger names used by Tomcat-internal copy of Commons Digester It is backport of r1164567, r1167394. https://issues.apache.org/bugzilla/attachment.cgi?id=27479 - +1: kkolinko, rjung + +1: kkolinko, rjung, fhanik -1: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51794 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1170647 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: fhanik Date: Wed Sep 14 14:39:05 2011 New Revision: 1170647 URL: http://svn.apache.org/viewvc?rev=1170647view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51794 Fix race condition in selector potentially causing a delay in select operations 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=1170647r1=1170646r2=1170647view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Sep 14 14:39:05 2011 @@ -1081,13 +1081,11 @@ public class NioEndpoint extends Abstrac } try { if ( !close ) { -if (wakeupCounter.get()0) { +if (wakeupCounter.getAndSet(-1) 0) { //if we are here, means we have other stuff to do //do a non blocking select keyCount = selector.selectNow(); -}else { -keyCount = selector.keys().size(); -wakeupCounter.set(-1); +} else { keyCount = selector.select(selectorTimeout); } wakeupCounter.set(0); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1170656 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: fhanik Date: Wed Sep 14 14:42:53 2011 New Revision: 1170656 URL: http://svn.apache.org/viewvc?rev=1170656view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51794 Fix race condition potentially causing a delay in select operations Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1170656r1=1170655r2=1170656view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Sep 14 14:42:53 2011 @@ -1081,13 +1081,11 @@ public class NioEndpoint extends Abstrac } try { if ( !close ) { -if (wakeupCounter.get()0) { +if (wakeupCounter.getAndSet(-1) 0) { //if we are here, means we have other stuff to do //do a non blocking select keyCount = selector.selectNow(); -}else { -keyCount = selector.keys().size(); -wakeupCounter.set(-1); +} else { keyCount = selector.select(selectorTimeout); } wakeupCounter.set(0); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1170657 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: fhanik Date: Wed Sep 14 14:45:00 2011 New Revision: 1170657 URL: http://svn.apache.org/viewvc?rev=1170657view=rev Log: proposal Modified: tomcat/tc6.0.x/trunk/STATUS.txt Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1170657r1=1170656r2=1170657view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Sep 14 14:45:00 2011 @@ -96,3 +96,10 @@ PATCHES PROPOSED TO BACKPORT: https://issues.apache.org/bugzilla/attachment.cgi?id=27479 +1: kkolinko -1: + + * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51794 + Race condition in NioEndpoint selector + +1: fhanik + -1 + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1170659 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Author: fhanik Date: Wed Sep 14 14:47:24 2011 New Revision: 1170659 URL: http://svn.apache.org/viewvc?rev=1170659view=rev Log: update changelog Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1170659r1=1170658r2=1170659view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Sep 14 14:47:24 2011 @@ -104,6 +104,9 @@ /subsection subsection name=Coyote changelog + fix +bug51794/bug: Fix race condition in NioEndpoint(fhanik) + /fix scode Remove unused and undocumented socketCloseDelay attribute from NIO connector. (markt) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1169796 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
Author: fhanik Date: Mon Sep 12 15:25:13 2011 New Revision: 1169796 URL: http://svn.apache.org/viewvc?rev=1169796view=rev Log: typo in decorator https://issues.apache.org/bugzilla/show_bug.cgi?id=48392 Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java?rev=1169796r1=1169795r2=1169796view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java Mon Sep 12 15:25:13 2011 @@ -127,7 +127,7 @@ public class StatementDecoratorIntercept result = constructor.newInstance(new Object[] { statementProxy }); statementProxy.setActualProxy(result); statementProxy.setConnection(proxy); -statementProxy.setConnection(constructor); +statementProxy.setConstructor(constructor); return result; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1157874 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Mon Aug 15 15:06:35 2011 New Revision: 1157874 URL: http://svn.apache.org/viewvc?rev=1157874view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51583 Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1157874r1=1157873r2=1157874view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Mon Aug 15 15:06:35 2011 @@ -364,7 +364,9 @@ public class ConnectionPool { release(con); else abandon(con); -con = pool.poll(1000, TimeUnit.MILLISECONDS); +if (pool.size()0) { +con = pool.poll(1000, TimeUnit.MILLISECONDS); +} } //while } catch (InterruptedException ex) { Thread.interrupted(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1157884 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Author: fhanik Date: Mon Aug 15 15:19:33 2011 New Revision: 1157884 URL: http://svn.apache.org/viewvc?rev=1157884view=rev Log: update doco for bug fix Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1157884r1=1157883r2=1157884view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Aug 15 15:19:33 2011 @@ -54,6 +54,13 @@ issues to not pop up wrt. others). -- section name=Tomcat 7.0.21 (markt) + subsection name=jdbc-pool +changelog + add +rev1157874/revbug51583/bug: Fix shutdown delay (fhanik) + /add +/changelog + /subsection subsection name=Catalina changelog add - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1157161 - /tomcat/trunk/modules/jdbc-pool/sign.sh
Author: fhanik Date: Fri Aug 12 15:40:01 2011 New Revision: 1157161 URL: http://svn.apache.org/viewvc?rev=1157161view=rev Log: remove file not needed anymore Removed: tomcat/trunk/modules/jdbc-pool/sign.sh - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1144358 - in /tomcat/trunk: modules/jdbc-pool/pom.xml webapps/docs/index.xml
Author: fhanik Date: Fri Jul 8 15:34:18 2011 New Revision: 1144358 URL: http://svn.apache.org/viewvc?rev=1144358view=rev Log: Change eol-style and add link to jdbc-pool on the documentation home page Modified: tomcat/trunk/modules/jdbc-pool/pom.xml (contents, props changed) tomcat/trunk/webapps/docs/index.xml Modified: tomcat/trunk/modules/jdbc-pool/pom.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/pom.xml?rev=1144358r1=1144357r2=1144358view=diff == --- tomcat/trunk/modules/jdbc-pool/pom.xml (original) +++ tomcat/trunk/modules/jdbc-pool/pom.xml Fri Jul 8 15:34:18 2011 @@ -1,140 +1,140 @@ -project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; - modelVersion4.0.0/modelVersion - - parent -groupIdorg.apache/groupId -artifactIdapache/artifactId -version9/version - /parent - - groupIdorg.apache.tomcat/groupId - artifactIdjdbc-pool/artifactId - version1.2-SNAPSHOT/version - packagingjar/packaging - - namejdbc-pool/name - urlhttp://people.apache.org/~fhanik/jdbc-pool//url - - properties -project.build.sourceEncodingUTF-8/project.build.sourceEncoding - /properties - - mailingLists -mailingList - nameDevelopment List/name - subscribedev-subscr...@tomcat.apache.org/subscribe - unsubscribedev-unsubscr...@tomcat.apache.org/unsubscribe - postdev@tomcat.apache.org/post -/mailingList -mailingList - nameUsers List/name - subscribeusers-subscr...@tomcat.apache.org/subscribe - unsubscribeusers-unsubscr...@tomcat.apache.org/unsubscribe - postus...@tomcat.apache.org/post -/mailingList - /mailingLists - - scm - connectionscm:svn:https://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/developerConnection -urlhttp://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/url - /scm - - dependencies -dependency - groupIdorg.apache.tomcat/groupId - artifactIdjuli/artifactId - version6.0.32/version -/dependency -dependency - groupIdjunit/groupId - artifactIdjunit/artifactId - version3.8.1/version - scopetest/scope -/dependency -dependency - groupIdorg.apache.tomcat/groupId - artifactIddbcp/artifactId - version6.0.32/version - scopetest/scope -/dependency -dependency - groupIdcom.h2database/groupId - artifactIdh2/artifactId - version1.3.152/version - scopetest/scope -/dependency - /dependencies - build -plugins - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-compiler-plugin/artifactId -configuration - source1.6/source - target1.6/target - optimizetrue/optimize - debugtrue/debug - showDeprecationtrue/showDeprecation - showWarningstrue/showWarnings -/configuration - /plugin - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-jar-plugin/artifactId -configuration -/configuration - /plugin - - - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-gpg-plugin/artifactId -version1.2/version -executions - execution -idsign-artifacts/id -phaseverify/phase -goals - goalsign/goal -/goals - /execution -/executions - /plugin - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-eclipse-plugin/artifactId -version2.5.1/version -configuration - downloadSourcestrue/downloadSources - downloadJavadocstrue/downloadJavadocs -/configuration - /plugin - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-source-plugin/artifactId -executions - execution -idattach-sources/id -goals - goaljar/goal -/goals - /execution -/executions - /plugin - plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-javadoc-plugin/artifactId -executions - execution -idattach-javadocs/id -goals - goaljar/goal -/goals - /execution -/executions - /plugin -/plugins - /build -/project +project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; + modelVersion4.0.0/modelVersion + + parent
svn commit: r1144061 - in /tomcat/trunk: build.xml modules/jdbc-pool/build.xml res/maven/mvn-pub.xml res/maven/tomcat-jdbc.pom webapps/docs/project.xml
Author: fhanik Date: Thu Jul 7 21:40:05 2011 New Revision: 1144061 URL: http://svn.apache.org/viewvc?rev=1144061view=rev Log: Include jdbc-pool into tomcat release. Added: tomcat/trunk/res/maven/tomcat-jdbc.pom Modified: tomcat/trunk/build.xml tomcat/trunk/modules/jdbc-pool/build.xml tomcat/trunk/res/maven/mvn-pub.xml tomcat/trunk/webapps/docs/project.xml Modified: tomcat/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1144061r1=1144060r2=1144061view=diff == --- tomcat/trunk/build.xml (original) +++ tomcat/trunk/build.xml Thu Jul 7 21:40:05 2011 @@ -69,6 +69,8 @@ property name=test.classes value=${tomcat.output}/testclasses/ property name=test.temp value=${tomcat.output}/test-tmp/ property name=test.apr.loc value=${tomcat.build}/bin/native/ + !-- base directory for jdbc-pool -- + property name=tomcat.jdbc.dir value=${basedir}/modules/jdbc-pool/ !-- Servlet 3.0 spec requires 1.6+ -- property name=compile.source value=1.6/ @@ -128,7 +130,7 @@ property name=tomcat-embed-juli-sources.jar value=${tomcat.embed.sources}/tomcat-embed-logging-juli-src.jar/ property name=tomcat-embed-dbcp-sources.jar value=${tomcat.embed.sources}/tomcat-dbcp-src.jar/ - !-- Extras JARs source JRAs -- + !-- Extras JARs source JARs -- property name=tomcat-juli-extras.jar value=${tomcat.extras}/tomcat-juli.jar/ property name=tomcat-juli-adapters.jar value=${tomcat.extras}/tomcat-juli-adapters.jar/ property name=catalina-ws.jar value=${tomcat.extras}/catalina-ws.jar/ @@ -141,6 +143,11 @@ property name=catalina-jmx-remote-src.jar value=${tomcat.extras.sources}/catalina-jmx-remote-src.jar/ property name=tomcat-embed-log4j-src.jar value=${tomcat.embed.sources}/tomcat-embed-logging-log4j-src.jar/ + !-- jdbc-pool JARs source JARs -- + property name=tomcat-jdbc.jar value=${tomcat.jdbc.dir}/output/tomcat-jdbc.jar/ + property name=tomcat-jdbc-src.jar value=${tomcat.jdbc.dir}/output/tomcat-jdbc-src.jar/ + + !-- Tests To Run -- property name=test.name value=**/Test*.java/ property name=test.formatter value=-Dorg.apache.juli.formatter=java.util.logging.SimpleFormatter/ @@ -501,6 +508,8 @@ /copy /target + + target name=build-manifests unless=manifests.uptodate depends=build-prepare @@ -680,6 +689,12 @@ mkdir dir=${tomcat.build}/webapps/docs/funcspecs / !-- XSL processing -- +copy tofile=webapps/docs/jdbc-pool.xml file=${tomcat.jdbc.dir}/doc/jdbc-pool.xml overwrite=true + !-- jdbc-pool documentation -- + filterset +filter token=TOMCAT_PROJECT_DEST value=project.xml/ + /filterset +/copy xslt basedir=webapps/docs destdir=${tomcat.build}/webapps/docs extension=.html @@ -691,6 +706,8 @@ param name=build-date expression=${today}/ param name=year expression=${year}/ /xslt +!-- remove jdbc-pool documentation -- +delete file=webapps/docs/jdbc-pool.xml/ xslt basedir=webapps/docs/appdev destdir=${tomcat.build}/webapps/docs/appdev extension=.html @@ -840,8 +857,16 @@ failonerror=false/ copy file=${jdt.jar} todir=${tomcat.build}/lib / - /target +!-- build the jdbc-pool jar and source jar-- +echo message=Building Tomcat JDBC pool libraries/ +ant antfile=${tomcat.jdbc.dir}/build.xml dir=${tomcat.jdbc.dir} inheritall=false target=clean-and-build + property name=tomcat.juli.jar value=${tomcat-juli.jar}/property + property name=skip.download value=set/ +/ant +copy file=${tomcat-jdbc.jar} todir=${tomcat.build}/lib overwrite=true/ + /target + target name=examples-sources description=Create examples sources unless=examples.sources.skip taskdef name=txt2html @@ -1517,7 +1542,6 @@ Apache Tomcat ${version} native binaries /classpath /javadoc javadoc packagenames=org.apache.* - sourcepath=${tomcat.dist}/src/java destdir=${tomcat.dist}/webapps/docs/api version=true windowtitle=Apache Tomcat ${version} API Documentation @@ -1538,6 +1562,11 @@ Apache Tomcat ${version} native binaries link href=http://download.oracle.com/javase/6/docs/api// link href=http://commons.apache.org/io/api-release// link href=http://download-llnw.oracle.com/javaee/6/api// + sourcepath +path location=${tomcat.dist}/src/java/ +!--jdbc-pool src files for javadoc-- +path location=${tomcat.dist}/src/modules/jdbc-pool/src/main/java/ + /sourcepath /javadoc /target @@ -1605,7 +1634,18 @@ Apache Tomcat ${version} native binaries exclude name=build.properties/ /fileset /copy - +!--jdbc-pool sources -- +copy todir=${tomcat.dist}/src + fileset dir=${basedir} defaultexcludes=true +include name=modules
svn commit: r1130605 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: DataSource.java DataSourceProxy.java
Author: fhanik Date: Thu Jun 2 15:26:21 2011 New Revision: 1130605 URL: http://svn.apache.org/viewvc?rev=1130605view=rev Log: Correctly cast to the right PooledConnection Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java?rev=1130605r1=1130604r2=1130605view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java Thu Jun 2 15:26:21 2011 @@ -36,7 +36,7 @@ import org.apache.juli.logging.LogFactor * @author Filip Hanik * @version 1.0 */ -public class DataSource extends DataSourceProxy implements javax.sql.DataSource,MBeanRegistration, org.apache.tomcat.jdbc.pool.jmx.ConnectionPoolMBean { +public class DataSource extends DataSourceProxy implements javax.sql.DataSource,MBeanRegistration, org.apache.tomcat.jdbc.pool.jmx.ConnectionPoolMBean, javax.sql.ConnectionPoolDataSource { private static final Log log = LogFactory.getLog(DataSource.class); /** @@ -53,6 +53,10 @@ public class DataSource extends DataSour public DataSource(PoolConfiguration poolProperties) { super(poolProperties); } + + + + //=== // JMX Operations - Register the actual pool itself under the tomcat.jdbc domain Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1130605r1=1130604r2=1130605view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Thu Jun 2 15:26:21 2011 @@ -165,16 +165,16 @@ public class DataSourceProxy implements /** * {@link javax.sql.DataSource#getConnection()} */ -public PooledConnection getPooledConnection() throws SQLException { -return (PooledConnection) getConnection(); +public javax.sql.PooledConnection getPooledConnection() throws SQLException { +return (javax.sql.PooledConnection) getConnection(); } /** * {@link javax.sql.DataSource#getConnection()} */ -public PooledConnection getPooledConnection(String username, +public javax.sql.PooledConnection getPooledConnection(String username, String password) throws SQLException { -return (PooledConnection) getConnection(); +return (javax.sql.PooledConnection) getConnection(); } public ConnectionPool getPool() { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1130636 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Thu Jun 2 16:30:52 2011 New Revision: 1130636 URL: http://svn.apache.org/viewvc?rev=1130636view=rev Log: More detailed information when waiting for a connection has timed out Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1130636r1=1130635r2=1130636view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Jun 2 16:30:52 2011 @@ -627,7 +627,7 @@ public class ConnectionPool { if ((System.currentTimeMillis() - now) = maxWait) { throw new SQLException([ + Thread.currentThread().getName()+] + Timeout: Pool empty. Unable to fetch a connection in + (maxWait / 1000) + - seconds, none available[+busy.size()+ in use].); + seconds, none available[size:+size.get() +; busy:+busy.size()+; idle:+idle.size()+; lastwait:+timetowait+].); } else { //no timeout, lets try again continue; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org