@Override
        public void run() {
            long startTime = System.nanoTime();
            try {
                runnable.run();
            } catch (Exception e) {
                LOGGER.error("Caught an error while running the task \""
                        + taskName
                        + "\" defined in the class: "
                        + runnable.getClass()
                                .getName(),
                        e);
            }
            long took = System.nanoTime() - startTime;
            if (took > SLOW_LOG_THRESHOLD_NANOS) {
                LOGGER.warn("The task \""
                        + taskName
                        + "\" defined in the class ("
                        + runnable.getClass()
                                .getName()
                        + ") was slow and took ("
                        + (took / DateTimeUtil.NANOS_PER_MILLI)
                        + ") millis to execute");
            }
        }
Handle tasks in a thread

@author James Chen
turms-server-common/src/main/java/im/turms/server/common/infra/task/TaskManager.java