directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r424716 - /directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
Date Sun, 23 Jul 2006 11:30:17 GMT
Author: elecharny
Date: Sun Jul 23 04:30:17 2006
New Revision: 424716

URL: http://svn.apache.org/viewvc?rev=424716&view=rev
Log:
Replaced the direct call to isDebugEnabled() by a check on a 
static boolean IS_DEBUG, because it's faster.

Modified:
    directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java

Modified: directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=424716&r1=424715&r2=424716&view=diff
==============================================================================
--- directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
(original)
+++ directory/branches/shared/optimization/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
Sun Jul 23 04:30:17 2006
@@ -44,6 +44,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( AbstractGrammar.class );
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     // ~ Instance fields
     // ----------------------------------------------------------------------------
 
@@ -114,7 +117,7 @@
 
         int tlvLength = tlv.getSize();
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Expected Length = " + ( ( Asn1Object ) object ).getExpectedLength()
+ ", current length = "
                 + ( ( Asn1Object ) object ).getCurrentLength() + ", added length = " + expectedLength
@@ -203,7 +206,7 @@
 
                     if ( container.isGrammarPopAllowed() )
                     {
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "Pop grammar {}, state = {}", container.getStates().getGrammarName(
                                 currentGrammar ), currentGrammar.getStatesEnum().getState(
@@ -226,7 +229,7 @@
                 }
             }
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( transition.toString( container.getCurrentGrammarType(), currentGrammar.getStatesEnum()
) );
             }
@@ -241,7 +244,7 @@
                     transition.getAction().action( container );
                 }
 
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "Switching from grammar {} to grammar {}", container.getStates().getGrammarName(
                         currentGrammar ), container.getStates().getGrammarName( ( nextState
>> 8 ) - 1 ) );



Mime
View raw message