IntelliJ sometimes does not respect breakpoints

Viewed 2025

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. Running the code stops on the breakpoints 21,7 and then 25 - the breakpoint 16 is skipped! But, the code has been executed, see the output:

Before producer
Before consumer
 After consumer
 After producer

Now, if I remove the breakpoint 7, then the debugger stops on the breakpoints 21,16 and then 25.

This is an extremely annoying issue. In fact, there are other scenarios where I have noticed that IntelliJ ignores the breakpoints, which is very disturbing.

Am I missing something?

0 Answers
Related