summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-10-27 19:11:20 +0100
committerBenoit Foucher <benoit@zeroc.com>2014-10-27 19:11:20 +0100
commit8c701618a42fc6c08456e53154bac1a1d40f9534 (patch)
treec6683dbbd27d9d85aa9d9b139ca0e2bd175ef54d /java/src
parentICE-5781: UDP test failure with IPv6 on OS X (diff)
downloadice-8c701618a42fc6c08456e53154bac1a1d40f9534.tar.bz2
ice-8c701618a42fc6c08456e53154bac1a1d40f9534.tar.xz
ice-8c701618a42fc6c08456e53154bac1a1d40f9534.zip
Fixed IceDiscovery and IceGridDiscovery to check for Ice.PreferIPv6Address to configure UDP
Diffstat (limited to 'java/src')
-rw-r--r--java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java3
-rw-r--r--java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java3
-rw-r--r--java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java135
3 files changed, 81 insertions, 60 deletions
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java b/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
index 6be47ee2750..6fea4934d1e 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
+++ b/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
@@ -24,8 +24,9 @@ public class PluginI implements Ice.Plugin
Ice.Properties properties = _communicator.getProperties();
boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
String address;
- if(ipv4)
+ if(ipv4 && !preferIPv6)
{
address = properties.getPropertyWithDefault("IceDiscovery.Address", "239.255.0.1");
}
diff --git a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java b/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java
index 30c9c02301c..877910c6dac 100644
--- a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java
+++ b/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java
@@ -329,8 +329,9 @@ class DiscoveryPluginI implements Ice.Plugin
Ice.Properties properties = _communicator.getProperties();
boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
String address;
- if(ipv4)
+ if(ipv4 && !preferIPv6)
{
address = properties.getPropertyWithDefault("IceGridDiscovery.Address", "239.255.0.1");
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
index 52f9536fac5..4e739ac3290 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
@@ -1224,45 +1224,53 @@ public class SessionKeeper
final Ice.Properties properties = communicator.getProperties();
final String intf = properties.getProperty("IceGridAdmin.Discovery.Interface");
String lookupEndpoints = properties.getProperty("IceGridAdmin.Discovery.Lookup");
-
+ String address;
+ if(properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0 &&
+ properties.getPropertyAsInt("Ice.PreferIPv6Address") <= 0)
+ {
+ address = "239.255.0.1";
+ }
+ else
+ {
+ address = "ff15::1";
+ }
if(lookupEndpoints.isEmpty())
{
StringBuilder s = new StringBuilder();
s.append("udp -h \"");
- s.append(properties.getPropertyWithDefault("IceGridAdmin.Discovery.Address",
- (properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0) ? "239.255.0.1" : "ff15::1"));
+ s.append(properties.getPropertyWithDefault("IceGridAdmin.Discovery.Address", address));
s.append("\" -p ");
s.append(4061);
if(!intf.isEmpty())
{
- s.append(" --interface \"").append(intf);
+ s.append(" --interface \"").append(intf).append("\"");
}
lookupEndpoints = s.toString();
}
- final LookupPrx lookupPrx = LookupPrxHelper.uncheckedCast(
- communicator.stringToProxy("IceGrid/Lookup -d:" + lookupEndpoints).ice_collocationOptimized(false)
- .ice_router(null));
-
- new Thread(new Runnable()
+ try
{
- @Override
- public void run()
+ final LookupPrx lookupPrx = LookupPrxHelper.uncheckedCast(
+ communicator.stringToProxy("IceGrid/Lookup -d:" + lookupEndpoints).ice_collocationOptimized(false)
+ .ice_router(null));
+
+ new Thread(new Runnable()
{
- synchronized(SessionKeeper.this)
+ @Override
+ public void run()
{
- //
- // If search is in progress when refresh is hit, cancel the
- // finish task we will schedule a new one with this new
- // search.
- //
- if(_discoveryFinishTask != null)
- {
- _discoveryFinishTask.cancel();
- }
-
- if(_discoveryAdapter == null)
+ synchronized(SessionKeeper.this)
{
+ //
+ // If search is in progress when refresh is hit, cancel the
+ // finish task we will schedule a new one with this new
+ // search.
+ //
+ if(_discoveryFinishTask != null)
+ {
+ _discoveryFinishTask.cancel();
+ }
+
if(properties.getProperty("IceGridAdmin.Discovery.Reply.Endpoints").isEmpty())
{
StringBuilder s = new StringBuilder();
@@ -1273,41 +1281,44 @@ public class SessionKeeper
}
properties.setProperty("IceGridAdmin.Discovery.Reply.Endpoints", s.toString());
}
-
- _discoveryAdapter = communicator.createObjectAdapter("IceGridAdmin.Discovery.Reply");
- _discoveryAdapter.activate();
- _discoveryReplyPrx =
- LookupReplyPrxHelper.uncheckedCast(
- _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram());
- }
-
- try
- {
- lookupPrx.findLocator("", _discoveryReplyPrx);
- }
- catch(final Ice.LocalException ex)
- {
- ex.printStackTrace();
- destroyDisconveryAdapter();
- SwingUtilities.invokeLater(new Runnable()
+
+ try
{
- @Override
- public void run()
+ if(_discoveryAdapter == null)
{
- JOptionPane.showMessageDialog(ConnectionWizardDialog.this,
- ex.toString(),
- "Error while loopup locator endpoints",
- JOptionPane.ERROR_MESSAGE);
+ _discoveryAdapter = communicator.createObjectAdapter(
+ "IceGridAdmin.Discovery.Reply");
+ _discoveryAdapter.activate();
+ _discoveryReplyPrx =
+ LookupReplyPrxHelper.uncheckedCast(
+ _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram());
}
- });
- }
-
- //
- // We schedule a timer task to destroy the discovery adapter after 2
- // seconds, the user doesn't need to wait, discovered proxies are
- // added as they are found.
- //
- _discoveryFinishTask = new java.util.TimerTask()
+
+ lookupPrx.findLocator("", _discoveryReplyPrx);
+ }
+ catch(final Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ destroyDisconveryAdapter();
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ JOptionPane.showMessageDialog(ConnectionWizardDialog.this,
+ ex.toString(),
+ "Error while looking up locator endpoints",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+
+ //
+ // We schedule a timer task to destroy the discovery adapter after 2
+ // seconds, the user doesn't need to wait, discovered proxies are
+ // added as they are found.
+ //
+ _discoveryFinishTask = new java.util.TimerTask()
{
@Override
public void run()
@@ -1315,10 +1326,18 @@ public class SessionKeeper
destroyDisconveryAdapter();
}
};
- new java.util.Timer().schedule(_discoveryFinishTask, 2000);
+ new java.util.Timer().schedule(_discoveryFinishTask, 2000);
+ }
}
- }
- }).start();
+ }).start();
+ }
+ catch(Ice.LocalException ex)
+ {
+ JOptionPane.showMessageDialog(ConnectionWizardDialog.this,
+ ex.toString(),
+ "Error while looking up locator endpoints",
+ JOptionPane.ERROR_MESSAGE);
+ }
}
private void initialize(String title, final JDialog parent)