Package jadex.platform.service.awareness
Class LocalHostAwarenessAgent
- java.lang.Object
-
- jadex.platform.service.awareness.LocalHostAwarenessAgent
-
- All Implemented Interfaces:
IAwarenessService
public class LocalHostAwarenessAgent extends java.lang.Object implements IAwarenessService
Uses the filesystem to find other platforms on the same host.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent access.protected static java.io.File
DISCOVERY_DIR
The discovery directory.protected boolean
doscan
Do scan flag.protected java.io.File
lastpostedfile
The last awareness file that has been posted.protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>>
platforms
The internal catalog.protected ITransportAddressService
tas
protected java.nio.file.WatchService
watchservice
The directory watch service.
-
Constructor Summary
Constructors Constructor Description LocalHostAwarenessAgent()
Creates the agent empty.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
end(java.lang.Exception e)
Implements the start.IFuture<java.util.List<TransportAddress>>
getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.protected void
postInfo()
Post awareness info via file system.protected void
scan()
Scans for new local awareness infos.IIntermediateFuture<IComponentIdentifier>
searchPlatforms()
Try to find other platforms and finish after timeout.void
start()
Implements the start.
-
-
-
Field Detail
-
DISCOVERY_DIR
protected static final java.io.File DISCOVERY_DIR
The discovery directory.
-
agent
protected IInternalAccess agent
The agent access.
-
tas
protected ITransportAddressService tas
-
platforms
protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>> platforms
The internal catalog.
-
lastpostedfile
protected java.io.File lastpostedfile
The last awareness file that has been posted.
-
watchservice
protected java.nio.file.WatchService watchservice
The directory watch service.
-
doscan
protected boolean doscan
Do scan flag.
-
-
Method Detail
-
start
public void start()
Implements the start.
-
end
public IFuture<java.lang.Void> end(java.lang.Exception e)
Implements the start.
-
postInfo
protected void postInfo()
Post awareness info via file system.
-
searchPlatforms
public IIntermediateFuture<IComponentIdentifier> searchPlatforms()
Try to find other platforms and finish after timeout. Immediately returns known platforms and concurrently issues a new search, waiting for replies until the timeout.- Specified by:
searchPlatforms
in interfaceIAwarenessService
-
getPlatformAddresses
public IFuture<java.util.List<TransportAddress>> getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.- Specified by:
getPlatformAddresses
in interfaceIAwarenessService
- Parameters:
platformid
- The platform ID.- Returns:
- The transport addresses or null if not available.
-
scan
protected void scan()
Scans for new local awareness infos.
-
-