Second, I've got some code running in the same JVM as Solr that
does some
stuff like getting the latest timestamp in the index to determine
if we need
to pull an update from our product info database, kicking off an
optimize
every night at 2:00AM, stuff like that. However I take it that
this line
won't work anymore due to the multicore stuff:
SolrCore core = SolrCore.getSolrCore();
That's fine, but how do I get a handle to the SolrCore intance(s)
now? The
SolrCore.getSolrCore method was static, the method in CoreContainer
that
replaces it is not static, so how, by just being in the same JVM,
can a
class get access to the CoreContainer?
It's available in the SolrDispatchFilter, so it might be reasonable
to extend that.
right, static access to core is deprecated, but it is still there.
To get access w/o deprecation, you will need to implement something
(RequestHandler?) that implements SorlCoreAware -- then it will be
given access to the core at startup.
once you have the core, you can use this train wreck to get all cores:
core.getCoreDescriptor().getCoreContainer().getCores()
https://svn.apache.org/repos/asf/lucene/solr/trunk/src/java/org/apache/solr/util/plugin/SolrCoreAware.java
If you still need to use the static method, you can still use
SolrCore.getSolrCore();
ryan