diff --git a/core/src/main/java/com/linecorp/armeria/common/NonBlocking.java b/core/src/main/java/com/linecorp/armeria/common/NonBlocking.java index dc33cd3a19c..cceeef41ff2 100644 --- a/core/src/main/java/com/linecorp/armeria/common/NonBlocking.java +++ b/core/src/main/java/com/linecorp/armeria/common/NonBlocking.java @@ -16,6 +16,15 @@ package com.linecorp.armeria.common; /** - * A dummy interface that indicates non-blocking thread. + * An interface that indicates a non-blocking thread. You can use this interface to check if the current + * thread is a non-blocking thread. For example: + *
{@code
+ * if (Thread.currentThread() instanceof NonBlocking) {
+ *     // Avoid blocking operations.
+ *     closeable.closeAsync();
+ * } else {
+ *     closeable.close();
+ * }
+ * }
*/ public interface NonBlocking {} diff --git a/core/src/main/java/com/linecorp/armeria/internal/common/util/EventLoopThread.java b/core/src/main/java/com/linecorp/armeria/internal/common/util/EventLoopThread.java index c8d36aa43f3..ac082c940e3 100644 --- a/core/src/main/java/com/linecorp/armeria/internal/common/util/EventLoopThread.java +++ b/core/src/main/java/com/linecorp/armeria/internal/common/util/EventLoopThread.java @@ -23,7 +23,7 @@ /** * An event loop thread with support for {@link TemporaryThreadLocals}, Netty {@link FastThreadLocal} and - * Project Reactor {@link NonBlocking}. + * {@link NonBlocking} interface. */ public final class EventLoopThread extends FastThreadLocalThread implements NonBlocking {