public boolean isActive(Object id) { // Check whether an object with the given id is available in the cache synchronized (getCacheLock()) { return getCache().peek(id) != null; } }
protected void doInvalidate(java.io.Serializable key) { if (key != null) { synchronized (getCacheLock()) { EnterpriseContext ctx = (EnterpriseContext)getCache().peek(key); if(ctx != null) { release(ctx); } } } }
/** * From InstanceCache interface * @jmx:managed-operation */ public void remove(Object id) { if (id == null) throw new IllegalArgumentException("Can't remove an object using a null key"); synchronized (getCacheLock()) { if (getCache().peek(id) != null) { getCache().remove(id); } } }
/** An accessor method that synchronizes access on the domainCache to avoid a race condition that can occur when the cache entry expires in the presence of multi-threaded access. The allowRefresh flag should be true for authentication accesses and false for other accesses. Previously the other accesses included authorization and caller principal mapping. Now the only use of the @param principal - the caller identity whose cached credentials are to be accessed. @param allowRefresh - a flag indicating if the cache access should flush any expired entries. */ private DomainInfo getCacheInfo(Principal principal, boolean allowRefresh) { if (domainCache == null) return null; DomainInfo cacheInfo = null; synchronized (domainCache) { if (allowRefresh == true) cacheInfo = (DomainInfo) domainCache.get(principal); else cacheInfo = (DomainInfo) domainCache.peek(principal); if (cacheInfo != null) cacheInfo.acquire(); } return cacheInfo; }
/** An accessor method that synchronizes access on the domainCache to avoid a race condition that can occur when the cache entry expires in the presence of multi-threaded access. The allowRefresh flag should be true for authentication accesses and false for other accesses. Previously the other accesses included authorization and caller principal mapping. Now the only use of the @param principal - the caller identity whose cached credentials are to be accessed. @param allowRefresh - a flag indicating if the cache access should flush any expired entries. */ private DomainInfo getCacheInfo(Principal principal, boolean allowRefresh) { if( domainCache == null ) return null; DomainInfo cacheInfo = null; synchronized( domainCache ) { if( allowRefresh == true ) cacheInfo = (DomainInfo) domainCache.get(principal); else cacheInfo = (DomainInfo) domainCache.peek(principal); if( cacheInfo != null ) cacheInfo.acquire(); } return cacheInfo; }
if (domainCache.peek(principal) != null) domainCache.remove(principal); domainCache.insert(principal, info);
if( domainCache.peek(principal) != null ) domainCache.remove(principal); domainCache.insert(principal, info);