Package jadex.platform.service.awareness
Class LocalNetworkAwarenessBaseAgent
- java.lang.Object
-
- jadex.platform.service.awareness.LocalNetworkAwarenessBaseAgent
-
- All Implemented Interfaces:
IAwarenessService
- Direct Known Subclasses:
BroadcastAwarenessAgent
,MulticastAwarenessAgent
public abstract class LocalNetworkAwarenessBaseAgent extends java.lang.Object implements IAwarenessService
Implements passive awareness via multicast.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
address
The address.protected IInternalAccess
agent
The agent.protected SlidingCuckooFilter
filter
The duplicate filter of the current search, if any.protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>>
newplatforms
The newly found platforms.protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>>
platforms
The currently known platforms.protected int
port
The receiver port.protected java.net.DatagramSocket
recvsocket
The socket to receive.protected IntermediateFuture<IComponentIdentifier>
search
The current search, if any.protected java.net.DatagramSocket
sendsocket
The socket to send.protected ITransportAddressService
tas
protected double
waitfactor
The search delay (time that is waited for responses from platforms) as factor of default/service call timeout (default 0.333..., i.e. a third of default/service call timeout).
-
Constructor Summary
Constructors Constructor Description LocalNetworkAwarenessBaseAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.util.List<TransportAddress>>
getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.void
init()
At startup create a multicast socket for listening.IIntermediateFuture<IComponentIdentifier>
searchPlatforms()
Try to find other platforms and finish after timeout.protected IFuture<java.lang.Void>
sendInfo(java.lang.String address, int port)
Send address info to a given multi or unicast address.void
shutdown()
Stop the service.
-
-
-
Field Detail
-
address
protected java.lang.String address
The address.
-
port
protected int port
The receiver port.
-
waitfactor
protected double waitfactor
The search delay (time that is waited for responses from platforms) as factor of default/service call timeout (default 0.333..., i.e. a third of default/service call timeout).
-
agent
protected IInternalAccess agent
The agent.
-
tas
protected ITransportAddressService tas
-
search
protected IntermediateFuture<IComponentIdentifier> search
The current search, if any.
-
filter
protected SlidingCuckooFilter filter
The duplicate filter of the current search, if any.
-
platforms
protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>> platforms
The currently known platforms.
-
newplatforms
protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>> newplatforms
The newly found platforms.
-
sendsocket
protected java.net.DatagramSocket sendsocket
The socket to send.
-
recvsocket
protected java.net.DatagramSocket recvsocket
The socket to receive.
-
-
Method Detail
-
init
public void init() throws java.lang.Exception
At startup create a multicast socket for listening.- Throws:
java.lang.Exception
-
shutdown
public void shutdown() throws java.lang.Exception
Stop the service.- Throws:
java.lang.Exception
-
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.
-
sendInfo
protected IFuture<java.lang.Void> sendInfo(java.lang.String address, int port)
Send address info to a given multi or unicast address.
-
-