batch job이 8080, 8081 에서 실행되는것 8080만 실행
This commit is contained in:
parent
4759c572a7
commit
711c8fcdca
@ -39,6 +39,9 @@ public class JobLauncherController {
|
||||
@Value("${spring.profiles.scheduler}")
|
||||
private String scheduler;
|
||||
|
||||
@Value("${server.port:8080}")
|
||||
private int serverPort;
|
||||
|
||||
/**
|
||||
* 서버 시작 시 실행 중(STARTED)인 상태로 남은 Job들을 FAILED 처리
|
||||
*/
|
||||
@ -253,6 +256,12 @@ public class JobLauncherController {
|
||||
* 공통 스케줄러 실행 메소드
|
||||
*/
|
||||
private String executeScheduledJob(String jobName) throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
|
||||
// 8080 포트 인스턴스에서만 스케줄러 실행 (멀티 인스턴스 데드락 방지)
|
||||
if (serverPort != 8080) {
|
||||
log.debug("스케줄러는 8080 포트 인스턴스에서만 실행됩니다. 현재 포트: {}, Job: {} 스킵", serverPort, jobName);
|
||||
return "Scheduler runs only on port 8080. Current port: " + serverPort;
|
||||
}
|
||||
|
||||
Job job = jobs.get(jobName);
|
||||
if (job == null) {
|
||||
log.error("Job {} not found", jobName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user