OBP 연계 모듈 프로퍼티 재로딩 지원

This commit is contained in:
Rinjae
2025-12-09 15:25:05 +09:00
parent b698147bba
commit 11c1244022
2 changed files with 14 additions and 0 deletions
@@ -2,6 +2,7 @@ package com.eactive.ext.kjb.obp;
import com.eactive.ext.kjb.common.KjbObpException; import com.eactive.ext.kjb.common.KjbObpException;
import com.eactive.ext.kjb.common.KjbProperty; import com.eactive.ext.kjb.common.KjbProperty;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -11,12 +12,18 @@ public class KjbObpModule {
private static KjbObpModule _instance; private static KjbObpModule _instance;
@Getter
private final KjbProperty property; private final KjbProperty property;
private final ObpClient client; private final ObpClient client;
public static synchronized KjbObpModule getInstance(KjbProperty kjbProperty) { public static synchronized KjbObpModule getInstance(KjbProperty kjbProperty) {
if (_instance == null) { if (_instance == null) {
_instance = new KjbObpModule(kjbProperty); _instance = new KjbObpModule(kjbProperty);
} else {
if (kjbProperty.equals(_instance.getProperty())) {
log.debug("KjbProperty 파라미터가 변경되어 KjbObpModule 인스턴스 재 생성");
_instance = new KjbObpModule(kjbProperty);
}
} }
return _instance; return _instance;
} }
@@ -1,6 +1,7 @@
package com.eactive.ext.kjb.obp; package com.eactive.ext.kjb.obp;
import com.eactive.ext.kjb.common.KjbProperty; import com.eactive.ext.kjb.common.KjbProperty;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.hc.client5.http.classic.methods.HttpGet; import org.apache.hc.client5.http.classic.methods.HttpGet;
@@ -23,6 +24,7 @@ import java.util.concurrent.*;
public class ObpClient { public class ObpClient {
private static ObpClient _instance; private static ObpClient _instance;
@Getter
private final KjbProperty property; private final KjbProperty property;
private final CloseableHttpClient httpClient; private final CloseableHttpClient httpClient;
private final RequestConfig requestConfig; private final RequestConfig requestConfig;
@@ -31,6 +33,11 @@ public class ObpClient {
public synchronized static ObpClient getInstance(KjbProperty kjbProperty) { public synchronized static ObpClient getInstance(KjbProperty kjbProperty) {
if (_instance == null) { if (_instance == null) {
_instance = new ObpClient(kjbProperty); _instance = new ObpClient(kjbProperty);
} else {
if (kjbProperty.equals(_instance.getProperty())) {
log.debug("KjbProperty 파라미터가 변경되어 ObpClient 인스턴스 재 생성");
_instance = new ObpClient(kjbProperty);
}
} }
return _instance; return _instance;