Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2111

Synchronization mechanism for Java Async Driver

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    Description

      I'm using the 3.2.1 Async driver to do the following :

      ...
       
      while(InputIterator.hasNext()){
       
         MongoCollection.insertOne(document, new SingleResultCallback<Void>(){
          @Override
          public void onResult(Void v, Throwable t) {
              
          }
      });
       
      }
      ...
       
      MongoClient.close();
      

      The only issue is that MongoClient is being closed before all of the queued inserts are processed and I'm getting "Pool is closed". I cannot use CountDownLatch as I don't know the size of my InputIterator.

      Does the Async driver provide any synchronization mechanisms that we can use in this case ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            amarouni Abbass Marouni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: