[freenet-dev] [freenet-cvs] r11936 - trunk/freenet/src/freenet/config

Florent Daignière (NextGen$) nextgens at freenetproject.org
Thu Mar 1 12:48:44 UTC 2007


* Dave Baker <dbkr at freenetproject.org> [2007-03-01 09:24:25]:

> On Wednesday 28 February 2007 22:51:25 nextgens at freenetproject.org wrote:
> > Author: nextgens
> > Date: 2007-02-28 22:51:25 +0000 (Wed, 28 Feb 2007)
> > New Revision: 11936
> >
> > Modified:
> >    trunk/freenet/src/freenet/config/PersistentConfig.java
> > Log:
> > Doh!
> 
> Hang on - could somebody explain what's going on with these three commits? As 
> I see it, we start by catching an exception that's only caused by class 
> changes and lack of a rebuild from clean (and by looking at the code it looks 
> like it would wipe the config file).

Indeed :  not a real problem.

> Then after that, it gets 'fixed', but rather than jnust reverting the commit, we
> iterate a different way (well, okay, whatever),

Yep, we iterate more efficiently now.

> but what worries me is that it has all the synchronisation 
> removed. Was the synchronised {} block unnecessary? If so, why?
> 

Cause the whole method is declared as synchronized so getting a
lock on (this) is useless :)

NextGen$

> >
> > Modified: trunk/freenet/src/freenet/config/PersistentConfig.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/config/PersistentConfig.java	2007-02-28
> > 22:41:01 UTC (rev 11935) +++
> > trunk/freenet/src/freenet/config/PersistentConfig.java	2007-02-28 22:51:25
> > UTC (rev 11936) @@ -34,11 +34,11 @@
> >  	public synchronized SimpleFieldSet exportFieldSet(boolean withDefaults) {
> >  		SimpleFieldSet fs = new SimpleFieldSet(true);
> >  		Iterator configsIterator = configsByPrefix.keySet().iterator();
> > -		SubConfig currentSubConfig;
> > +		SubConfig current;
> >  		while (configsIterator.hasNext()) {
> > -			currentSubConfig = (SubConfig) configsIterator.next();
> > -			SimpleFieldSet scfs = currentSubConfig.exportFieldSet(withDefaults);
> > -			fs.tput(currentSubConfig.prefix, scfs);
> > +			current = (SubConfig) configsByPrefix.get(configsIterator.next());
> > +			SimpleFieldSet scfs = current.exportFieldSet(withDefaults);
> > +			fs.tput(current.prefix, scfs);
> >  		}
> >  		return fs;
> >  	}
> >
> > _______________________________________________
> > cvs mailing list
> > cvs at freenetproject.org
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
> _______________________________________________
> Devl mailing list
> Devl at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl



More information about the Devl mailing list