summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/ThreadHookPlugin.cs
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-03-10 15:50:20 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-03-10 15:50:20 +0100
commite3965dcfae46026f3e6ef2e1ee68aeb818413a43 (patch)
tree7a20165b26d74fd698df216408fe9bc3234b6ae6 /csharp/src/Ice/ThreadHookPlugin.cs
parentAligned C# throwUOE with Java (diff)
downloadice-e3965dcfae46026f3e6ef2e1ee68aeb818413a43.tar.bz2
ice-e3965dcfae46026f3e6ef2e1ee68aeb818413a43.tar.xz
ice-e3965dcfae46026f3e6ef2e1ee68aeb818413a43.zip
Fixed ICE-7662 - Use System.Action & System.Func classes
Diffstat (limited to 'csharp/src/Ice/ThreadHookPlugin.cs')
-rw-r--r--csharp/src/Ice/ThreadHookPlugin.cs31
1 files changed, 23 insertions, 8 deletions
diff --git a/csharp/src/Ice/ThreadHookPlugin.cs b/csharp/src/Ice/ThreadHookPlugin.cs
index d1d5a02b450..4cc1714e8a9 100644
--- a/csharp/src/Ice/ThreadHookPlugin.cs
+++ b/csharp/src/Ice/ThreadHookPlugin.cs
@@ -7,10 +7,12 @@
//
// **********************************************************************
+using System;
+
namespace Ice
{
/// <summary>
- /// Class to support thread notification hooks. Applications using
+ /// Class to support thread notification hooks. Applications using
/// thread notification hooks instantiate a ThreadHookPlugin with a
/// thread notification hook and return the instance from their
/// PluginFactory implementation.
@@ -18,12 +20,25 @@ namespace Ice
public class ThreadHookPlugin : Plugin
{
/// <summary>
- /// Installs a custom logger for a communicator.
+ /// Installs a thread hook for a communicator.
/// </summary>
/// <param name="communicator">The communicator using the thread notification hook.</param>
/// <param name="threadHook">The thread notification hook for the communicator.</param>
- public
- ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook)
+ [Obsolete("This constructor is deprecated. Use the constructur with threadStart and threadStop parameters instead.")]
+ public
+ ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook) :
+ this(communicator, threadHook.start, threadHook.stop)
+ {
+ }
+
+ /// <summary>
+ /// Installs thread hooks for a communicator.
+ /// </summary>
+ /// <param name="communicator">The communicator using the thread notification hook.</param>
+ /// <param name="threadStart">The start thread notification hook for the communicator.</param>
+ /// <param name="threadStop">The stop thread notification hook for the communicator.</param>
+ public
+ ThreadHookPlugin(Communicator communicator, System.Action threadStart, System.Action threadStop)
{
if(communicator == null)
{
@@ -31,9 +46,9 @@ namespace Ice
ex.reason = "Communicator cannot be null";
throw ex;
}
-
+
IceInternal.Instance instance = IceInternal.Util.getInstance(communicator);
- instance.setThreadHook(threadHook);
+ instance.setThreadHook(threadStart, threadStop);
}
/// <summary>
@@ -41,11 +56,11 @@ namespace Ice
/// can override this method to perform any initialization that might be required
/// by the thread notification hook.
/// </summary>
- public void
+ public void
initialize()
{
}
-
+
/// <summary>
/// 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