T - the type of data read by the client. Plain TCP use String, Lumberjack use Map<String,String>.public class Destination<T> extends Object implements INettyConnectionCallback, Comparable<Destination<T>>
Besides, it registers a connection callback to be told upon connection/disconnection of the underlying client. That is used to update the status (i.e. total weight) of the group.
| Constructor and Description |
|---|
Destination(int weight,
Group<T> group,
NettyTcpClient<T> client)
Ctor
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Destination<T> o) |
boolean |
equals(Object o) |
NettyTcpClient<T> |
getClient() |
int |
getWeight() |
int |
hashCode() |
boolean |
isConnected() |
void |
onConnected(NettyAbstractClient client)
Connection callback.
|
void |
onDisconnected(NettyAbstractClient client,
Throwable e)
Disconnection callback.
|
void |
start()
start this destination.
|
void |
stop()
Stop and shutdown this destination.
|
String |
toString() |
public Destination(int weight,
Group<T> group,
NettyTcpClient<T> client)
weight - the weight of a destinationgroup - the group it belongs tooclient - the corresponding netty clientpublic int getWeight()
public NettyTcpClient<T> getClient()
public void onConnected(NettyAbstractClient client)
INettyConnectionCallbackonConnected in interface INettyConnectionCallbackclient - your clientpublic void onDisconnected(NettyAbstractClient client, Throwable e)
INettyConnectionCallbackonDisconnected in interface INettyConnectionCallbackclient - your cliente - an optional cause. Possibly null after a regular closing.public void start()
public void stop()
public int compareTo(Destination<T> o)
compareTo in interface Comparable<Destination<T>>public boolean isConnected()
Copyright © 2023. All rights reserved.