I'm using JEE and I created EJB-Singleton. It has as a field LRUMap, which represents cache to store data in application. I want to clear that data inside singleton or just kill and start again whole singleton during runtime. Is there any option to do that periodically? For example to reset singleton bean once per day in order to clear data?
Here is the code:
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
public class BpNotificationCacheBean {
private static final int CACHE_SIZE = 1000;
private Map cacheMap;
@PostConstruct
public void init() {
cacheMap = new LRUMap(CACHE_SIZE);
}
@Lock(LockType.WRITE)
public Boolean get(String businessPartnerId) {
return cacheMap.get(businessPartnerId);
}
@Lock(LockType.WRITE)
public void put(String businessPartnerId, Boolean isVIP) {
this.cacheMap.put(businessPartnerId, isVIP);
}
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)