package de.jeha.photo.mosaic.concurrents;

import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

class MosaicThreadMonitor implements Runnable {

    private final ThreadPoolExecutor executor;
    private final int delaySeconds;
    private boolean isRunning = true;

    MosaicThreadMonitor(ThreadPoolExecutor executor, int delaySeconds) {
        this.executor = executor;
        this.delaySeconds = delaySeconds;
    }

    @Override
    public void run() {
        while (isRunning) {
            System.out.println(
                    String.format("[monitor] [%d/%d] Active: %d, Completed: %d, Task: %d, isShutdown: %s, isTerminated: %s",
                            executor.getPoolSize(),
                            executor.getCorePoolSize(),
                            executor.getActiveCount(),
                            executor.getCompletedTaskCount(),
                            executor.getTaskCount(),
                            executor.isShutdown(),
                            executor.isTerminated()));
            try {
                Thread.sleep(TimeUnit.SECONDS.toMillis(delaySeconds));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    void shutdown() {
        isRunning = false;
    }

}
@@ -36,16 +36,74 @@
 rents;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import j
@@ -230,16 +230,107 @@
 able %7B%0A%0A
+    private static final Logger LOG = LoggerFactory.getLogger(MosaicThreadMonitor.class);%0A%0A
     priv
@@ -681,61 +681,16 @@
     
-System.out.println(%0A                    String.format
+LOG.info
 (%22%5Bm
@@ -702,28 +702,28 @@
 r%5D %5B
-%25d/%25d%5D A
+%7B%7D/%7B%7D%5D a
 ctive: 
-%25d, C
+%7B%7D, c
 ompl
@@ -732,20 +732,20 @@
 ed: 
-%25d, T
+%7B%7D, t
 ask: 
-%25d
+%7B%7D
 , is
@@ -754,18 +754,18 @@
 utdown: 
-%25s
+%7B%7D
 , isTerm
@@ -776,10 +776,10 @@
 ed: 
-%25s
+%7B%7D
 %22,%0A 
@@ -793,32 +793,24 @@
             
-        
 executor.get
@@ -817,32 +817,24 @@
 PoolSize(),%0A
-        
             
@@ -885,32 +885,24 @@
             
-        
 executor.get
@@ -912,32 +912,24 @@
 iveCount(),%0A
-        
             
@@ -966,32 +966,24 @@
 askCount(),%0A
-        
             
@@ -1031,32 +1031,24 @@
             
-        
 executor.isS
@@ -1074,32 +1074,24 @@
             
-        
 executor.isT
@@ -1102,17 +1102,16 @@
 nated())
-)
 ;%0A      
@@ -1260,26 +1260,42 @@
     
-e.printStackTrace(
+LOG.warn(%22Unexpected interrupt%22, e
 );%0A 

use logger