Plugin initialization order

I saw a post about this subject sometime in the past year, but I cannot
find it.

I created a new type of TransportNodesOperationAction and tried to inject
the AnalysisService into the constructor. Upon startup I received a
"Initialization Failed" exception, so I am assuming that the
AnalysisService does not get initialized until after the plugins are
loaded. I have no other issues with other services,
including IndicesAnalysisService, but AnalysisService is what I am after.

Before I dig deeper into the code, especially the Guice injections, can
someone confirm this issue is true? The only locations in the code that I
can see AnalysisService injected into is
RobinEngine, MapperService, IndexQueryParserService, and
InternalIndexService. No Actions of any kind.

Cheers,

Ivan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Without seeing the exception stack trace, I'm unable to shed some light on
the cause.

You can instantiate an AnalysisService if you have an Index, there is a
constructor with a single parameter.

Another approach for Guice-based instantiation is to use an Injector with a
ModuleBuilder so you can pack the required instances for dependency
resolution, an example is in IndexQueryParserModuleTests

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Responses inline.

On Thu, Sep 12, 2013 at 12:24 AM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

Without seeing the exception stack trace, I'm unable to shed some light on
the cause.

I do not have the code in front of me now, but there was no real stack
trace. Just "Initialization Failed" along with various instance variables
that have no been initialized, so obviously the AnalysisService has not
been initialized. Now I remember that there was another mailing list post
about someone trying to override an analysis component definition via a
plugin, but the initialization of the AnalysisModule happened after the
plugin, so the new defaults were overridden by the true defaults. Once
again, I cannot find the post.

You can instantiate an AnalysisService if you have an Index, there is a
constructor with a single parameter.

I do this exact step on the client side so that I can pre-analyze terms for
span queries that do not analyze terms. I am more worried about
initializing something before its time because of other dependencies.

Another approach for Guice-based instantiation is to use an Injector with
a ModuleBuilder so you can pack the required instances for dependency
resolution, an example is in IndexQueryParserModuleTests

Ultimately, the lack of the AnalysisService is not a show-stopper since I
can create my own registry of token filter factories as statics at the JVM
level. Not much memory needed for a few objects and my access patterns
would be simplified. Still thinking about which Action type to use, but
that's another posting.

Cheers,

Ivan

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Finally had a chance to revisit the exception. As I stated before, there
was no real stack trace:

My own code might have an ordering issue since the onModule methods have no
explicit ordering:

public void onModule(ActionModule module) {
module.registerAction(...);
}

public void onModule(AnalysisModule module) {
module.addTokenFilter(...);
}

The action registered in the ActionModule is the one that should have the
injected AnalysisService. Ideally, this AnalysisService should have access
to the token filters added to the AnalysisModule, but have so one startup
is not essential. Going to simply write my own token fitler registry.

Cheers,

Ivan

On Thu, Sep 12, 2013 at 12:24 AM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

Without seeing the exception stack trace, I'm unable to shed some light on
the cause.

You can instantiate an AnalysisService if you have an Index, there is a
constructor with a single parameter.

Another approach for Guice-based instantiation is to use an Injector with
a ModuleBuilder so you can pack the required instances for dependency
resolution, an example is in IndexQueryParserModuleTests

Jörg

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.