package com.uas.platform.b2b.manage.support;

import javax.validation.constraints.NotNull;
import java.util.concurrent.ThreadFactory;

/**
 * 手动创建线程池
 *
 * @author hejq
 * @date 2018-07-27 17:54
 */
public class MyThread implements ThreadFactory {
    /**
     * Constructs a new {@code Thread}.  Implementations may also initialize
     * priority, name, daemon status, {@code ThreadGroup}, etc.
     *
     * @param r a runnable to be executed by new thread instance
     * @return constructed thread, or {@code null} if the request to
     * create a thread is rejected
     */
    @Override
    public Thread newThread(@NotNull Runnable r) {
        Thread thread = new Thread(r);
        thread.setName("myThread");
        return thread;
    }
}
