Class PeerDiscoveryThread

java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.server.peer.PeerDiscoveryThread
All Implemented Interfaces:
Runnable

public class PeerDiscoveryThread extends org.jppf.utils.concurrent.ThreadSynchronization implements Runnable
Instances of this class discover peer drivers over the network.
Author:
Laurent Cohen
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Defines a callback for objects wishing to be notified of discovery events.
  • Field Summary

    Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    stopped
  • Constructor Summary

    Constructors
    Constructor
    Description
    PeerDiscoveryThread(org.jppf.utils.TypedProperties config, org.jppf.comm.discovery.IPFilter ipFilter, org.jppf.comm.discovery.JPPFConnectionInformation localInfo, PeerDiscoveryThread.ConnectionHandler connectionHandler)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
    Add the specified connection information to discovered map.
    Set<org.jppf.comm.discovery.JPPFConnectionInformation>
    Contains the set of retrieved connection information objects.
    protected boolean
    hasConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
    Determine whether a connection information object is already discovered.
    protected void
    onNewConnection(String name, org.jppf.comm.discovery.JPPFConnectionInformation info)
    Add a newly found connection.
    boolean
    removeConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
    Remove a disconnected connection.
    void
    run()
    Lookup server configurations from UDP multicasts.

    Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PeerDiscoveryThread

      public PeerDiscoveryThread(org.jppf.utils.TypedProperties config, org.jppf.comm.discovery.IPFilter ipFilter, org.jppf.comm.discovery.JPPFConnectionInformation localInfo, PeerDiscoveryThread.ConnectionHandler connectionHandler)
      Default constructor.
      Parameters:
      config - the driver configuration.
      connectionHandler - handler for adding new connection
      ipFilter - for accepted IP addresses
      localInfo - Connection information for this JPPF driver.
  • Method Details

    • run

      public void run()
      Lookup server configurations from UDP multicasts.
      Specified by:
      run in interface Runnable
    • onNewConnection

      protected void onNewConnection(String name, org.jppf.comm.discovery.JPPFConnectionInformation info)
      Add a newly found connection.
      Parameters:
      name - for the connection
      info - the peer's connection information.
    • hasConnectionInformation

      protected boolean hasConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
      Determine whether a connection information object is already discovered.
      Parameters:
      info - the connection information to lookup.
      Returns:
      true if the connection information is in the map, false otherwise.
    • addConnectionInformation

      public void addConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
      Add the specified connection information to discovered map.
      Parameters:
      info - a JPPFConnectionInformation instance.
    • removeConnectionInformation

      public boolean removeConnectionInformation(org.jppf.comm.discovery.JPPFConnectionInformation info)
      Remove a disconnected connection.
      Parameters:
      info - connection info of the peer to remove
      Returns:
      whether connection was successfully removed
    • getInfoSet

      public Set<org.jppf.comm.discovery.JPPFConnectionInformation> getInfoSet()
      Contains the set of retrieved connection information objects.
      Returns:
      the list of discovered connection information.