directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1385033 - /directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
Date Sat, 15 Sep 2012 09:12:40 GMT
Author: elecharny
Date: Sat Sep 15 09:12:40 2012
New Revision: 1385033

URL: http://svn.apache.org/viewvc?rev=1385033&view=rev
Log:
Small speedup : used a static field for the logs as we won't often need to log the calls to
UUIDComparator (which is called zillions of times)

Modified:
    directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java

Modified: directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java?rev=1385033&r1=1385032&r2=1385033&view=diff
==============================================================================
--- directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
(original)
+++ directory/shared/branches/shared-mvbt/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/UuidComparator.java
Sat Sep 15 09:12:40 2012
@@ -38,6 +38,7 @@ public class UuidComparator extends Seri
 
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( UuidComparator.class );
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     public static UuidComparator INSTANCE = new UuidComparator( "1.3.6.1.1.16.4" );
 
@@ -57,7 +58,10 @@ public class UuidComparator extends Seri
      */
     public int compare( String uuid1, String uuid2 )
     {
-        LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
+        }
 
         // -------------------------------------------------------------------
         // Handle some basis cases
@@ -81,7 +85,10 @@ public class UuidComparator extends Seri
      */
     public int compare( UUID uuid1, UUID uuid2 )
     {
-        LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "comparing UUID objects '{}' with '{}'", uuid1, uuid2 );
+        }
 
         // -------------------------------------------------------------------
         // Handle some basis cases



Mime
View raw message