Fix monitoring process destroy

This commit is contained in:
Mikhail Trofimov 2026-07-03 15:29:11 +03:00
parent 0c977947cd
commit a93ed1ccb4
2 changed files with 4 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.DependsOn;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment; import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +34,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
@DependsOn(value = "signalKafkaEventWriterService")
public class KafkaMonitoringService { public class KafkaMonitoringService {
private volatile boolean isShuttingdDown = false; private volatile boolean isShuttingdDown = false;
private final int permits; private final int permits;

View file

@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit;
@Service @Service
public class SignalKafkaEventWriterService { public class SignalKafkaEventWriterService {
private final static Charset encoding = Charset.forName("windows-1251"); private final static Charset encoding = Charset.forName("windows-1251");
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss"); // TODO убрать время private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
private final ExecutorService executorService = Executors.newSingleThreadExecutor( private final ExecutorService executorService = Executors.newSingleThreadExecutor(
new CustomizableThreadFactory("signal-kafka-event-writer-") new CustomizableThreadFactory("signal-kafka-event-writer-")
@ -73,7 +73,7 @@ public class SignalKafkaEventWriterService {
continue; continue;
} }
if (event.getEventType() == EventType.STOP) { if (event.getEventType() == EventType.STOP) {
break; return;
} }
if (event.getEventType() == EventType.WRITE) { if (event.getEventType() == EventType.WRITE) {