Index: third_party/grpc/src/csharp/Grpc.Core/Internal/DebugStats.cs |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core/Internal/DebugStats.cs |
similarity index 67% |
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs |
copy to third_party/grpc/src/csharp/Grpc.Core/Internal/DebugStats.cs |
index 318d58c968a58a35a3ccd45ee1c7b1f0df275546..1bea1adf9e3e5ed84191fe456182c9c16be2fad2 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs |
+++ b/third_party/grpc/src/csharp/Grpc.Core/Internal/DebugStats.cs |
@@ -1,7 +1,7 @@ |
#region Copyright notice and license |
-// Protocol Buffers - Google's data interchange format |
-// Copyright 2008 Google Inc. All rights reserved. |
-// https://developers.google.com/protocol-buffers/ |
+ |
+// Copyright 2015, Google Inc. |
+// All rights reserved. |
// |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
@@ -28,28 +28,33 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ |
#endregion |
-namespace Google.Protobuf.Reflection |
+using System; |
+using System.Threading; |
+ |
+namespace Grpc.Core.Internal |
{ |
- /// <summary> |
- /// Interface implemented by all descriptor types. |
- /// </summary> |
- public interface IDescriptor |
+ internal class DebugStats |
{ |
- /// <summary> |
- /// Returns the name of the entity (message, field etc) being described. |
- /// </summary> |
- string Name { get; } |
+ public readonly AtomicCounter PendingBatchCompletions = new AtomicCounter(); |
/// <summary> |
- /// Returns the fully-qualified name of the entity being described. |
+ /// Checks the debug stats and take action for any inconsistency found. |
/// </summary> |
- string FullName { get; } |
+ public void CheckOK() |
+ { |
+ var pendingBatchCompletions = PendingBatchCompletions.Count; |
+ if (pendingBatchCompletions != 0) |
+ { |
+ DebugWarning(string.Format("Detected {0} pending batch completions.", pendingBatchCompletions)); |
+ } |
+ } |
- /// <summary> |
- /// Returns the descriptor for the .proto file that this entity is part of. |
- /// </summary> |
- FileDescriptor File { get; } |
- } |
-} |
+ private void DebugWarning(string message) |
+ { |
+ throw new Exception("Shutdown check: " + message); |
+ } |
+ } |
+} |