You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2012/01/03 21:20:34 UTC

Re: best practice to introducing singletons inside of Solr (IoC)

: Ok. Let me try with plain java one. Possibly I'll need more tight
: integration like injecting a core into the singleton, etc. But I don't know
: yet.

yeah ... it really depends on what you mean by "singleton" ...

	...single instance in entire JVM?
	...single instance in each webapp?
	...single instance in each solr core?

If you want the first or the second, standard java patterns will be your 
best bet, but you'll need to be careful with the classpath and make sure 
your class is loaded at the appropriate level (and in the first case: 
can't directly know about any Solr specific classes).

If you want one instance per solr core, that is part of the solr core 
lifecycle (so a new one is created if/when the core is replaced) i 
think the approach of an explicitly named request handler is simplest way 
to go.  

-Hoss