private static final Object _javaWithCachingLock = new Object();
protected static JavaWithCaching getJavaWithCaching() {
synchronized( _javaWithCachingLock ) {
// has the state of the ApplicationClassloader changed?
ApplicationClassloaderState currentApplicationClassloaderState = Play.classloader.currentState;
if( !currentApplicationClassloaderState.equals( _lastKnownApplicationClassloaderState )) {
// it has changed.
// we must drop our current _javaWithCaching and create a new one...
// and start the caching over again.
_lastKnownApplicationClassloaderState = currentApplicationClassloaderState;
_javaWithCaching = new JavaWithCaching();