Executors 之 ScheduledExecutorService 代码片断
来源:互联网 发布:清真食品卫生吗 知乎 编辑:程序博客网 时间:2024/06/06 02:19
//1 thread for this pool private final ScheduledExecutorService healthCheckScheduler = Executors.newScheduledThreadPool(1); public void scheduleHealthCheck() { //此处使用lambda healthCheckScheduler.scheduleAtFixedRate(() -> { HealthReport healthReport = createHealthReport(); latestHealth = new Health(healthReport); if (healthReport.isAvailable()) { String message = XXXXFormatter.toJson("health", 1); log.info(message); XXXClient.send(message); } }, 30, 900, TimeUnit.SECONDS); log.info("Health check scheduler started with 15 minutes period"); }
0 0
- Executors 之 ScheduledExecutorService 代码片断
- 代码片断
- 代码片断
- 代码片断
- 代码片断
- Java 多线程线程池之concurrent包,ExecutorService接口,ScheduledExecutorService接口和Executors类
- Runnable、Callable、Executor、ExecutorService、ScheduledExecutorService、Executors
- 代码之破碎时刻(代码片断分析)(Break Up Time)
- 常用代码片断
- C#代码片断
- 常用的代码片断
- C++Builder代码片断
- 代码片断改进
- DropFile实现代码片断
- 代码片断2
- 代码片断3
- .net常用代码片断
- 创建xcode代码片断
- 检测更新版本
- sass中@keyframes、animation的使用
- 剑指offer面试题4:替换空格
- leetcode Best Time to Buy and Sell Stock
- 支持多种屏幕Supporting Multiple Screens---Develop ---API Guides ---Best Practices
- Executors 之 ScheduledExecutorService 代码片断
- windows内存申请
- javascript入门篇(慕课网笔记整理)
- java实现短信接口
- RxJava 各种操作符(1)
- oracle sqlloader安装及使用
- ios中runtime和runloop 的区别
- Python-Day4(函数式编程)
- Android JNI 动态注册方法(JNI_OnLoad)