I have a question about the loading mechanism of plugin classes. I'm working with a custom URLFilter, and I need a singleton object loaded and initialized by the first instance of the URLFilter, and shared by other instances (e.g., instantiated by other threads). I was assuming that the URLFilter class was being loaded only once even when the filter is used by multiple threads, so I tried to use a static member variable of my URLFilter class to hold a reference to the object to be shared: but it appears that the supposed singleton, actually, isn't, because the method responsible for its instantiation finds the static field initialized to null. So: are URLFilter classes loaded multiple times by their classloader in Nutch? The wiki page at http://wiki.apache.org/nutch/WhichTechnicalConceptsAreBehindTheNutchPluginSystem seems to suggest otherwise:

   Until Nutch runtime, only one instance of such a plugin
   class is alive in the Java virtual machine.

(By the way, what does "Until Nutch runtime" mean here? Before Nutch runtime, no class whatsoever is supposed to be alive in the JVM, is it?)

Enzo

Reply via email to