GeoTools.getInitialContext() returns a javax.naming.InitialContext for JNDI configuration, or throws a javax.naming.NamingException if there's no InitialContext configured.
This method happens to be called by all JNDI DataStore factories (e.g. at DataStoreFactory.isAvailable()), and it happens to be called a lot by GeoServer.
For example, when configuring resources through the REST API and under concurrency, this method shows up as a bottleneck due both to the synchronization itself, and because it tries to create a new InitialContext on each invocation, which happens to block heavily down the pipe at java.lang.ClassLoader.loadClass() to finally throw a NamingException whose cause is a ClassNotFoundException.
So it should be possible to:
a) remove the synchronization on the getInitialContext() method in favor of AtomicReference semantics;
b) avoid trying to instantiate an InitialContext if it already failed due to a ClassNotFoundException