Class GossipProtocolCodec
- java.lang.Object
-
- io.hekate.cluster.internal.gossip.GossipProtocolCodec
-
- All Implemented Interfaces:
Codec<GossipProtocol>
,DecodeFunction<GossipProtocol>
,EncodeFunction<GossipProtocol>
public class GossipProtocolCodec extends Object implements Codec<GossipProtocol>
-
-
Constructor Summary
Constructors Constructor Description GossipProtocolCodec(AtomicReference<ClusterNodeId> localNodeIdRef)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<GossipProtocol>
baseType()
Returns the base data type that is supported by this codec.GossipProtocol
decode(DataReader in)
Decodes object from the provided reader.void
encode(GossipProtocol msg, DataWriter out)
Encodes object into the provided writer.boolean
isStateful()
Returnstrue
if this codec maintains an internal state and can't be shared among multiple threads or network connections.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.hekate.codec.DecodeFunction
decodeUnchecked
-
Methods inherited from interface io.hekate.codec.EncodeFunction
encodeUnchecked
-
-
-
-
Constructor Detail
-
GossipProtocolCodec
public GossipProtocolCodec(AtomicReference<ClusterNodeId> localNodeIdRef)
-
-
Method Detail
-
isStateful
public boolean isStateful()
Description copied from interface:Codec
Returnstrue
if this codec maintains an internal state and can't be shared among multiple threads or network connections.Stateful codecs are optimized for encoding/decoding data between two stream-based endpoints (i.e. endpoints that maintain some kind of persistent connection, for example TCP socket connections). Stateful codecs can rely on the fact that encoded data is always decoded by the same codec on the receiver side and can perform various optimizations like data compression based on auto-populating dictionaries.
- Specified by:
isStateful
in interfaceCodec<GossipProtocol>
- Returns:
true
if this codec maintains an internal state and can't be shared among multiple threads or network connections.
-
baseType
public Class<GossipProtocol> baseType()
Description copied from interface:Codec
Returns the base data type that is supported by this codec.- Specified by:
baseType
in interfaceCodec<GossipProtocol>
- Returns:
- Base data type that is supported by this codec.
-
encode
public void encode(GossipProtocol msg, DataWriter out) throws IOException
Description copied from interface:EncodeFunction
Encodes object into the provided writer.- Specified by:
encode
in interfaceEncodeFunction<GossipProtocol>
- Parameters:
msg
- Object to encode.out
- Data writer.- Throws:
IOException
- If object couldn't be encoded.
-
decode
public GossipProtocol decode(DataReader in) throws IOException
Description copied from interface:DecodeFunction
Decodes object from the provided reader.- Specified by:
decode
in interfaceDecodeFunction<GossipProtocol>
- Parameters:
in
- Data reader.- Returns:
- Decoded object.
- Throws:
IOException
- If object couldn't be decoded.
-
-