所以我有一个不和谐的机器人,我试图每小时发送一条消息。我使用预定的executor服务让这部分代码正常工作。我说的时候就开始了!未来 我希望在发送时能够阻止它!未来关闭 但是,我不能让它正常工作。下面是我的代码: String[] args = event.getMessage().getContentRaw().split(" "); Color red = new Color(255, 0, 0);
Color green = new
我正在使用ScheduledExecutorService执行一个以固定速率调用服务的任务。服务可能会向任务返回一些数据。该任务将数据存储在队列中。java.util.concurrent.BlockingQueue;import java.util.concurrent.ScheduledExecutorServiceimport java.util.concurrent.TimeUnit;
public class EverlastingThread i
我正在使用ScheduledExecutorService在一个J2EE应用程序中调度一个任务,每x秒从一个配置文件(从数据库中获取数据并发送到外部服务器)。我的代码是: final ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor()我应该编写一个while循环来确保线程已经完成,然后执行一个service.shutdown(),还是由ScheduledExecutorService来处理呢?