sigram commented on code in PR #2347:
URL: https://github.com/apache/solr/pull/2347#discussion_r1528795286
##########
solr/core/src/java/org/apache/solr/search/CpuAllowedLimit.java:
##########
@@ -17,25 +17,29 @@
package org.apache.solr.search;
import com.google.common.annotations.VisibleForTesting;
-import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit;
+import net.jcip.annotations.NotThreadSafe;
import org.apache.lucene.index.QueryTimeout;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrRequestInfo;
import org.apache.solr.util.ThreadCpuTimer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Enforces a CPU-time based timeout on a given SolrQueryRequest, as specified
by the {@code
* cpuAllowed} query parameter.
+ *
+ * <p>Since this class uses {@link ThreadCpuTimer} it is irrevocably
lock-hostile and can never be
+ * exposed to multiple threads, even if guarded by synchronization. Normally
this is attached to
+ * objects ultimately held by a ThreadLocal in {@link SolrRequestInfo} to
provide safe usage on the
+ * assumption that such objects are not shared to other threads.
Review Comment:
💯
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]