[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Logging (Factory)





2. It has its LogPluginInfo (stolen from PluginInfo - but without
 logging).



What about keeping our PluginInfo, remove all unnecessary logs and only
keep the single log.warn().

In Global.java you do something like this:


public LogChannel getLog(String key) {
I_Logger logger = hash.get(key);
if (logger == null) {
synchronized (this) {
if (logger == null) {
if (creatingInstance) return null; // !!!!
creatingInstance = true;
// call plugin ....
// this.logger = plugin.load()
creatingInstance = false;
}
}
}



Would this really work? Say this happens glob.init->getLog()->getFactory().new PluginInfo->getLog()

Would it not deadlock?

No, the same thread may recursively enter the this synchronize multiple times.
And as 'creatingInstance' is true the second time, it will return 'null'
as logging handle - which you check in PluginInfo and probably ignore the
log.warn (or do a System.err.out()).




[snip]


What do you say? Is it usable, acceptable, commitable?



Michele and i just discussed  it.
We are thankful if you donate this to xmlBlaster.org.




Thanks! I take another round tomorrow. Clean some stuff up and documenting it: then commit ;-)

Ah, yes, don't forget a requirement XML :-)

thanks

Marcel


And thanks for your allways good input.
//Peter