geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [32/51] [abbrv] geronimo-yoko git commit: Guard slow logging
Date Sun, 19 Feb 2017 01:49:49 GMT
Guard slow logging


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/760b9dd2
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/760b9dd2
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/760b9dd2

Branch: refs/heads/master
Commit: 760b9dd2034e50df15fbbc567af8395e28c4373c
Parents: 9ca4094
Author: David Jencks <djencks@apache.org>
Authored: Tue May 10 13:35:52 2016 -0700
Committer: David Jencks <djencks@apache.org>
Committed: Tue May 10 13:35:52 2016 -0700

----------------------------------------------------------------------
 .../apache/yoko/osgi/locator/ProviderBean.java   |  4 +++-
 .../yoko/osgi/locator/ProviderRegistryImpl.java  | 19 ++++++++++---------
 .../apache/yoko/osgi/locator/ServiceBean.java    |  4 +++-
 3 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/760b9dd2/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
----------------------------------------------------------------------
diff --git a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
index 688ff61..8a8d452 100644
--- a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
+++ b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
@@ -20,6 +20,7 @@
 
 package org.apache.yoko.osgi.locator;
 
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.osgi.framework.Bundle;
@@ -47,7 +48,8 @@ public class ProviderBean {
                         Register providerRegistry,
                         Integer priority) {
         bundleProviderLoader = new BundleProviderLoader(key, className, bundle, priority
== null? -1: priority);
-        log.finer("ProviderBean: " + bundleProviderLoader);
+        if (log.isLoggable(Level.FINER))
+            log.finer("ProviderBean: " + bundleProviderLoader);
         this.providerRegistry = providerRegistry;
     }
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/760b9dd2/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
----------------------------------------------------------------------
diff --git a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
index 31dfa31..28fa885 100644
--- a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
+++ b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
@@ -55,7 +55,8 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
      * @param provider The loader used to resolve the provider class.
      */
     public void registerProvider(BundleProviderLoader provider) {
-        log(Level.FINE, "registering provider " + provider);
+        if (log.isLoggable(Level.FINE))
+            log.log(Level.FINE, "registering provider " + provider);
         providers.register(provider);
     }
 
@@ -65,7 +66,8 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
      * @param provider The provider registration instance
      */
     public void unregisterProvider(BundleProviderLoader provider) {
-        log(Level.FINE, "unregistering provider " + provider);
+        if (log.isLoggable(Level.FINE))
+            log.log(Level.FINE, "unregistering provider " + provider);
         providers.unregister(provider);
     }
 
@@ -76,7 +78,8 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
      * @param provider The loader used to resolve the provider class.
      */
     public void registerService(BundleProviderLoader provider) {
-        log(Level.FINE, "registering service " + provider);
+        if (log.isLoggable(Level.FINE))
+            log.log(Level.FINE, "registering service " + provider);
         serviceProviders.register(provider);
     }
 
@@ -86,7 +89,8 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
      * @param provider The provider registration instance
      */
     public void unregisterService(BundleProviderLoader provider) {
-        log(Level.FINE, "unregistering service " + provider);
+        if (log.isLoggable(Level.FINE))
+            log.log(Level.FINE, "unregistering service " + provider);
         serviceProviders.unregister(provider);
     }
 
@@ -242,10 +246,6 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
         return null;
     }
 
-    private void log(Level level, String message) {
-        log.log(level, message);
-    }
-
     /**
      * Holder class for information about a given collection of
      * id to provider mappings.  Used for both the providers and
@@ -298,7 +298,8 @@ public class ProviderRegistryImpl implements ProviderRegistry, Register
{
         private synchronized BundleProviderLoader getLoader(String id) {
             // synchronize on the registry instance
             if (registry != null) {
-                log.fine("registry: " + registry);
+                if (log.isLoggable(Level.FINE))
+                    log.fine("registry: " + registry);
                 // return the first match, if any
                 List<BundleProviderLoader> list = registry.get(id);
                 if (list != null && !list.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/760b9dd2/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
----------------------------------------------------------------------
diff --git a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
index 7876495..b42f3fe 100644
--- a/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
+++ b/yoko-osgi/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
@@ -20,6 +20,7 @@
 
 package org.apache.yoko.osgi.locator;
 
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.osgi.framework.Bundle;
@@ -47,7 +48,8 @@ public class ServiceBean {
                        Register providerRegistry,
                        Integer priority) {
         bundleProviderLoader = new BundleProviderLoader(key, className, bundle, priority
== null? -1: priority);
-        log.finer("ServiceBean: " + bundleProviderLoader);
+        if (log.isLoggable(Level.FINER))
+            log.finer("ServiceBean: " + bundleProviderLoader);
         this.providerRegistry = providerRegistry;
     }
 


Mime
View raw message