在Jgroups中向协调员发送消息时如何设置发件人地址

How to set sender Address when sending message to co-ordinator in Jgroups

我们可以使用 Message() 对象向协调器发送消息。这里我们必须设置发件人地址和收件人地址。如果我想向协调员发送消息,那么我可以从视图中获取 get(0) 成员并将其用作目标地址。但是如何设置发件人地址,我应该使用我当前机器的IP地址,MAC地址还是其他地址?

您无需设置发件人地址;堆栈将为您填充它。

补充一点,你也可以点对点

Address  newAddress = getAddress();
org.jgroups.Message performMessage = new org.jgroups.Message();
performMessage.setDest(newAddress);
getChannel.send(performMessage);