Class LocalMessageEnvironment
- java.lang.Object
-
- org.apache.nemo.runtime.common.message.local.LocalMessageEnvironment
-
- All Implemented Interfaces:
MessageEnvironment
public final class LocalMessageEnvironment extends java.lang.Object implements MessageEnvironment
A simpleMessageEnvironment
implementation that works on a single node. Used for unit tests.
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.reef.tang.Configuration
LOCAL_MESSAGE_ENVIRONMENT_CONFIGURATION
-
Fields inherited from interface org.apache.nemo.runtime.common.message.MessageEnvironment
BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID, EXECUTOR_MESSAGE_LISTENER_ID, MASTER_COMMUNICATION_ID, PIPE_MANAGER_MASTER_MESSAGE_LISTENER_ID, RUNTIME_MASTER_MESSAGE_LISTENER_ID
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> java.util.concurrent.Future<MessageSender<T>>
asyncConnect(java.lang.String targetId, java.lang.String messageTypeId)
Asynchronously connect to the node calledreceiverId
and return a future ofMessageSender
that sends messages to the listener withlistenerId
.void
close()
Close this message environment.static org.apache.reef.tang.Injector
forkInjector(org.apache.reef.tang.Injector baseInjector, java.lang.String senderId)
java.lang.String
getId()
void
removeListener(java.lang.String listenerId)
Remove theMessageListener
bound to a specific listener ID.<T> void
setupListener(java.lang.String listenerId, MessageListener<T> listener)
Set up aMessageListener
with a listener id.
-
-
-
Method Detail
-
setupListener
public <T> void setupListener(java.lang.String listenerId, MessageListener<T> listener)
Description copied from interface:MessageEnvironment
Set up aMessageListener
with a listener id.- Specified by:
setupListener
in interfaceMessageEnvironment
- Type Parameters:
T
- The type of the message to be sent in the environment- Parameters:
listenerId
- an identifier of the message listenerlistener
- a message listener
-
removeListener
public void removeListener(java.lang.String listenerId)
Description copied from interface:MessageEnvironment
Remove theMessageListener
bound to a specific listener ID.- Specified by:
removeListener
in interfaceMessageEnvironment
- Parameters:
listenerId
- the ID of the listener to remove.
-
asyncConnect
public <T> java.util.concurrent.Future<MessageSender<T>> asyncConnect(java.lang.String targetId, java.lang.String messageTypeId)
Description copied from interface:MessageEnvironment
Asynchronously connect to the node calledreceiverId
and return a future ofMessageSender
that sends messages to the listener withlistenerId
.- Specified by:
asyncConnect
in interfaceMessageEnvironment
- Type Parameters:
T
- The type of the message to be sent in the environment- Parameters:
targetId
- a receiver idmessageTypeId
- an identifier of the message listener- Returns:
- a message sender
-
getId
public java.lang.String getId()
- Specified by:
getId
in interfaceMessageEnvironment
- Returns:
- identifier for this node
-
close
public void close()
Description copied from interface:MessageEnvironment
Close this message environment.- Specified by:
close
in interfaceMessageEnvironment
-
forkInjector
public static org.apache.reef.tang.Injector forkInjector(org.apache.reef.tang.Injector baseInjector, java.lang.String senderId) throws org.apache.reef.tang.exceptions.InjectionException
- Parameters:
baseInjector
- provided byLocalMessageDispatcher.getInjector()
orLocalMessageDispatcher.forkInjector(Injector)
senderId
- the identifier for the sender- Returns:
- an
Injector
which hasLocalMessageDispatcher
instance forMessageEnvironment
- Throws:
org.apache.reef.tang.exceptions.InjectionException
- when fails to injectMessageEnvironment
-
-