33import com .bugsnag .serialization .Expose ;
44
55import java .util .Date ;
6- import java .util .concurrent .Semaphore ;
76import java .util .concurrent .atomic .AtomicInteger ;
87
98class Session {
109
11- private final Semaphore incrementRequest = new Semaphore (1 );
12-
1310 private final String id ;
1411 private final Date startedAt ;
1512 private final AtomicInteger handledCount ;
@@ -22,13 +19,6 @@ class Session {
2219 this .unhandledCount = new AtomicInteger (0 );
2320 }
2421
25- private Session (String id , Date startedAt , int handledCount , int unhandledCount ) {
26- this .id = id ;
27- this .startedAt = startedAt ;
28- this .handledCount = new AtomicInteger (handledCount );
29- this .unhandledCount = new AtomicInteger (unhandledCount );
30- }
31-
3222 int getHandledCount () {
3323 return handledCount .get ();
3424 }
@@ -37,16 +27,6 @@ void incrementHandledCount() {
3727 this .handledCount .incrementAndGet ();
3828 }
3929
40- Session incrementHandledCountAndClone () throws InterruptedException {
41- try {
42- incrementRequest .acquire ();
43- incrementHandledCount ();
44- return cloneSession ();
45- } finally {
46- incrementRequest .release ();
47- }
48- }
49-
5030 int getUnhandledCount () {
5131 return unhandledCount .get ();
5232 }
@@ -55,20 +35,6 @@ void incrementUnhandledCount() {
5535 this .unhandledCount .incrementAndGet ();
5636 }
5737
58- Session incrementUnhandledCountAndClone () throws InterruptedException {
59- try {
60- incrementRequest .acquire ();
61- incrementUnhandledCount ();
62- return cloneSession ();
63- } finally {
64- incrementRequest .release ();
65- }
66- }
67-
68- private Session cloneSession () {
69- return new Session (id , startedAt , handledCount .get (), unhandledCount .get ());
70- }
71-
7238 String getId () {
7339 return id ;
7440 }
0 commit comments