-
Beta Was this translation helpful? Give feedback.
Answered by
jchambers
Jul 23, 2021
Replies: 1 comment 1 reply
-
While I'm having a little trouble following your example code (you're both calling My recommendation would be to do something like this: final ApnsClient apnsClient = ...;
final CountDownLatch countDownLatch = new CountDownLatch(cfgList.size());
for (final PushConfigRspDTO configRspDTO : cfgLst) {
final final SimpleApnsPushNotification pushNotification = ...;
apnsClient.sendNotification(pushNotification).whenComplete((response, cause) -> {
// Do whatever processing you need to do when you receive a response
countDownLatch.countDown();
});
}
// Wait until all sending operations are done before closing the client
countDownLatch.await();
apnsClient.close().join(); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
pasake
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While I'm having a little trouble following your example code (you're both calling
sendNotificationFuture.get
ANDsendNotificationFuture.whenComplete
, which is a little confusing), it sounds like you're running into this frequently-asked question:My recommendation would be to do something like this: