프로젝트에서 LDAP 연결 풀링을 구현했으며 새로운 연결 요청이 발생할 때마다 내가 구성한 LDAP 연결 풀이 기존 연결을 다시 사용하는 대신 새 연결을 반환한다는 이상한 동작을 발견했습니다. 연결이 풀로 반환되었습니다.새 연결이 LDAP 연결 풀에서 반환 될 때마다
LDAP의 JNDI 로그 :
00:07:10,824 ERROR [stderr] (IPAdminGlobalDataReloader) Create and use [email protected][eun2p3-be.stp-qa.st.com:636]
00:07:12,222 ERROR [stderr] (IPAdminGlobalDataReloader) Release [email protected]
00:07:46,704 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:08:46,707 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:22:26,329 ERROR [stderr] (IPAdminGlobalDataReloader) Create [email protected][eun2p3-be.stp-qa.st.com:636]
00:22:26,333 ERROR [stderr] (IPAdminGlobalDataReloader) Create and use [email protected][eun2p3-be.stp-qa.st.com:636]
00:22:27,748 ERROR [stderr] (IPAdminGlobalDataReloader) Release [email protected]
00:22:46,730 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:23:46,734 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:37:45,242 ERROR [stderr] (IPAdminGlobalDataReloader) Create [email protected][eun2p3-be.stp-qa.st.com:636]
00:37:45,244 ERROR [stderr] (IPAdminGlobalDataReloader) Create and use [email protected][eun2p3-be.stp-qa.st.com:636]
00:37:46,759 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:37:46,823 ERROR [stderr] (IPAdminGlobalDataReloader) Release [email protected]
00:39:46,764 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:53:00,864 ERROR [stderr] (IPAdminGlobalDataReloader) Create [email protected][eun2p3-be.stp-qa.st.com:636]
00:53:00,865 ERROR [stderr] (IPAdminGlobalDataReloader) Create and use [email protected][eun2p3-be.stp-qa.st.com:636]
00:53:02,392 ERROR [stderr] (IPAdminGlobalDataReloader) Release [email protected]
00:53:46,787 ERROR [stderr] (Thread-65) Expired [email protected] expired
00:54:46,791 ERROR [stderr] (Thread-65) Expired [email protected] expired
내 연결 설정 : 식별
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldaps://" + server + ":" + serverPort);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, pUserName);
env.put(Context.SECURITY_CREDENTIALS, pPassword);
env.put(LdapContext.CONTROL_FACTORIES, "com.sun.jndi.ldap.ControlFactory");
env.put(Context.SECURITY_PROTOCOL, "ssl");
env.put("com.sun.jndi.ldap.read.timeout", "300000");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// load the location of keystore that holds trusted root certificates from web.xml
ServletContext context = ApplicationServlet.getApplication().getServlet().getServletContext();
String certificatePath = context.getInitParameter("AD_CERTIFICATE_PATH");
System.setProperty("javax.net.ssl.trustStore", certificatePath);
// System.setProperty("javax.net.debug", "all");
// For connection pooling
env.put("com.sun.jndi.ldap.connect.pool", "true");
System.setProperty("com.sun.jndi.ldap.connect.pool.protocol", "plain ssl");
System.setProperty("com.sun.jndi.ldap.connect.pool.maxsize", poolMaxSize);
System.setProperty("com.sun.jndi.ldap.connect.pool.prefsize", poolPrefSize);
System.setProperty("com.sun.jndi.ldap.connect.pool.timeout", poolTimeOut);
System.setProperty("com.sun.jndi.ldap.connect.pool.debug", "fine");
ctx = new InitialDirContext(env);
return (DirContext) ctx;
덕분 곳마다 새로운 연결을 생성하는 대신 재사용 왜 근본 원인이다.
풀 시간 초과가 만료되었습니다. 주의 10 년 동안 SSL 공급자를 추가 할 필요가 없습니다. – EJP
연결 시간 초과가 5 분으로 설정되고 로그 연결 당 즉시 만료됩니다. –
이상적인 유휴 연결은 timeout 등록 정보가 5 분으로 설정되어 있으므로 만료되기 전에 5 분 동안 기다려야합니다. –