Class BPING

All Implemented Interfaces:
Runnable, Lifecycle

public class BPING extends PING implements Runnable
Broadcast PING. Uses UDP broadcasts to discover initial membership. This protocol is useless in IPv6 environments, as IPv6 has no notion of broadcast addresses. Use IP multicasts instead (e.g. PING or MPING) when running in IPv6.
Since:
2.12
  • Field Details

    • dest

      protected String dest
    • bind_port

      protected int bind_port
    • port_range

      protected int port_range
    • sock

      protected DatagramSocket sock
    • receiver

      protected volatile Thread receiver
    • dest_addr

      protected InetAddress dest_addr
  • Constructor Details

    • BPING

      public BPING()
  • Method Details

    • getBindPort

      public int getBindPort()
    • setBindPort

      public BPING setBindPort(int bind_port)
    • init

      public void init() throws Exception
      Description copied from class: Protocol
      Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
      Specified by:
      init in interface Lifecycle
      Overrides:
      init in class Discovery
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
    • start

      public void start() throws Exception
      Description copied from class: Protocol
      This method is called on a JChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top.
      Specified by:
      start in interface Lifecycle
      Overrides:
      start in class Discovery
      Throws:
      Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so JChannel.connect(String) will throw an exception
    • startReceiver

      private void startReceiver()
    • stop

      public void stop()
      Description copied from class: Protocol
      Called on a JChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
      Specified by:
      stop in interface Lifecycle
      Overrides:
      stop in class Discovery
    • sendMcastDiscoveryRequest

      protected void sendMcastDiscoveryRequest(Message msg)
      Overrides:
      sendMcastDiscoveryRequest in class PING
    • run

      public void run()
      Specified by:
      run in interface Runnable