Compare commits
No commits in common. "5d360803273673f2a9fa2c2f5206e5f867c930e7" and "a45137214268bdabcb64b9dc6f79f598ea09fe19" have entirely different histories.
5d36080327
...
a451372142
@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -75,7 +74,6 @@ public class JobLauncherController {
|
|||||||
JobParametersInvalidException, JobRestartException {
|
JobParametersInvalidException, JobRestartException {
|
||||||
|
|
||||||
|
|
||||||
log.info("Manual launch requested for job: {}", jobName);
|
|
||||||
Job job = jobs.get(jobName);
|
Job job = jobs.get(jobName);
|
||||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
@ -100,7 +98,6 @@ public class JobLauncherController {
|
|||||||
.addDate("time", new Date()).toJobParameters();
|
.addDate("time", new Date()).toJobParameters();
|
||||||
|
|
||||||
JobExecution jobExecution = jobLauncher.run(job, jobParameters);
|
JobExecution jobExecution = jobLauncher.run(job, jobParameters);
|
||||||
log.info("Job {} started with execution id {}", jobName, jobExecution.getId());
|
|
||||||
|
|
||||||
BatchStatus status = jobExecution.getStatus();
|
BatchStatus status = jobExecution.getStatus();
|
||||||
ExitStatus exitStatus = jobExecution.getExitStatus();
|
ExitStatus exitStatus = jobExecution.getExitStatus();
|
||||||
@ -111,7 +108,6 @@ public class JobLauncherController {
|
|||||||
// return "Job " + jobName + " started";
|
// return "Job " + jobName + " started";
|
||||||
return resultMap;
|
return resultMap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logExceptionDetails("Manual launch failed", jobName, e);
|
|
||||||
resultMap.put("code", "FAILED");
|
resultMap.put("code", "FAILED");
|
||||||
resultMap.put("message", e.getMessage());
|
resultMap.put("message", e.getMessage());
|
||||||
return resultMap;
|
return resultMap;
|
||||||
@ -306,14 +302,12 @@ public class JobLauncherController {
|
|||||||
|
|
||||||
log.info("Job {} 실행 시도 (재시도 {}/{})", jobName, retryCount + 1, maxRetries);
|
log.info("Job {} 실행 시도 (재시도 {}/{})", jobName, retryCount + 1, maxRetries);
|
||||||
JobExecution jobExecution = jobLauncher.run(job, jobParameters);
|
JobExecution jobExecution = jobLauncher.run(job, jobParameters);
|
||||||
log.info("Job {} started with execution id {}", jobName, jobExecution.getId());
|
|
||||||
|
|
||||||
log.info("Job {} 완료 상태: {}", jobName, jobExecution.getExitStatus().getExitCode());
|
log.info("Job {} 완료 상태: {}", jobName, jobExecution.getExitStatus().getExitCode());
|
||||||
return jobName + " executed successfully";
|
return jobName + " executed successfully";
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
retryCount++;
|
retryCount++;
|
||||||
logExceptionDetails("Scheduled launch failed", jobName, e);
|
|
||||||
|
|
||||||
// 데드락 오류인지 확인
|
// 데드락 오류인지 확인
|
||||||
boolean isDeadlock = e.getCause() != null &&
|
boolean isDeadlock = e.getCause() != null &&
|
||||||
@ -347,7 +341,6 @@ public class JobLauncherController {
|
|||||||
*/
|
*/
|
||||||
private boolean isJobRunning(String jobName) {
|
private boolean isJobRunning(String jobName) {
|
||||||
try {
|
try {
|
||||||
log.debug("Checking running executions for job: {}", jobName);
|
|
||||||
Set<JobExecution> runningExecutions = jobExplorer.findRunningJobExecutions(jobName);
|
Set<JobExecution> runningExecutions = jobExplorer.findRunningJobExecutions(jobName);
|
||||||
if (runningExecutions.isEmpty()) {
|
if (runningExecutions.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@ -387,18 +380,4 @@ public class JobLauncherController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logExceptionDetails(String context, String jobName, Exception e) {
|
|
||||||
Throwable root = e;
|
|
||||||
while (root.getCause() != null) {
|
|
||||||
root = root.getCause();
|
|
||||||
}
|
|
||||||
if (root instanceof SQLException) {
|
|
||||||
SQLException sqlEx = (SQLException) root;
|
|
||||||
log.error("{} for job {}: SQLState={}, errorCode={}, message={}",
|
|
||||||
context, jobName, sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), e);
|
|
||||||
} else {
|
|
||||||
log.error("{} for job {}: {}", context, jobName, root.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user