84d99cb37286574b0c695a2ad2715d10225a6e6d.svn-base 1021 B

1234567891011121314151617181920212223242526272829303132
  1. package com.chinacreator.process.job;
  2. import org.quartz.DisallowConcurrentExecution;
  3. import org.quartz.PersistJobDataAfterExecution;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import com.chinacreator.common.support.cache.EhCacheManager;
  6. import com.chinacreator.process.dao.DictionaryDao;
  7. @PersistJobDataAfterExecution
  8. @DisallowConcurrentExecution
  9. public class CleanCaheJob {
  10. @Autowired
  11. private EhCacheManager cacheManager;
  12. @Autowired
  13. private DictionaryDao dictionaryDao;
  14. public void doProcess() throws Exception {
  15. System.out.println("清楚缓存JOB启动");
  16. System.out.println("清除之前============="+dictionaryDao.getValue("recivemq"));
  17. clearCache("Dictionary");
  18. System.out.println("清除之后============="+dictionaryDao.getValue("recivemq"));
  19. }
  20. private void clearCache(String cacheName) throws Exception {
  21. if (this.cacheManager.getCacheManager().cacheExists(cacheName)){
  22. this.cacheManager.getCacheManager().getCache(cacheName).removeAll();
  23. }
  24. }
  25. }