Author: kkolinko Date: Fri Mar 22 19:45:06 2013 New Revision: 1459952 URL: http://svn.apache.org/r1459952 Log: Merged revision 1432517 from tomcat/trunk: Fix threading issue reported by FindBugs - in a test class in jdbc-pool
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1432517 Modified: tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java?rev=1459952&r1=1459951&r2=1459952&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java (original) +++ tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java Fri Mar 22 19:45:06 2013 @@ -23,6 +23,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import javax.management.AttributeChangeNotification; import javax.management.Notification; @@ -122,7 +123,7 @@ public class TestSlowQueryReport extends st.close(); } System.out.println("Stats:"+stats); - assertEquals("Expecting to have received "+(2*count)+" notifications.",2*count, listener.notificationCount); + assertEquals("Expecting to have received "+(2*count)+" notifications.",2*count, listener.notificationCount.get()); con.close(); tearDown(); //make sure we actually did clean up when the pool closed @@ -184,11 +185,11 @@ public class TestSlowQueryReport extends public class ClientListener implements NotificationListener { - volatile int notificationCount = 0; + AtomicInteger notificationCount = new AtomicInteger(0); @Override public void handleNotification(Notification notification, Object handback) { - notificationCount++; + notificationCount.incrementAndGet(); System.out.println("\nReceived notification:"); System.out.println("\tClassName: " + notification.getClass().getName()); System.out.println("\tSource: " + notification.getSource()); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org