简体   繁体   中英

With Twitter4j, how do I wait for all async calls to finish?

This example shows how to use the async methods of Twitter4j to make requests to the Twitter API, but it only makes one request.

I want to be able to fire multiple queries to the API, execute them asynchronously and wait for them to finish before exiting the program.

Since I'm not creating the threads myself, I'm not sure how I can create the synchronization mechanism. I thought about creating some kind of thread counter, and decrementing it on the callback listeners, but seemed a little hackish.

Any help? Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM