Skip to content

Commit

Permalink
[#noissue] Add EnableScheduling annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
donghun-cho committed Aug 20, 2024
1 parent befedfe commit a5fcca0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean;

@Configuration
@EnableScheduling
@Import({
GrpcComponentConfiguration.class,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package com.navercorp.pinpoint.collector.grpc.config;

import com.navercorp.pinpoint.collector.receiver.grpc.service.KeepAliveService;
import com.navercorp.pinpoint.common.profiler.logging.ThrottledLogger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
public class GrpcKeepAliveScheduler {
private final Logger logger = LogManager.getLogger(this.getClass());
private final ThrottledLogger throttledLogger = ThrottledLogger.getLogger(logger, 12);

private final KeepAliveService keepAliveService;

public GrpcKeepAliveScheduler(KeepAliveService keepAliveService) {
Expand All @@ -16,6 +22,9 @@ public GrpcKeepAliveScheduler(KeepAliveService keepAliveService) {

@Scheduled(fixedRate = 300_000, scheduler = "grpcLifecycleScheduler")
public void keepAliveServiceUpdate() {
if (throttledLogger.isInfoEnabled()) {
throttledLogger.info("keepAliveServiceUpdate started");
}
this.keepAliveService.updateState();
}
}

0 comments on commit a5fcca0

Please sign in to comment.