org.livetribe.slp.spi
Class StandardAgentManager

java.lang.Object
  extended by org.livetribe.slp.spi.StandardAgentManager
All Implemented Interfaces:
AgentManager
Direct Known Subclasses:
StandardDirectoryAgentManager, StandardServiceAgentManager, StandardUserAgentManager

public abstract class StandardAgentManager
extends Object
implements AgentManager

Version:
$Rev: 200 $ $Date: 2006-08-09 14:17:10 +0200 (Wed, 09 Aug 2006) $

Field Summary
protected  Logger logger
           
 
Constructor Summary
StandardAgentManager()
           
 
Method Summary
 void addMessageListener(MessageListener listener, boolean udp)
           
protected  void closeNoExceptions(Socket socket)
           
protected  void configureTCPConnector(TCPConnector connector)
           
protected  void configureUDPConnector(UDPConnector connector)
           
protected  DAAdvert[] convergentDASrvRqst(SrvRqst message, long timeframe)
           
protected  List convergentMulticastSend(Rqst message, long timeframe, Converger converger)
          Implements the multicast convergence algorithm, with the extension of returning after the specified timeframe.
protected  SAAdvert[] convergentSASrvRqst(SrvRqst message, long timeframe)
           
protected  SrvRply[] convergentSrvRqst(SrvRqst message, long timeframe)
           
protected  TCPConnector createTCPConnector()
           
protected  UDPConnector createUDPConnector()
           
protected  void doStart()
           
protected  void doStop()
           
protected  int generateXID()
           
 int getMaxTransmissionUnit()
           
 InetAddress getMulticastAddress()
           
 long getMulticastMaxWait()
           
 long[] getMulticastTimeouts()
           
 int getNotificationPort()
           
 int getPort()
           
protected  TCPConnector getTCPConnector()
           
protected  UDPConnector getUDPConnector()
           
 boolean isRunning()
           
 void removeMessageListener(MessageListener listener, boolean udp)
           
protected  byte[] serializeMessage(Message message)
           
 void setMaxTransmissionUnit(int maxTransmissionUnit)
           
 void setMulticastAddress(InetAddress multicastAddress)
           
 void setMulticastMaxWait(long multicastMaxWait)
           
 void setMulticastTimeouts(long[] multicastTimeouts)
           
 void setNotificationPort(int notificationPort)
           
 void setPort(int port)
           
 void setTCPConnector(TCPConnector tcpConnector)
           
 void setUDPConnector(UDPConnector connector)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Logger logger
Constructor Detail

StandardAgentManager

public StandardAgentManager()
Method Detail

getMulticastAddress

public InetAddress getMulticastAddress()

setMulticastAddress

public void setMulticastAddress(InetAddress multicastAddress)

getPort

public int getPort()

setPort

public void setPort(int port)

getNotificationPort

public int getNotificationPort()

setNotificationPort

public void setNotificationPort(int notificationPort)

getMulticastMaxWait

public long getMulticastMaxWait()

setMulticastMaxWait

public void setMulticastMaxWait(long multicastMaxWait)

getMulticastTimeouts

public long[] getMulticastTimeouts()

setMulticastTimeouts

public void setMulticastTimeouts(long[] multicastTimeouts)

getMaxTransmissionUnit

public int getMaxTransmissionUnit()

setMaxTransmissionUnit

public void setMaxTransmissionUnit(int maxTransmissionUnit)

setUDPConnector

public void setUDPConnector(UDPConnector connector)

getUDPConnector

protected UDPConnector getUDPConnector()

setTCPConnector

public void setTCPConnector(TCPConnector tcpConnector)

getTCPConnector

protected TCPConnector getTCPConnector()

addMessageListener

public void addMessageListener(MessageListener listener,
                               boolean udp)
Specified by:
addMessageListener in interface AgentManager

removeMessageListener

public void removeMessageListener(MessageListener listener,
                                  boolean udp)
Specified by:
removeMessageListener in interface AgentManager

isRunning

public boolean isRunning()
Specified by:
isRunning in interface AgentManager

start

public void start()
           throws IOException
Specified by:
start in interface AgentManager
Throws:
IOException

doStart

protected void doStart()
                throws IOException
Throws:
IOException

createUDPConnector

protected UDPConnector createUDPConnector()
                                   throws IOException
Throws:
IOException

configureUDPConnector

protected void configureUDPConnector(UDPConnector connector)

createTCPConnector

protected TCPConnector createTCPConnector()
                                   throws IOException
Throws:
IOException

configureTCPConnector

protected void configureTCPConnector(TCPConnector connector)

stop

public void stop()
          throws IOException
Specified by:
stop in interface AgentManager
Throws:
IOException

doStop

protected void doStop()
               throws IOException
Throws:
IOException

generateXID

protected int generateXID()

closeNoExceptions

protected void closeNoExceptions(Socket socket)

serializeMessage

protected byte[] serializeMessage(Message message)

convergentDASrvRqst

protected DAAdvert[] convergentDASrvRqst(SrvRqst message,
                                         long timeframe)
                                  throws IOException
Throws:
IOException

convergentSASrvRqst

protected SAAdvert[] convergentSASrvRqst(SrvRqst message,
                                         long timeframe)
                                  throws IOException
Throws:
IOException

convergentSrvRqst

protected SrvRply[] convergentSrvRqst(SrvRqst message,
                                      long timeframe)
                               throws IOException
Throws:
IOException

convergentMulticastSend

protected List convergentMulticastSend(Rqst message,
                                       long timeframe,
                                       Converger converger)
                                throws IOException
Implements the multicast convergence algorithm, with the extension of returning after the specified timeframe. If the timeframe is negative, the plain multicast convergence algorithm is used.
The multicast convergence algorithm tries to give some sort of reliability to multicast and sends the message via multicast many times at different response timeouts until: a) all responses have been received, or b) no responses have been received and a timeout expires, or c) the number of responders cannot fit into a datagram of the size of the configured MTU.
The multicast convergence algorithm works in this way:
  1. Set the initial responder list to be empty
  2. Send the message via multicast, with the responder list
  3. Wait at most responseTimeout[i] and collect the replies
  4. Extract the responders from the replies into the responder list
  5. Increase i and go back to point 2
Exit point of the algorithm are when no responses are received (because ServiceAgents and DirectoryAgents drops messages containing their IP in the received responder list), or when a timeout expires.
The algorithm is described very briefly in RFC 2608, section 6.3

Returns:
A list of messages in response of the multicast send
Throws:
IOException


Copyright © 2006-2012 LiveTribe. All Rights Reserved.