비동기 핸들러 수정

This commit is contained in:
현성필
2024-12-30 21:13:06 +09:00
parent 0c93e76be6
commit 388794937d
@@ -52,29 +52,6 @@ public class QueueListenerService {
this.console = new Console();
}
// @PostConstruct
// public void startListening() {
// if (queueHandler != null) {
// taskQueue = hazelcastInstance.getQueue(queueHandler.getQueueName());
// executorService.submit(this::processQueueItems);
// logger.info("Queue listener started");
// this.running.set(true);
// }
// }
// private void processQueueItems() {
// while (running.get()) {
// try {
// Object item = taskQueue.poll();
// if (item != null) {
// processItem(item);
// }
// } catch (Exception e) {
// logger.error("Error processing queue item", e);
// }
// }
// }
@PostConstruct
public void startListening() {
if (queueHandler != null) {
@@ -126,22 +103,6 @@ public class QueueListenerService {
return running.get();
}
// @PreDestroy
// public void stopListening() {
// logger.info("Stopping queue listener...");
// running.set(false);
// executorService.shutdown();
// try {
// if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
// executorService.shutdownNow();
// }
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// executorService.shutdownNow();
// }
// logger.info("Queue listener stopped");
//
// }
@PreDestroy
public void stopListening() {
@@ -150,7 +111,7 @@ public class QueueListenerService {
// Interrupt the blocking take() call
executorService.shutdownNow();
try {
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
if (!executorService.awaitTermination(15, TimeUnit.SECONDS)) {
logger.warn("Queue listener did not terminate in time");
}
} catch (InterruptedException e) {