摘要: Thread类实现 import org.springframework.stereotype.Component; @Component public class AlarmMockThread extends Thread { private volatile long startTime = 阅读全文
posted @ 2020-04-06 19:29 大浪不惊涛 阅读(280) 评论(0) 推荐(0)
摘要: 之前在一篇文章中提到过线程的安全终止的方法,大致的意思就是自定义一个boolean 类型的 volatile 变量,通过控制这个变量来终止线程。 class UiThread extends Thread { private volatile boolean isRun = true; @Overr 阅读全文
posted @ 2020-04-06 19:22 大浪不惊涛 阅读(289) 评论(0) 推荐(0)