r26738 - trunk/freenet/src/freenet/pluginmanager

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-11 17:45:33 +0000 (Sat, 11 Apr 2009)
New Revision: 26738

Modified:
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
Separate lock for final stage of plugin loading


Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2009-04-11 17:42:57 UTC (rev 26737)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2009-04-11 17:45:33 UTC (rev 26738)
@@ -733,6 +733,11 @@
 		return false;
 	}
 
+	/** Separate lock for plugin loading. Don't use (this) as we also use that for
+	 * writing the config file, and because we do a lot inside the lock below; it
+	 * must not be taken in any other circumstance. */
+	private final Object pluginLoadSyncObject = new Object();
+	
 	/**
 	 * Tries to load a plugin from the given name. If the name only contains the
 	 * name of a plugin it is loaded from the plugin directory, if found,
@@ -822,8 +827,8 @@
 				}
 		}
 		
-		// synchronized(this), not (pluginwrappers)
-		synchronized (this) {
+		// we do quite a lot inside the lock, use a dedicated one
+		synchronized (pluginLoadSyncObject) {
 			if(this.isPluginLoaded(filename)) {
 				Logger.error(this, "Plugin already loaded: "+filename);
 				return null;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.