for logging

This commit is contained in:
zoomk
2025-10-28 15:46:22 +09:00
parent 1ca8447484
commit 4af1baccbc
@@ -188,13 +188,21 @@ public class ServiceLocator {
public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName) public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName)
throws ServiceLocatorException { throws ServiceLocatorException {
QueueConnectionFactory factory = null; QueueConnectionFactory factory = null;
System.out.println("=================getQueueConnectionFactory qConnFactoryName["+qConnFactoryName+"]");
try { try {
if (cache.containsKey(qConnFactoryName)) { if (cache.containsKey(qConnFactoryName)) {
System.out.println("=================getQueueConnectionFactory containsKey");
factory = (QueueConnectionFactory) cache.get(qConnFactoryName); factory = (QueueConnectionFactory) cache.get(qConnFactoryName);
} else { } else {
factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName); //factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName);
cache.put(qConnFactoryName, factory); //cache.put(qConnFactoryName, factory);
System.out.println("=================getQueueConnectionFactory not containsKey");
factory = getRemoteQueueConnectionFactory(
"t3://localhost:7001", // 또는 실제 서버 주소
qConnFactoryName
);
} }
} catch (NamingException ne) { } catch (NamingException ne) {
//throw new ServiceLocatorException(ne); //throw new ServiceLocatorException(ne);
@@ -206,6 +214,32 @@ public class ServiceLocator {
return factory; return factory;
} }
public QueueConnectionFactory getRemoteQueueConnectionFactory(String providerUrl, String jmsFactoryJndiName)
throws ServiceLocatorException {
QueueConnectionFactory factory = null;
try {
if (cache.containsKey(jmsFactoryJndiName)) {
factory = (QueueConnectionFactory) cache.get(jmsFactoryJndiName);
} else {
Hashtable<String, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, WEBLOGIC_INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, providerUrl); // ex: "t3://localhost:7001"
Context ctx = new InitialContext(env);
factory = (QueueConnectionFactory) ctx.lookup(jmsFactoryJndiName);
cache.put(jmsFactoryJndiName, factory);
}
return factory;
} catch (NamingException ne) {
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(ne, "RECEAICUL113"));
} catch (Exception e) {
throw new ServiceLocatorException(ExceptionUtil.getErrorCode(e, "RECEAICUL114"));
}
}
/** /**
* 1. 기능 : Queue를 반환하는 method * 1. 기능 : Queue를 반환하는 method