Package org.elasticsearch.common.network
Interface CloseableChannel
- All Superinterfaces:
,
- All Known Subinterfaces:
HttpChannel
,HttpServerChannel
,TcpChannel
,TcpServerChannel
public interface CloseableChannel
extends
-
Method Summary
Modifier and TypeMethodDescriptionvoid
> listener)
Adds a listener that will be executed when the channel is closed.static void
<>> futures)
void
close()
Closes the channel.static <C extends CloseableChannel>
voidcloseChannel(C channel)
Closes the channel without blocking.static <C extends CloseableChannel>
voidcloseChannel(C channel, boolean blocking)
Closes the channel.static <C extends CloseableChannel>
void<C> channels, boolean blocking)
Closes the channels.boolean
isOpen()
Indicates whether a channel is currently open
-
Method Details
-
close
void close()Closes the channel. For most implementations, this will be be an asynchronous process. For this reason, this method does not throw There is no guarantee that the channel will be closed when this method returns. Use theaddCloseListener(ActionListener)
method to implement logic that depends on knowing when the channel is closed.- Specified by:
in interface
- Specified by:
in interface
-
addCloseListener
void addCloseListener(> listener)Adds a listener that will be executed when the channel is closed. If the channel is still open when this listener is added, the listener will be executed by the thread that eventually closes the channel. If the channel is already closed when the listener is added the listener will immediately be executed by the thread that is attempting to add the listener.- Parameters:
listener
- to be executed
-
isOpen
boolean isOpen()Indicates whether a channel is currently open- Returns:
- boolean indicating if channel is open
-
closeChannel
Closes the channel without blocking.- Parameters:
channel
- to close
-
closeChannel
Closes the channel.- Parameters:
channel
- to closeblocking
- indicates if we should block on channel close
-
closeChannels
static <C extends <C> channels, boolean blocking)Closes the channels.- Parameters:
channels
- to closeblocking
- indicates if we should block on channel close
-
blockOnFutures
static void blockOnFutures(<>> futures)
-