moving latch instation before submit in push-test-intent command
Showing
1 changed file
with
7 additions
and
2 deletions
... | @@ -74,6 +74,8 @@ public class IntentPushTestCommand extends AbstractShellCommand | ... | @@ -74,6 +74,8 @@ public class IntentPushTestCommand extends AbstractShellCommand |
74 | int count = Integer.parseInt(countString); | 74 | int count = Integer.parseInt(countString); |
75 | 75 | ||
76 | service.addListener(this); | 76 | service.addListener(this); |
77 | + latch = new CountDownLatch(count); | ||
78 | + | ||
77 | start = System.currentTimeMillis(); | 79 | start = System.currentTimeMillis(); |
78 | for (int i = 0; i < count; i++) { | 80 | for (int i = 0; i < count; i++) { |
79 | TrafficSelector s = selector | 81 | TrafficSelector s = selector |
... | @@ -87,9 +89,8 @@ public class IntentPushTestCommand extends AbstractShellCommand | ... | @@ -87,9 +89,8 @@ public class IntentPushTestCommand extends AbstractShellCommand |
87 | egress); | 89 | egress); |
88 | service.submit(intent); | 90 | service.submit(intent); |
89 | } | 91 | } |
90 | - latch = new CountDownLatch(count); | ||
91 | try { | 92 | try { |
92 | - latch.await(3, TimeUnit.SECONDS); | 93 | + latch.await(5, TimeUnit.SECONDS); |
93 | printResults(count); | 94 | printResults(count); |
94 | } catch (InterruptedException e) { | 95 | } catch (InterruptedException e) { |
95 | print(e.toString()); | 96 | print(e.toString()); |
... | @@ -134,7 +135,11 @@ public class IntentPushTestCommand extends AbstractShellCommand | ... | @@ -134,7 +135,11 @@ public class IntentPushTestCommand extends AbstractShellCommand |
134 | public void event(IntentEvent event) { | 135 | public void event(IntentEvent event) { |
135 | if (event.type() == Type.INSTALLED) { | 136 | if (event.type() == Type.INSTALLED) { |
136 | end = event.time(); | 137 | end = event.time(); |
138 | + if (latch != null) { | ||
137 | latch.countDown(); | 139 | latch.countDown(); |
140 | + } else { | ||
141 | + log.warn("install event latch is null"); | ||
142 | + } | ||
138 | } | 143 | } |
139 | } | 144 | } |
140 | } | 145 | } | ... | ... |
-
Please register or login to post a comment