diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/OffLockDisposalCallback.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/OffLockDisposalCallback.java index 4d079eaa12..70f083d8c2 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/OffLockDisposalCallback.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/OffLockDisposalCallback.java @@ -34,6 +34,17 @@ import org.apache.hc.core5.io.ModalCloseable; import org.apache.hc.core5.pool.DisposalCallback; +/** + * {@link DisposalCallback} that defers graceful connection disposal so it can + * be executed outside core pool synchronization. + *
+ * Calls with {@link CloseMode#IMMEDIATE} are delegated directly to the
+ * underlying callback on the caller thread. All other modes are queued and
+ * later disposed with {@link CloseMode#GRACEFUL} when {@link #drain()} is
+ * invoked by {@link PoolingHttpClientConnectionManager}.
+ *
+ * @since 5.6
+ */
@Internal
final class OffLockDisposalCallback
+ * When enabled, graceful connection closes are deferred and performed
+ * outside the core pool synchronization in
+ * {@link PoolingHttpClientConnectionManager}. This reduces the time spent
+ * holding internal locks at the cost of slightly more complex disposal
+ * logic. Immediate closes {@link CloseMode#IMMEDIATE} are still executed
+ * on the caller thread.
+ *
+ * @param enabled {@code true} to enable off-lock disposal, {@code false} to disable
+ * @return this builder
* @since 5.6
*/
@Experimental
@@ -317,6 +328,7 @@ public final PoolingHttpClientConnectionManagerBuilder setOffLockDisposalEnabled
return this;
}
+
@Internal
protected HttpClientConnectionOperator createConnectionOperator(
final SchemePortResolver schemePortResolver,