README documentation is incorrect!

Posted by thestarmaker:

The below code sample is a terrible recommendation, there is a race condition in code (transaction is closed before the query executes):



try(AsyncTransaction txn = dgraphAsyncClient.newTransaction()) {
  txn.query(query).thenAccept(response -> {
      // Deserialize
      People ppl = gson.fromJson(res.getJson().toStringUtf8(), People.class);

      // Print results
      System.out.printf("people found: %d\n", ppl.all.size());
      ppl.all.forEach(person -> System.out.println(person.name));
  });
}

deepakjois commented :

Yes, I see that now. Sorry about that.

Will fix.

deepakjois commented :

Fixed by removing try block