Package herddb.network.netty
Class AbstractChannel
- java.lang.Object
-
- herddb.network.Channel
-
- herddb.network.netty.AbstractChannel
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
LocalVMChannel,NettyChannel
public abstract class AbstractChannel extends Channel
Common implementation.- Author:
- eolivelli
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class herddb.network.Channel
Channel.PduCallback
-
-
Field Summary
Fields Modifier and Type Field Description static StringADDRESS_JVM_LOCALprotected booleanioErrors-
Fields inherited from class herddb.network.Channel
messagesReceiver
-
-
Constructor Summary
Constructors Constructor Description AbstractChannel(String name, String remoteAddress, ExecutorService callbackexecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidchannelIdle()voidclose()protected abstract StringdescribeSocket()voiddirectProcessPdu(Pdu message)Esecute processing (mostly) in the same threadprotected abstract voiddoClose()longgetId()StringgetRemoteAddress()booleanisClosed()voidpduReceived(Pdu message)This method is intended to be used while serving a PDU coming from Networkprotected longpendingCallbacks()voidsendReplyMessage(long inAnswerTo, io.netty.buffer.ByteBuf message)voidsendRequestWithAsyncReply(long id, io.netty.buffer.ByteBuf message, long timeout, Channel.PduCallback callback)-
Methods inherited from class herddb.network.Channel
generateRequestId, getMessagesReceiver, getName, isLocalChannel, isValid, sendMessageWithPduReply, sendOneWayMessage, setMessagesReceiver
-
-
-
-
Field Detail
-
ADDRESS_JVM_LOCAL
public static final String ADDRESS_JVM_LOCAL
- See Also:
- Constant Field Values
-
ioErrors
protected boolean ioErrors
-
-
Constructor Detail
-
AbstractChannel
public AbstractChannel(String name, String remoteAddress, ExecutorService callbackexecutor)
-
-
Method Detail
-
pendingCallbacks
protected final long pendingCallbacks()
-
getId
public final long getId()
-
pduReceived
public final void pduReceived(Pdu message)
This method is intended to be used while serving a PDU coming from Network- Parameters:
message-
-
directProcessPdu
public final void directProcessPdu(Pdu message)
Esecute processing (mostly) in the same thread- Parameters:
message-
-
sendReplyMessage
public final void sendReplyMessage(long inAnswerTo, io.netty.buffer.ByteBuf message)- Specified by:
sendReplyMessagein classChannel
-
sendRequestWithAsyncReply
public final void sendRequestWithAsyncReply(long id, io.netty.buffer.ByteBuf message, long timeout, Channel.PduCallback callback)- Specified by:
sendRequestWithAsyncReplyin classChannel
-
describeSocket
protected abstract String describeSocket()
-
doClose
protected abstract void doClose()
-
close
public final void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classChannel
-
getRemoteAddress
public final String getRemoteAddress()
- Specified by:
getRemoteAddressin classChannel
-
channelIdle
public final void channelIdle()
- Specified by:
channelIdlein classChannel
-
-