비동기 핸들러 수정
This commit is contained in:
@@ -52,29 +52,6 @@ public class QueueListenerService {
|
|||||||
this.console = new Console();
|
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
|
@PostConstruct
|
||||||
public void startListening() {
|
public void startListening() {
|
||||||
if (queueHandler != null) {
|
if (queueHandler != null) {
|
||||||
@@ -126,22 +103,6 @@ public class QueueListenerService {
|
|||||||
return running.get();
|
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
|
@PreDestroy
|
||||||
public void stopListening() {
|
public void stopListening() {
|
||||||
@@ -150,7 +111,7 @@ public class QueueListenerService {
|
|||||||
// Interrupt the blocking take() call
|
// Interrupt the blocking take() call
|
||||||
executorService.shutdownNow();
|
executorService.shutdownNow();
|
||||||
try {
|
try {
|
||||||
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
|
if (!executorService.awaitTermination(15, TimeUnit.SECONDS)) {
|
||||||
logger.warn("Queue listener did not terminate in time");
|
logger.warn("Queue listener did not terminate in time");
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user