On Tue, May 12, 2009 at 7:10 AM, Matthew Toseland
<[email protected]> wrote:
> On Wednesday 06 May 2009 01:39:54 Daniel Cheng wrote:
>> On Wed, May 6, 2009 at 6:21 AM, Matthew Toseland
>> <[email protected]> wrote:
>> > sdiz commit 006d85dbcd31ffce94279667f5e9ab62d054c9cf
>> >
>> > diff --git a/src/freenet/client/ArchiveHandlerImpl.java
>> > b/src/freenet/client/ArchiveHandlerImpl.java
>> > index 56a9b81..e8046ca 100644
>> > --- a/src/freenet/client/ArchiveHandlerImpl.java
>> > +++ b/src/freenet/client/ArchiveHandlerImpl.java
>> > @@ -24,13 +24,7 @@ class ArchiveHandlerImpl implements ArchiveHandler {
>> >        private static volatile boolean logMINOR;
>> >
>> >        static {
>> > -               Logger.registerLogThresholdCallback(new
> LogThresholdCallback()
>> > {
>> > -
>> > -                       @Override
>> > -                       public void shouldUpdate() {
>> > -                               logMINOR = Logger.shouldLog(Logger.MINOR,
>> > this);
>> > -                       }
>> > -               });
>> > +               Logger.registerClass(ArchiveHandlerImpl.class);
>> >        }
>> >
>> >        private final FreenetURI key;
>> >
>> > Etc.
>> >
>> > Logger.registerClass uses JNI and weak references, it is a great thing. It
>>
>> That's not JNI, ... JNI is native C code.
>> This is Reflection (
>> http://java.sun.com/docs/books/tutorial/reflect/index.html )
>
> Yes, I meant reflection. :)
>>
>> > could simplify much code as above, but shouldUpdate() is slow because of
> JNI.
>> > Given we very rarely change logging settings, is that a problem? How long
>> > would it take to run the JNI hooks on every class? If it's less than 100ms
> or
>> > so, we should use this everywhere.
>
> Do you have an opinion on this part?

The reflection part (minor the "shouldLog()" function) take <2ms on my machine
for each class.
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to