@ApiStatus.Internal public class NettyChannelContext extends Object implements Closeable, Cloneable
Channel
instanceModifier and Type | Class and Description |
---|---|
class |
NettyChannelContext.Properties
Contains all the properties associated with the channel
|
Modifier | Constructor and Description |
---|---|
|
NettyChannelContext(io.netty.channel.Channel channel,
NettyMessenger<? extends AbstractRequest,? extends AbstractResponse> messenger)
Constructor for NettyChannelContext.
|
protected |
NettyChannelContext(NettyChannelContext context)
Constructor for NettyChannelContext.
|
Modifier and Type | Method and Description |
---|---|
NettyChannelContext |
attach(AbstractRequest request)
attach.
|
io.netty.channel.Channel |
channel()
channel.
|
protected void |
cleanup()
Called once the underlying
Channel /Connection has been closed. |
void |
clear()
Clear the properties stack
|
NettyChannelContext |
clone() |
void |
close() |
<C extends NettyChannelContext> |
composedFuture()
Returns a
CompletableFuture that returns this context once the response has been marked as completed. |
NettyChannelContext |
disableAutoRelease()
Disable auto-release of context
|
NettyChannelContext |
disableReadTimeout()
Disable read timeouts.
|
NettyChannelContext |
disableWriteTimeout()
Disable write timeouts
|
NettyChannelContext |
enableAutoRelease()
enableAutoRelease.
|
boolean |
equals(Object o) |
io.netty.channel.EventLoop |
eventLoop()
eventLoop.
|
<V> boolean |
exists(io.netty.util.AttributeKey<V> key)
exists.
|
CompletableFuture<NettyChannelContext> |
future()
future.
|
<V> V |
get(io.netty.util.AttributeKey<V> key)
get.
|
static NettyChannelContext |
getContext(io.netty.channel.Channel channel)
Get the channel context attached to the provided
Channel |
boolean |
hasError()
hasError.
|
int |
hashCode() |
boolean |
hasResponse()
hasResponse.
|
String |
id()
id.
|
boolean |
inEventLoop()
inEventLoop.
|
boolean |
isCompleted()
isCompleted.
|
boolean |
isValid()
isValid.
|
InetSocketAddress |
localAddress()
localAddress.
|
void |
markInError(Throwable error)
markInError.
|
boolean |
markSuccess(AbstractResponse response)
markSuccess.
|
NettyMessenger<? extends AbstractRequest,? extends AbstractResponse> |
messenger()
messenger.
|
protected NettyChannelContext.Properties |
newProperties(NettyChannelContext.Properties copy)
newProperties.
|
NettyChannelContext.Properties |
properties()
properties.
|
void |
receive(AbstractResponse response)
Pass the message back to the messenger.
|
void |
receive(Throwable error)
Pass the error back to the messenger.
|
InetSocketAddress |
remoteAddress()
remoteAddress.
|
NettyChannelContext |
restore()
Restore the previously saved context
|
NettyChannelContext |
save()
Save the current state of this context
|
CompletableFuture<? extends NettyChannelContext> |
send()
send.
|
<V> void |
set(io.netty.util.AttributeKey<V> key,
V value)
set.
|
String |
toString() |
public NettyChannelContext(io.netty.channel.Channel channel, NettyMessenger<? extends AbstractRequest,? extends AbstractResponse> messenger)
Constructor for NettyChannelContext.
channel
- a Channel
objectmessenger
- a NettyMessenger
objectprotected NettyChannelContext(NettyChannelContext context)
Constructor for NettyChannelContext.
context
- a NettyChannelContext
objectprotected NettyChannelContext.Properties newProperties(NettyChannelContext.Properties copy)
newProperties.
copy
- a NettyChannelContext.Properties
objectNettyChannelContext.Properties
objectpublic NettyChannelContext.Properties properties()
properties.
NettyChannelContext.Properties
objectpublic final io.netty.channel.Channel channel()
channel.
Channel
objectprotected void cleanup()
Channel
/Connection has been closed.public static NettyChannelContext getContext(io.netty.channel.Channel channel)
Channel
channel
- The Channel
to retrieve the context fromNettyChannelContext
associated with the Channel
public final <C extends NettyChannelContext> CompletableFuture<C> composedFuture()
Returns a CompletableFuture
that returns this context once the response has been marked as completed.
C
- A captured type of NettyChannelContext
CompletableFuture
returning this context instance once response has been received.public final CompletableFuture<NettyChannelContext> future()
future.
CompletableFuture
objectpublic final io.netty.channel.EventLoop eventLoop()
eventLoop.
EventLoop
objectpublic boolean isValid()
isValid.
public NettyMessenger<? extends AbstractRequest,? extends AbstractResponse> messenger()
messenger.
NettyMessenger
objectpublic final boolean inEventLoop()
inEventLoop.
public final boolean hasResponse()
hasResponse.
public final boolean isCompleted()
isCompleted.
public final boolean hasError()
hasError.
public final boolean markSuccess(AbstractResponse response)
markSuccess.
response
- a AbstractResponse
objectpublic final void receive(AbstractResponse response)
response
- The AbstractResponse
to receivepublic final void markInError(Throwable error)
markInError.
error
- a Throwable
objectpublic final void receive(Throwable error)
error
- The Throwable
to receivepublic final <V> boolean exists(io.netty.util.AttributeKey<V> key)
exists.
V
- a V classkey
- a AttributeKey
objectpublic final <V> V get(io.netty.util.AttributeKey<V> key)
get.
V
- a V classkey
- a AttributeKey
objectpublic final <V> void set(io.netty.util.AttributeKey<V> key, V value)
set.
V
- a V classkey
- a AttributeKey
objectvalue
- a V objectpublic InetSocketAddress remoteAddress()
remoteAddress.
InetSocketAddress
objectpublic InetSocketAddress localAddress()
localAddress.
InetSocketAddress
objectpublic CompletableFuture<? extends NettyChannelContext> send()
send.
CompletableFuture
objectpublic NettyChannelContext save()
NettyChannelContext
public NettyChannelContext restore()
NettyChannelContext
public void clear()
public NettyChannelContext attach(AbstractRequest request)
attach.
request
- a AbstractRequest
objectNettyChannelContext
objectpublic NettyChannelContext enableAutoRelease()
enableAutoRelease.
NettyChannelContext
objectpublic NettyChannelContext disableAutoRelease()
Disable auto-release of context
NettyChannelContext
objectpublic NettyChannelContext disableWriteTimeout()
Disable write timeouts
NettyChannelContext
objectpublic NettyChannelContext disableReadTimeout()
Disable read timeouts.
NettyChannelContext
objectpublic void close()
Close or release the underlying Channel
of this context. If the Channel
is not pooled, it will call ChannelOutboundInvoker.close()
otherwise it will attempt to call release to return it back to the pool.
close
in interface Closeable
close
in interface AutoCloseable
public NettyChannelContext clone()
Copyright © 2016–2024. All rights reserved.