Skip to content

Instantly share code, notes, and snippets.

@atishn
Created December 26, 2016 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atishn/9daa5c6e5a1f9e7a8fef3ebc185115d7 to your computer and use it in GitHub Desktop.
Save atishn/9daa5c6e5a1f9e7a8fef3ebc185115d7 to your computer and use it in GitHub Desktop.
@Component
@Service
public class CacheServiceImpl implements CacheService {
@Activate
void onActivate() {
URL url = getClass().getResource("/ehcache.xml");
cacheManager = CacheManager.create(url);
registerMBeans();
cacheManager.clearAll();
}
@Deactivate
void onDeactivate() {
if (cacheManager != null) {
cacheManager.shutdown();
cacheManager = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment