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.
 
 
 

53 regels
1.1 KiB

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