Class GossipCommManager
- java.lang.Object
-
- io.hekate.cluster.internal.gossip.GossipCommManager
-
- All Implemented Interfaces:
NetworkServerHandler<GossipProtocol>
public class GossipCommManager extends Object implements NetworkServerHandler<GossipProtocol>
-
-
Constructor Summary
Constructors Constructor Description GossipCommManager(NetworkConnector<GossipProtocol> connector, ClusterAddress localAddress, GossipCommListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onConnect(GossipProtocol msg, NetworkEndpoint<GossipProtocol> client)
Called whenNetworkClient
connects to the server.void
onDisconnect(NetworkEndpoint<GossipProtocol> from)
Called when client connection is closed.void
onMessage(NetworkMessage<GossipProtocol> packet, NetworkEndpoint<GossipProtocol> from)
Called when new message is received from the client.void
send(GossipProtocol.GossipMessage msg, Runnable onComplete)
void
sendAndDisconnect(GossipProtocol msg)
void
stop()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.hekate.network.NetworkServerHandler
onFailure
-
-
-
-
Constructor Detail
-
GossipCommManager
public GossipCommManager(NetworkConnector<GossipProtocol> connector, ClusterAddress localAddress, GossipCommListener listener)
-
-
Method Detail
-
send
public void send(GossipProtocol.GossipMessage msg, Runnable onComplete)
-
sendAndDisconnect
public void sendAndDisconnect(GossipProtocol msg)
-
onConnect
public void onConnect(GossipProtocol msg, NetworkEndpoint<GossipProtocol> client)
Description copied from interface:NetworkServerHandler
Called whenNetworkClient
connects to the server.- Specified by:
onConnect
in interfaceNetworkServerHandler<GossipProtocol>
- Parameters:
msg
- Login message that was submitted by the client viaNetworkClient.connect(InetSocketAddress, Object, NetworkClientCallback)
method. If client haven't submitted any login message then this parameter will benull
.client
- Client connection.
-
onMessage
public void onMessage(NetworkMessage<GossipProtocol> packet, NetworkEndpoint<GossipProtocol> from) throws IOException
Description copied from interface:NetworkServerHandler
Called when new message is received from the client.- Specified by:
onMessage
in interfaceNetworkServerHandler<GossipProtocol>
- Parameters:
packet
- Message.from
- Client connection.- Throws:
IOException
- Message handling error.
-
onDisconnect
public void onDisconnect(NetworkEndpoint<GossipProtocol> from)
Description copied from interface:NetworkServerHandler
Called when client connection is closed.- Specified by:
onDisconnect
in interfaceNetworkServerHandler<GossipProtocol>
- Parameters:
from
- Client connection.
-
stop
public void stop()
-
-