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(3, 6, 10, TimeUnit.SECONDS, LinkedBlockingQueue(200), DFSThreadFactory("log"))
    private val ioExecutor =
        ThreadPoolExecutor(10, 20, 0, TimeUnit.MILLISECONDS, LinkedBlockingQueue(200), DFSThreadFactory("io"))

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