package com.doverfuelingsolutions.issp.utils.thread

import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit

object ThreadUtil {

    private val logExecutor =
        ThreadPoolExecutor(1, 1, 10, TimeUnit.SECONDS, LinkedBlockingQueue(100), DFSThreadFactory("log"))
    private val ioExecutor =
        ThreadPoolExecutor(3, 5, 0, TimeUnit.MILLISECONDS, LinkedBlockingQueue(200), DFSThreadFactory("io"))

    fun log(runnable: Runnable) = logExecutor.execute(runnable)
    fun io(runnable: Runnable) = ioExecutor.execute(runnable)
}