harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r1001741 - /harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java
Date Mon, 27 Sep 2010 13:47:57 GMT
Author: tellison
Date: Mon Sep 27 13:47:57 2010
New Revision: 1001741

URL: http://svn.apache.org/viewvc?rev=1001741&view=rev
Log:
Move invariants out of loop to make selecting child loggers more efficient.

Modified:
    harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java

Modified: harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java?rev=1001741&r1=1001740&r2=1001741&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/logging/src/main/java/java/util/logging/LogManager.java
Mon Sep 27 13:47:57 2010
@@ -323,11 +323,12 @@ public class LogManager {
         // find children
         // TODO: performance can be improved here?
         Collection<Logger> allLoggers = loggers.values();
+        boolean emptyName = name.length() == 0;
+        String namePrefix = name + '.';
         for (final Logger child : allLoggers) {
             Logger oldParent = child.getParent();
             if (parent == oldParent
-                    && (name.length() == 0 || child.getName().startsWith(
-                            name + '.'))) {
+                    && (emptyName || child.getName().startsWith(namePrefix))) {
                 final Logger thisLogger = logger;
                 AccessController.doPrivileged(new PrivilegedAction<Object>() {
                     public Object run() {



Mime
View raw message