Class SolrCore
- All Implemented Interfaces:
Closeable,AutoCloseable,SolrInfoBean,SolrMetricProducer
- Direct Known Subclasses:
SyntheticSolrCore
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvides the core instance if the core instance is still alive.static interfaceNested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SolrCore.Providerstatic final Map<String, QueryResponseWriter> booleanbooleanbooleanfinal UUIDA unique id to differentiate multiple instances of the same core If we reload a core, the name remains same , but the id will be newstatic booleanstatic final StringFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSolrCore(CoreContainer coreContainer, CoreDescriptor coreDescriptor, ConfigSet configSet, String dataDir, UpdateHandler updateHandler, IndexDeletionPolicyWrapper delPolicy, SolrCore prev, boolean reload) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseHook(CloseHook hook) Add a close callback hookvoidaddConfListener(Runnable runnable) Register to notify for any file change in the conf directory.voidaddTransformerFactory(String name, TransformerFactory factory) protected voidbufferUpdatesIfConstructing(CoreDescriptor coreDescriptor) Set UpdateLog to buffer updates if the slice is in construction.voidcleanupOldIndexDirectories(boolean reload) protected SolrCorecloneForReloadCore(CoreDescriptor newCoreDescriptor, ConfigSet newCoreConfig, boolean cloneCoreState) Clones the current core for core reload, with the provided CoreDescriptor and ConfigSet.voidclose()Close all resources allocated by the core if it is no longer in use...voidClose the core, if it is still in use waits until is no longer in use.void<T> TcreateInitInstance(PluginInfo info, Class<T> cast, String msg, String defClassName) static <T> TcreateInstance(String className, Class<T> cast, String msg, SolrCore core, org.apache.lucene.util.ResourceLoader resourceLoader) Creates an instance by trying a constructor that accepts a SolrCore before trying the default (no arg) constructor.Create an instance ofStatsCacheusing configured parameters.voiddeleteNamedSnapshot(String commitName) This method deletes the snapshot with the specified name.voiddeleteNonSnapshotIndexFiles(String indexDirPath) This method deletes the index files not associated with any named snapshot only if the specified indexDirPath is not the *current* index directory.static voiddeleteUnloadedCore(CoreDescriptor cd, boolean deleteDataDir, boolean deleteInstanceDir) voidexecute(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) voidCategory of this componentorg.apache.lucene.codecs.CodecgetCodec()Gets the configuration resource name used by this core instance.org.apache.solr.common.util.NamedList<?> static RunnablegetConfListener(SolrCore core, ZkSolrResourceLoader zkSolrResourceLoader) io.opentelemetry.api.common.AttributesReturns theSolrCoreMetricManagerfor this core.Simple one or two line descriptiongetIndexFingerprint(SolrIndexSearcher searcher, org.apache.lucene.index.LeafReaderContext ctx, long maxVersion) Computes fingerprint of a segment and caches it only if all the version in segment are included in the fingerprint.longThe index size in bytes, of the index that the current searcher is pointed to.Returns a Map of name vs SolrInfoBean objects.The core's instance directory (absolute).org.glassfish.jersey.server.ApplicationHandlergetName()Simple common usage name, e.g.getNewestSearcher(boolean openNew) Return the newest normalRefCounted<SolrIndexSearcher> with the reference count incremented.Returns the indexdir as given in index.properties.intCurrent core usage count.getQueryPlugin(String parserName) final QueryResponseWritergetQueryResponseWriter(String writerName) Finds a writer by name, or returns the default writer if not found.final QueryResponseWritergetQueryResponseWriter(SolrQueryRequest request) Returns the appropriate writer for a request.Gets the latest real-time searcher w/o forcing open a new searcher if one already exists.Returns the current registered searcher with its reference count incremented, or null if none are registered.getRequestHandler(String handlerName) Get the request handler registered to a given name.Returns an unmodifiable Map containing the registered handlersThe SolrResourceLoader used to load all resources for this core.getResourceLoader(String pkg) Gets the SolrResourceLoader for a given packageGets the schema resource name used by this core instance.getSearchComponent(String name) Accessor for all the Search ComponentsReturn a registeredRefCounted<SolrIndexSearcher> with the reference count incremented.getSearcher(boolean forceNew, boolean returnSearcher, Future<?>[] waitSearcher) getSearcher(boolean forceNew, boolean returnSearcher, Future<?>[] waitSearcher, boolean updateHandlerReopens) Get aSolrIndexSearcheror start the process of creating a new one.intGets the configuration object used by this core instance.Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, Attributes)to ensure proper cleanup of metrics at the end of the life-cycle of this component.longgetTransformerFactory(String name) RequestHandlers need access to the updateHandler so they can all talk to the same RAM indexer.getUpdateProcessorChain(org.apache.solr.common.params.SolrParams params) longgetValueSourceParser(String parserName) voidinitDefaultPlugin(Object plugin, Class<?> type) voidinitializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Implementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/componentstatic <T> TinitPlugin(PluginInfo info, T o) <T> List<T> initPlugins(List<PluginInfo> pluginInfos, Class<T> type, String defClassName) For a given List of PluginInfo return the instances as a List<T> TinitPlugins(List<PluginInfo> pluginInfos, Map<String, T> registry, Class<T> type, String defClassName) <T> TinitPlugins(Map<String, T> registry, Class<T> type) protected RestManagerCreates and initializes a RestManager based on configuration args in solrconfig.xml.booleanisClosed()Whether this core is closed.booleanisReady()Returns true if the core is ready for use.booleanbooleanmodifyIndexProps(String tmpIdxDirName) voidopen()expert: increments the core reference countopenNewSearcher(boolean updateHandlerReopens, boolean realtime) Opens a new searcher and returns a RefCounted<SolrIndexSearcher> with its reference incremented.static voidpostDecorateResponse(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) Put status, QTime, and possibly request handler and params, in the response headerstatic voidvoidNOTE: this function is not thread safe.voidregisterInfoBean(String name, SolrInfoBean solrInfoBean) voidregisterNewSearcherListener(SolrEventListener listener) NOTE: this function is not thread safe.registerRequestHandler(String handlerName, SolrRequestHandler handler) Registers a handler at the specified location.registerResponseWriter(String name, QueryResponseWriter responseWriter) NOTE: this function is not thread safe.voidremoveCloseHook(CloseHook hook) Remove a close callback hookbooleanremoveConfListener(Runnable runnable) Remove a listenervoidRun an arbitrary task in its own thread.voidsetLatestSchema(IndexSchema replacementSchema) Sets the latest schema snapshot to be used by this core instance.voidCalled to rename a core.toString()voidunloadOnClose(CoreDescriptor desc, boolean deleteIndexDir, boolean deleteDataDir, boolean deleteInstanceDir) static void<R> RwithSearcher(IOFunction<SolrIndexSearcher, R> lambda) Executes the lambda with theSolrIndexSearcher.
-
Field Details
-
version
- See Also:
-
uniqueId
A unique id to differentiate multiple instances of the same core If we reload a core, the name remains same , but the id will be new -
searchEnabled
public volatile boolean searchEnabled -
indexEnabled
public volatile boolean indexEnabled -
readOnly
public volatile boolean readOnly -
coreProvider
-
VERBOSE
public static boolean VERBOSE- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
- Debugging aid only. No non-test code should be released with uncommented verbose() calls.
-
DEFAULT_RESPONSE_WRITERS
-
-
Constructor Details
-
SolrCore
protected SolrCore(CoreContainer coreContainer, CoreDescriptor coreDescriptor, ConfigSet configSet, String dataDir, UpdateHandler updateHandler, IndexDeletionPolicyWrapper delPolicy, SolrCore prev, boolean reload)
-
-
Method Details
-
getStartTimeStamp
-
getStartNanoTime
public long getStartNanoTime() -
getUptimeMs
public long getUptimeMs() -
getRestManager
-
getPackageListeners
-
getResourceLoader
The SolrResourceLoader used to load all resources for this core.- Since:
- solr 1.3
-
getResourceLoader
Gets the SolrResourceLoader for a given package- Parameters:
pkg- The package name
-
getConfigResource
Gets the configuration resource name used by this core instance.- Since:
- solr 1.3
-
getSolrConfig
Gets the configuration object used by this core instance. -
getSchemaResource
Gets the schema resource name used by this core instance.- Since:
- solr 1.3
-
getLatestSchema
- Returns:
- the latest snapshot of the schema used by this core instance.
- See Also:
-
getInstancePath
The core's instance directory (absolute). -
setLatestSchema
Sets the latest schema snapshot to be used by this core instance. If the specifiedreplacementSchemauses aSimilarityFactorywhich isSolrCoreAwarethen this method willSolrCoreAware.inform(org.apache.solr.core.SolrCore)that factory about this SolrCore prior to using thereplacementSchema- See Also:
-
getConfigSetProperties
public org.apache.solr.common.util.NamedList<?> getConfigSetProperties() -
getDataDir
-
getIndexDir
-
getNewIndexDir
Returns the indexdir as given in index.properties. If index.properties exists in dataDir and there is a property index available, and it points to a valid directory in dataDir that is returned. Else dataDir/index is returned. Only called for creating new indexSearchers and indexwriters. Use the getIndexDir() method to know the active index directory- Returns:
- the indexdir as given in index.properties
- Throws:
org.apache.solr.common.SolrException- if for any reason an index directory cannot be determined.
-
getDirectoryFactory
-
getIndexReaderFactory
-
getIndexSize
public long getIndexSize()The index size in bytes, of the index that the current searcher is pointed to. -
getSegmentCount
public int getSegmentCount() -
toString
-
getName
Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getNamein interfaceSolrInfoBean
-
setName
Called to rename a core. Not called to initialize the name. -
getCoreAttributes
public io.opentelemetry.api.common.Attributes getCoreAttributes() -
getCoreMetricManager
Returns theSolrCoreMetricManagerfor this core.- Returns:
- the
SolrCoreMetricManagerfor this core
-
getInfoRegistry
Returns a Map of name vs SolrInfoBean objects. The returned map is an instance of a ConcurrentHashMap and therefore no synchronization is needed for putting, removing or iterating over it.- Returns:
- the Info Registry map which contains SolrInfoBean objects keyed by name
- Since:
- solr 1.3
-
deleteNamedSnapshot
This method deletes the snapshot with the specified name. If the directory storing the snapshot is not the same as the *current* core index directory, then delete the files corresponding to this snapshot. Otherwise we leave the index files related to snapshot as is (assuming the underlying Solr IndexDeletionPolicy will clean them up appropriately).- Parameters:
commitName- The name of the snapshot to be deleted.- Throws:
IOException- in case of I/O error.
-
deleteNonSnapshotIndexFiles
This method deletes the index files not associated with any named snapshot only if the specified indexDirPath is not the *current* index directory.- Parameters:
indexDirPath- The path of the directory- Throws:
IOException- In case of I/O error.
-
createEventListener
-
registerFirstSearcherListener
NOTE: this function is not thread safe. However, it is safe to call within theinform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException- See Also:
-
registerNewSearcherListener
NOTE: this function is not thread safe. However, it is safe to call within theinform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException- See Also:
-
registerResponseWriter
NOTE: this function is not thread safe. However, it is safe to call within theinform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException- See Also:
-
reload
- Throws:
IOException
-
cloneForReloadCore
protected SolrCore cloneForReloadCore(CoreDescriptor newCoreDescriptor, ConfigSet newCoreConfig, boolean cloneCoreState) Clones the current core for core reload, with the provided CoreDescriptor and ConfigSet.- Returns:
- the cloned core to be used for
reload(org.apache.solr.core.ConfigSet)
-
createInstance
public static <T> T createInstance(String className, Class<T> cast, String msg, SolrCore core, org.apache.lucene.util.ResourceLoader resourceLoader) Creates an instance by trying a constructor that accepts a SolrCore before trying the default (no arg) constructor.- Parameters:
className- the instance class to createcast- the class or interface that the instance should extend or implementmsg- a message helping compose the exception error if any occurs.core- The SolrCore instance for which this object needs to be loaded- Returns:
- the desired instance
- Throws:
org.apache.solr.common.SolrException- if the object could not be instantiated
-
createInitInstance
-
initPlugin
-
getCoreContainer
-
bufferUpdatesIfConstructing
Set UpdateLog to buffer updates if the slice is in construction. -
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Description copied from interface:SolrMetricProducerImplementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/component- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Parameters:
parentContext- The registry that the component will initialize metrics toattributes- Base set of attributes that will be bound to all metrics for that component
-
getMetricTag
-
getSolrMetricsContext
Description copied from interface:SolrMetricProducerImplementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, Attributes)to ensure proper cleanup of metrics at the end of the life-cycle of this component. This should be the child context if one was created, or null if the parent context was used.- Specified by:
getSolrMetricsContextin interfaceSolrMetricProducer
-
modifyIndexProps
-
closeAndWait
public void closeAndWait()Close the core, if it is still in use waits until is no longer in use.- See Also:
-
createStatsCache
Create an instance ofStatsCacheusing configured parameters. -
getSolrCoreState
-
getUpdateProcessingChain
- Returns:
- an update processor registered to the given name. Throw an exception if this chain is undefined
-
getUpdateProcessorChain
public UpdateRequestProcessorChain getUpdateProcessorChain(org.apache.solr.common.params.SolrParams params) -
getUpdateProcessors
-
getCircuitBreakerRegistry
-
open
public void open()expert: increments the core reference count -
close
public void close()Close all resources allocated by the core if it is no longer in use...- searcher
- updateHandler
- all CloseHooks will be notified
- All MBeans will be unregistered from MBeanServer if JMX was enabled
The behavior of this method is determined by the result of decrementing the core's reference count (A core is created with a reference count of 1)...
- If reference count is > 0, the usage count is decreased by 1 and no resources are released.
- If reference count is == 0, the resources are released.
- If reference count is < 0, and error is logged and no further action is taken.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSolrMetricProducer- See Also:
-
getOpenCount
public int getOpenCount()Current core usage count. -
isClosed
public boolean isClosed()Whether this core is closed. -
isReady
public boolean isReady()Returns true if the core is ready for use. It is not initializing or closing/closed. -
addCloseHook
Add a close callback hook -
removeCloseHook
Remove a close callback hook -
getCloseHooks
-
verbose
-
getRequestHandler
Get the request handler registered to a given name.This function is thread safe.
-
getRequestHandlers
Returns an unmodifiable Map containing the registered handlers -
getJerseyApplicationHandler
public org.glassfish.jersey.server.ApplicationHandler getJerseyApplicationHandler() -
registerRequestHandler
Registers a handler at the specified location. If one exists there, it will be replaced. To remove a handler, registernullat its pathOnce registered the handler can be accessed through:
http://${host}:${port}/${context}/${handlerName} or: http://${host}:${port}/${context}/select?qt=${handlerName}Handlers must be initialized before getting registered. Registered handlers can immediately accept requests.
This call is thread safe.
- Returns:
- the previous
SolrRequestHandlerregistered to this namenullif none.
-
getSearchComponent
- Returns:
- a Search Component registered to a given name. Throw an exception if the component is undefined
-
getSearchComponents
Accessor for all the Search Components- Returns:
- An unmodifiable Map of Search Components
-
getUpdateHandler
RequestHandlers need access to the updateHandler so they can all talk to the same RAM indexer. -
getSearcher
Return a registeredRefCounted<SolrIndexSearcher> with the reference count incremented. It must be decremented when no longer needed. This method should not be called from SolrCoreAware.inform() since it can result in a deadlock if useColdSearcher==false. If handling a normal request, the searcher should be obtained fromSolrQueryRequest.getSearcher()instead. If you still think you need to call this, considerwithSearcher(IOFunction)instead which is easier to use.- See Also:
-
withSearcher
Executes the lambda with theSolrIndexSearcher. This is more convenient than usinggetSearcher()since there is no ref-counting business to worry about. Example:IndexReader reader = h.getCore().withSearcher(SolrIndexSearcher::getIndexReader);
Warning: although a lambda is concise, it may be inappropriate to simply return the IndexReader because it might be closed soon after this method returns; it really depends.- Throws:
IOException
-
getIndexFingerprint
public IndexFingerprint getIndexFingerprint(SolrIndexSearcher searcher, org.apache.lucene.index.LeafReaderContext ctx, long maxVersion) throws IOException Computes fingerprint of a segment and caches it only if all the version in segment are included in the fingerprint. We can't use computeIfAbsent as caching is conditional (as described above) There is chance that two threads may compute fingerprint on the same segment. It might be OK to do so rather than locking entire map.- Parameters:
searcher- searcher that includes specified LeaderReaderContextctx- LeafReaderContext of a segment to compute fingerprint ofmaxVersion- maximum version number to consider for fingerprint computation- Returns:
- IndexFingerprint of the segment
- Throws:
IOException- Can throw IOException
-
getRegisteredSearcher
Returns the current registered searcher with its reference count incremented, or null if none are registered. -
getNewestSearcher
Return the newest normalRefCounted<SolrIndexSearcher> with the reference count incremented. It must be decremented when no longer needed. If no searcher is currently open, then if openNew==true a new searcher will be opened, or null is returned if openNew==false. -
getRealtimeSearcher
Gets the latest real-time searcher w/o forcing open a new searcher if one already exists. The reference count will be incremented. -
getSearcher
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, Future<?>[] waitSearcher) -
openNewSearcher
public RefCounted<SolrIndexSearcher> openNewSearcher(boolean updateHandlerReopens, boolean realtime) Opens a new searcher and returns a RefCounted<SolrIndexSearcher> with its reference incremented."realtime" means that we need to open quickly for a realtime view of the index, hence don't do any autowarming and add to the _realtimeSearchers queue rather than the _searchers queue (so it won't be used for autowarming by a future normal searcher). A "realtime" searcher will currently never become "registered" (since it currently lacks caching).
realtimeSearcher is updated to the latest opened searcher, regardless of the value of "realtime".
This method acquires openSearcherLock - do not call with searchLock held!
-
getSearcher
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, Future<?>[] waitSearcher, boolean updateHandlerReopens) Get aSolrIndexSearcheror start the process of creating a new one.The registered searcher is the default searcher used to service queries. A searcher will normally be registered after all of the warming and event handlers (newSearcher or firstSearcher events) have run. In the case where there is no registered searcher, the newly created searcher will be registered before running the event handlers (a slow searcher is better than no searcher).
These searchers contain read-only IndexReaders. To access a non read-only IndexReader, see newSearcher(String name, boolean readOnly).
If
forceNew==truethen A new searcher will be opened and registered regardless of whether there is already a registered searcher or other searchers in the process of being created.If
forceNew==falsethen:- If a searcher is already registered, that searcher will be returned
- If no searcher is currently registered, but at least one is in the process of being created, then this call will block until the first searcher is registered
- If no searcher is currently registered, and no searchers in the process of being registered, a new searcher will be created.
If
returnSearcher==truethen aRefCounted<SolrIndexSearcher> will be returned with the reference count incremented. It must be decremented when no longer needed.If
waitSearcher!=nulland a newSolrIndexSearcherwas created, then it is filled in with a Future that will return after the searcher is registered. The Future may be set tonullin which case the SolrIndexSearcher created has already been registered at the time this method returned.- Parameters:
forceNew- if true, force the open of a new index searcher regardless if there is already one open.returnSearcher- if true, returns aSolrIndexSearcherholder with the refcount already incremented.waitSearcher- if non-null, will be filled in with aFuturethat will return after the new searcher is registered.updateHandlerReopens- if true, the UpdateHandler will be used when reopening aSolrIndexSearcher.
-
isReloaded
public boolean isReloaded() -
closeSearcher
public void closeSearcher() -
execute
-
preDecorateResponse
-
postDecorateResponse
public static void postDecorateResponse(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) Put status, QTime, and possibly request handler and params, in the response header -
getResponseWriters
-
fetchLatestSchema
public void fetchLatestSchema() -
getQueryResponseWriter
Finds a writer by name, or returns the default writer if not found. -
getQueryResponseWriter
Returns the appropriate writer for a request. If the request specifies a writer via the 'wt' parameter, attempts to find that one; otherwise return the default writer. -
getQueryPlugin
-
getTransformerFactory
-
addTransformerFactory
-
initPlugins
-
initDefaultPlugin
-
initPlugins
For a given List of PluginInfo return the instances as a List- Parameters:
defClassName- The default classname if PluginInfo#className == null- Returns:
- The instances initialized
-
initPlugins
- Parameters:
registry- The map to which the instance should be added to. The key is the name attributetype- The type of the Plugin. These should be standard ones registered by type.getName() in SolrConfig- Returns:
- The default if any
-
getValueSourceParser
-
initRestManager
Creates and initializes a RestManager based on configuration args in solrconfig.xml. RestManager provides basic storage support for managed resource data, such as to persist stopwords to ZooKeeper if running in SolrCloud mode.- Throws:
org.apache.solr.common.SolrException
-
getCoreDescriptor
-
getDeletionPolicy
-
getSnapshotMetaDataManager
- Returns:
- A reference of SolrSnapshotMetaDataManager managing the persistent snapshots for this Solr core.
-
getRuleExpiryLock
-
getDescription
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean
-
getCategory
Description copied from interface:SolrInfoBeanCategory of this component- Specified by:
getCategoryin interfaceSolrInfoBean
-
getCodec
public org.apache.lucene.codecs.Codec getCodec() -
unloadOnClose
public void unloadOnClose(CoreDescriptor desc, boolean deleteIndexDir, boolean deleteDataDir, boolean deleteInstanceDir) -
deleteUnloadedCore
public static void deleteUnloadedCore(CoreDescriptor cd, boolean deleteDataDir, boolean deleteInstanceDir) -
addConfListener
Register to notify for any file change in the conf directory. If the file change results in a core reload , then the listener is not fired -
removeConfListener
Remove a listener -
getConfListener
-
registerInfoBean
-
cleanupOldIndexDirectories
public void cleanupOldIndexDirectories(boolean reload) -
getImplicitHandlers
-
getCancellableQueryTracker
-
runAsync
Run an arbitrary task in its own thread. This is an expert option and is a method you should use with great care. It would be bad to run something that never stopped or run something that took a very long time. Typically, this is intended for actions that take a few seconds, and therefore would be bad to wait for within a request, but would not pose a significant hindrance to server shut down times. It is not intended for long-running tasks and if you are using a Runnable with a loop in it, you are almost certainly doing it wrong.WARNING: Solr wil not be able to shut down gracefully until this task completes!
A significant upside of using this method vs creating your own ExecutorService is that your code does not have to properly shutdown executors which typically is risky from a unit testing perspective since the test framework will complain if you don't carefully ensure the executor shuts down before the end of the test. Also, the threads running this task are sure to have a proper MDC for logging.
- Parameters:
r- the task to run
-