Skip to content

Instantly share code, notes, and snippets.

@JensRantil
Created March 16, 2012 14:15
Show Gist options
  • Save JensRantil/2050235 to your computer and use it in GitHub Desktop.
Save JensRantil/2050235 to your computer and use it in GitHub Desktop.
Java indentation horror
/**
* Get a local cache manager. It's not replicated nor distributed in any
* way.
* @return
*/
public static BasicCacheHandler getCacheManager(){
//We jump through these hoops so we don't have to deploy a ehcache.xml
if (cache_manager==null) {
// Trying not to make the lock
synchronized (CacheHandler.class) {
if(cache_manager==null) {
// if we did happen to instantiate a cache handler before
// entering the synchronized block
cache_manager = new BasicCacheHandler();
}
}
}
return cache_manager;
}
@JensRantil
Copy link
Author

Trying to figure out if it would be possible to use a CountDownLatch for this. Not sure though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment