This commit is contained in:
2025-02-12 18:32:21 +09:00
commit aff0f4eeda
767 changed files with 285356 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package com.caliverse.admin.scheduler;
import com.caliverse.admin.domain.entity.InGame;
import com.caliverse.admin.domain.entity.Mail;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
@Service
public class SchedulerService {
private final Map<String, ScheduledFuture<?>> scheduledTasks = new ConcurrentHashMap<>();
private final Map<Long, Mail> mailTask = new ConcurrentHashMap<>();
private final Map<Long, InGame> noticeTask = new ConcurrentHashMap<>();
public boolean isTaskExist(String key){
return scheduledTasks.containsKey(key);
}
public void addTask(String key, ScheduledFuture<?> schdule){
scheduledTasks.put(key, schdule);
}
public void closeTask(String key) {
ScheduledFuture<?> scheduledFuture = scheduledTasks.get(key);
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
scheduledTasks.remove(key);
}
}
// public boolean isTaskExist(String type, Long id) {
// switch (type) {
// case "mail" -> {
// return mailTask.containsKey(id);
// }
// case "notice" -> {
// return noticeTask.containsKey(id);
// }
// default -> {
// return false;
// }
// }
// }
//
// public void createTask(Mail mail) {
// mailTask.put(mail.getId(), mail);
// }
}