TS-Benchmark icon indicating copy to clipboard operation
TS-Benchmark copied to clipboard

TSBM - queue.take blocking

Open ylin30 opened this issue 3 years ago • 1 comments

queue.take() will hang forever and block thread2.join and thread3.join later. You can use queue.poll(timeout, unit) instead.

@@ -255,9 +258,9 @@ public class TSBM { break; } try {

  •                    String data = queue.take();
    
  •                    String data = queue.poll(100, TimeUnit.MILLISECONDS);
                       if (data == null) {
    
  •                        Thread.sleep(100);
    
  •                        //Thread.sleep(100);
                           continue;
                       }
                       adapter.insertData(data);
    

@@ -265,6 +268,7 @@ public class TSBM { e.printStackTrace(); }

image

ylin30 avatar Nov 05 '21 17:11 ylin30

Thanks, you can fork this, then make a PR.

rainmaple avatar Mar 18 '22 08:03 rainmaple