Yes. Integrating my CustomComponent along with SolrCoreAware (I was unaware of this prev) should give me what I am looking for.
Thanks! Mark. On Sat, Jul 2, 2016 at 5:57 AM, Andrea Gazzarini <gxs...@gmail.com> wrote: > You're welcome ;) is that close to what you were looking for? > On 2 Jul 2016 11:53, "Mark Robinson" <mark123lea...@gmail.com> wrote: > > > Thanks much Andrea esp. for the suggestion of SolrCoreAware! > > > > > > > > Best, > > Mark. > > > > On Thu, Jun 30, 2016 at 10:23 AM, Andrea Gazzarini <gxs...@gmail.com> > > wrote: > > > > > Hi, > > > the lifecycle of your Solr extension (i.e. the component) is not > > something > > > that's up to you. > > > Before designing the component you should read the framework docs [1], > in > > > order to understand the context where it will live, once deployed. > > > > > > There's nothing, as far as I know, other than the component callbacks > > > (e.g. the inform, init methods) that can help you to manage the > lifecycle > > > of a custom class you're using within the component. Look at the > > > SolrCoreAware [2] interface, maybe it could fit your needs. > > > From what you write it seems you could need something like a singleton > > > (which is often an anti-pattern in distributed environment) , but > without > > > further details I'm just shooting in the dark > > > > > > In addition: you wrote a component so I guess it shouldn't be so hard > to > > > have a look at one of the existing built-in components. I'm quite sure > > they > > > already met (and solved) a similar issue. > > > > > > Best, > > > Andrea > > > > > > [1] > > > > > > https://lucene.apache.org/solr/6_1_0/solr-core/org/apache/solr/handler/component/SearchComponent.html > > > [2] https://wiki.apache.org/solr/SolrPlugins#SolrCoreAware > > > > > > > > > On 30/06/16 16:00, Mark Robinson wrote: > > > > > >> Hi, > > >> > > >> I have a java OBJECT which I need to load once. > > >> I have written a java custom component, which I have added in > > >> "last-components" in solrconfig.xml, from which I want to access the > > above > > >> mentioned OBJECT when each search request comes in. > > >> > > >> Is there a way I can load a java object on server/ instance startup? > > >> OR > > >> Load it when the first call comes to SOLR? > > >> > > >> For the time being I created that Java object inside the custom > > component > > >> itself; but it is loaded each time a search request comes in. > > >> > > >> Could some one pls give some pointers on how my above requirement can > be > > >> achieved in SOLR? > > >> > > >> Thanks! > > >> Mark > > >> > > >> > > > > > >