IntelliJ sometimes does not follow breakpoints

I have the following code:

/*01*/ final BlockingQueue<CsvFileRow> allRows = new LinkedBlockingQueue<CsvFileRow>(); /*02*/ ExecutorService exec = Executors.newFixedThreadPool(3); /*03*/ Callable<Void> producer = new Callable<Void>() { /*04*/ @Override /*05*/ public Void call() throws Exception { /*06*/ System.out.println("Before producer"); /*07*/ produceDataRows(allRows); /*08*/ System.out.println(" After producer"); /*09*/ return null; /*10*/ } /*11*/ }; /*12*/ Callable<Void> consumer = new Callable<Void>() { /*13*/ @Override /*14*/ public Void call() throws Exception { /*15*/ System.out.println("Before consumer"); /*16*/ consumeDataRows(allRows); /*17*/ System.out.println(" After consumer"); /*18*/ return null; /*19*/ } /*20*/ }; /*21*/ exec.submit(producer); /*22*/ exec.submit(consumer); /*23*/ exec.shutdown(); /*24*/ exec.awaitTermination(10, TimeUnit.DAYS); /*25*/ assert Boolean.TRUE; 

I have breakpoints on lines 7, 16, 21, and 25. Code execution stops at breakpoints 21.7, and then 25 - breakpoint 16 is skipped! But the code was executed, see Output:

 Before producer Before consumer After consumer After producer 

Now, if I remove breakpoint 7, the debugger will stop at breakpoints 21.16, and then 25.

This is a very annoying problem. In fact, there are other scenarios where I noticed that IntelliJ ignores breakpoints, which is very alarming.

Did I miss something?

+6
source share

Source: https://habr.com/ru/post/922302/


All Articles