public interface Transport
| Modifier and Type | Method and Description |
|---|---|
<T extends RequestMessage> |
addRequestConsumer(Class<T> cls,
io.reactivex.functions.Consumer<T> consumer)
This methd allows to set callback instance for various
|
void |
ensureConnection(String id)
This method checks connection to the given node ID, and if it's not connected - establishes connection
|
String |
getRandomDownstreamFrom(String id,
String exclude)
This method returns random
|
String |
getRootId()
This method returns ID of the root node
|
String |
getUpstreamId()
This methos returns Id of the upstream node
|
String |
id()
This method returns id of the current transport
|
org.reactivestreams.Publisher<INDArrayMessage> |
incomingPublisher()
This method returns flow of messages for parameter server
|
boolean |
isConnected()
This method checks if all connections required for work are established
|
boolean |
isIntroduced()
This method checks if this node was properly introduced to driver
|
void |
launch()
This method starts this Transport instance
|
void |
launchAsMaster()
This method will start this Transport instance
|
void |
onMeshUpdate(MeshOrganizer mesh)
This method will be called if mesh update was received
PLEASE NOTE: This method will be called ONLY if new mesh differs from current one
|
void |
onRemap(String id)
This method will be called upon remap request
|
io.reactivex.functions.Consumer<VoidMessage> |
outgoingConsumer()
This method returns consumer that accepts messages for delivery
|
void |
processMessage(VoidMessage message)
This method will be invoked for all incoming messages
PLEASE NOTE: this method is mostly suited for tests
|
void |
propagateMessage(VoidMessage message,
PropagationMode mode)
This method will send message to the network, using tree structure
|
void |
sendMessage(VoidMessage message,
String id)
This method will send message to the node specified by Id
|
<T extends ResponseMessage> |
sendMessageBlocking(RequestMessage message,
String id)
This method will send message to specified node, and will return its response
|
<T extends ResponseMessage> |
sendMessageBlocking(RequestMessage message,
String id,
long waitTime,
TimeUnit timeUnit)
This method will send message to specified node, and will return its response
|
void |
setRestartCallback(RestartCallback callback)
This method allows to set callback instance, which will be called upon restart event
|
void |
shutdown()
This method shuts down this Transport instance
|
int |
totalNumberOfNodes()
This method returns total number of nodes known to this Transport
|
String id()
String getUpstreamId()
String getRandomDownstreamFrom(String id, String exclude)
id - exclude - io.reactivex.functions.Consumer<VoidMessage> outgoingConsumer()
org.reactivestreams.Publisher<INDArrayMessage> incomingPublisher()
void launch()
void launchAsMaster()
void shutdown()
void propagateMessage(VoidMessage message, PropagationMode mode) throws IOException
message - IOExceptionvoid sendMessage(VoidMessage message, String id)
message - id - <T extends ResponseMessage> T sendMessageBlocking(RequestMessage message, String id) throws InterruptedException
T - message - id - InterruptedException<T extends ResponseMessage> T sendMessageBlocking(RequestMessage message, String id, long waitTime, TimeUnit timeUnit) throws InterruptedException
T - message - id - InterruptedExceptionvoid processMessage(VoidMessage message)
message - void setRestartCallback(RestartCallback callback)
callback - <T extends RequestMessage> void addRequestConsumer(Class<T> cls, io.reactivex.functions.Consumer<T> consumer)
T1 - RequestMessage classT2 - ResponseMessage classcls - callback - void onMeshUpdate(MeshOrganizer mesh)
mesh - void onRemap(String id)
id - int totalNumberOfNodes()
String getRootId()
boolean isConnected()
boolean isIntroduced()
void ensureConnection(String id)
id - Copyright © 2021. All rights reserved.