Class LocalNetwork
java.lang.Object
com.yahoo.messagebus.network.local.LocalNetwork
- All Implemented Interfaces:
Network
- Author:
- Simon Thoresen Hult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallocServiceAddress(RoutingNode recipient) Resolves the service address of the recipient referenced by the given routing node.voidattach(NetworkOwner owner) Attach the network layer to the given owner.voidfreeServiceAddress(RoutingNode recipient) Frees the service address from the given routing node.Returns a string that represents the connection specs of this network.com.yahoo.jrt.slobrok.api.IMirrorReturns a reference to a name server mirror.voidregisterSession(String session) Register a session name with the network layer.voidsend(Message msg, List<RoutingNode> recipients) Send a message to the given recipients.voidshutdown()Shuts down the network.voidsync()Synchronize with internal threads.voidunregisterSession(String session) Unregister a session name with the network layer.booleanwaitUntilReady(double seconds) Waits for at most the given number of seconds for all dependencies to become ready.
-
Constructor Details
-
LocalNetwork
public LocalNetwork() -
LocalNetwork
-
-
Method Details
-
waitUntilReady
public boolean waitUntilReady(double seconds) Description copied from interface:NetworkWaits for at most the given number of seconds for all dependencies to become ready.- Specified by:
waitUntilReadyin interfaceNetwork- Parameters:
seconds- the timeout- Returns:
- true if ready
-
attach
Description copied from interface:NetworkAttach the network layer to the given owner. -
registerSession
Description copied from interface:NetworkRegister a session name with the network layer. This will make the session visible to other nodes.- Specified by:
registerSessionin interfaceNetwork- Parameters:
session- the session name
-
unregisterSession
Description copied from interface:NetworkUnregister a session name with the network layer. This will make the session unavailable for other nodes.- Specified by:
unregisterSessionin interfaceNetwork- Parameters:
session- session name
-
allocServiceAddress
Description copied from interface:NetworkResolves the service address of the recipient referenced by the given routing node. If a recipient can not be resolved, this method tags the node with an error. If this method succeeds, you need to invokeNetwork.freeServiceAddress(RoutingNode)once you are done with the service address.- Specified by:
allocServiceAddressin interfaceNetwork- Parameters:
recipient- the node whose service address to allocate- Returns:
- true if a service address was allocated
-
freeServiceAddress
Description copied from interface:NetworkFrees the service address from the given routing node. This allows the network layer to track and close connections as required.- Specified by:
freeServiceAddressin interfaceNetwork- Parameters:
recipient- the node whose service address to free
-
send
Description copied from interface:NetworkSend a message to the given recipients. ARoutingNodecontains all the necessary context for sending. -
sync
public void sync()Description copied from interface:NetworkSynchronize with internal threads. This method will handshake with all internal threads. This has the implicit effect of waiting for all active callbacks. Note that this method should never be invoked from a callback since that would make the thread wait for itself... forever. This method is typically used to untangle during session shutdown. -
shutdown
public void shutdown()Description copied from interface:NetworkShuts down the network. This is a blocking call that waits for all scheduled tasks to complete. -
getConnectionSpec
Description copied from interface:NetworkReturns a string that represents the connection specs of this network. It is in not a complete address since it know nothing of the sessions that run on it.- Specified by:
getConnectionSpecin interfaceNetwork
-
getMirror
public com.yahoo.jrt.slobrok.api.IMirror getMirror()Description copied from interface:NetworkReturns a reference to a name server mirror.
-