Author: nextgens
Date: 2008-08-31 21:48:41 +0000 (Sun, 31 Aug 2008)
New Revision: 22289
Modified:
trunk/freenet/src/freenet/support/Logger.java
trunk/freenet/src/freenet/support/LoggerHook.java
Log:
Logger: reduce logging on Logger.shouldLog(); it was INSANE... and it still is.
Modified: trunk/freenet/src/freenet/support/Logger.java
===================================================================
--- trunk/freenet/src/freenet/support/Logger.java 2008-08-31 21:19:44 UTC
(rev 22288)
+++ trunk/freenet/src/freenet/support/Logger.java 2008-08-31 21:48:41 UTC
(rev 22289)
@@ -350,7 +350,7 @@
public abstract boolean instanceShouldLog(int priority, Class c);
- public synchronized static boolean shouldLog(int priority, Class c) {
+ public static boolean shouldLog(int priority, Class c) {
return logger.instanceShouldLog(priority, c);
}
Modified: trunk/freenet/src/freenet/support/LoggerHook.java
===================================================================
--- trunk/freenet/src/freenet/support/LoggerHook.java 2008-08-31 21:19:44 UTC
(rev 22288)
+++ trunk/freenet/src/freenet/support/LoggerHook.java 2008-08-31 21:48:41 UTC
(rev 22289)
@@ -134,11 +134,16 @@
}
DetailedThreshold[] newThresholds = new
DetailedThreshold[stuff.size()];
stuff.toArray(newThresholds);
- detailedThresholds = newThresholds;
+ synchronized(this) {
+ detailedThresholds = newThresholds;
+ }
}
public String getDetailedThresholds() {
- DetailedThreshold[] thresh = detailedThresholds;
+ DetailedThreshold[] thresh = null;
+ synchronized(this) {
+ thresh = detailedThresholds;
+ }
StringBuilder sb = new StringBuilder();
for(int i=0;i<thresh.length;i++) {
if(i != 0)
@@ -198,10 +203,11 @@
int thresh = threshold;
if ((c != null) && (detailedThresholds.length != 0)) {
String cname = c.getName();
- for (int i = 0; i < detailedThresholds.length; i++) {
- DetailedThreshold dt = detailedThresholds[i];
- if (cname.startsWith(dt.section)) {
- thresh = dt.dThreshold;
+ synchronized(this) {
+ for(int i = 0; i < detailedThresholds.length;
i++) {
+ DetailedThreshold dt =
detailedThresholds[i];
+ if(cname.startsWith(dt.section))
+ thresh = dt.dThreshold;
}
}
}