summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2015-02-03 14:00:35 +0100
committerBenoit Foucher <benoit@zeroc.com>2015-02-03 14:00:35 +0100
commita46e190723a7678e92eccd46971a98f23df64115 (patch)
tree02c38e29b8a63a419092653339b9ceaefc176c3c /java/src
parentFixed (ICE-6235) - Update eclipse to support new JAR names (diff)
downloadice-a46e190723a7678e92eccd46971a98f23df64115.tar.bz2
ice-a46e190723a7678e92eccd46971a98f23df64115.tar.xz
ice-a46e190723a7678e92eccd46971a98f23df64115.zip
IceGridDiscovery is now IceLocatorDiscovery
Diffstat (limited to 'java/src')
-rw-r--r--java/src/IceGridGUI/build.gradle1
-rw-r--r--java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java10
-rw-r--r--java/src/IceLocatorDiscovery/build.gradle25
-rw-r--r--java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java (renamed from java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginFactoryI.java)14
-rw-r--r--java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java (renamed from java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java)88
5 files changed, 82 insertions, 56 deletions
diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle
index 24e9b383c5d..966c26e006c 100644
--- a/java/src/IceGridGUI/build.gradle
+++ b/java/src/IceGridGUI/build.gradle
@@ -38,6 +38,7 @@ configurations {
dependencies {
compile project(':ice')
+ compile project(':icelocatordiscovery')
compile project(':icebox')
compile project(':icegrid')
compile 'com.jgoodies:jgoodies-common:1.8.0'
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
index e18f5156666..abbeae1f98c 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
@@ -58,6 +58,12 @@ import java.security.MessageDigest;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
+import IceLocatorDiscovery.LookupPrx;
+import IceLocatorDiscovery.LookupPrxHelper;
+import IceLocatorDiscovery.LookupReplyPrx;
+import IceLocatorDiscovery.LookupReplyPrxHelper;
+import IceLocatorDiscovery._LookupReplyDisp;
+
import IceGrid.*;
//
@@ -1251,8 +1257,8 @@ public class SessionKeeper
try
{
final LookupPrx lookupPrx = LookupPrxHelper.uncheckedCast(
- communicator.stringToProxy("IceGrid/Lookup -d:" + lookupEndpoints).ice_collocationOptimized(false)
- .ice_router(null));
+ communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" +
+ lookupEndpoints).ice_collocationOptimized(false).ice_router(null));
new Thread(new Runnable()
{
diff --git a/java/src/IceLocatorDiscovery/build.gradle b/java/src/IceLocatorDiscovery/build.gradle
new file mode 100644
index 00000000000..1a47ef9dd78
--- /dev/null
+++ b/java/src/IceLocatorDiscovery/build.gradle
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+slice {
+ java {
+ include = ["${sliceDir}"]
+ args = "--ice"
+ files = fileTree(dir: "$sliceDir/IceLocatorDiscovery", includes:['*.ice'], excludes:["*F.ice"])
+ }
+}
+
+dependencies {
+ compile project(':ice')
+}
+
+apply from: "$rootProject.projectDir/gradle/library.gradle" \ No newline at end of file
diff --git a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginFactoryI.java b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java
index 98cff92f818..21192e48bc7 100644
--- a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginFactoryI.java
+++ b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGrid;
+package IceLocatorDiscovery;
-public class DiscoveryPluginFactoryI implements Ice.PluginFactory
+public class PluginFactory implements Ice.PluginFactory
{
- @Override
+ @Override
public Ice.Plugin
- create(Ice.Communicator communicator, String name, String[] args)
- {
- return new DiscoveryPluginI(communicator);
- }
+ create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI(communicator);
+ }
}
diff --git a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
index d0dbb020352..bbe3fd148ff 100644
--- a/java/src/IceGrid/src/main/java/IceGrid/DiscoveryPluginI.java
+++ b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGrid;
+package IceLocatorDiscovery;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
-class DiscoveryPluginI implements Ice.Plugin
+class PluginI implements Ice.Plugin
{
private static class Request
{
@@ -50,14 +50,22 @@ class DiscoveryPluginI implements Ice.Plugin
public void
exception(Ice.LocalException ex)
{
- _locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy
- }
-
- @Override
- public void
- exception(Ice.SystemException ex)
- {
- _locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy
+ try
+ {
+ throw ex;
+ }
+ catch(Ice.RequestFailedException exc)
+ {
+ _amdCB.ice_exception(ex);
+ }
+ catch(Ice.UnknownException exc)
+ {
+ _amdCB.ice_exception(ex);
+ }
+ catch(Ice.LocalException exc)
+ {
+ _locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy
+ }
}
});
}
@@ -72,7 +80,7 @@ class DiscoveryPluginI implements Ice.Plugin
private Ice.LocatorPrx _locatorPrx;
};
- static private class VoidLocatorI extends IceGrid._LocatorDisp
+ static private class VoidLocatorI extends Ice._LocatorDisp
{
@Override
public void
@@ -94,20 +102,6 @@ class DiscoveryPluginI implements Ice.Plugin
{
return null;
}
-
- @Override
- public IceGrid.RegistryPrx
- getLocalRegistry(Ice.Current current)
- {
- return null;
- }
-
- @Override
- public IceGrid.QueryPrx
- getLocalQuery(Ice.Current current)
- {
- return null;
- }
};
private static class LocatorI extends Ice.BlobjectAsync
@@ -115,9 +109,9 @@ class DiscoveryPluginI implements Ice.Plugin
LocatorI(LookupPrx lookup, Ice.Properties properties, String instanceName, Ice.LocatorPrx voidLocator)
{
_lookup = lookup;
- _timeout = properties.getPropertyAsIntWithDefault("IceGridDiscovery.Timeout", 300);
- _retryCount = properties.getPropertyAsIntWithDefault("IceGridDiscovery.RetryCount", 3);
- _retryDelay = properties.getPropertyAsIntWithDefault("IceGridDiscovery.RetryDelay", 2000);
+ _timeout = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Timeout", 300);
+ _retryCount = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryCount", 3);
+ _retryDelay = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryDelay", 2000);
_timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer();
_instanceName = instanceName;
_warned = false;
@@ -159,11 +153,11 @@ class DiscoveryPluginI implements Ice.Plugin
_warned = true; // Only warn once
locator.ice_getCommunicator().getLogger().warning(
- "received IceGrid locator with different instance name:\n" +
+ "received Ice locator with different instance name:\n" +
"using = `" + _locator.ice_getIdentity().category + "'\n" +
"received = `" + locator.ice_getIdentity().category + "'\n" +
- "This is typically the case if multiple IceGrid registries with different " +
- "instance names are deployed and the property `IceGridDiscovery.InstanceName'" +
+ "This is typically the case if multiple Ice locators with different " +
+ "instance names are deployed and the property `IceLocatorDiscovery.InstanceName'" +
"is not set.");
}
return;
@@ -317,7 +311,7 @@ class DiscoveryPluginI implements Ice.Plugin
};
public
- DiscoveryPluginI(Ice.Communicator communicator)
+ PluginI(Ice.Communicator communicator)
{
_communicator = communicator;
}
@@ -333,16 +327,16 @@ class DiscoveryPluginI implements Ice.Plugin
String address;
if(ipv4 && !preferIPv6)
{
- address = properties.getPropertyWithDefault("IceGridDiscovery.Address", "239.255.0.1");
+ address = properties.getPropertyWithDefault("IceLocatorDiscovery.Address", "239.255.0.1");
}
else
{
- address = properties.getPropertyWithDefault("IceGridDiscovery.Address", "ff15::1");
+ address = properties.getPropertyWithDefault("IceLocatorDiscovery.Address", "ff15::1");
}
- int port = properties.getPropertyAsIntWithDefault("IceGridDiscovery.Port", 4061);
- String intf = properties.getProperty("IceGridDiscovery.Interface");
+ int port = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Port", 4061);
+ String intf = properties.getProperty("IceLocatorDiscovery.Interface");
- if(properties.getProperty("IceGridDiscovery.Reply.Endpoints").isEmpty())
+ if(properties.getProperty("IceLocatorDiscovery.Reply.Endpoints").isEmpty())
{
StringBuilder s = new StringBuilder();
s.append("udp");
@@ -350,21 +344,21 @@ class DiscoveryPluginI implements Ice.Plugin
{
s.append(" -h \"").append(intf).append("\"");
}
- properties.setProperty("IceGridDiscovery.Reply.Endpoints", s.toString());
+ properties.setProperty("IceLocatorDiscovery.Reply.Endpoints", s.toString());
}
- if(properties.getProperty("IceGridDiscovery.Locator.Endpoints").isEmpty())
+ if(properties.getProperty("IceLocatorDiscovery.Locator.Endpoints").isEmpty())
{
- properties.setProperty("IceGridDiscovery.Locator.AdapterId", java.util.UUID.randomUUID().toString());
+ properties.setProperty("IceLocatorDiscovery.Locator.AdapterId", java.util.UUID.randomUUID().toString());
}
- _replyAdapter = _communicator.createObjectAdapter("IceGridDiscovery.Reply");
- _locatorAdapter = _communicator.createObjectAdapter("IceGridDiscovery.Locator");
+ _replyAdapter = _communicator.createObjectAdapter("IceLocatorDiscovery.Reply");
+ _locatorAdapter = _communicator.createObjectAdapter("IceLocatorDiscovery.Locator");
// We don't want those adapters to be registered with the locator so clear their locator.
_replyAdapter.setLocator(null);
_locatorAdapter.setLocator(null);
- String lookupEndpoints = properties.getProperty("IceGridDiscovery.Lookup");
+ String lookupEndpoints = properties.getProperty("IceLocatorDiscovery.Lookup");
if(lookupEndpoints.isEmpty())
{
StringBuilder s = new StringBuilder();
@@ -376,7 +370,7 @@ class DiscoveryPluginI implements Ice.Plugin
lookupEndpoints = s.toString();
}
- Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceGrid/Lookup -d:" + lookupEndpoints);
+ Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" + lookupEndpoints);
lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy!
try
{
@@ -385,14 +379,14 @@ class DiscoveryPluginI implements Ice.Plugin
catch(Ice.LocalException ex)
{
StringBuilder s = new StringBuilder();
- s.append("unable to establish multicast connection, IceGrid discovery will be disabled:\n");
+ s.append("unable to establish multicast connection, Ice locator discovery will be disabled:\n");
s.append("proxy = ").append(lookupPrx.toString()).append("\n").append(ex);
throw new Ice.PluginInitializationException(s.toString());
}
- LocatorPrx voidLoc = LocatorPrxHelper.uncheckedCast(_locatorAdapter.addWithUUID(new VoidLocatorI()));
+ Ice.LocatorPrx voidLoc = Ice.LocatorPrxHelper.uncheckedCast(_locatorAdapter.addWithUUID(new VoidLocatorI()));
- String instanceName = properties.getProperty("IceGridDiscovery.InstanceName");
+ String instanceName = properties.getProperty("IceLocatorDiscovery.InstanceName");
Ice.Identity id = new Ice.Identity();
id.name = "Locator";
id.category = !instanceName.isEmpty() ? instanceName : java.util.UUID.randomUUID().toString();