package com.yh.saas.plugin.news.util.thread;

import java.util.Arrays;
import java.util.List;

public class ThreadLifeCycleClient {

    public static void main(String[] args) {
        List<String> ids = Arrays.asList("1", "2", "3", "4");
        ThreadLifeCycleObserver observer = new ThreadLifeCycleObserver();
        // 将任务使用我们的包装类进行包装
        System.out.println("-----------------start");
        new Thread(new ObservableRunnable(observer, () -> {
            System.out.println("当前任务正在执行一些操作");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        })).start();
        System.out.println("-----------------end");
    }


}
