Author: nextgens Date: 2006-06-17 18:26:31 +0000 (Sat, 17 Jun 2006) New Revision: 9270
Modified: trunk/freenet/src/freenet/node/updater/UpdaterEnabledCallback.java Log: see http://archives.freenetproject.org/message/20060617.142700.11fc2b27.en.html fixes a potential threadloss on the auto-updater Modified: trunk/freenet/src/freenet/node/updater/UpdaterEnabledCallback.java =================================================================== --- trunk/freenet/src/freenet/node/updater/UpdaterEnabledCallback.java 2006-06-17 17:04:40 UTC (rev 9269) +++ trunk/freenet/src/freenet/node/updater/UpdaterEnabledCallback.java 2006-06-17 18:26:31 UTC (rev 9270) @@ -26,19 +26,21 @@ } public void set(boolean val) throws InvalidConfigValueException { - if(val == get()) return; - if(val){ - try{ - SubConfig sc = nodeConfig.get("node.updater"); - node.nodeUpdater = new NodeUpdater(node , sc.getBoolean("autoupdate"), new FreenetURI(sc.getString("URI")), new FreenetURI(sc.getString("revocationURI"))); - Logger.normal(this, "Starting up the node updater"); - }catch (Exception e){ - Logger.error(this, "unable to start the node updater up "+e); - throw new InvalidConfigValueException("Unable to enable the Node Updater "+e); + synchronized (node.nodeUpdater) { + if(val == get()) return; + if(val){ + try{ + SubConfig sc = nodeConfig.get("node.updater"); + node.nodeUpdater = new NodeUpdater(node , sc.getBoolean("autoupdate"), new FreenetURI(sc.getString("URI")), new FreenetURI(sc.getString("revocationURI"))); + Logger.normal(this, "Starting up the node updater"); + }catch (Exception e){ + Logger.error(this, "unable to start the node updater up "+e); + throw new InvalidConfigValueException("Unable to enable the Node Updater "+e); + } + }else{ + node.nodeUpdater.kill(); + Logger.normal(this, "Shutting down the node updater"); } - }else{ - node.nodeUpdater.kill(); - Logger.normal(this, "Shutting down the node updater"); } } } \ No newline at end of file
