Package org.drasyl.intravm
Class IntraVmDiscovery
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler<I,E,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler<I,Event,O,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexHandler<ApplicationMessage,ApplicationMessage,Address>
-
- org.drasyl.intravm.IntraVmDiscovery
-
- All Implemented Interfaces:
Handler
public class IntraVmDiscovery extends SimpleDuplexHandler<ApplicationMessage,ApplicationMessage,Address>
Uses shared memory to discover other drasyl nodes running on same JVM.Inspired by: https://github.com/actoron/jadex/blob/10e464b230d7695dfd9bf2b36f736f93d69ee314/platform/base/src/main/java/jadex/platform/service/awareness/IntraVMAwarenessAgent.java
-
-
Field Summary
Fields Modifier and Type Field Description static IntraVmDiscovery
INSTANCE
static String
INTRA_VM_DISCOVERY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
eventTriggered(HandlerContext ctx, Event event, CompletableFuture<Void> future)
Gets called if aEvent
was emitted.protected void
matchedRead(HandlerContext ctx, Address sender, ApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleInboundEventAwareHandler
.protected void
matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexHandler
matchedEventTriggered
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler
acceptOutbound, write
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, read
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Field Detail
-
INSTANCE
public static final IntraVmDiscovery INSTANCE
-
INTRA_VM_DISCOVERY
public static final String INTRA_VM_DISCOVERY
- See Also:
- Constant Field Values
-
-
Method Detail
-
eventTriggered
public void eventTriggered(HandlerContext ctx, Event event, CompletableFuture<Void> future)
Description copied from interface:Handler
Gets called if aEvent
was emitted.- Specified by:
eventTriggered
in interfaceHandler
- Overrides:
eventTriggered
in classSimpleDuplexHandler<ApplicationMessage,ApplicationMessage,Address>
- Parameters:
ctx
- handler contextevent
- the eventfuture
- a future for the message
-
matchedRead
protected void matchedRead(HandlerContext ctx, Address sender, ApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleInboundEventAwareHandler
Is called for each message of typeSimpleInboundEventAwareHandler
.- Specified by:
matchedRead
in classSimpleInboundEventAwareHandler<ApplicationMessage,Event,Address>
- Parameters:
ctx
- handler contextsender
- the sender of the messagemsg
- the messagefuture
- the future of the message
-
matchedWrite
protected void matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleDuplexEventAwareHandler
Is called for each message of typeSimpleDuplexEventAwareHandler
.- Specified by:
matchedWrite
in classSimpleDuplexEventAwareHandler<ApplicationMessage,Event,ApplicationMessage,Address>
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
-