File tree 1 file changed +11
-4
lines changed
pulsar-broker/src/test/java/org/apache/pulsar/client/api
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -844,14 +844,15 @@ public void testMsgDropStat() throws Exception {
844
844
.messageRoutingMode (MessageRoutingMode .SinglePartition )
845
845
.create ();
846
846
@ Cleanup ("shutdownNow" )
847
- ExecutorService executor = Executors .newFixedThreadPool (5 );
847
+ ExecutorService executor = Executors .newFixedThreadPool (10 );
848
848
byte [] msgData = "testData" .getBytes ();
849
849
final int totalProduceMessages = 1000 ;
850
850
CountDownLatch latch = new CountDownLatch (1 );
851
851
AtomicInteger messagesSent = new AtomicInteger (0 );
852
852
for (int i = 0 ; i < totalProduceMessages ; i ++) {
853
853
executor .submit (() -> {
854
- producer .sendAsync (msgData ).handle ((msgId , e ) -> {
854
+ try {
855
+ MessageId msgId = producer .send (msgData );
855
856
int count = messagesSent .incrementAndGet ();
856
857
// process at least 20% of messages before signalling the latch
857
858
// a non-persistent message will return entryId as -1 when it has been dropped
@@ -861,8 +862,14 @@ public void testMsgDropStat() throws Exception {
861
862
&& ((MessageIdImpl ) msgId ).getEntryId () == -1 ) {
862
863
latch .countDown ();
863
864
}
864
- return null ;
865
- });
865
+
866
+ Thread .sleep (10 );
867
+ } catch (PulsarClientException e ) {
868
+ throw new RuntimeException (e );
869
+ } catch (InterruptedException e ) {
870
+ Thread .currentThread ().interrupt ();
871
+ throw new RuntimeException (e );
872
+ }
866
873
});
867
874
}
868
875
assertTrue (latch .await (5 , TimeUnit .SECONDS ));
You can’t perform that action at this time.
0 commit comments