Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

/**
* @author Paul Ferraro
*
*/
public interface AdvertiseListenerFactory {
public AdvertiseListener createListener(MCMPHandler handler, AdvertiseConfiguration config) throws IOException;
AdvertiseListener createListener(MCMPHandler handler, AdvertiseConfiguration config) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@
import org.jboss.modcluster.advertise.MulticastSocketFactory;

/**
* On Linux, we attempt to avoid cross-talk problem by binding the MulticastSocket to the multicast address, if possible. See
* {@linkplain https://jira.jboss.org/jira/browse/JGRP-777}
* On Linux, Solaris and HP-UX, we attempt to avoid cross-talk problem by binding the {@link MulticastSocket} to the
* multicast address, if possible. See <a href="https://jira.jboss.org/jira/browse/JGRP-777">JGRP-777</a>.
*
* @author Paul Ferraro
*/
public class MulticastSocketFactoryImpl implements MulticastSocketFactory {
final Logger log = Logger.getLogger(this.getClass());

private final boolean linuxlike;
private final boolean canBindMulticastSocket;

public MulticastSocketFactoryImpl() {
String value = this.getSystemProperty("os.name");
this.linuxlike = (value != null) && (value.toLowerCase().startsWith("linux") || value.toLowerCase().startsWith("mac") || value.toLowerCase().startsWith("hp"));
this.canBindMulticastSocket = (value != null) && (value.toLowerCase().startsWith("linux") ||
value.toLowerCase().startsWith("sun") || value.toLowerCase().startsWith("hp"));
}

private String getSystemProperty(final String key) {
Expand All @@ -65,13 +66,9 @@ public String run() {
return AccessController.doPrivileged(action);
}

/**
* @{inheritDoc
* @see org.jboss.modcluster.advertise.MulticastSocketFactory#createMulticastSocket(java.net.InetAddress, int)
*/
@Override
public MulticastSocket createMulticastSocket(InetAddress address, int port) throws IOException {
if ((address == null) || !this.linuxlike) return new MulticastSocket(port);
if ((address == null) || !this.canBindMulticastSocket) return new MulticastSocket(port);

if (!address.isMulticastAddress()) {
ModClusterLogger.LOGGER.createMulticastSocketWithUnicastAddress(address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.jboss.modcluster.mcmp.MCMPHandler;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;

Expand Down Expand Up @@ -100,7 +99,6 @@ public void tearDown() {
}

@Test
@Ignore("MODCLUSTER-432")
public void testBasicOperation() throws IOException, NoSuchAlgorithmException {
ArgumentCaptor<InetAddress> capturedAddress = ArgumentCaptor.forClass(InetAddress.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import org.jboss.modcluster.advertise.impl.MulticastSocketFactoryImpl;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

/**
Expand All @@ -51,7 +50,6 @@ public class MulticastSocketFactoryImplTestCase {
private static final int PORT = 23364;

@Test
@Ignore("MODCLUSTER-432")
public void testMulticastSocketNoCrossTalk() throws IOException {
InetAddress address = InetAddress.getByName(GROUP1);

Expand Down