@@ -171,20 +171,23 @@ void shouldTrackPercentilesWhenDynatraceSummaryInstrumentsNotUsed() throws Throw
171171 DistributionSummary distributionSummary = DistributionSummary .builder ("my.ds" )
172172 .publishPercentiles (trackedPercentiles )
173173 .register (registry );
174- CountDownLatch lttCountDownLatch = new CountDownLatch (1 );
175174 LongTaskTimer longTaskTimer = LongTaskTimer .builder ("my.ltt" )
176175 .publishPercentiles (trackedPercentiles )
177176 .register (registry );
178177
179178 timer .record (Duration .ofMillis (100 ));
180179 distributionSummary .record (100 );
181180
181+ CountDownLatch lttCountDownLatch1 = new CountDownLatch (1 );
182+ CountDownLatch lttCountDownLatch2 = new CountDownLatch (1 );
183+
182184 ExecutorService executorService = Executors .newSingleThreadExecutor ();
183185 executorService .submit (() -> longTaskTimer .record (() -> {
184186 clock .add (Duration .ofMillis (100 ));
187+ lttCountDownLatch1 .countDown ();
185188
186189 try {
187- assertThat (lttCountDownLatch .await (300 , MILLISECONDS )).isTrue ();
190+ assertThat (lttCountDownLatch2 .await (300 , MILLISECONDS )).isTrue ();
188191 }
189192 catch (InterruptedException e ) {
190193 throw new RuntimeException (e );
@@ -193,9 +196,10 @@ void shouldTrackPercentilesWhenDynatraceSummaryInstrumentsNotUsed() throws Throw
193196
194197 clock .add (dynatraceConfig .step ());
195198
199+ assertThat (lttCountDownLatch1 .await (100 , MILLISECONDS )).isTrue ();
196200 registry .publish ();
197201 // release long task timer
198- lttCountDownLatch .countDown ();
202+ lttCountDownLatch2 .countDown ();
199203
200204 verify (httpClient ).send (
201205 assertArg ((request -> assertThat (request .getEntity ()).asString ()
0 commit comments