@@ -52,8 +52,6 @@ public class DocumentCRUDQuickstartAsync {
5252 private AtomicBoolean createDocDone = new AtomicBoolean (false );
5353 private AtomicBoolean createDocsDone = new AtomicBoolean (false );
5454
55- private AtomicBoolean readDocDone = new AtomicBoolean (false );
56-
5755 private List <JsonNode > jsonList ;
5856 private String etag1 ;
5957 private String etag2 ;
@@ -135,8 +133,8 @@ private void documentCRUDDemo() throws Exception {
135133 createDocuments (familiesToCreate );
136134
137135 while (!(createDocDone .get () && createDocsDone .get ())) {
138- //waiting for async createDoc and createDocs to complete...
139- logger . info ( "waiting for async createDoc and createDocs to complete..." );
136+ // We are adding Thread.sleep to mimic the some business computation that can
137+ // happen while waiting for earlier processes to finish.
140138 Thread .sleep (100 );
141139 }
142140
@@ -149,8 +147,8 @@ private void documentCRUDDemo() throws Exception {
149147
150148 getDocumentsAsJsonArray ();
151149 while (this .jsonList == null ) {
152- //wait for jsonList to be set
153- logger . info ( "waiting in while (this.jsonList == null) {" );
150+ // We are adding Thread.sleep to mimic the some business computation that can
151+ // happen while waiting for earlier processes to finish.
154152 Thread .sleep (100 );
155153 }
156154 //convert jsonList to ArrayNode
@@ -159,7 +157,8 @@ private void documentCRUDDemo() throws Exception {
159157 replaceDocument ();
160158 upsertDocument ();
161159 while (!(upsertDone .get () && replaceDone .get ())) {
162- logger .info ("waiting for async upsert and replace to complete..." );
160+ // We are adding Thread.sleep to mimic the some business computation that can
161+ // happen while waiting for earlier processes to finish.
163162 Thread .sleep (100 );
164163 }
165164 logger .info ("replace and upsert done now..." );
@@ -404,7 +403,8 @@ private void replaceDocumentWithConditionalEtagCheck() throws Exception {
404403 }).subscribe ();
405404
406405 while (this .etag1 == null ) {
407- logger .info ("waiting until we got the etag1 from the first read...." );
406+ // We are adding Thread.sleep to mimic the some business computation that can
407+ // happen while waiting for earlier processes to finish.
408408 Thread .sleep (100 );
409409 }
410410 String etag = this .etag1 ;
@@ -430,7 +430,9 @@ private void replaceDocumentWithConditionalEtagCheck() throws Exception {
430430
431431
432432 while (updateEtagDone .get () == false ) {
433- //wait until update done
433+ // We are adding Thread.sleep to mimic the some business computation that can
434+ // happen while waiting for earlier processes to finish.
435+ Thread .sleep (100 );
434436 }
435437 // Now update the document and call replace with the AccessCondition requiring that ETag has not changed.
436438 // This should fail because the "concurrent" document change updated the ETag.
@@ -471,12 +473,13 @@ private void readDocumentOnlyIfChanged() throws Exception {
471473 }).subscribe ();
472474
473475 while (this .etag2 == null ) {
474- logger .info ("waiting until we got the etag2 from the first read...." );
476+ // We are adding Thread.sleep to mimic the some business computation that can
477+ // happen while waiting for earlier processes to finish.
475478 Thread .sleep (100 );
476479 }
477480 while (this .isFamily2Updated .get () == false ) {
478- //wait for family to be upadted...
479- logger . info ( " waiting until family2 got updated...." );
481+ // We are adding Thread.sleep to mimic the some business computation that can
482+ // happen while waiting for earlier processes to finish.
480483 Thread .sleep (100 );
481484 }
482485 ;
@@ -501,7 +504,8 @@ private void readDocumentOnlyIfChanged() throws Exception {
501504 .subscribe ();
502505
503506 while (reReadDone .get () == false ) {
504- //wait for reRead
507+ // We are adding Thread.sleep to mimic the some business computation that can
508+ // happen while waiting for earlier processes to finish.
505509 Thread .sleep (100 );
506510 }
507511 // Replace the doc with a modified version, which will update ETag
@@ -521,7 +525,9 @@ private void readDocumentOnlyIfChanged() throws Exception {
521525 }).subscribe ();
522526
523527 while (secondUpdateDone .get () == false ) {
524- //wait for second update before re-reading the doc...
528+ // We are adding Thread.sleep to mimic the some business computation that can
529+ // happen while waiting for earlier processes to finish.
530+ Thread .sleep (100 );
525531 }
526532
527533 // Re-read doc again, with conditional access requirements.
0 commit comments