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 SummaryFields 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.
 - 
Constructor SummaryConstructors Constructor Description LocalNetworkAwarenessBaseAgent()
 - 
Method SummaryAll 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- 
addressprotected java.lang.String address The address.
 - 
portprotected int port The receiver port.
 - 
waitfactorprotected 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).
 - 
agentprotected IInternalAccess agent The agent.
 - 
tasprotected ITransportAddressService tas 
 - 
searchprotected IntermediateFuture<IComponentIdentifier> search The current search, if any.
 - 
filterprotected SlidingCuckooFilter filter The duplicate filter of the current search, if any.
 - 
platformsprotected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>> platforms The currently known platforms.
 - 
newplatformsprotected java.util.Map<IComponentIdentifier,java.util.List<TransportAddress>> newplatforms The newly found platforms.
 - 
sendsocketprotected java.net.DatagramSocket sendsocket The socket to send.
 - 
recvsocketprotected java.net.DatagramSocket recvsocket The socket to receive.
 
- 
 - 
Method Detail- 
initpublic void init() throws java.lang.ExceptionAt startup create a multicast socket for listening.- Throws:
- java.lang.Exception
 
 - 
shutdownpublic void shutdown() throws java.lang.ExceptionStop the service.- Throws:
- java.lang.Exception
 
 - 
searchPlatformspublic 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 interface- IAwarenessService
 
 - 
getPlatformAddressespublic IFuture<java.util.List<TransportAddress>> getPlatformAddresses(IComponentIdentifier platformid) Gets the address for a platform ID using the awareness mechanism.- Specified by:
- getPlatformAddressesin interface- IAwarenessService
- Parameters:
- platformid- The platform ID.
- Returns:
- The transport addresses or null if not available.
 
 - 
sendInfoprotected IFuture<java.lang.Void> sendInfo(java.lang.String address, int port) Send address info to a given multi or unicast address.
 
- 
 
-