랃그
This commit is contained in:
@@ -20,7 +20,9 @@ import java.util.stream.Stream;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ public class JobRecoveryOnStartupService {
|
|||||||
* <p>@Transactional: - recover() 메서드 전체가 하나의 트랜잭션으로 감싸집니다. - Job 하나씩 처리하다가 예외가 발생하면 전체 롤백이 될 수
|
* <p>@Transactional: - recover() 메서드 전체가 하나의 트랜잭션으로 감싸집니다. - Job 하나씩 처리하다가 예외가 발생하면 전체 롤백이 될 수
|
||||||
* 있으므로 "잡 단위로 확실히 커밋"이 필요하면 (권장) 잡 단위로 분리 트랜잭션(REQUIRES_NEW) 고려하세요.
|
* 있으므로 "잡 단위로 확실히 커밋"이 필요하면 (권장) 잡 단위로 분리 트랜잭션(REQUIRES_NEW) 고려하세요.
|
||||||
*/
|
*/
|
||||||
// @EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
@Transactional
|
@Transactional
|
||||||
public void recover() {
|
public void recover() {
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ public class JobRecoveryOnStartupService {
|
|||||||
|
|
||||||
// 4) 컨테이너는 존재하고, 아직 running=true
|
// 4) 컨테이너는 존재하고, 아직 running=true
|
||||||
// - 서버만 재기동됐고 컨테이너는 그대로 살아있는 케이스
|
// - 서버만 재기동됐고 컨테이너는 그대로 살아있는 케이스
|
||||||
// - 이 경우 DB를 건드리면 오히려 꼬일 수 있으니 RUNNING 유지
|
// - 실행중 docker 를 stop 하고 이어하기를 한다,
|
||||||
if (state.running()) {
|
if (state.running()) {
|
||||||
log.info("[RECOVERY] container still running. container={}", containerName);
|
log.info("[RECOVERY] container still running. container={}", containerName);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user