Created
November 23, 2014 18:29
-
-
Save bparry02/f39f2901f49a9f9ce4bc to your computer and use it in GitHub Desktop.
Infinispan close cache example
This file contains hidden or 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
| @Named | |
| @ApplicationScoped | |
| public class GreetingCacheManager { | |
| @Inject | |
| @GreetingCache | |
| private Cache<CacheKey, String> cache; | |
| @PreDestroy | |
| public void closeCache() { | |
| cache.getCacheManager().stop(); | |
| } | |
| ... | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This eliminates the following error:
Keep in mind, the class that should contain this
@PreDestroymethod should have@Singleton @Startupor be application-scoped as above.Alternatively, if there is a
@Producermethod for the Cache or CacheManager, then you can use an@Disposesmethod.