directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r278638 - /directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java
Date Sun, 04 Sep 2005 22:39:12 GMT
Author: elecharny
Date: Sun Sep  4 15:39:08 2005
New Revision: 278638

URL: http://svn.apache.org/viewcvs?rev=278638&view=rev
Log:
Add a static DEBUG which is initialized in the constructor, to speed up the logging.

Modified:
    directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java

Modified: directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java?rev=278638&r1=278637&r2=278638&view=diff
==============================================================================
--- directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java
(original)
+++ directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/ber/grammar/AbstractGrammar.java
Sun Sep  4 15:39:08 2005
@@ -40,6 +40,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( AbstractGrammar.class );
 
+    /** A speedup for logs */
+    private static boolean DEBUG;
+
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** Table of transitions. It's a two dimension array, the first dimension
@@ -51,6 +54,11 @@
 
     /** The grammar's states */
     protected IStates statesEnum;
+    
+    public AbstractGrammar()
+    {
+    	DEBUG = log.isDebugEnabled();
+    }
 
     //~ Methods ------------------------------------------------------------------------------------
 
@@ -92,7 +100,7 @@
 
         int tlvLength      = tlv.getSize();
 
-        if ( log.isDebugEnabled() )
+        if ( DEBUG )
         {
             log.debug(
                 "Expected Length = " + ( ( Asn1Object ) object ).getExpectedLength() +
@@ -176,7 +184,7 @@
                 }
             }
 
-            if ( log.isDebugEnabled() )
+            if ( DEBUG )
             {
                 log.debug( transition.toString( container.getCurrentGrammarType(),
                         currentGrammar.getStatesEnum() ) );
@@ -188,7 +196,7 @@
                     ( nextState != IStates.END_STATE ) )
             {
 
-                if ( log.isDebugEnabled() )
+                if ( DEBUG )
                 {
                     log.debug(
                         "Switching from grammar " +



Mime
View raw message