网络 调度执行器服务
If your goal was to create a "heartbeat" command that "pinged" every five seconds, ScheduledExecutorService would make it as simple as what you see in Listing 4.
如果您的目标是创建一个每隔5秒跳一次的“心跳”命令,使用ScheduledExecutorService可以轻松实现,如清单4所示。