Created
March 27, 2014 00:53
-
-
Save ramapalani/9797475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final ConcurrentMap<AppDescriptor, TestContainer> cache = new ConcurrentHashMap<AppDescriptor, TestContainer>(); | |
private final TestContainerFactory tcf; | |
public OnePerAppDescriptorTestContainerFactory(TestContainerFactory tcf) { | |
this.tcf = tcf; | |
} | |
@Override | |
public Class<? extends AppDescriptor> supports() { | |
return tcf.supports(); | |
} | |
@Override | |
public TestContainer create(URI baseUri, AppDescriptor ad) { | |
if (cache.get(ad) == null) { | |
cache.putIfAbsent(ad, tcf.create(baseUri, ad)); | |
} | |
return cache.get(ad); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment