Make some expensive debug logging conditional 60/38160/2
authorLorand Jakab <lojakab@cisco.com>
Wed, 27 Apr 2016 16:06:58 +0000 (19:06 +0300)
committerLorand Jakab <lojakab@cisco.com>
Wed, 27 Apr 2016 16:36:13 +0000 (19:36 +0300)
Change-Id: Id6462b06e3299bf624a970e7a0524b05120b26dd
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingSystem.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/DataStoreBackEnd.java

index 60e03c4d8348cb2d750b409ef176b3de8a0d6b67..e53d9a0150a84a3c8c6f5734643895b530053b56 100644 (file)
@@ -133,8 +133,10 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
     }
 
     public MapReply handleMapRequest(MapRequest request) {
-        LOG.debug("DAO: Retrieving mapping for {}",
-                LispAddressStringifier.getString(request.getEidItem().get(0).getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("DAO: Retrieving mapping for {}",
+                    LispAddressStringifier.getString(request.getEidItem().get(0).getEid()));
+        }
 
         tlsMapReply.set(null);
         tlsMapRequest.set(null);
@@ -152,9 +154,11 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
     }
 
     public Pair<MapNotify, List<TransportAddress>> handleMapRegister(MapRegister mapRegister) {
-        LOG.debug("DAO: Adding mapping for {}",
-                LispAddressStringifier.getString(mapRegister.getMappingRecordItem().get(0)
-                        .getMappingRecord().getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("DAO: Adding mapping for {}",
+                    LispAddressStringifier.getString(mapRegister.getMappingRecordItem().get(0)
+                            .getMappingRecord().getEid()));
+        }
 
         tlsMapNotify.set(null);
         mapServer.handleMapRegister(mapRegister);
@@ -252,10 +256,12 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
 
     @Override
     public void handleSMR(MapRequest smr, Rloc subscriber) {
-        LOG.debug("Sending SMR to {} with Source-EID {} and EID Record {}",
-                LispAddressStringifier.getString(subscriber),
-                LispAddressStringifier.getString(smr.getSourceEid().getEid()),
-                LispAddressStringifier.getString(smr.getEidItem().get(0).getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Sending SMR to {} with Source-EID {} and EID Record {}",
+                    LispAddressStringifier.getString(subscriber),
+                    LispAddressStringifier.getString(smr.getSourceEid().getEid()),
+                    LispAddressStringifier.getString(smr.getEidItem().get(0).getEid()));
+        }
         SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder();
         smrib.setMapRequest(new MapRequestBuilder(smr).build());
         smrib.setTransportAddress(LispNotificationHelper.getTransportAddressFromRloc(subscriber));
index 25bc4832072d2e2b18dad333d30ad44f97c8f9b4..9045b9e906589bde88895c6dc97d022e2008b5cb 100644 (file)
@@ -246,32 +246,42 @@ public class MappingSystem implements IMappingSystem {
 
     @Override
     public MappingAuthkey getAuthenticationKey(Eid key) {
-        LOG.debug("Retrieving authentication key for {}", LispAddressStringifier.getString(key));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Retrieving authentication key for {}", LispAddressStringifier.getString(key));
+        }
         return smc.getAuthenticationKey(key);
     }
 
     @Override
     public void removeAuthenticationKey(Eid key) {
-        LOG.debug("Removing authentication key for {}", LispAddressStringifier.getString(key));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Removing authentication key for {}", LispAddressStringifier.getString(key));
+        }
         smc.removeAuthenticationKey(key);
     }
 
     @Override
     public void addData(MappingOrigin origin, Eid key, String subKey, Object data) {
-        LOG.debug("Add data of class {} for key {} and subkey {}", data.getClass(),
-                LispAddressStringifier.getString(key), subKey);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Add data of class {} for key {} and subkey {}", data.getClass(),
+                    LispAddressStringifier.getString(key), subKey);
+        }
         tableMap.get(origin).addData(key, subKey, data);
     }
 
     @Override
     public Object getData(MappingOrigin origin, Eid key, String subKey) {
-        LOG.debug("Retrieving data for key {} and subkey {}", LispAddressStringifier.getString(key), subKey);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Retrieving data for key {} and subkey {}", LispAddressStringifier.getString(key), subKey);
+        }
         return tableMap.get(origin).getData(key, subKey);
     }
 
     @Override
     public void removeData(MappingOrigin origin, Eid key, String subKey) {
-        LOG.debug("Removing data for key {} and subkey {}", LispAddressStringifier.getString(key), subKey);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Removing data for key {} and subkey {}", LispAddressStringifier.getString(key), subKey);
+        }
         tableMap.get(origin).removeData(key, subKey);
     }
 
index 1d02eb7e6e38da3deb6d94c7270609d893e2f75b..aee385ac0423981bdaae8adb261256190434a68e 100644 (file)
@@ -55,8 +55,11 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void addAuthenticationKey(AuthenticationKey authenticationKey) {
-        LOG.debug("MD-SAL: Adding authentication key '{}' for {}", authenticationKey.getMappingAuthkey().getKeyString(),
-                LispAddressStringifier.getString(authenticationKey.getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Adding authentication key '{}' for {}",
+                    authenticationKey.getMappingAuthkey().getKeyString(),
+                    LispAddressStringifier.getString(authenticationKey.getEid()));
+        }
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
                 .createAuthenticationKeyIid(authenticationKey.getEid());
@@ -65,8 +68,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void addMapping(Mapping mapping) {
-        LOG.debug("MD-SAL: Adding mapping for {}",
-                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Adding mapping for {}",
+                    LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        }
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
                 .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());
@@ -79,8 +84,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
         XtrId xtrId = mapping.getMappingRecord().getXtrId();
         Preconditions.checkNotNull(xtrId, "Make sure you only call addXtrIdMapping when the MappingRecord "
                 + "contains an xTR-ID");
-        LOG.debug("MD-SAL: Adding mapping for {}, xTR-ID {}",
-                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()), xtrId);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Adding mapping for {}, xTR-ID {}",
+                    LispAddressStringifier.getString(mapping.getMappingRecord().getEid()), xtrId);
+        }
 
         InstanceIdentifier<XtrIdMapping> path = InstanceIdentifierUtil
                 .createXtrIdMappingIid(mapping.getMappingRecord().getEid(), MappingOrigin.Southbound, xtrId);
@@ -89,8 +96,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void removeAuthenticationKey(AuthenticationKey authenticationKey) {
-        LOG.debug("MD-SAL: Removing authentication key for {}",
-                LispAddressStringifier.getString(authenticationKey.getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Removing authentication key for {}",
+                    LispAddressStringifier.getString(authenticationKey.getEid()));
+        }
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
                 .createAuthenticationKeyIid(authenticationKey.getEid());
@@ -99,8 +108,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void removeMapping(Mapping mapping) {
-        LOG.debug("MD-SAL: Removing mapping for {}",
-                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Removing mapping for {}",
+                    LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        }
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
                 .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());
@@ -111,8 +122,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
         XtrId xtrId = mapping.getMappingRecord().getXtrId();
         Preconditions.checkNotNull(xtrId, "Make sure you only call addXtrIdMapping when the MappingRecord "
                 + "contains an xTR-ID");
-        LOG.debug("MD-SAL: Removing mapping for {}, xTR-ID {}",
-                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()), xtrId);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Removing mapping for {}, xTR-ID {}",
+                    LispAddressStringifier.getString(mapping.getMappingRecord().getEid()), xtrId);
+        }
 
         InstanceIdentifier<XtrIdMapping> path = InstanceIdentifierUtil
                 .createXtrIdMappingIid(mapping.getMappingRecord().getEid(), MappingOrigin.Southbound, xtrId);
@@ -137,9 +150,11 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void updateAuthenticationKey(AuthenticationKey authenticationKey) {
-        LOG.debug("MD-SAL: Updating authentication key for {} with '{}'",
-                LispAddressStringifier.getString(authenticationKey.getEid()),
-                authenticationKey.getMappingAuthkey().getKeyString());
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Updating authentication key for {} with '{}'",
+                    LispAddressStringifier.getString(authenticationKey.getEid()),
+                    authenticationKey.getMappingAuthkey().getKeyString());
+        }
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
                 .createAuthenticationKeyIid(authenticationKey.getEid());
@@ -148,8 +163,10 @@ public class DataStoreBackEnd implements TransactionChainListener {
     }
 
     public void updateMapping(Mapping mapping) {
-        LOG.debug("MD-SAL: Updating mapping for {}",
-                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MD-SAL: Updating mapping for {}",
+                    LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
+        }
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
                 .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());