How to put Aerospike Async Client into wait till all submitted job completed?



I am inserting 10 million record using Aerospike Async client in loop and after finishing loop i am calling if(aerospikeClient != null && aerospikeClient.isConnected()) aerospikeClient.close(); But then i am start getting "com.aerospike.client.AerospikeException: java.util.concurrent.RejectedExecutionException:". That means job is still running when aerospikeClient close connection.

Is there any way we can put wait till all submitted job completed. I can do this using some atomic global variable but i want to know whether this feature is present in java client library


There is no current mechanism to wait until all async commands have finished.