directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r422906 - in /directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec: ./ bind/
Date Mon, 17 Jul 2006 22:33:12 GMT
Author: elecharny
Date: Mon Jul 17 15:33:12 2006
New Revision: 422906

URL: http://svn.apache.org/viewvc?rev=422906&view=rev
Log:
- Created a static final boolean IS_DEBUG which is initialized with the 
logger when the class is loaded : this will be evaluated only once, so
we will avoid a lot of isDebugEnabled() calls.

Modified:
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapControlGrammar.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResultGrammar.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapControlGrammar.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapControlGrammar.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapControlGrammar.java
Mon Jul 17 15:33:12 2006
@@ -51,6 +51,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( LdapControlGrammar.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** The instance of grammar. LdapControlGrammar is a singleton */
     private static IGrammar instance = new LdapControlGrammar();
 
@@ -208,7 +211,7 @@
                     // We can have an END transition
                     ldapMessageContainer.grammarEndAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "Control OID : " + control.getControlType() );
                     }
@@ -267,7 +270,7 @@
                     // We can have an END transition
                     ldapMessageContainer.grammarEndAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "Control criticality : " + control.getCriticality() );
                     }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Mon Jul 17 15:33:12 2006
@@ -48,6 +48,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( LdapMessageGrammar.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** The instance of grammar. LdapMessageGrammar is a singleton */
     private static IGrammar instance = new LdapMessageGrammar();
 
@@ -147,7 +150,7 @@
 
                         ldapMessage.setMessageId( messageId );
 
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "Ldap Message Id has been decoded : " + messageId
);
                         }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResultGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResultGrammar.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResultGrammar.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResultGrammar.java
Mon Jul 17 15:33:12 2006
@@ -59,6 +59,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( LdapResultGrammar.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** The instance of grammar. LdapResultGrammar is a singleton */
     private static IGrammar instance = new LdapResultGrammar();
 
@@ -220,7 +223,7 @@
                             ldapResult.setResultCode( LdapResultEnum.OTHER );
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The result code is set to " + LdapResultEnum.errorCode(
resultCode ) );
                     }
@@ -288,7 +291,7 @@
                         }
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The matchedDN is " + ldapResult.getMatchedDN() );
                     }
@@ -349,7 +352,7 @@
                     // We can pop this grammar
                     container.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The error message is : " + ldapResult.getErrorMessage()
);
                     }
@@ -455,7 +458,7 @@
                     // We can have a Pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         Iterator urls = ldapResult.getReferrals().iterator();
 

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
Mon Jul 17 15:33:12 2006
@@ -42,6 +42,9 @@
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( TwixDecoder.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     /** The associated Provider */
     private final Provider provider;
 
@@ -102,7 +105,7 @@
             {
                 ldapDecoder.decode( buf, ldapMessageContainer );
     
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "Decoding the PDU : " );
     
@@ -123,7 +126,7 @@
                 
                 if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
                         buf.mark();
@@ -134,7 +137,7 @@
                 }
                 else
                 {
-                	if ( log.isDebugEnabled() )
+                	if ( IS_DEBUG )
                 	{
                 		
                 	}
@@ -205,7 +208,7 @@
 
             if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
             {
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
                 }
@@ -244,7 +247,7 @@
 
             if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
             {
-                if ( log.isDebugEnabled() )
+                if ( IS_DEBUG )
                 {
                     log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
                 }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
Mon Jul 17 15:33:12 2006
@@ -46,6 +46,9 @@
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( TwixEncoder.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** The associated Provider */
     private final Provider provider;
 
@@ -82,7 +85,7 @@
     {
         try
         {
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Encoding this LdapMessage : " + obj );
             }
@@ -113,14 +116,14 @@
     {
         try
         {
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Encoding this LdapMessage : " + obj );
             }
 
             ByteBuffer pdu = ( ( LdapMessage ) obj ).encode( null );
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Encoded PDU : " + StringTools.dumpBytes( pdu.array() ) );
             }
@@ -152,14 +155,14 @@
     {
         try
         {
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Encoding this LdapMessage : " + obj );
             }
 
             byte[] pdu = ( ( LdapMessage ) obj ).encode( null ).array();
 
-            if ( log.isDebugEnabled() )
+            if ( IS_DEBUG )
             {
                 log.debug( "Encoded PDU : " + StringTools.dumpBytes( pdu ) );
             }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Mon Jul 17 15:33:12 2006
@@ -121,6 +121,9 @@
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( TwixTransformer.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** the provider this transformer is part of */
     private final Provider provider;
 
@@ -658,7 +661,7 @@
         LdapMessage twixMessage = ( LdapMessage ) obj;
         int messageId = twixMessage.getMessageId();
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Transforming LdapMessage <" + messageId + ", " + twixMessage.getMessageTypeName()
                 + "> from Twix to Snickers." );
@@ -1134,7 +1137,7 @@
      */
     public Object transform( Message msg )
     {
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Transforming message type " + msg.getType() );
         }
@@ -1190,7 +1193,7 @@
             transformControls( twixMessage, msg );
         }
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Transformed message : " + twixMessage );
         }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
Mon Jul 17 15:33:12 2006
@@ -58,6 +58,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( BindRequestGrammar.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     /** The instance of grammar. BindRequestGrammar is a singleton */
     private static IGrammar instance = new BindRequestGrammar();
 
@@ -163,7 +166,7 @@
                             throw new DecoderException( "Ldap Version " + version + " is
not supported" );
                         }
 
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "Ldap version ", new Integer( version ) );
                         }
@@ -228,7 +231,7 @@
                         bindRequestMessage.setName( name );
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( " The Bind name is {}", bindRequestMessage.getName() );
                     }
@@ -291,7 +294,7 @@
                     // We can have an pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The simple authentication is : {}", authentication.getSimple()
);
                     }
@@ -356,7 +359,10 @@
 
                     bindRequestMessage.setAuthentication( authentication );
 
-                    log.debug( "The SaslCredential has been created" );
+                    if ( IS_DEBUG ) 
+                    {
+                        log.debug( "The SaslCredential has been created" );
+                    }
 
                     return;
                 }
@@ -422,7 +428,7 @@
                     // We can have an Pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The mechanism is : {}", authentication.getMechanism()
);
                     }
@@ -499,7 +505,7 @@
                     // We can have an Pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The credentials are : {}", credentials.getCredentials()
);
                     }

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java?rev=422906&r1=422905&r2=422906&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java
Mon Jul 17 15:33:12 2006
@@ -37,6 +37,9 @@
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( SimpleAuthentication.class );
 
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    
     // ~ Instance fields
     // ----------------------------------------------------------------------------
 
@@ -81,7 +84,7 @@
 
         length += Length.getNbBytes( simple.length ) + simple.length;
 
-        if ( log.isDebugEnabled() )
+        if ( IS_DEBUG )
         {
             log.debug( "Simple Authentication length : {}", new Integer( length ) );
         }



Mime
View raw message