Hi,

Nutch initializes plugins multiple times and so
any expensive initialization procedures are being executed more than once.
For example plugin needs to make a connection to the data base. Each
instance of the plugin will have to create that connection, which leads to
plugins spending lots of time making connections (I'm using db connections
only as an example). Ideally a connection pool must be created and shared
between instances of a given plugin.

Is there any way to share objects (e.g. connection pools) between instances
of the plugin?

JavaDoc for org.apache.nutch.plugin.Plugin states:

"A possible usecase of the <code>Plugin</code> implementation is to
create or close a database connection."

I have tried this code in Plugin's startUp code:

((MyPlugin)
getDescriptor().getExtensions()[j].getExtensionInstance()).setExpeciveStuff(
x );

but calling getExtensionInstance leads to StackOverflowException

Regards,
zm

Reply via email to