You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 line
1.1 KiB

  1. using JTNE.DotNetty.Core.Metadata;
  2. namespace JTNE.DotNetty.Core.Services
  3. {
  4. /// <summary>
  5. /// Tcp计数包服务
  6. /// </summary>
  7. public class JTNETcpAtomicCounterService
  8. {
  9. private readonly JTNEAtomicCounter MsgSuccessCounter = new JTNEAtomicCounter();
  10. private readonly JTNEAtomicCounter MsgFailCounter = new JTNEAtomicCounter();
  11. public JTNETcpAtomicCounterService()
  12. {
  13. }
  14. public void Reset()
  15. {
  16. MsgSuccessCounter.Reset();
  17. MsgFailCounter.Reset();
  18. }
  19. public long MsgSuccessIncrement()
  20. {
  21. return MsgSuccessCounter.Increment();
  22. }
  23. public long MsgSuccessCount
  24. {
  25. get
  26. {
  27. return MsgSuccessCounter.Count;
  28. }
  29. }
  30. public long MsgFailIncrement()
  31. {
  32. return MsgFailCounter.Increment();
  33. }
  34. public long MsgFailCount
  35. {
  36. get
  37. {
  38. return MsgFailCounter.Count;
  39. }
  40. }
  41. }
  42. }