for logging
This commit is contained in:
@@ -188,13 +188,21 @@ public class ServiceLocator {
|
||||
public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName)
|
||||
throws ServiceLocatorException {
|
||||
QueueConnectionFactory factory = null;
|
||||
|
||||
System.out.println("=================getQueueConnectionFactory qConnFactoryName["+qConnFactoryName+"]");
|
||||
try {
|
||||
if (cache.containsKey(qConnFactoryName)) {
|
||||
System.out.println("=================getQueueConnectionFactory containsKey");
|
||||
factory = (QueueConnectionFactory) cache.get(qConnFactoryName);
|
||||
} else {
|
||||
factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName);
|
||||
cache.put(qConnFactoryName, factory);
|
||||
//factory = (QueueConnectionFactory) initial.lookup(qConnFactoryName);
|
||||
//cache.put(qConnFactoryName, factory);
|
||||
System.out.println("=================getQueueConnectionFactory not containsKey");
|
||||
factory = getRemoteQueueConnectionFactory(
|
||||
"t3://localhost:7001", // 또는 실제 서버 주소
|
||||
qConnFactoryName
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
} catch (NamingException ne) {
|
||||
//throw new ServiceLocatorException(ne);
|
||||
@@ -206,6 +214,32 @@ public class ServiceLocator {
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user