public class Client extends ConnectionWithStatus implements IStatefulObject, ISaslClient
A Netty client for sending task messages to a remote destination (Netty server).
Implementation details:
ConnectionWithStatus.Status
Modifier and Type | Field and Description |
---|---|
protected String |
dstAddressPrefixedName |
Modifier and Type | Method and Description |
---|---|
void |
channelConnected(org.jboss.netty.channel.Channel channel)
ISaslClient interface
|
void |
channelReady() |
void |
close()
Gracefully close this client.
|
Map |
getConfig() |
InetSocketAddress |
getDstAddress() |
Map<Integer,Load> |
getLoad(Collection<Integer> tasks)
Get the current load for the given tasks
|
Object |
getState() |
String |
name() |
void |
notifyInterestChanged(org.jboss.netty.channel.Channel channel)
Called by Netty thread on change in channel interest
|
void |
registerRecv(IConnectionCallback cb)
Receiving messages is not supported by a client.
|
String |
secretKey() |
void |
send(int taskId,
byte[] payload)
send a message with taskId and payload
|
void |
send(Iterator<TaskMessage> msgs)
Enqueue task messages to be sent to the remote destination (cf.
|
void |
sendLoadMetrics(Map<Integer,Double> taskToLoad)
Send load metrics to all downstream connections.
|
ConnectionWithStatus.Status |
status()
Note: Storm will check via this method whether a worker can be activated safely during the initial startup of a topology.
|
String |
toString() |
protected final String dstAddressPrefixedName
public ConnectionWithStatus.Status status()
Note: Storm will check via this method whether a worker can be activated safely during the initial startup of a topology. The worker will only be activated once all of the its connections are ready.
status
in class ConnectionWithStatus
public void registerRecv(IConnectionCallback cb)
Receiving messages is not supported by a client.
registerRecv
in interface IConnection
cb
- the callback to process the messages.UnsupportedOperationException
- whenever this method is being called.public void sendLoadMetrics(Map<Integer,Double> taskToLoad)
IConnection
Send load metrics to all downstream connections.
sendLoadMetrics
in interface IConnection
taskToLoad
- a map from the task id to the load for that task.public void send(int taskId, byte[] payload)
IConnection
send a message with taskId and payload
send
in interface IConnection
taskId
- task IDpublic void send(Iterator<TaskMessage> msgs)
Enqueue task messages to be sent to the remote destination (cf. host
and port
).
send
in interface IConnection
public InetSocketAddress getDstAddress()
public void close()
Gracefully close this client.
close
in interface IConnection
public Map<Integer,Load> getLoad(Collection<Integer> tasks)
IConnection
Get the current load for the given tasks
getLoad
in interface IConnection
tasks
- the tasks to look for.public Object getState()
getState
in interface IStatefulObject
public Map getConfig()
public void channelConnected(org.jboss.netty.channel.Channel channel)
ISaslClient interface
channelConnected
in interface ISaslClient
public void channelReady()
channelReady
in interface ISaslClient
public String name()
name
in interface ISaslClient
public String secretKey()
secretKey
in interface ISaslClient
public void notifyInterestChanged(org.jboss.netty.channel.Channel channel)
Called by Netty thread on change in channel interest
channel
- Copyright © 2019 The Apache Software Foundation. All Rights Reserved.