2015-10-15 13:40 GMT+03:00  <fschumac...@apache.org>:
> Author: fschumacher
> Date: Thu Oct 15 10:40:25 2015
> New Revision: 1708780
>
> URL: http://svn.apache.org/viewvc?rev=1708780&view=rev
> Log:
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58489
>
> Comparator should follow the rules. If first object has lastInvocation of 
> zero,
> we should compare it to the second objects lastInvocation and vice versa.
> When we do that, we can use Long#compare just as well.
>
> Merge r1708779 from /tomcat/tc8.0.x/trunk (Merged r1708687 and r1708745 from 
> /tomcat/trunk)
>
> Added:
>     
> tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryComparator.java
>       - copied unchanged from r1708779, 
> tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryComparator.java
> Modified:
>     tomcat/tc7.0.x/trunk/   (props changed)
>     
> tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java


> Modified: 
> tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=1708780&r1=1708779&r2=1708780&view=diff
> ==============================================================================
> --- 
> tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
>  (original)
> +++ 
> tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
>  Thu Oct 15 10:40:25 2015
> @@ -447,17 +447,7 @@ public class SlowQueryReport extends Abs
>
>          @Override
>          public int compare(QueryStats stats1, QueryStats stats2) {
> -            if (stats1.lastInvocation == 0) return 1;
> -            if (stats2.lastInvocation == 0) return -1;
> -
> -            long result = stats1.lastInvocation - stats2.lastInvocation;
> -            if (result > 0) {
> -                return 1;
> -            } else if (result == 0) {
> -                return 0;
> -            } else {
> -                return -1;
> -            }
> +            return Long.compare(stats1.lastInvocation, 
> stats2.lastInvocation);
>          }
>      }


Tomcat 7 (minus websocket APIs) must be built with Java 6.

The above Long.compare() method is @since 1.7.

https://ci.apache.org/builders/tomcat-7-trunk/builds/99


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to