mirror of https://github.com/apache/activemq.git
resolve: https://issues.apache.org/activemq/browse/AMQ-2842 - patch applied with thanks
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@979324 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ecc679b38
commit
af5d8d154a
|
@ -14,6 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.transport.discovery.multicast;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -83,6 +84,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
private long keepAliveInterval = DEFAULT_IDLE_TIME;
|
||||
private String mcInterface;
|
||||
private String mcNetworkInterface;
|
||||
private String mcJoinNetworkInterface;
|
||||
private long lastAdvertizeTime;
|
||||
private AtomicBoolean started = new AtomicBoolean(false);
|
||||
private boolean reportAdvertizeFailed = true;
|
||||
|
@ -259,6 +261,10 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
this.mcNetworkInterface = mcNetworkInterface;
|
||||
}
|
||||
|
||||
public void setJoinNetworkInterface(String mcJoinNetwrokInterface) {
|
||||
this.mcJoinNetworkInterface = mcJoinNetwrokInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* start the discovery agent
|
||||
*
|
||||
|
@ -299,6 +305,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
LOG.trace("start - group = " + group );
|
||||
LOG.trace("start - interface = " + mcInterface );
|
||||
LOG.trace("start - network interface = " + mcNetworkInterface );
|
||||
LOG.trace("start - join network interface = " + mcJoinNetworkInterface );
|
||||
}
|
||||
|
||||
this.inetAddress = InetAddress.getByName(myHost);
|
||||
|
@ -306,7 +313,12 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
|
|||
mcast = new MulticastSocket(myPort);
|
||||
mcast.setLoopbackMode(loopBackMode);
|
||||
mcast.setTimeToLive(getTimeToLive());
|
||||
mcast.joinGroup(inetAddress);
|
||||
if (mcJoinNetworkInterface != null) {
|
||||
mcast.joinGroup(sockAddress, NetworkInterface.getByName(mcJoinNetworkInterface));
|
||||
}
|
||||
else {
|
||||
mcast.joinGroup(inetAddress);
|
||||
}
|
||||
mcast.setSoTimeout((int)keepAliveInterval);
|
||||
if (mcInterface != null) {
|
||||
mcast.setInterface(InetAddress.getByName(mcInterface));
|
||||
|
|
Loading…
Reference in New Issue