public class EmbeddedChannel extends AttributeChannel<EmbeddedChannel> implements NetDuplexChannel<EmbeddedChannel>
SoChannel implementations that are used in an embedded fashion.| 限定符和类型 | 字段和说明 |
|---|---|
protected PipeContext |
pipeCtx |
protected Pipeline<?> |
pipeline |
| 构造器和说明 |
|---|
EmbeddedChannel(boolean asServer,
EmbeddedInitializer initializer,
EmbeddedSoContext context) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearRcvError()
Clear the RcvError status.
|
void |
clearSndError()
Clear the SndError status.
|
net.hasor.cobble.concurrent.future.Future<EmbeddedChannel> |
close()
close this channel.
|
net.hasor.cobble.concurrent.future.Future<EmbeddedChannel> |
closeNow()
close this channel now.
|
<T> T |
findPipeContext(Class<T> serviceType)
Get the attachment for
PipeContext |
long |
getChannelID()
channel id
|
SoContext |
getContext()
get context
|
long |
getCreatedTime()
channel accept time
|
long |
getLastActiveTime()
The last time data was received or sent
|
SocketAddress |
getLocalAddr()
local
SocketAddress |
PipeStatistical |
getPipeStatistical()
Get protocol stack statistics
|
Throwable |
getRcvError()
Get the possible received data protocol layer error
|
int |
getRcvSize()
read messages limit from the RCV_DOWN of this
SoChannel. |
SocketAddress |
getRemoteAddr()
get remote address of the channel
|
Throwable |
getSndError()
Get the possible send data protocol layer error
|
int |
getSndSize()
read messages limit from the SND_DOWN of this
SoChannel. |
boolean |
hasRcvError()
Receive data protocol layer error
|
boolean |
hasSndError()
send data protocol layer error
|
void |
ignoreReadEofFlag()
When shutdownOutput is called remotely, an end of read flag was encountered, which usually means closing the channel.
|
boolean |
isClient()
a connect
NetChannel |
boolean |
isClose()
return close status.
|
boolean |
isListen()
|
boolean |
isServer()
an accept
NetChannel |
boolean |
isShutdownInput()
Returns whether the read channel is closed.
|
boolean |
isShutdownOutput()
Returns whether the write channel is closed.
|
void |
printStackTrace()
Prints this pipline status and its backtrace to the System.out.
|
void |
printStackTrace(PrintStream s)
Prints this pipline status and its backtrace to the specified print stream.
|
Object |
readRcv()
read messages from the RCV_DOWN of this
SoChannel. |
Object[] |
readRcvArray()
read messages from the RCV_DOWN of this
SoChannel. |
Object |
readSnd()
read messages from the SND_DOWN of this
SoChannel. |
Object[] |
readSndArray(int readSize)
read messages from the SND_DOWN of this
SoChannel. |
void |
receive(Object... object)
Write messages to the RCV_UP of this
SoChannel. |
void |
receiveError(String pipeName,
Throwable e)
Write error to the RCV_UP of this
SoChannel, the message will only be sent to the specific protocol layer |
void |
receiveError(Throwable e)
Write error to the RCV_UP of this
SoChannel. |
void |
receiveTo(String pipeName,
Object... object)
Write messages to the RCV_UP of this
SoChannel, the message will only be sent to the specific protocol layer |
void |
send(Object... object)
Write messages to the SND_UP of this
SoChannel. |
void |
sendError(String pipeName,
Throwable e)
Write error to the SND_UP of this
SoChannel, the message will only be sent to the specific protocol layer |
void |
sendError(Throwable e)
Write error to the SND_UP of this
SoChannel. |
void |
sendTo(String pipeName,
Object... object)
Write messages to the SND_UP of this
SoChannel, the message will only be sent to the specific protocol layer |
void |
shutdownInput()
Shutdown the connection for reading without closing the channel.
|
void |
shutdownOutput()
Shutdown the connection for write without closing the channel.
|
getAttribute, setAttributeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAttribute, setAttributeprotected final PipeContext pipeCtx
protected final Pipeline<?> pipeline
public EmbeddedChannel(boolean asServer,
EmbeddedInitializer initializer,
EmbeddedSoContext context)
public long getChannelID()
SoChannelgetChannelID 在接口中 SoChannel<EmbeddedChannel>public long getCreatedTime()
SoChannelgetCreatedTime 在接口中 SoChannel<EmbeddedChannel>public long getLastActiveTime()
SoChannelgetLastActiveTime 在接口中 SoChannel<EmbeddedChannel>public boolean isListen()
SoChannelisListen 在接口中 SoChannel<EmbeddedChannel>public boolean isServer()
SoChannelNetChannelisServer 在接口中 SoChannel<EmbeddedChannel>public boolean isClient()
SoChannelNetChannelisClient 在接口中 SoChannel<EmbeddedChannel>public SocketAddress getLocalAddr()
SoChannelSocketAddressgetLocalAddr 在接口中 SoChannel<EmbeddedChannel>public SocketAddress getRemoteAddr()
SoChannelgetRemoteAddr 在接口中 SoChannel<EmbeddedChannel>public SoContext getContext()
SoChannelgetContext 在接口中 SoChannel<EmbeddedChannel>public <T> T findPipeContext(Class<T> serviceType)
SoChannelPipeContextfindPipeContext 在接口中 SoChannel<EmbeddedChannel>public net.hasor.cobble.concurrent.future.Future<EmbeddedChannel> close()
SoChannelThe SoChannel.closeNow() and SoChannel.close() methods are valid if they are called first
close 在接口中 SoChannel<EmbeddedChannel>public net.hasor.cobble.concurrent.future.Future<EmbeddedChannel> closeNow()
SoChannelcloseNow 在接口中 SoChannel<EmbeddedChannel>public boolean isClose()
SoChannelisClose 在接口中 SoChannel<EmbeddedChannel>public boolean isShutdownInput()
NetDuplexChannelisShutdownInput 在接口中 NetDuplexChannel<EmbeddedChannel>public void shutdownInput()
NetDuplexChannelshutdownInput 在接口中 NetDuplexChannel<EmbeddedChannel>public void ignoreReadEofFlag()
NetDuplexChannelWhen shutdownOutput is called remotely, an end of read flag was encountered, which usually means closing the channel. But the remote still has the ability to receive data.
so use NetDuplexChannel.ignoreReadEofFlag() method, keep the channel state and continue to send data
Once NetDuplexChannel.ignoreReadEofFlag() is activated, the release of remote connections needs to be managed manually,
leading to NetChannel leakage if not released in time
ignoreReadEofFlag 在接口中 NetDuplexChannel<EmbeddedChannel>public boolean isShutdownOutput()
NetDuplexChannelisShutdownOutput 在接口中 NetDuplexChannel<EmbeddedChannel>public void shutdownOutput()
NetDuplexChannelshutdownOutput 在接口中 NetDuplexChannel<EmbeddedChannel>public PipeStatistical getPipeStatistical()
public void receive(Object... object)
SoChannel.object - the messages to be writtenpublic void receiveTo(String pipeName, Object... object)
SoChannel, the message will only be sent to the specific protocol layerpipeName - specific protocol layerobject - the messages to be writtenpublic void receiveError(Throwable e)
SoChannel.e - the messages to be writtenpublic void receiveError(String pipeName, Throwable e)
SoChannel, the message will only be sent to the specific protocol layere - the messages to be writtenpublic int getRcvSize()
SoChannel.public boolean hasRcvError()
public Throwable getRcvError()
public void clearRcvError()
public void send(Object... object)
SoChannel.object - the messages to be writtenpublic void sendTo(String pipeName, Object... object)
SoChannel, the message will only be sent to the specific protocol layerpipeName - specific protocol layerobject - the messages to be writtenpublic void sendError(Throwable e)
SoChannel.e - the messages to be writtenpublic void sendError(String pipeName, Throwable e)
SoChannel, the message will only be sent to the specific protocol layere - the messages to be writtenpublic Object[] readSndArray(int readSize)
SoChannel.public int getSndSize()
SoChannel.public boolean hasSndError()
public Throwable getSndError()
public void clearSndError()
public void printStackTrace()
public void printStackTrace(PrintStream s)
s - PrintStream to use for outputCopyright © 2022–2024. All rights reserved.