org.jgroups.protocols
Class BPING

java.lang.Object
  extended by org.jgroups.stack.Protocol
      extended by org.jgroups.protocols.Discovery
          extended by org.jgroups.protocols.PING
              extended by org.jgroups.protocols.BPING
All Implemented Interfaces:
java.lang.Runnable

public class BPING
extends PING
implements java.lang.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
Author:
Bela Ban

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.Responses
 
Field Summary
protected  int bind_port
           
protected  java.lang.String dest
           
protected  java.net.InetAddress dest_addr
           
protected  int port_range
           
protected  java.lang.Thread receiver
           
protected  java.net.DatagramSocket sock
           
 
Fields inherited from class org.jgroups.protocols.Discovery
break_on_coord_rsp, current_coord, force_sending_discovery_rsps, group_addr, is_coord, is_leaving, is_server, local_addr, members, num_discovery_requests, num_initial_members, num_initial_srv_members, ping_responses, return_entire_cache, stagger_timeout, timeout, timer, use_disk_cache, view
 
Fields inherited from class org.jgroups.stack.Protocol
down_prot, ergonomics, id, log, name, stack, stats, up_prot
 
Constructor Summary
BPING()
           
 
Method Summary
 int getBindPort()
           
 void init()
          Called after instance has been created (null constructor) and before protocol is started.
 void run()
           
protected  void sendMcastDiscoveryRequest(Message msg)
           
 void setBindPort(int bind_port)
           
 void start()
          This method is called on a Channel.connect(String).
 void stop()
          This method is called on a Channel.disconnect().
 
Methods inherited from class org.jgroups.protocols.PING
fetchClusterMembers, isDynamic, sendDiscoveryRequestsInParallel
 
Methods inherited from class org.jgroups.protocols.Discovery
deserialize, discoveryRequestReceived, down, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembersAsString, findMembers, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getTimeout, getView, getViewId, handleConnect, handleDisconnect, isMergeRunning, providedUpServices, resetStats, sendDiscoveryRequest, sendDiscoveryResponse, serializeWithoutView, setForceSendingDiscoveryRsps, setNumInitialMembers, setTimeout, up
 
Methods inherited from class org.jgroups.stack.Protocol
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dest

protected java.lang.String dest

bind_port

protected int bind_port

port_range

protected int port_range

sock

protected java.net.DatagramSocket sock

receiver

protected volatile java.lang.Thread receiver

dest_addr

protected java.net.InetAddress dest_addr
Constructor Detail

BPING

public BPING()
Method Detail

getBindPort

public int getBindPort()

setBindPort

public void setBindPort(int bind_port)

init

public void init()
          throws java.lang.Exception
Description copied from class: Protocol
Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.

Overrides:
init in class Discovery
Throws:
java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception

start

public void start()
           throws java.lang.Exception
Description copied from class: Protocol
This method is called on a Channel.connect(String). Starts work. Protocols are connected and queues are ready to receive events. Will be called from bottom to top. This call will replace the START and START_OK events.

Overrides:
start in class Discovery
Throws:
java.lang.Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so Channel.connect(String) will throw an exception

stop

public void stop()
Description copied from class: Protocol
This method is called on a Channel.disconnect(). Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed

Overrides:
stop in class Discovery

sendMcastDiscoveryRequest

protected void sendMcastDiscoveryRequest(Message msg)
Overrides:
sendMcastDiscoveryRequest in class Discovery

run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.