/*
 * Copyright 2014-2018 Chronicle Software
 *
 * http://chronicle.software
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.openhft.chronicle.queue.impl.single;

import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.core.OS;
import net.openhft.chronicle.threads.Threads;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.concurrent.ExecutorService;

public enum QueueFileShrinkManager {
    ;
    public static final String THREAD_NAME = "queue-file-shrink-daemon";
    static boolean RUN_SYNCHRONOUSLY = false;
    private static final boolean DISABLE_QUEUE_FILE_SHRINKING = !OS.isWindows() && Boolean.getBoolean("chronicle.queue.disableFileShrinking");
    private static final ExecutorService executor = Threads.acquireExecutorService(THREAD_NAME, 1, true);

    public static void scheduleShrinking(File queueFile, long writePos) {
        if (DISABLE_QUEUE_FILE_SHRINKING)
            return;
        Runnable task = () -> {
            while (true) {
                try {
                    Jvm.debug().on(QueueFileShrinkManager.class, "Shrinking " + queueFile + " to " + writePos);
                    RandomAccessFile raf = new RandomAccessFile(queueFile, "rw");

                    raf.setLength(writePos);
                    raf.close();
                } catch (IOException ex) {
                    // on macrosux windows, keep retrying until the file is unmapped
                    if (ex.getMessage().contains("The requested operation cannot be performed on a file with a user-mapped section open"))
                        continue;
                    Jvm.warn().on(QueueFileShrinkManager.class, "Failed to shrink file " + queueFile, ex);
                }
                break;
            }
        };
        if (RUN_SYNCHRONOUSLY)
            task.run();
        else
            executor.submit(task);
    }
}

@@ -682,47 +682,8 @@
 e;%0A%0A
-import net.openhft.chronicle.core.Jvm;%0A
 impo
@@ -716,16 +716,16 @@
 ore.OS;%0A
+
 import n
@@ -761,16 +761,73 @@
 Threads;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0Aimport
@@ -1110,16 +1110,109 @@
  false;%0A
+    private static final Logger LOG = LoggerFactory.getLogger(QueueFileShrinkManager.class);%0A
     priv
@@ -1694,88 +1694,50 @@
     
-Jvm
+LOG
 .debug(
-).on(QueueFileShrinkManager.class, %22Shrinking %22 + queueFile + %22 to %22 +
+%22Shrinking %7B%7D to %7B%7D%22, queueFile,
  wri
@@ -2230,52 +2230,17 @@
     
-Jvm
+LOG
 .warn(
-).on(QueueFileShrinkManager.class, 
 %22Fai

Use logger