public class ChannelClosedException
extends IllegalStateException
Thrown when an AsyncChannel operation is attempted after the channel has been closed.
This exception is raised in the following situations:
When used with for await, a plain for, each,
collect or toList, a close with no cause ends iteration.
A close that carries a cause throws that cause after the values already
sent. The code that reads the channel writes the try/catch:
def ch = AsyncChannel.create()
// ... producer sends values, then calls ch.close()
for await (item in ch) {
process(item) // processes all buffered values
}
// loop exits cleanly after the channel is closed and drained
A Java enhanced for calls Iterator.hasNext(), which may
throw a checked exception that Iterator does not declare.
| Constructor and description |
|---|
ChannelClosedException(String message)Creates a ChannelClosedException with the specified detail message. |
ChannelClosedException(String message, Throwable cause)Creates a ChannelClosedException with the specified detail message
and cause. |
| Methods inherited from class | Name |
|---|---|
class IllegalStateException |
addSuppressed, equals, fillInStackTrace, getCause, getClass, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, hashCode, initCause, notify, notifyAll, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString, wait, wait, wait |
Creates a ChannelClosedException with the specified detail message.
message - the detail message describing which operation failed Creates a ChannelClosedException with the specified detail message
and cause.
message - the detail messagecause - the underlying cause (e.g., an InterruptedException
if the thread was interrupted while waiting on a channel operation)Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.