diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index 572409fca2..9592922ea7 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -2345,10 +2345,24 @@ public class JNDIRealm extends RealmBase { * @exception NamingException if a directory server error occurs */ protected DirContext open() throws NamingException { + // pm: disable this just to see what happens... trying to make failover faster + // so far I know that the createDirContext(...) it does at the tomcat initialization is very fast to choose a working server, + // but other code is slow so returning a bad context now means it takes 15m32s to fail over + boolean uglyhack = true; + if (uglyhack) { + if (context != null) + try{ + context.close(); + }catch(Throwable ignored){ - // Do nothing if there is a directory server connection already open - if (context != null) - return context; + }finally{ + context = null; + } + }else{ + // Do nothing if there is a directory server connection already open + if (context != null) + return context; + } try {