On Wednesday 28 Mar 2012 01:04:14 Zlatin Balevsky wrote: > There are many problems with > https://github.com/Heiral/fred-staging/commit/b876f8c454cb269281ffcb18d14d25b22818d130#L0R49 > : > > line 25: the static field log should be volatile. It may work now and > then but it's broken. Google "double-checked locking" for more info. > Either that or synchronize it properly everywhere > > lines 49-60 - "out" will refer to the parameter, not the static field > so you will end up closing the parameter. Also what if Log.out is > null? Can't synchronize on null. > > Line 61: bad synchronization again > > lines 65-75 Level.ordinal() will compile to a vtable call if you have > more than two levels in use across the jvm. > > lines 100-101: again, if out is null you can't synchronize on it. > > Besides all this, adding a static dependency will create problems > if/when a multi-node simulator or multi-node black box unit tests are > written.
Both exist today. See freenet/node/simulator/. RealNodeULPRTest is a black-box unit test, which is run regularly in a cron script on my system. The others are mostly run on an as-needed basis, but are useful for testing changes that might affect routing. But we use a static logging API anyway, and this works adequately well. I have debugged stuff largely through logs in multi-node simulators, I generally rely on the thread name to identify the node (e.g. the UDP receive and send thread include the port number in the thread name). -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <https://emu.freenetproject.org/pipermail/devl/attachments/20120330/a8db2d6f/attachment.pgp>
