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.StringaddressThe address.protected IInternalAccessagentThe agent.protected SlidingCuckooFilterfilterThe duplicate filter of the current search, if any.protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>>newplatformsThe newly found platforms.protected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>>platformsThe currently known platforms.protected intportThe receiver port.protected java.net.DatagramSocketrecvsocketThe socket to receive.protected IntermediateFuture<IComponentIdentifier>searchThe current search, if any.protected java.net.DatagramSocketsendsocketThe socket to send.protected ITransportAddressServicetasprotected doublewaitfactorThe 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.voidinit()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.voidshutdown()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.ExceptionAt startup create a multicast socket for listening.- Throws:
java.lang.Exception
-
shutdown
public void shutdown() throws java.lang.ExceptionStop 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:
searchPlatformsin interfaceIAwarenessService
-
getPlatformAddresses
public IFuture<java.util.List<TransportAddress>> getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.- Specified by:
getPlatformAddressesin 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.
-
-