You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2016/05/18 17:09:20 UTC
reef git commit: [REEF-1387] Deprecate Forget in favor of
LoggingHelper.LogAndIgnoreExceptionIfAny
Repository: reef
Updated Branches:
refs/heads/master 9e07de6b6 -> 96f32a592
[REEF-1387] Deprecate Forget in favor of LoggingHelper.LogAndIgnoreExceptionIfAny
JIRA:
[REEF-1387](https://issues.apache.org/jira/browse/REEF-1387)
Pull Request:
This closes #999
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/96f32a59
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/96f32a59
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/96f32a59
Branch: refs/heads/master
Commit: 96f32a59241e479681cae8d78f2bb2e27aa9c13b
Parents: 9e07de6
Author: Andrew Chung <af...@gmail.com>
Authored: Thu May 12 11:33:25 2016 -0700
Committer: Markus Weimer <we...@apache.org>
Committed: Wed May 18 10:07:51 2016 -0700
----------------------------------------------------------------------
lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs | 5 ++++-
.../Remote/Impl/StreamingTransportServer.cs | 4 +++-
lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs | 4 +++-
lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs | 4 ++++
4 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/96f32a59/lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs b/lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs
index b17de6b..600ebf2 100644
--- a/lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs
+++ b/lang/cs/Org.Apache.REEF.Utilities/AsyncUtils/LoggingHelper.cs
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+using System;
using System.Threading.Tasks;
using Org.Apache.REEF.Utilities.Logging;
@@ -36,8 +37,10 @@ namespace Org.Apache.REEF.Utilities.AsyncUtils
{
self.ContinueWith(t =>
{
+ var message = string.IsNullOrWhiteSpace(msg) ? string.Empty : msg + " ";
+
// ReSharper disable once PossibleNullReferenceException ; We know the task is Faulted
- logger.Log(logLevel, "{0} Exception:{1}", t.Exception.GetBaseException());
+ logger.Log(logLevel, "{0}Exception: {1}", message, t.Exception.GetBaseException());
},
TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously);
}
http://git-wip-us.apache.org/repos/asf/reef/blob/96f32a59/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/StreamingTransportServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/StreamingTransportServer.cs b/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/StreamingTransportServer.cs
index 47248ed..706fac4 100644
--- a/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/StreamingTransportServer.cs
+++ b/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/StreamingTransportServer.cs
@@ -20,6 +20,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
+using Org.Apache.REEF.Utilities.AsyncUtils;
using Org.Apache.REEF.Utilities.Diagnostics;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Wake.StreamingCodec;
@@ -160,7 +161,8 @@ namespace Org.Apache.REEF.Wake.Remote.Impl
while (!_cancellationSource.Token.IsCancellationRequested)
{
TcpClient client = await _listener.AcceptTcpClientAsync().ConfigureAwait(false);
- ProcessClient(client).Forget();
+ ProcessClient(client).LogAndIgnoreExceptionIfAny(
+ LOGGER, "Task Exception observed processing client in StreamingTransportServer.", Level.Warning);
}
}
catch (InvalidOperationException)
http://git-wip-us.apache.org/repos/asf/reef/blob/96f32a59/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs b/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs
index c5ec20c..ec2c4e2 100644
--- a/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs
+++ b/lang/cs/Org.Apache.REEF.Wake/Remote/Impl/TransportServer.cs
@@ -20,6 +20,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
+using Org.Apache.REEF.Utilities.AsyncUtils;
using Org.Apache.REEF.Utilities.Diagnostics;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Wake.Util;
@@ -175,7 +176,8 @@ namespace Org.Apache.REEF.Wake.Remote.Impl
while (!_cancellationSource.Token.IsCancellationRequested)
{
TcpClient client = await _listener.AcceptTcpClientAsync().ConfigureAwait(false);
- ProcessClient(client).Forget();
+ ProcessClient(client).LogAndIgnoreExceptionIfAny(
+ LOGGER, "Task Exception observed processing client in TransportServer.", Level.Warning);
}
}
catch (InvalidOperationException)
http://git-wip-us.apache.org/repos/asf/reef/blob/96f32a59/lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs b/lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs
index 53b53d0..2865fc5 100644
--- a/lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs
+++ b/lang/cs/Org.Apache.REEF.Wake/Util/TaskExtensions.cs
@@ -15,12 +15,16 @@
// specific language governing permissions and limitations
// under the License.
+using System;
using System.Threading.Tasks;
namespace Org.Apache.REEF.Wake.Util
{
+ [Obsolete("Deprecated in 0.15. Will be removed in 0.16.")]
public static class TaskExtensions
{
+ [Obsolete("Deprecated in 0.15. Will be removed in 0.16. " +
+ "Please use LoggingHelper.LogAndIgnoreExceptionIfAny instead.")]
public static void Forget(this Task task)
{
}