summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-02-13 19:06:23 -0500
committerBernard Normier <bernard@zeroc.com>2017-02-13 19:06:23 -0500
commit3631ed4ffe08242a1c626976541d85e18b56c05f (patch)
tree82911b4e68f8bf6e5bc7897ae1453acf654c4d7a
parentICE-7506 - Update copyright to 2017 (diff)
downloadice-3631ed4ffe08242a1c626976541d85e18b56c05f.tar.bz2
ice-3631ed4ffe08242a1c626976541d85e18b56c05f.tar.xz
ice-3631ed4ffe08242a1c626976541d85e18b56c05f.zip
Replaced several functional classes by java.util.function classes
Replaced varous new Runnable() by lambdas Generate @FunctionalInterface Java interfaces for "delegate" Slice interfaces
-rw-r--r--cpp/src/slice2java/Gen.cpp4
-rw-r--r--java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java193
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java1
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java29
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java29
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java40
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java32
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java4
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java17
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java18
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java12
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java100
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java13
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java13
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java5
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java12
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java20
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java10
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java36
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java27
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java855
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java60
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java44
-rw-r--r--java/test/src/main/java/test/Glacier2/sessionHelper/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/acm/AllTests.java10
-rw-r--r--java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java2
-rw-r--r--java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java4
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java8
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/AllTests.java146
-rw-r--r--java/test/src/main/java/test/IceBox/admin/TestFacetI.java4
-rw-r--r--java/test/src/main/java/test/IceBox/admin/TestServiceI.java2
35 files changed, 752 insertions, 1109 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index ce104682cd1..16d63924f8d 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -2425,6 +2425,10 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if(p->isInterface())
{
+ if(p->isDelegate())
+ {
+ out << nl << "@FunctionalInterface";
+ }
out << nl << "public interface " << fixKwd(name);
ClassList::const_iterator q = bases.begin();
StringList::const_iterator r = implements.begin();
diff --git a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java
index 6c570353803..98c27772fec 100644
--- a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java
+++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java
@@ -56,14 +56,7 @@ public class SessionHelper
// We destroy the communicator to trigger the immediate
// failure of the connection establishment.
//
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- destroyCommunicator();
- }
- }).start();
+ new Thread(()-> { destroyCommunicator(); }).start();
return;
}
_session = null;
@@ -86,14 +79,7 @@ public class SessionHelper
//
// Run destroyInternal in a thread because it makes remote invocations.
//
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- destroyInternal();
- }
- }).start();
+ new Thread(()-> { destroyInternal(); }).start();
}
/**
@@ -290,14 +276,7 @@ public class SessionHelper
//
// Run destroyInternal in a thread because it makes remote invocations.
//
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- destroyInternal();
- }
- }).start();
+ new Thread(()-> { destroyInternal(); }).start();
return;
}
@@ -349,19 +328,14 @@ public class SessionHelper
}
}
- dispatchCallback(new Runnable()
- {
- @Override
- public void run()
+ dispatchCallback(() -> {
+ try
+ {
+ _callback.connected(SessionHelper.this);
+ }
+ catch(SessionNotExistException ex)
{
- try
- {
- _callback.connected(SessionHelper.this);
- }
- catch(SessionNotExistException ex)
- {
- SessionHelper.this.destroy();
- }
+ SessionHelper.this.destroy();
}
}, conn);
}
@@ -415,14 +389,7 @@ public class SessionHelper
//
// Notify the callback that the session is gone.
//
- dispatchCallback(new Runnable()
- {
- @Override
- public void run()
- {
- _callback.disconnected(SessionHelper.this);
- }
- }, null);
+ dispatchCallback(() -> { _callback.disconnected(SessionHelper.this); }, null);
}
private void destroyCommunicator()
@@ -450,99 +417,62 @@ public class SessionHelper
catch(final com.zeroc.Ice.LocalException ex)
{
_destroy = true;
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- dispatchCallback(new Runnable()
- {
- @Override
- public void run()
- {
- _callback.connectFailed(SessionHelper.this, ex);
- }
- }, null);
- }
- }).start();
+ new Thread(() -> { dispatchCallback(() -> { _callback.connectFailed(SessionHelper.this, ex); },
+ null); }).start();
return;
}
final com.zeroc.Ice.RouterFinderPrx finder =
com.zeroc.Ice.RouterFinderPrx.uncheckedCast(_communicator.stringToProxy(_finderStr));
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- if(_communicator.getDefaultRouter() == null)
- {
- try
- {
- _communicator.setDefaultRouter(finder.getRouter());
- }
- catch(final com.zeroc.Ice.CommunicatorDestroyedException ex)
- {
- dispatchCallback(new Runnable()
- {
- @Override
- public void run()
- {
- _callback.connectFailed(SessionHelper.this, ex);
- }
- }, null);
- return;
- }
- catch(Exception ex)
- {
- //
- // In case of error getting router identity from RouterFinder use
- // default identity.
- //
- com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("router", "Glacier2");
- _communicator.setDefaultRouter(
- com.zeroc.Ice.RouterPrx.uncheckedCast(finder.ice_identity(ident)));
- }
- }
-
- try
- {
- dispatchCallbackAndWait(new Runnable()
- {
- @Override
- public void run()
- {
- _callback.createdCommunicator(SessionHelper.this);
- }
- });
-
- com.zeroc.Glacier2.RouterPrx routerPrx = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
- _communicator.getDefaultRouter());
- com.zeroc.Glacier2.SessionPrx session = factory.connect(routerPrx);
- connected(routerPrx, session);
- }
- catch(final Exception ex)
- {
- _communicator.destroy();
-
- dispatchCallback(new Runnable()
- {
- @Override
- public void run()
- {
- _callback.connectFailed(SessionHelper.this, ex);
- }
- }, null);
- }
- }
- }).start();
+ new Thread(() ->
+ {
+ if(_communicator.getDefaultRouter() == null)
+ {
+ try
+ {
+ _communicator.setDefaultRouter(finder.getRouter());
+ }
+ catch(final com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ dispatchCallback(() -> { _callback.connectFailed(SessionHelper.this, ex); }, null);
+ return;
+ }
+ catch(Exception ex)
+ {
+ //
+ // In case of error getting router identity from RouterFinder use
+ // default identity.
+ //
+ com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("router", "Glacier2");
+ _communicator.setDefaultRouter(
+ com.zeroc.Ice.RouterPrx.uncheckedCast(finder.ice_identity(ident)));
+ }
+ }
+
+ try
+ {
+ dispatchCallbackAndWait(() -> { _callback.createdCommunicator(SessionHelper.this); });
+
+ com.zeroc.Glacier2.RouterPrx routerPrx = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
+ _communicator.getDefaultRouter());
+ com.zeroc.Glacier2.SessionPrx session = factory.connect(routerPrx);
+ connected(routerPrx, session);
+ }
+ catch(final Exception ex)
+ {
+ _communicator.destroy();
+
+ dispatchCallback(() -> { _callback.connectFailed(SessionHelper.this, ex); }, null);
+ }
+ }
+ ).start();
}
private void dispatchCallback(Runnable runnable, com.zeroc.Ice.Connection conn)
{
if(_initData.dispatcher != null)
{
- _initData.dispatcher.dispatch(runnable, conn);
+ _initData.dispatcher.accept(runnable, conn);
}
else
{
@@ -555,16 +485,7 @@ public class SessionHelper
if(_initData.dispatcher != null)
{
final java.util.concurrent.Semaphore sem = new java.util.concurrent.Semaphore(0);
- _initData.dispatcher.dispatch(
- new Runnable()
- {
- @Override
- public void run()
- {
- runnable.run();
- sem.release();
- }
- }, null);
+ _initData.dispatcher.accept(()-> { runnable.run(); sem.release(); }, null);
sem.acquireUninterruptibly();
}
else
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java
index 62687e489cf..64d1941bd50 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java
@@ -12,6 +12,7 @@ package com.zeroc.Ice;
/**
* Base interface for listening to batch request queues.
**/
+@FunctionalInterface
public interface BatchRequestInterceptor
{
/**
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java
deleted file mode 100644
index 9260c12870b..00000000000
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-package com.zeroc.Ice;
-
-/**
- *
- * A ClassResolver translates a Slice type Id into a Java class using
- * an implementation-defined algorithm.
- *
- **/
-public interface ClassResolver
-{
- /**
- * Resolve a Slice type Id into a Java class. The type Id corresponds to a
- * Slice value or user exception.
- *
- * @param typeId A string type ID (such as <code>"::Module::Class"</code>).
- * @return The Java class object corresponding to the Slice type ID, or null
- * if no class could be found.
- **/
- Class<?> resolveClass(String typeId);
-}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java
deleted file mode 100644
index 9a49b2dae7f..00000000000
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-package com.zeroc.Ice;
-
-/**
- * Applications that make use of compact type IDs to conserve space
- * when marshaling class instances, and also use the streaming API to
- * extract such classes, can intercept the translation between compact
- * type IDs and their corresponding string type IDs by installing an
- * instance of <code>CompactIdResolver</code> in <code>InitializationData</code>.
- **/
-public interface CompactIdResolver
-{
- /**
- * Translates a compact (integer) ID into its string equivalent.
- *
- * @param id The compact ID.
- * @return A string type ID (such as <code>"::Module::Class"</code>),
- * or an empty string if the compact ID is unknown.
- **/
- String resolve(int id);
-}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java
deleted file mode 100644
index 18b7114404f..00000000000
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-package com.zeroc.Ice;
-
-/**
- * You can control which thread receives operation invocations and AMI
- * callbacks by implementing the <code>Dispatcher</code> interface and
- * supplying an instance in <code>InitializationData</code> when
- * initializing a communicator.
- * <p>
- * For example, you can use this dispatching facility to ensure that
- * all invocations and callbacks are dispatched in a GUI event loop
- * thread so that it is safe to invoke directly on GUI objects.
- **/
-public interface Dispatcher
-{
- /**
- * Responsible for dispatching an invocation or AMI callback.
- * The method must eventually invoke <code>run</code> on the
- * supplied <code>Runnable</code> object.
- *
- * @param runnable The object encapsulating the invocation or
- * callback to be dispatched.
- * @param con The connection associated with the dispatch.
- **/
- void dispatch(Runnable runnable, Connection con);
-}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java
index 0dbbfa2c9e7..a00fb5cfff0 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java
@@ -15,7 +15,6 @@ package com.zeroc.Ice;
* @see Util#initialize
* @see Properties
* @see Logger
- * @see ThreadNotification
**/
public final class InitializationData implements Cloneable
{
@@ -44,7 +43,7 @@ public final class InitializationData implements Cloneable
}
catch(CloneNotSupportedException ex)
{
- assert false;
+ assert false;
}
return c;
}
@@ -65,9 +64,15 @@ public final class InitializationData implements Cloneable
public com.zeroc.Ice.Instrumentation.CommunicatorObserver observer;
/**
- * The thread hook for the communicator.
+ * threadStart is called whenever the communicator starts a new thread.
**/
- public ThreadNotification threadHook;
+ public Runnable threadStart;
+
+ /**
+ * threadStop is called whenever a thread created by the communicator is
+ * about to be destroyed.
+ **/
+ public Runnable threadStop;
/**
* The custom class loader for the communicator.
@@ -75,14 +80,31 @@ public final class InitializationData implements Cloneable
public ClassLoader classLoader;
/**
- * The call dispatcher for the communicator.
- **/
- public Dispatcher dispatcher;
+ * You can control which thread receives operation invocations and AMI
+ * callbacks by supplying a dispatcher.
+ * <p>
+ * For example, you can use this dispatching facility to ensure that
+ * all invocations and callbacks are dispatched in a GUI event loop
+ * thread so that it is safe to invoke directly on GUI objects.
+ * <p>
+ * The dispatcher is responsible for running (dispatching) the
+ * invocation or AMI callback on its favorite thread. It must execute the
+ * the provided <code>Runnable</code> parameter. The con parameter represents
+ * the connection associated with this dispatch.
+ **/
+ public java.util.function.BiConsumer<Runnable, Connection> dispatcher;
/**
- * The compact type ID resolver.
+ * Applications that make use of compact type IDs to conserve space
+ * when marshaling class instances, and also use the streaming API to
+ * extract such classes, can intercept the translation between compact
+ * type IDs and their corresponding string type IDs by installing a
+ * compact ID resolver in <code>InitializationData</code>
+ * The parameter id represents the compact ID; the returned value is the
+ * type ID such as <code>"::Module::Class"</code>, or an empty string if
+ * the compact ID is unknown.
**/
- public CompactIdResolver compactIdResolver;
+ public java.util.function.IntFunction<String> compactIdResolver;
/**
* The batch request interceptor.
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java
index f0e0884758e..52ce5cb6544 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java
@@ -350,7 +350,7 @@ public class InputStream
*
* @param r The compact ID resolver.
**/
- public void setCompactIdResolver(CompactIdResolver r)
+ public void setCompactIdResolver(java.util.function.IntFunction<String> r)
{
_compactIdResolver = r;
}
@@ -362,7 +362,7 @@ public class InputStream
*
* @param r The class resolver.
**/
- public void setClassResolver(ClassResolver r)
+ public void setClassResolver(java.util.function.Function<String, Class<?>> r)
{
_classResolver = r;
}
@@ -472,11 +472,11 @@ public class InputStream
other._logger = _logger;
_logger = tmpLogger;
- CompactIdResolver tmpCompactIdResolver = other._compactIdResolver;
+ java.util.function.IntFunction<String> tmpCompactIdResolver = other._compactIdResolver;
other._compactIdResolver = _compactIdResolver;
_compactIdResolver = tmpCompactIdResolver;
- ClassResolver tmpClassResolver = other._classResolver;
+ java.util.function.Function<String, Class<?>> tmpClassResolver = other._classResolver;
other._classResolver = _classResolver;
_classResolver = tmpClassResolver;
}
@@ -2213,7 +2213,7 @@ public class InputStream
{
if(_classResolver != null)
{
- Class<?> c = _classResolver.resolveClass(id);
+ Class<?> c = _classResolver.apply(id);
if(c != null)
{
userEx = (UserException)c.newInstance();
@@ -2238,7 +2238,7 @@ public class InputStream
abstract private static class EncapsDecoder
{
- EncapsDecoder(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr)
+ EncapsDecoder(InputStream stream, boolean sliceValues, ValueFactoryManager f, java.util.function.Function<String, Class<?>> cr)
{
_stream = stream;
_sliceValues = sliceValues;
@@ -2314,7 +2314,7 @@ public class InputStream
{
if(_classResolver != null)
{
- cls = _classResolver.resolveClass(typeId);
+ cls = _classResolver.apply(typeId);
_typeIdCache.put(typeId, cls != null ? cls : EncapsDecoder.class);
}
}
@@ -2505,7 +2505,7 @@ public class InputStream
protected final InputStream _stream;
protected final boolean _sliceValues;
protected ValueFactoryManager _valueFactoryManager;
- protected ClassResolver _classResolver;
+ protected java.util.function.Function<String, Class<?>> _classResolver;
//
// Encapsulation attributes for value unmarshaling.
@@ -2520,7 +2520,7 @@ public class InputStream
private static final class EncapsDecoder10 extends EncapsDecoder
{
- EncapsDecoder10(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr)
+ EncapsDecoder10(InputStream stream, boolean sliceValues, ValueFactoryManager f, java.util.function.Function<String, Class<?>> cr)
{
super(stream, sliceValues, f, cr);
_sliceType = SliceType.NoSlice;
@@ -2811,8 +2811,8 @@ public class InputStream
private static class EncapsDecoder11 extends EncapsDecoder
{
- EncapsDecoder11(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr,
- CompactIdResolver r)
+ EncapsDecoder11(InputStream stream, boolean sliceValues, ValueFactoryManager f, java.util.function.Function<String, Class<?>> cr,
+ java.util.function.IntFunction<String> r)
{
super(stream, sliceValues, f, cr);
_compactIdResolver = r;
@@ -3263,7 +3263,7 @@ public class InputStream
{
try
{
- _current.typeId = _compactIdResolver.resolve(_current.compactId);
+ _current.typeId = _compactIdResolver.apply(_current.compactId);
}
catch(LocalException ex)
{
@@ -3271,7 +3271,7 @@ public class InputStream
}
catch(Throwable ex)
{
- throw new MarshalException("exception in CompactIdResolver for ID " +
+ throw new MarshalException("exception in compact ID resolver for ID " +
_current.compactId, ex);
}
}
@@ -3445,7 +3445,7 @@ public class InputStream
InstanceData next;
}
- private CompactIdResolver _compactIdResolver;
+ private java.util.function.IntFunction<String> _compactIdResolver;
private InstanceData _current;
private int _valueIdIndex; // The ID of the next instance to unmarshal.
private java.util.TreeMap<Integer, Class<?> > _compactIdCache; // Cache of compact type IDs.
@@ -3542,6 +3542,6 @@ public class InputStream
private ValueFactoryManager _valueFactoryManager;
private Logger _logger;
- private CompactIdResolver _compactIdResolver;
- private ClassResolver _classResolver;
+ private java.util.function.IntFunction<String> _compactIdResolver;
+ private java.util.function.Function<String, Class<?>> _classResolver;
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java
index ad9e685a6c8..dc6a27be8f2 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java
@@ -11,6 +11,6 @@ package com.zeroc.Ice;
public interface NativePropertiesAdmin
{
- void addUpdateCallback(PropertiesAdminUpdateCallback callback);
- void removeUpdateCallback(PropertiesAdminUpdateCallback callback);
+ void addUpdateCallback(java.util.function.Consumer<java.util.Map<String, String>> callback);
+ void removeUpdateCallback(java.util.function.Consumer<java.util.Map<String, String>> callback);
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java
deleted file mode 100644
index 2177888d6ac..00000000000
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-package com.zeroc.Ice;
-
-@FunctionalInterface
-public interface PropertiesAdminUpdateCallback
-{
- void updated(java.util.Map<String, String> changes);
-}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java
index 91b99083037..ae7c5845379 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java
@@ -12,7 +12,7 @@ package com.zeroc.Ice;
/**
* Class to support thread notification hooks. Applications using thread
* notifications hooks instantiate a <code>ThreadHookPlugin</code> with
- * a thread notification hook and return the instance from their
+ * a thread start and threaed stop Runnable and return the instance from their
* {@link PluginFactory} implementation.
*
* @see PluginFactory
@@ -21,13 +21,14 @@ package com.zeroc.Ice;
public class ThreadHookPlugin implements Plugin
{
/**
- * Installs a thread notification hook for a communicator.
+ * Installs thread notification hooks for a communicator.
*
- * @param communicator The communicator using the thread notification hook.
- * @param threadHook The thread notification hook for the communicator.
+ * @param communicator The communicator using the thread notification hooks.
+ * @param threadStart The callback for newly started threads.
+ * @param threadStop The callback for stopped threads.
**/
public
- ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook)
+ ThreadHookPlugin(Communicator communicator, Runnable threadStart, Runnable threadStop)
{
if(communicator == null)
{
@@ -37,13 +38,13 @@ public class ThreadHookPlugin implements Plugin
}
com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
- instance.setThreadHook(threadHook);
+ instance.setThreadHooks(threadStart, threadStop);
}
/**
* Called by the Ice run time during communicator initialization. The derived class
* can override this method to perform any initialization that might be required
- * by a custom thread notification hook.
+ * by custom thread notification hooks.
**/
@Override
public void
@@ -54,7 +55,7 @@ public class ThreadHookPlugin implements Plugin
/**
* Called by the Ice run time when the communicator is destroyed. The derived class
* can override this method to perform any finalization that might be required
- * by a custom thread notification hook.
+ * by custom thread notification hooks.
**/
@Override
public void
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java
deleted file mode 100644
index d9292107476..00000000000
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-package com.zeroc.Ice;
-
-/**
- * Interface for thread notification hooks. Applications can derive
- * a class that implements the <code>start</code> and <code>stop</code>
- * methods to intercept creation and destruction of threads created
- * by the Ice run time.
- *
- * @see InitializationData
- **/
-public interface ThreadNotification
-{
- /**
- * The Ice run time calls <code>start</code> for each new
- * thread it creates. The call is made by the newly-started thread.
- **/
- void start();
-
- /**
- * The Ice run time calls <code>stop</code> before it destroys
- * a thread. The call is made by thread that is about to be
- * destroyed.
- **/
- void stop();
-}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java
index 80005902d16..fc351bc33ba 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java
@@ -797,22 +797,8 @@ public class CommunicatorObserverI implements com.zeroc.Ice.Instrumentation.Comm
}
else
{
- _connections.setUpdater(new Runnable() {
- @Override
- public void
- run()
- {
- updater.updateConnectionObservers();
- }
- });
- _threads.setUpdater(new Runnable() {
- @Override
- public void
- run()
- {
- updater.updateThreadObservers();
- }
- });
+ _connections.setUpdater(() -> { updater.updateConnectionObservers(); });
+ _threads.setUpdater(() -> { updater.updateThreadObservers(); });
}
if(_delegate != null)
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java
index f364b6c239d..eb8d111c299 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java
@@ -45,14 +45,10 @@ class ConnectionACMMonitor implements ACMMonitor
_connection = connection;
if(_config.timeout > 0)
{
- _future = _timer.scheduleAtFixedRate(new Runnable() {
- @Override
- public void run()
- {
- monitorConnection();
- }
- },
- _config.timeout / 2, _config.timeout / 2, java.util.concurrent.TimeUnit.MILLISECONDS);
+ _future = _timer.scheduleAtFixedRate(() -> { monitorConnection(); },
+ _config.timeout / 2,
+ _config.timeout / 2,
+ java.util.concurrent.TimeUnit.MILLISECONDS);
}
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java
index 0e766c2a570..29cd2ff96bd 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java
@@ -61,75 +61,71 @@ class EndpointHostResolver
observer.attach();
}
- _executor.execute(new Runnable()
+ _executor.execute(() ->
{
- @Override
- public void run()
+ synchronized(EndpointHostResolver.this)
{
- synchronized(EndpointHostResolver.this)
+ if(_destroyed)
{
- if(_destroyed)
+ com.zeroc.Ice.CommunicatorDestroyedException ex =
+ new com.zeroc.Ice.CommunicatorDestroyedException();
+ if(observer != null)
{
- com.zeroc.Ice.CommunicatorDestroyedException ex =
- new com.zeroc.Ice.CommunicatorDestroyedException();
- if(observer != null)
- {
- observer.failed(ex.ice_id());
- observer.detach();
- }
- callback.exception(ex);
- return;
+ observer.failed(ex.ice_id());
+ observer.detach();
}
+ callback.exception(ex);
+ return;
}
+ }
- if(threadObserver != null)
- {
- threadObserver.stateChanged(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle,
- com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther);
- }
+ if(threadObserver != null)
+ {
+ threadObserver.stateChanged(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle,
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther);
+ }
- com.zeroc.Ice.Instrumentation.Observer obsv = observer;
- try
+ com.zeroc.Ice.Instrumentation.Observer obsv = observer;
+ try
+ {
+ int protocol = _protocol;
+ NetworkProxy np = _instance.networkProxy();
+ if(np != null)
{
- int protocol = _protocol;
- NetworkProxy networkProxy = _instance.networkProxy();
- if(networkProxy != null)
+ np = np.resolveHost(_protocol);
+ if(np != null)
{
- networkProxy = networkProxy.resolveHost(_protocol);
- if(networkProxy != null)
- {
- protocol = networkProxy.getProtocolSupport();
- }
+ protocol = np.getProtocolSupport();
}
+ }
- java.util.List<java.net.InetSocketAddress> addresses =
- Network.getAddresses(host, port, _protocol, selType, _preferIPv6, true);
-
- if(obsv != null)
- {
- obsv.detach();
- obsv = null;
- }
+ java.util.List<java.net.InetSocketAddress> addresses =
+ Network.getAddresses(host, port, _protocol, selType, _preferIPv6, true);
- callback.connectors(endpoint.connectors(addresses, networkProxy));
+ if(obsv != null)
+ {
+ obsv.detach();
+ obsv = null;
}
- catch(com.zeroc.Ice.LocalException ex)
+
+ callback.connectors(endpoint.connectors(addresses, np));
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ if(obsv != null)
{
- if(obsv != null)
- {
- obsv.failed(ex.ice_id());
- obsv.detach();
- }
- callback.exception(ex);
+ obsv.failed(ex.ice_id());
+ obsv.detach();
}
- finally
+ callback.exception(ex);
+ }
+ finally
+ {
+ if(threadObserver != null)
{
- if(threadObserver != null)
- {
- threadObserver.stateChanged(
- com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther,
- com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle);
- }
+ threadObserver.stateChanged(
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther,
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle);
}
}
});
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java
index 279d63c238d..f6c1bfd1780 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java
@@ -77,14 +77,10 @@ class FactoryACMMonitor implements ACMMonitor
{
_connections.add(connection);
assert _future == null;
- _future = _instance.timer().scheduleAtFixedRate(new Runnable() {
- @Override
- public void run()
- {
- monitorConnections();
- }
- },
- _config.timeout / 2, _config.timeout / 2, java.util.concurrent.TimeUnit.MILLISECONDS);
+ _future = _instance.timer().scheduleAtFixedRate(() -> { monitorConnections(); },
+ _config.timeout / 2,
+ _config.timeout / 2,
+ java.util.concurrent.TimeUnit.MILLISECONDS);
}
else
{
@@ -230,4 +226,3 @@ class FactoryACMMonitor implements ACMMonitor
private java.util.List<com.zeroc.Ice.ConnectionI> _reapedConnections = new java.util.ArrayList<>();
private java.util.concurrent.Future<?> _future;
}
-
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java
index bc8f603da9c..aae804b8850 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
import com.zeroc.Ice.Instrumentation.ThreadState;
-public final class Instance implements com.zeroc.Ice.ClassResolver
+public final class Instance implements java.util.function.Function<String, Class<?>>
{
static private class ThreadObserverHelper
{
@@ -697,12 +697,13 @@ public final class Instance implements com.zeroc.Ice.ClassResolver
}
public void
- setThreadHook(com.zeroc.Ice.ThreadNotification threadHook)
+ setThreadHooks(Runnable threadStart, Runnable threadStop)
{
//
// No locking, as it can only be called during plug-in loading
//
- _initData.threadHook = threadHook;
+ _initData.threadStart = threadStart;
+ _initData.threadStop = threadStop;
}
public Class<?>
@@ -731,10 +732,10 @@ public final class Instance implements com.zeroc.Ice.ClassResolver
};
//
- // From com.zeroc.Ice.ClassResolver.
+ // For the "class resolver".
//
- public Class<?> resolveClass(String typeId)
- throws LinkageError
+ @Override
+ public Class<?> apply(String typeId)
{
Class<?> c = null;
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java
index 4120b76f193..707176fba50 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java
@@ -9,7 +9,8 @@
package com.zeroc.IceInternal;
-public class MetricsAdminI implements com.zeroc.IceMX.MetricsAdmin, com.zeroc.Ice.PropertiesAdminUpdateCallback
+public class MetricsAdminI implements com.zeroc.IceMX.MetricsAdmin,
+ java.util.function.Consumer<java.util.Map<String, String>>
{
final static private String[] suffixes =
{
@@ -332,7 +333,7 @@ public class MetricsAdminI implements com.zeroc.IceMX.MetricsAdmin, com.zeroc.Ic
}
@Override
- public void updated(java.util.Map<String, String> props)
+ public void accept(java.util.Map<String, String> props)
{
for(java.util.Map.Entry<String, String> e : props.entrySet())
{
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java
index f5f47638a79..eb21777f89c 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java
@@ -9,8 +9,6 @@
package com.zeroc.IceInternal;
-import com.zeroc.Ice.PropertiesAdminUpdateCallback;
-
class PropertiesAdminI implements com.zeroc.Ice.PropertiesAdmin, com.zeroc.Ice.NativePropertiesAdmin
{
public PropertiesAdminI(Instance instance)
@@ -168,11 +166,11 @@ class PropertiesAdminI implements com.zeroc.Ice.PropertiesAdmin, com.zeroc.Ice.N
//
// Copy the callbacks to allow callbacks to update the callbacks.
//
- for(PropertiesAdminUpdateCallback callback : new java.util.ArrayList<>(_updateCallbacks))
+ for(java.util.function.Consumer<java.util.Map<String, String>> callback : new java.util.ArrayList<>(_updateCallbacks))
{
try
{
- callback.updated(changes);
+ callback.accept(changes);
}
catch(RuntimeException ex)
{
@@ -191,20 +189,20 @@ class PropertiesAdminI implements com.zeroc.Ice.PropertiesAdmin, com.zeroc.Ice.N
}
@Override
- public synchronized void addUpdateCallback(PropertiesAdminUpdateCallback cb)
+ public synchronized void addUpdateCallback(java.util.function.Consumer<java.util.Map<String, String>> cb)
{
_updateCallbacks.add(cb);
}
@Override
- public synchronized void removeUpdateCallback(PropertiesAdminUpdateCallback cb)
+ public synchronized void removeUpdateCallback(java.util.function.Consumer<java.util.Map<String, String>> cb)
{
_updateCallbacks.remove(cb);
}
private final com.zeroc.Ice.Properties _properties;
private final com.zeroc.Ice.Logger _logger;
- private java.util.List<PropertiesAdminUpdateCallback> _updateCallbacks = new java.util.ArrayList<>();
+ private java.util.List<java.util.function.Consumer<java.util.Map<String, String>>> _updateCallbacks = new java.util.ArrayList<>();
static private final String _traceCategory = "Admin.Properties";
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java
index 2e47a6ca9bb..5c49d464c6c 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java
@@ -246,14 +246,8 @@ public abstract class ProxyOutgoingAsyncBaseI<T> extends OutgoingAsyncBaseI<T> i
if(timeout > 0)
{
_timerFuture = _instance.timer().schedule(
- new Runnable()
- {
- @Override
- public void run()
- {
- cancel(new com.zeroc.Ice.ConnectionTimeoutException());
- }
- }, timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ () -> { cancel(new com.zeroc.Ice.ConnectionTimeoutException()); },
+ timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
}
}
super.cancelable(handler);
@@ -314,14 +308,8 @@ public abstract class ProxyOutgoingAsyncBaseI<T> extends OutgoingAsyncBaseI<T> i
if(invocationTimeout > 0)
{
_timerFuture = _instance.timer().schedule(
- new Runnable()
- {
- @Override
- public void run()
- {
- cancel(new com.zeroc.Ice.InvocationTimeoutException());
- }
- }, invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ () -> { cancel(new com.zeroc.Ice.InvocationTimeoutException()); },
+ invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);
}
}
else // If not called from the user thread, it's called from the retry queue
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java
index 4eb2c69dff2..2fc47677a4d 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java
@@ -335,7 +335,7 @@ public final class ThreadPool
{
try
{
- _dispatcher.dispatch(workItem, workItem.getConnection());
+ _dispatcher.accept(workItem, workItem.getConnection());
}
catch(java.lang.Exception ex)
{
@@ -686,7 +686,7 @@ public final class ThreadPool
}
private final Instance _instance;
- private final com.zeroc.Ice.Dispatcher _dispatcher;
+ private final java.util.function.BiConsumer<Runnable, com.zeroc.Ice.Connection> _dispatcher;
private final ThreadPoolWorkQueue _workQueue;
private boolean _destroyed;
private final String _prefix;
@@ -750,15 +750,15 @@ public final class ThreadPool
public void
run()
{
- if(_instance.initializationData().threadHook != null)
+ if(_instance.initializationData().threadStart != null)
{
try
{
- _instance.initializationData().threadHook.start();
+ _instance.initializationData().threadStart.run();
}
catch(java.lang.Exception ex)
{
- String s = "thread hook start() method raised an unexpected exception in `";
+ String s = "threadStart method raised an unexpected exception in `";
s += _prefix + "' thread " + _name + ":\n" + Ex.toString(ex);
_instance.initializationData().logger.error(s);
}
@@ -779,15 +779,15 @@ public final class ThreadPool
_observer.detach();
}
- if(_instance.initializationData().threadHook != null)
+ if(_instance.initializationData().threadStop != null)
{
try
{
- _instance.initializationData().threadHook.stop();
+ _instance.initializationData().threadStop.run();
}
catch(java.lang.Exception ex)
{
- String s = "thread hook stop() method raised an unexpected exception in `";
+ String s = "threadStop method raised an unexpected exception in `";
s += _prefix + "' thread " + _name + ":\n" + Ex.toString(ex);
_instance.initializationData().logger.error(s);
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java
index bcb90e486d6..b52c7bcc471 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java
@@ -19,15 +19,7 @@ public class ObserverFactory<T extends Metrics, O extends Observer<T>>
_metrics = metrics;
_name = name;
_class = cl;
- _metrics.registerMap(name, _class, new Runnable()
- {
- @Override
- public void
- run()
- {
- update();
- }
- });
+ _metrics.registerMap(name, _class, () -> { update(); });
}
public void
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java
index 53d65d57a4e..0fade61f075 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java
@@ -41,14 +41,7 @@ class AdapterObserverI implements AdapterObserver
}
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.adapterInit(adapters);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.adapterInit(adapters); });
}
@Override
@@ -59,14 +52,7 @@ class AdapterObserverI implements AdapterObserver
_coordinator.traceObserver("adapterAdded for adapter " + info.id);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.adapterAdded(info);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.adapterAdded(info); });
}
@Override
@@ -77,14 +63,7 @@ class AdapterObserverI implements AdapterObserver
_coordinator.traceObserver("adapterUpdated for adapter " + info.id);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.adapterUpdated(info);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.adapterUpdated(info); });
}
@Override
@@ -95,14 +74,7 @@ class AdapterObserverI implements AdapterObserver
_coordinator.traceObserver("adapterRemoved for adapter " + id);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.adapterRemoved(id);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.adapterRemoved(id); });
}
private final Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java
index ad0b57bae7e..5f69945e175 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java
@@ -95,14 +95,7 @@ class ApplicationObserverI implements ApplicationObserver
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.applicationAdded(serial, info);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.applicationAdded(serial, info); });
}
@Override
@@ -115,14 +108,7 @@ class ApplicationObserverI implements ApplicationObserver
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.applicationRemoved(serial, name);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.applicationRemoved(serial, name); });
}
@Override
@@ -135,14 +121,7 @@ class ApplicationObserverI implements ApplicationObserver
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.applicationUpdated(serial, info);
- }
- });
+ SwingUtilities.invokeLater(() -> { _coordinator.applicationUpdated(serial, info); });
}
private final Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java
index eb19b9204c7..814ce55a083 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java
@@ -946,7 +946,8 @@ public class Coordinator
try
{
- _sessionKeeper.getAdmin().removeApplicationAsync(name).whenComplete((result, ex) ->
+ _sessionKeeper.getAdmin().removeApplicationAsync(name).whenComplete(
+ (result, ex) ->
{
if(_traceSaveToRegistry)
{
@@ -957,28 +958,28 @@ public class Coordinator
if(ex == null)
{
SwingUtilities.invokeLater(() ->
- {
- release();
- getStatusBar().setText(prefix + "done.");
- });
+ {
+ release();
+ getStatusBar().setText(prefix + "done.");
+ });
}
else
{
if(ex instanceof com.zeroc.Ice.UserException)
{
SwingUtilities.invokeLater(() ->
- {
- handleFailure(prefix, "Delete failed",
- "IceGrid exception: " + ex.toString());
- });
+ {
+ handleFailure(prefix, "Delete failed",
+ "IceGrid exception: " + ex.toString());
+ });
}
else
{
SwingUtilities.invokeLater(() ->
- {
- handleFailure(prefix, "Delete failed",
- "Communication exception: " + ex.toString());
- });
+ {
+ handleFailure(prefix, "Delete failed",
+ "Communication exception: " + ex.toString());
+ });
}
}
});
@@ -1450,15 +1451,11 @@ public class Coordinator
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
- {
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent, ex.toString(), "Error loading keystore",
- JOptionPane.ERROR_MESSAGE);
- }
- });
+ SwingUtilities.invokeAndWait(() ->
+ {
+ JOptionPane.showMessageDialog(parent, ex.toString(), "Error loading keystore",
+ JOptionPane.ERROR_MESSAGE);
+ });
break;
}
catch(java.lang.InterruptedException e)
@@ -1560,15 +1557,11 @@ public class Coordinator
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
- {
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent, ex.toString(), "Error loading keystore",
- JOptionPane.ERROR_MESSAGE);
- }
- });
+ SwingUtilities.invokeAndWait(() ->
+ {
+ JOptionPane.showMessageDialog(parent, ex.toString(), "Error loading keystore",
+ JOptionPane.ERROR_MESSAGE);
+ });
break;
}
catch(java.lang.InterruptedException e)
@@ -1621,16 +1614,12 @@ public class Coordinator
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
- {
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent, ex.toString(),
- "Error saving certificate",
- JOptionPane.ERROR_MESSAGE);
- }
- });
+ SwingUtilities.invokeAndWait(() ->
+ {
+ JOptionPane.showMessageDialog(parent, ex.toString(),
+ "Error saving certificate",
+ JOptionPane.ERROR_MESSAGE);
+ });
break;
}
catch(java.lang.InterruptedException e)
@@ -1661,17 +1650,13 @@ public class Coordinator
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
- {
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent, ex.toString(),
- "Error creating certificate verifier",
- JOptionPane.ERROR_MESSAGE);
- parent.setCursor(oldCursor);
- }
- });
+ SwingUtilities.invokeAndWait(() ->
+ {
+ JOptionPane.showMessageDialog(parent, ex.toString(),
+ "Error creating certificate verifier",
+ JOptionPane.ERROR_MESSAGE);
+ parent.setCursor(oldCursor);
+ });
break;
}
catch(java.lang.InterruptedException e)
@@ -1687,8 +1672,8 @@ public class Coordinator
final String finderStr = "Ice/" + (info.getDirect() ? "LocatorFinder" : "RouterFinder") + ":" +
(info.getDefaultEndpoint() ?
- ((info.getSSL() ? "ssl" : "tcp") + " -h " + info.getHost() + " -p " + info.getPort()) :
- info.getEndpoint());
+ ((info.getSSL() ? "ssl" : "tcp") + " -h " + info.getHost() + " -p " + info.getPort()) :
+ info.getEndpoint());
class ConnectionCallback
{
@@ -1754,138 +1739,134 @@ public class Coordinator
if(!info.getDirect())
{
final ConnectionCallback cb = new ConnectionCallback();
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast(
- _communicator.stringToProxy(finderStr));
- info.setInstanceName(finder.getRouter().ice_getIdentity().category);
- info.save();
- com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
- finder.ice_identity(new com.zeroc.Ice.Identity("router", info.getInstanceName())));
-
- //
- // The session must be routed through this router
- //
- _communicator.setDefaultRouter(router);
-
- com.zeroc.Glacier2.SessionPrx s;
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_secure(true));
-
- s = router.createSessionFromSecureConnection();
-
- if(s == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(
- parent,
- "createSessionFromSecureConnection returned a null session: \n"
- + "verify that Glacier2.SSLSessionManager is set to "
- + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 "
- + "router configuration",
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- }
- else
- {
- router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_preferSecure(true));
-
- s = router.createSession(info.getUsername(), info.getPassword() != null ?
- new String(info.getPassword()) : "");
-
- if(s == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(
- parent,
- "createSession returned a null session: \n"
- + "verify that Glacier2.SessionManager is set to "
- + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 "
- + "router configuration",
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- }
- cb.setSession(AdminSessionPrx.uncheckedCast(s));
- cb.setSessionTimeout(router.getSessionTimeout());
- try
- {
- cb.setACMTimeout(router.getACMTimeout());
- }
- catch(com.zeroc.Ice.OperationNotExistException ex)
- {
- }
- SwingUtilities.invokeLater(() -> cb.loginSuccess());
- }
- catch(final com.zeroc.Glacier2.PermissionDeniedException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- String msg = e.reason;
- if(msg.length() == 0)
- {
- msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
- "Invalid credentials" : "Invalid username/password";
- }
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- JOptionPane.showMessageDialog(parent, "Permission denied: " + msg,
- "Login failed", JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
- else
- {
- cb.permissionDenied(msg);
- }
- });
- return;
- }
- catch(final com.zeroc.Glacier2.CannotCreateSessionException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(parent, "Could not create session: " + e.reason,
- "Login failed", JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- catch(final java.util.prefs.BackingStoreException ex)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(getMainFrame(), ex.toString(),
- "Error saving connection", JOptionPane.ERROR_MESSAGE);
- });
- return;
- }
- catch(final com.zeroc.Ice.LocalException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(),
- "Login failed", JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- }
- }).start();
+ new Thread(() ->
+ {
+ try
+ {
+ com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast(
+ _communicator.stringToProxy(finderStr));
+ info.setInstanceName(finder.getRouter().ice_getIdentity().category);
+ info.save();
+ com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
+ finder.ice_identity(new com.zeroc.Ice.Identity("router", info.getInstanceName())));
+
+ //
+ // The session must be routed through this router
+ //
+ _communicator.setDefaultRouter(router);
+
+ com.zeroc.Glacier2.SessionPrx s;
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_secure(true));
+
+ s = router.createSessionFromSecureConnection();
+
+ if(s == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(
+ parent,
+ "createSessionFromSecureConnection returned a null session: \n"
+ + "verify that Glacier2.SSLSessionManager is set to "
+ + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 "
+ + "router configuration",
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ }
+ else
+ {
+ router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_preferSecure(true));
+
+ s = router.createSession(info.getUsername(), info.getPassword() != null ?
+ new String(info.getPassword()) : "");
+
+ if(s == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(
+ parent,
+ "createSession returned a null session: \n"
+ + "verify that Glacier2.SessionManager is set to "
+ + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 "
+ + "router configuration",
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ }
+ cb.setSession(AdminSessionPrx.uncheckedCast(s));
+ cb.setSessionTimeout(router.getSessionTimeout());
+ try
+ {
+ cb.setACMTimeout(router.getACMTimeout());
+ }
+ catch(com.zeroc.Ice.OperationNotExistException ex)
+ {
+ }
+ SwingUtilities.invokeLater(() -> cb.loginSuccess());
+ }
+ catch(final com.zeroc.Glacier2.PermissionDeniedException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ String msg = e.reason;
+ if(msg.length() == 0)
+ {
+ msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
+ "Invalid credentials" : "Invalid username/password";
+ }
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ JOptionPane.showMessageDialog(parent, "Permission denied: " + msg,
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ }
+ else
+ {
+ cb.permissionDenied(msg);
+ }
+ });
+ return;
+ }
+ catch(final com.zeroc.Glacier2.CannotCreateSessionException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(parent, "Could not create session: " + e.reason,
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ catch(final java.util.prefs.BackingStoreException ex)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(getMainFrame(), ex.toString(),
+ "Error saving connection", JOptionPane.ERROR_MESSAGE);
+ });
+ return;
+ }
+ catch(final com.zeroc.Ice.LocalException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(),
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ }).start();
}
else
{
@@ -1939,229 +1920,221 @@ public class Coordinator
return;
}
- new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- synchronized(Coordinator.this)
- {
- try
- {
- LocatorFinderPrx finder = LocatorFinderPrx.uncheckedCast(
- _communicator.stringToProxy(finderStr));
-
- info.setInstanceName(finder.getLocator().ice_getIdentity().category);
- info.save();
-
- //
- // The client uses the locator only without routing
- //
- cb.setLocator(com.zeroc.IceGrid.LocatorPrx.checkedCast(
- finder.ice_identity(
- new com.zeroc.Ice.Identity("Locator", info.getInstanceName()))));
-
- if(cb.getLocator() == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(
- parent,
- "This version of IceGrid GUI requires an IceGrid Registry "
- + "version 3.3 or higher",
- "Version Mismatch",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- cb.setCurrentRegistry(cb.getLocator().getLocalRegistry());
- _communicator.setDefaultLocator(cb.getLocator());
- }
- catch(final java.util.prefs.BackingStoreException ex)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- getMainFrame(),
- ex.toString(),
- "Error saving connection",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- return;
- }
- catch(final com.zeroc.Ice.LocalException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(
- parent,
- "Could not create session: " + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
-
- cb.setRegistry(cb.getCurrentRegistry());
- if(info.getConnectToMaster() &&
- !cb.getCurrentRegistry().ice_getIdentity().name.equals("Registry"))
- {
- com.zeroc.Ice.Identity masterRegistryId = new com.zeroc.Ice.Identity();
- masterRegistryId.category = info.getInstanceName();
- masterRegistryId.name = "Registry";
-
- cb.setRegistry(RegistryPrx.uncheckedCast(_communicator.stringToProxy(
- "\"" + _communicator.identityToString(masterRegistryId) +
- "\"")));
- }
-
- //
- // If the registry to use is the locator local registry, we install a default router
- // to ensure we'll use a single connection regardless of the endpoints returned in the
- // proxies of the various session/admin methods (useful if used over a ssh tunnel).
- //
- if(cb.getRegistry().ice_getIdentity().equals(cb.getCurrentRegistry().ice_getIdentity()))
- {
- try
- {
- com.zeroc.Ice.ObjectAdapter colloc = _communicator.createObjectAdapter("");
- com.zeroc.Ice.ObjectPrx router =
- colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator()));
- _communicator.setDefaultRouter(com.zeroc.Ice.RouterPrx.uncheckedCast(router));
- cb.setRegistry(cb.getRegistry().ice_router(_communicator.getDefaultRouter()));
- }
- catch(final com.zeroc.Ice.LocalException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(parent, "Could not create session: " +
- e.toString(), "Login failed",
+ new Thread(() ->
+ {
+ synchronized(Coordinator.this)
+ {
+ try
+ {
+ LocatorFinderPrx finder = LocatorFinderPrx.uncheckedCast(
+ _communicator.stringToProxy(finderStr));
+
+ info.setInstanceName(finder.getLocator().ice_getIdentity().category);
+ info.save();
+
+ //
+ // The client uses the locator only without routing
+ //
+ cb.setLocator(com.zeroc.IceGrid.LocatorPrx.checkedCast(
+ finder.ice_identity(
+ new com.zeroc.Ice.Identity("Locator", info.getInstanceName()))));
+
+ if(cb.getLocator() == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(
+ parent,
+ "This version of IceGrid GUI requires an IceGrid Registry "
+ + "version 3.3 or higher",
+ "Version Mismatch",
JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- }
- do
- {
- try
- {
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- cb.setRegistry(cb.getRegistry().ice_secure(true));
- cb.setSession(cb.getRegistry().createAdminSessionFromSecureConnection());
- assert cb.getSession() != null;
- }
- else
- {
- cb.setRegistry(cb.getRegistry().ice_preferSecure(true));
-
- cb.setSession(cb.getRegistry().createAdminSession(info.getUsername(),
- info.getPassword() != null ? new String(info.getPassword()) : ""));
- assert cb.getSession() != null;
- }
- cb.setSessionTimeout(cb.getRegistry().getSessionTimeout());
- try
- {
- cb.setACMTimeout(cb.getRegistry().getACMTimeout());
- }
- catch(com.zeroc.Ice.OperationNotExistException ex)
- {
- }
- }
- catch(final com.zeroc.IceGrid.PermissionDeniedException e)
- {
- SwingUtilities.invokeLater(() ->
- {
- String msg = e.reason;
- if(msg.length() == 0)
- {
- msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
- "Invalid credentials" : "Invalid username/password";
- }
-
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- JOptionPane.showMessageDialog(parent, "Permission denied: " + e.reason,
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
- else
- {
- cb.permissionDenied(msg);
- }
- });
- return;
- }
- catch(final com.zeroc.Ice.LocalException e)
- {
- if(cb.getRegistry().ice_getIdentity().equals(
- cb.getCurrentRegistry().ice_getIdentity()))
- {
- SwingUtilities.invokeLater(() ->
- {
- JOptionPane.showMessageDialog(parent, "Could not create session: " +
- e.toString(), "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- });
- return;
- }
- else
- {
- while(true)
- {
- try
- {
- SwingUtilities.invokeAndWait(() ->
- {
- if(JOptionPane.showConfirmDialog(
- parent,
- "Unable to connect to the Master Registry:\n " +
- e.toString() +
- "\n\nDo you want to connect to a Slave Registry?",
- "Cannot connect to Master Registry",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
- {
- cb.setRegistry(cb.getCurrentRegistry());
- }
- else
- {
- cb.loginFailed();
- }
- });
- break;
- }
- catch(java.lang.InterruptedException ex)
- {
- // Ignore and retry
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- cb.loginFailed();
- break;
- }
- }
- if(cb.failed())
- {
- return;
- }
- }
- }
- } while(cb.getSession() == null);
-
- SwingUtilities.invokeLater(() -> cb.loginSuccess());
- }
- }
- }).start();
+ cb.loginFailed();
+ });
+ return;
+ }
+ cb.setCurrentRegistry(cb.getLocator().getLocalRegistry());
+ _communicator.setDefaultLocator(cb.getLocator());
+ }
+ catch(final java.util.prefs.BackingStoreException ex)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(
+ getMainFrame(),
+ ex.toString(),
+ "Error saving connection",
+ JOptionPane.ERROR_MESSAGE);
+ });
+ return;
+ }
+ catch(final com.zeroc.Ice.LocalException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(
+ parent,
+ "Could not create session: " + e.toString(),
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+
+ cb.setRegistry(cb.getCurrentRegistry());
+ if(info.getConnectToMaster() &&
+ !cb.getCurrentRegistry().ice_getIdentity().name.equals("Registry"))
+ {
+ com.zeroc.Ice.Identity masterRegistryId = new com.zeroc.Ice.Identity();
+ masterRegistryId.category = info.getInstanceName();
+ masterRegistryId.name = "Registry";
+
+ cb.setRegistry(RegistryPrx.uncheckedCast(_communicator.stringToProxy(
+ "\"" + _communicator.identityToString(masterRegistryId) +
+ "\"")));
+ }
+
+ //
+ // If the registry to use is the locator local registry, we install a default router
+ // to ensure we'll use a single connection regardless of the endpoints returned in the
+ // proxies of the various session/admin methods (useful if used over a ssh tunnel).
+ //
+ if(cb.getRegistry().ice_getIdentity().equals(cb.getCurrentRegistry().ice_getIdentity()))
+ {
+ try
+ {
+ com.zeroc.Ice.ObjectAdapter colloc = _communicator.createObjectAdapter("");
+ com.zeroc.Ice.ObjectPrx router =
+ colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator()));
+ _communicator.setDefaultRouter(com.zeroc.Ice.RouterPrx.uncheckedCast(router));
+ cb.setRegistry(cb.getRegistry().ice_router(_communicator.getDefaultRouter()));
+ }
+ catch(final com.zeroc.Ice.LocalException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(parent, "Could not create session: " +
+ e.toString(), "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ }
+ do
+ {
+ try
+ {
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ cb.setRegistry(cb.getRegistry().ice_secure(true));
+ cb.setSession(cb.getRegistry().createAdminSessionFromSecureConnection());
+ assert cb.getSession() != null;
+ }
+ else
+ {
+ cb.setRegistry(cb.getRegistry().ice_preferSecure(true));
+
+ cb.setSession(cb.getRegistry().createAdminSession(info.getUsername(),
+ info.getPassword() != null ? new String(info.getPassword()) : ""));
+ assert cb.getSession() != null;
+ }
+ cb.setSessionTimeout(cb.getRegistry().getSessionTimeout());
+ try
+ {
+ cb.setACMTimeout(cb.getRegistry().getACMTimeout());
+ }
+ catch(com.zeroc.Ice.OperationNotExistException ex)
+ {
+ }
+ }
+ catch(final com.zeroc.IceGrid.PermissionDeniedException e)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ String msg = e.reason;
+ if(msg.length() == 0)
+ {
+ msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
+ "Invalid credentials" : "Invalid username/password";
+ }
+
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ JOptionPane.showMessageDialog(parent, "Permission denied: " + e.reason,
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ }
+ else
+ {
+ cb.permissionDenied(msg);
+ }
+ });
+ return;
+ }
+ catch(final com.zeroc.Ice.LocalException e)
+ {
+ if(cb.getRegistry().ice_getIdentity().equals(
+ cb.getCurrentRegistry().ice_getIdentity()))
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ JOptionPane.showMessageDialog(parent, "Could not create session: " +
+ e.toString(), "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ });
+ return;
+ }
+ else
+ {
+ while(true)
+ {
+ try
+ {
+ SwingUtilities.invokeAndWait(() ->
+ {
+ if(JOptionPane.showConfirmDialog(
+ parent,
+ "Unable to connect to the Master Registry:\n " +
+ e.toString() +
+ "\n\nDo you want to connect to a Slave Registry?",
+ "Cannot connect to Master Registry",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
+ {
+ cb.setRegistry(cb.getCurrentRegistry());
+ }
+ else
+ {
+ cb.loginFailed();
+ }
+ });
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ // Ignore and retry
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ cb.loginFailed();
+ break;
+ }
+ }
+ if(cb.failed())
+ {
+ return;
+ }
+ }
+ }
+ } while(cb.getSession() == null);
+
+ SwingUtilities.invokeLater(() -> cb.loginSuccess());
+ }
+ }).start();
}
}
@@ -2287,7 +2260,7 @@ public class Coordinator
_icegridadminProcess = Runtime.getRuntime().exec("icegridadmin --server");
}
catch(java.io.IOException e)
- {
+ {
JOptionPane.showMessageDialog(
_mainFrame,
"Failed to start icegridadmin subprocess: " + e.toString(),
@@ -2624,8 +2597,8 @@ public class Coordinator
if(_graphViews.size() > 0)
{
if(JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(
- getMainFrame(), "Close all open Metrics Graph Views and logout?", "Confirm logout",
- JOptionPane.YES_NO_OPTION))
+ getMainFrame(), "Close all open Metrics Graph Views and logout?", "Confirm logout",
+ JOptionPane.YES_NO_OPTION))
{
return;
}
@@ -3031,10 +3004,10 @@ public class Coordinator
if(appName == null)
{
appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which application do you to display",
- "Show details",
- JOptionPane.QUESTION_MESSAGE, null,
- applicationNames, applicationNames[0]);
+ _mainFrame, "Which application do you to display",
+ "Show details",
+ JOptionPane.QUESTION_MESSAGE, null,
+ applicationNames, applicationNames[0]);
}
if(appName != null)
@@ -3135,16 +3108,16 @@ public class Coordinator
java.util.concurrent.ScheduledThreadPoolExecutor executor =
new java.util.concurrent.ScheduledThreadPoolExecutor(1,
- new java.util.concurrent.ThreadFactory()
- {
- @Override
- public Thread newThread(Runnable r)
- {
- Thread t = new Thread(r);
- t.setName("Pinger");
- return t;
- }
- });
+ new java.util.concurrent.ThreadFactory()
+ {
+ @Override
+ public Thread newThread(Runnable r)
+ {
+ Thread t = new Thread(r);
+ t.setName("Pinger");
+ return t;
+ }
+ });
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
_executor = executor;
}
@@ -3212,13 +3185,13 @@ public class Coordinator
private void newApplication()
{
ApplicationDescriptor desc = new ApplicationDescriptor("NewApplication",
- new java.util.TreeMap<String, String>(),
- new java.util.LinkedList<ReplicaGroupDescriptor>(),
- new java.util.HashMap<String, TemplateDescriptor>(),
- new java.util.HashMap<String, TemplateDescriptor>(),
- new java.util.HashMap<String, NodeDescriptor>(),
- new DistributionDescriptor(
- "", new java.util.LinkedList<String>()),
+ new java.util.TreeMap<String, String>(),
+ new java.util.LinkedList<ReplicaGroupDescriptor>(),
+ new java.util.HashMap<String, TemplateDescriptor>(),
+ new java.util.HashMap<String, TemplateDescriptor>(),
+ new java.util.HashMap<String, NodeDescriptor>(),
+ new DistributionDescriptor(
+ "", new java.util.LinkedList<String>()),
"",
new java.util.HashMap<String, PropertySetDescriptor>());
com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, desc);
@@ -3291,7 +3264,7 @@ public class Coordinator
catch(Exception e)
{
JOptionPane.showMessageDialog(null,
- "Error attempting to launch web browser" + ":\n" + e.getLocalizedMessage());
+ "Error attempting to launch web browser" + ":\n" + e.getLocalizedMessage());
}
}
else
@@ -3633,8 +3606,8 @@ public class Coordinator
{
public UntrustedCertificateDialog(java.awt.Window owner, com.zeroc.IceSSL.NativeConnectionInfo info,
boolean validDate, boolean validAlternateName, boolean trustedCA)
- throws java.security.GeneralSecurityException, java.io.IOException,
- javax.naming.InvalidNameException
+ throws java.security.GeneralSecurityException, java.io.IOException,
+ javax.naming.InvalidNameException
{
super(owner, "Connection Security Warning - IceGrid GUI");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
@@ -3663,23 +3636,23 @@ public class Coordinator
if(validAlternateName)
{
builder.append(new JLabel("The subject alternate name matches the connection remote address.",
- _infoIcon, SwingConstants.LEADING));
+ _infoIcon, SwingConstants.LEADING));
}
else
{
builder.append(new JLabel("The subject alternate name doesn't match the connection remote address.",
- _warnIcon, SwingConstants.LEADING));
+ _warnIcon, SwingConstants.LEADING));
}
if(trustedCA)
{
builder.append(new JLabel("The server certificate is signed by a trusted CA.", _infoIcon,
- SwingConstants.LEADING));
+ SwingConstants.LEADING));
}
else
{
builder.append(new JLabel("The server certificate is not signed by a trusted CA.", _warnIcon,
- SwingConstants.LEADING));
+ SwingConstants.LEADING));
}
contentPane.add(builder.getPanel());
}
@@ -3739,11 +3712,11 @@ public class Coordinator
private TrustDecision _decision = TrustDecision.No;
private static Icon _infoIcon = new ImageIcon(
Utils.iconToImage(UIManager.getIcon("OptionPane.informationIcon")).
- getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
+ getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
private static Icon _warnIcon = new ImageIcon(
Utils.iconToImage(UIManager.getIcon("OptionPane.warningIcon")).
- getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
+ getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
}
private String _dataDir;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java
index 2c88f51f98d..6c2b5b80432 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java
@@ -385,38 +385,34 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Remove series from the chart, in JavaFx thread.
//
- enqueueJFX(new Runnable()
- {
- @Override
- public void run()
- {
- for(MetricsRow row : rows)
- {
- for(int i = 0; i < row.series.size(); ++i)
- {
- XYChart.Series<Number, Number> series = row.series.get(i);
- String seriesClass = getSeriesClass(series);
- if(seriesClass != null)
- {
- _styles.remove(seriesClass);
- }
- //
- // Don't remove the XYChart.Series object here, to avoid the series
- // style classes to be reasign by JavaFX.
- //
- // _chart.getData().remove(row.series);
- try
- {
- series.getData().clear();
- }
- catch(NullPointerException ex)
- {
- // JavaFX bug
- }
- }
- }
- }
- });
+ enqueueJFX(() ->
+ {
+ for(MetricsRow row : rows)
+ {
+ for(int i = 0; i < row.series.size(); ++i)
+ {
+ XYChart.Series<Number, Number> series = row.series.get(i);
+ String seriesClass = getSeriesClass(series);
+ if(seriesClass != null)
+ {
+ _styles.remove(seriesClass);
+ }
+ //
+ // Don't remove the XYChart.Series object here, to avoid the series
+ // style classes to be reasign by JavaFX.
+ //
+ // _chart.getData().remove(row.series);
+ try
+ {
+ series.getData().clear();
+ }
+ catch(NullPointerException ex)
+ {
+ // JavaFX bug
+ }
+ }
+ }
+ });
}
};
delete.setEnabled(false);
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
index 8e23986350d..7c658b9ce8d 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
@@ -47,28 +47,24 @@ public class Main extends JFrame
System.err.println(e.toString());
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- //
- // Create and set up the window.
- //
- new Main(args);
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- JOptionPane.showMessageDialog(null,
- e.toString(),
- "Initialization failed",
- JOptionPane.ERROR_MESSAGE);
- System.exit(1);
- }
- }
- });
+ SwingUtilities.invokeLater(() ->
+ {
+ try
+ {
+ //
+ // Create and set up the window.
+ //
+ new Main(args);
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(null,
+ e.toString(),
+ "Initialization failed",
+ JOptionPane.ERROR_MESSAGE);
+ System.exit(1);
+ }
+ });
}
Main(String[] args)
@@ -88,10 +84,10 @@ public class Main extends JFrame
{
if(_coordinator != null)
{
- if(_coordinator.needsSaving())
+ if(_coordinator.needsSaving())
{
if(JOptionPane.showOptionDialog(
- Main.this,
+ Main.this,
"The application has unsaved changes, if you exit all unsaved changes " +
"will be lost.\nExit and discard changes?",
"Save application", JOptionPane.YES_NO_OPTION,
diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
index 906c11b2a46..aa04fbe1c93 100644
--- a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
+++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
@@ -36,14 +36,9 @@ public class Client extends test.Util.Application
_initData = initData;
_initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" +
getTestEndpoint(_initData.properties, 10));
- _initData.dispatcher = new com.zeroc.Ice.Dispatcher()
- {
- @Override
- public void dispatch(Runnable runnable, com.zeroc.Ice.Connection connection)
- {
- SwingUtilities.invokeLater(runnable);
- }
- };
+ _initData.dispatcher =
+ (Runnable runnable, com.zeroc.Ice.Connection c) -> { SwingUtilities.invokeLater(runnable); };
+
return initData;
}
diff --git a/java/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java
index 72a9e621153..0436ebe53f7 100644
--- a/java/test/src/main/java/test/Ice/acm/AllTests.java
+++ b/java/test/src/main/java/test/Ice/acm/AllTests.java
@@ -164,15 +164,7 @@ public class AllTests
//initData.properties.setProperty("Ice.Trace.Network", "2");
_communicator = _app.initialize(initData);
- _thread = new Thread(
- new Runnable()
- {
- public void
- run()
- {
- TestCase.this.run();
- }
- });
+ _thread = new Thread(() -> { TestCase.this.run(); });
}
public void start()
diff --git a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
index 15cb73d968f..3edd32c0ab6 100644
--- a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
+++ b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
@@ -70,7 +70,7 @@ public class RemoteCommunicatorFactoryI implements RemoteCommunicatorFactory
communicator.addAdminFacet(new TestFacetI(), "TestFacet");
//
- // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
+ // The RemoteCommunicator servant also implements java.util.function.Consumer<java.util.Map<String, String>>.
// Set the callback on the admin facet.
//
RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator);
diff --git a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
index db6d28ea450..37406ba712f 100644
--- a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
+++ b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
@@ -11,7 +11,7 @@ package test.Ice.admin;
import test.Ice.admin.Test.*;
-public class RemoteCommunicatorI implements RemoteCommunicator, com.zeroc.Ice.PropertiesAdminUpdateCallback
+public class RemoteCommunicatorI implements RemoteCommunicator, java.util.function.Consumer<java.util.Map<String, String>>
{
RemoteCommunicatorI(com.zeroc.Ice.Communicator communicator)
{
@@ -77,7 +77,7 @@ public class RemoteCommunicatorI implements RemoteCommunicator, com.zeroc.Ice.Pr
}
@Override
- public synchronized void updated(java.util.Map<String, String> changes)
+ public synchronized void accept(java.util.Map<String, String> changes)
{
_changes = changes;
}
diff --git a/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java b/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
index c3ee343b147..bb455a2a1da 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
@@ -9,7 +9,9 @@
package test.Ice.dispatcher;
-public class Dispatcher implements Runnable, com.zeroc.Ice.Dispatcher, java.util.concurrent.Executor
+public class Dispatcher implements Runnable,
+ java.util.function.BiConsumer<Runnable, com.zeroc.Ice.Connection>,
+ java.util.concurrent.Executor
{
private static void test(boolean b)
{
@@ -71,7 +73,7 @@ public class Dispatcher implements Runnable, com.zeroc.Ice.Dispatcher, java.util
}
@Override
- synchronized public void dispatch(Runnable call, com.zeroc.Ice.Connection con)
+ synchronized public void accept(Runnable call, com.zeroc.Ice.Connection con)
{
boolean added = _calls.offer(call);
assert(added);
@@ -84,7 +86,7 @@ public class Dispatcher implements Runnable, com.zeroc.Ice.Dispatcher, java.util
@Override
public void execute(Runnable call)
{
- dispatch(call, null);
+ accept(call, null);
}
public void terminate()
diff --git a/java/test/src/main/java/test/Ice/interrupt/AllTests.java b/java/test/src/main/java/test/Ice/interrupt/AllTests.java
index 2bafa57cbec..79a0f659399 100644
--- a/java/test/src/main/java/test/Ice/interrupt/AllTests.java
+++ b/java/test/src/main/java/test/Ice/interrupt/AllTests.java
@@ -152,22 +152,18 @@ public class AllTests
cb.check();
ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1);
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- Thread.sleep(500);
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- mainThread.interrupt();
- }
- });
-
+ executor.submit(() ->
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ });
try
{
test(!mainThread.isInterrupted());
@@ -183,22 +179,18 @@ public class AllTests
test(false);
}
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- Thread.sleep(500);
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- mainThread.interrupt();
- }
- });
-
+ executor.submit(() ->
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ });
try
{
test(!mainThread.isInterrupted());
@@ -214,22 +206,18 @@ public class AllTests
// Expected
}
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- Thread.sleep(500);
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- mainThread.interrupt();
- }
- });
-
+ executor.submit(() ->
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ });
try
{
test(!mainThread.isInterrupted());
@@ -276,22 +264,18 @@ public class AllTests
// Test interrupt of waitForSent. Here hold the adapter and send a large payload. The
// thread is interrupted in 500ms which should result in a operation interrupted exception.
//
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- Thread.sleep(500);
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- mainThread.interrupt();
- }
- });
-
+ executor.submit(() ->
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ });
testController.holdAdapter();
CompletableFuture<Void> r = null;
InvocationFuture<Void> f = null;
@@ -558,21 +542,18 @@ public class AllTests
final Callback cb = new Callback();
final TestIntfPrx p2 = TestIntfPrx.checkedCast(o);
final CountDownLatch waitSignal = new CountDownLatch(1);
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- waitSignal.await();
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- thread[0].interrupt();
- }
- });
+ executor.submit(() ->
+ {
+ try
+ {
+ waitSignal.await();
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ thread[0].interrupt();
+ });
//
// The whenComplete() action may be executed in the current thread (if the future is
// already completed). We have to submit the runnable to the executor *before*
@@ -697,9 +678,7 @@ public class AllTests
// Expected.
}
- Runnable interruptMainThread = new Runnable() {
- @Override
- public void run()
+ Runnable interruptMainThread = () ->
{
try
{
@@ -710,8 +689,7 @@ public class AllTests
test(false);
}
mainThread.interrupt();
- }
- };
+ };
executor.execute(interruptMainThread);
try
diff --git a/java/test/src/main/java/test/IceBox/admin/TestFacetI.java b/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
index afdf71ccd2c..9043be39595 100644
--- a/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
+++ b/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
@@ -11,7 +11,7 @@ package test.IceBox.admin;
import test.IceBox.admin.Test.*;
-public class TestFacetI implements TestFacet, com.zeroc.Ice.PropertiesAdminUpdateCallback
+public class TestFacetI implements TestFacet, java.util.function.Consumer<java.util.Map<String, String>>
{
public TestFacetI()
{
@@ -24,7 +24,7 @@ public class TestFacetI implements TestFacet, com.zeroc.Ice.PropertiesAdminUpdat
}
@Override
- public synchronized void updated(java.util.Map<String, String> changes)
+ public synchronized void accept(java.util.Map<String, String> changes)
{
_changes = changes;
}
diff --git a/java/test/src/main/java/test/IceBox/admin/TestServiceI.java b/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
index 5c5bd4ab807..087b6441d25 100644
--- a/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
+++ b/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
@@ -21,7 +21,7 @@ public class TestServiceI implements com.zeroc.IceBox.Service
serviceManagerCommunicator.addAdminFacet(facet, "TestFacet");
//
- // The TestFacetI servant also implements PropertiesAdminUpdateCallback.
+ // The TestFacetI servant also implements java.util.function.Consumer<java.util.Map<String, String>>.
// Set the callback on the admin facet.
//
com.zeroc.Ice.Object propFacet =