Skip to content

Commit 61bf4cf

Browse files
committed
Sending I_AM_NOT_DEAD response back as multicast (if enabled) [https://issues.jboss.org/browse/JGRP-1591]
1 parent 66fee6c commit 61bf4cf

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/org/jgroups/protocols/VERIFY_SUSPECT.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,27 @@ public class VERIFY_SUSPECT extends Protocol implements Runnable {
3131
/* ------------------------------------------ Properties ------------------------------------------ */
3232

3333
@Property(description="Number of millisecs to wait for a response from a suspected member")
34-
private long timeout=2000;
34+
protected long timeout=2000;
3535

3636
@Property(description="Number of verify heartbeats sent to a suspected member")
37-
private int num_msgs=1;
37+
protected int num_msgs=1;
3838

3939
@Property(description="Use InetAddress.isReachable() to verify suspected member instead of regular messages")
40-
private boolean use_icmp=false;
40+
protected boolean use_icmp=false;
41+
42+
@Property(description="Send the I_AM_NOT_DEAD message back as a multicast rather than as multiple unicasts " +
43+
"(default is false)")
44+
protected boolean use_mcast_rsps=false;
4145

4246
@LocalAddress
4347
@Property(description="Interface for ICMP pings. Used if use_icmp is true " +
4448
"The following special values are also recognized: GLOBAL, SITE_LOCAL, LINK_LOCAL and NON_LOOPBACK",
4549
systemProperty={Global.BIND_ADDR})
46-
private InetAddress bind_addr; // interface for ICMP pings
50+
protected InetAddress bind_addr; // interface for ICMP pings
4751

4852
@Property(name="bind_interface", converter=PropertyConverters.BindInterface.class,
4953
description="The interface (NIC) which should be used by this transport", dependsUpon="bind_addr")
50-
protected String bind_interface_str=null;
54+
protected String bind_interface_str=null;
5155

5256
/* --------------------------------------------- Fields ------------------------------------------------ */
5357

@@ -115,10 +119,10 @@ public Object up(Event evt) {
115119
}
116120
else {
117121
Message rsp;
122+
Address target=use_mcast_rsps? null : hdr.from;
118123
for(int i=0; i < num_msgs; i++) {
119-
rsp=new Message(hdr.from, null, null);
120-
rsp.setFlag(Message.OOB);
121-
rsp.putHeader(this.id, new VerifyHeader(VerifyHeader.I_AM_NOT_DEAD, local_addr));
124+
rsp=new Message(target).setFlag(Message.OOB)
125+
.putHeader(this.id, new VerifyHeader(VerifyHeader.I_AM_NOT_DEAD, local_addr));
122126
down_prot.down(new Event(Event.MSG, rsp));
123127
}
124128
}
@@ -271,7 +275,7 @@ public void unsuspect(Address mbr) {
271275
}
272276

273277

274-
private synchronized void startTimer() {
278+
protected synchronized void startTimer() {
275279
if(timer == null || !timer.isAlive()) {
276280
timer=getThreadFactory().newThread(this,"VERIFY_SUSPECT.TimerThread");
277281
timer.setDaemon(true);

0 commit comments

Comments
 (0)