diff --git a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java index 22062cb7f1..b17dfbdade 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java @@ -447,12 +447,32 @@ public class PluginStarter implements Runnable { // run this guy now LoadClientAppsJob.runClient(app.className, app.clientName, argVal, log, pluginThreadGroup, cl); } else { - // quick check, will throw ClassNotFoundException on error - LoadClientAppsJob.testClient(app.className, cl); - // wait before firing it up - Job job = new LoadClientAppsJob.DelayedRunClient(ctx, app.className, app.clientName, argVal, app.delay, pluginThreadGroup, cl); - ctx.jobQueue().addJob(job); - pluginJobs.get(pluginName).add(job); + // If there is some delay, there may be a really good reason for it. + // Loading a class would be one of them! + // So we do a quick check first, If it bombs out, we delay and try again. + // If it bombs after that, then we throw the ClassNotFoundException. + try { + // quick check + LoadClientAppsJob.testClient(app.className, cl); + } catch(ClassNotFoundException ex) { + // Try again 1 or 2 seconds later. + // This should be enough time. Although it is a lousy hack + // it should work for most cases. + // Perhaps it may be even better to delay a percentage + // if > 1, and reduce the delay time. + // Under normal circumstances there will be no delay at all. + if(app.delay > 1) { + Thread.sleep(2000); + } else { + Thread.sleep(1000); + } + } + // quick check, will throw ClassNotFoundException on error + LoadClientAppsJob.testClient(app.className, cl); + // wait before firing it up + Job job = new LoadClientAppsJob.DelayedRunClient(ctx, app.className, app.clientName, argVal, app.delay, pluginThreadGroup, cl); + ctx.jobQueue().addJob(job); + pluginJobs.get(pluginName).add(job); } } } diff --git a/history.txt b/history.txt index 15fca9fff4..6a954bc34a 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,9 @@ +2010-05-10 sponge + * PluginStarter: If there is some delay, there may be a really good reason for it. + Loading a class would be one of them! + So we do a quick check first, If it bombs out, we delay and try again. + If it bombs after that, then we throw the ClassNotFoundException. + 2010-05-05 zzz * build.xml: Create packed sud in release * Console: diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 0725033fa6..f6e6df3a5c 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 3; + public final static long BUILD = 4; /** for example "-test" */ public final static String EXTRA = "";