LDAP directory sessions initialize a DirContext for every session even though a cache may exist. This makes the session creation much more costly than needed for the case where we only read entries from the cache then close the session. It's especially bad in concurrent situations because internally DirContext creation takes various locks.
This should be fixed by pushing down lazy DirContext creation into LDAPSession.getContext and always use getContext instead of the dirContext field.
Stack trace of 6.0 call graph below.