Rename method
This commit is contained in:
parent
d09c59996b
commit
161c91b45d
@ -52,7 +52,7 @@ public class Cache
|
||||
private static LocalDateTime startupTime = null;
|
||||
|
||||
// the scheduler that should always be used when running a scheduled task.
|
||||
private final static ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); // todo: try-with-resources
|
||||
private final static ScheduledExecutorService taskScheduler = Executors.newSingleThreadScheduledExecutor(); // todo: try-with-resources
|
||||
|
||||
private final static String execPath = System.getProperty("user.dir");
|
||||
private static final String botName = "Hideko";
|
||||
@ -322,8 +322,8 @@ public class Cache
|
||||
loveCalculatorValues.remove(userId2 + "|" + userId1);
|
||||
}
|
||||
|
||||
public static ScheduledExecutorService getScheduler() {
|
||||
return scheduler;
|
||||
public static ScheduledExecutorService getTaskScheduler() {
|
||||
return taskScheduler;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class HidekoBot
|
||||
}
|
||||
|
||||
// start scheduled runnables
|
||||
ScheduledExecutorService scheduler = Cache.getScheduler();
|
||||
ScheduledExecutorService scheduler = Cache.getTaskScheduler();
|
||||
ExpiredMessageTask expiredMessageTask = new ExpiredMessageTask();
|
||||
scheduler.scheduleAtFixedRate(expiredMessageTask, 5, 5, TimeUnit.SECONDS); //every 5 seconds
|
||||
HeartBeatTask heartBeatTask = new HeartBeatTask();
|
||||
|
@ -20,7 +20,7 @@ public class LoveCalculator
|
||||
{
|
||||
loveAmount = RandomUtil.getRandomNumber(0, 100);
|
||||
Cache.cacheLoveCalculatorValue(userId1, userId2, loveAmount);
|
||||
Cache.getScheduler().schedule(() ->
|
||||
Cache.getTaskScheduler().schedule(() ->
|
||||
Cache.removeLoveCalculatorValue(userId1, userId2), 10, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user