net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory Java Examples

The following examples show how to use net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EhCacheFactoryBean.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Predict the particular {@code Ehcache} implementation that will be returned from
 * {@link #getObject()} based on logic in {@link #createCache()} and
 * {@link #decorateCache(Ehcache)} as orchestrated by {@link #afterPropertiesSet()}.
 */
@Override
public Class<? extends Ehcache> getObjectType() {
	if (this.cache != null) {
		return this.cache.getClass();
	}
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return UpdatingSelfPopulatingCache.class;
		}
		else {
			return SelfPopulatingCache.class;
		}
	}
	if (this.blocking) {
		return BlockingCache.class;
	}
	return Cache.class;
}
 
Example #2
Source File: EhCacheFactoryBean.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Predict the particular {@code Ehcache} implementation that will be returned from
 * {@link #getObject()} based on logic in {@link #createCache()} and
 * {@link #decorateCache(Ehcache)} as orchestrated by {@link #afterPropertiesSet()}.
 */
@Override
public Class<? extends Ehcache> getObjectType() {
	if (this.cache != null) {
		return this.cache.getClass();
	}
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return UpdatingSelfPopulatingCache.class;
		}
		else {
			return SelfPopulatingCache.class;
		}
	}
	if (this.blocking) {
		return BlockingCache.class;
	}
	return Cache.class;
}
 
Example #3
Source File: EhCacheFactoryBean.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Predict the particular {@code Ehcache} implementation that will be returned from
 * {@link #getObject()} based on logic in {@link #createCache()} and
 * {@link #decorateCache(Ehcache)} as orchestrated by {@link #afterPropertiesSet()}.
 */
@Override
public Class<? extends Ehcache> getObjectType() {
	if (this.cache != null) {
		return this.cache.getClass();
	}
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return UpdatingSelfPopulatingCache.class;
		}
		else {
			return SelfPopulatingCache.class;
		}
	}
	if (this.blocking) {
		return BlockingCache.class;
	}
	return Cache.class;
}
 
Example #4
Source File: EhCacheFactoryBean.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Predict the particular {@code Ehcache} implementation that will be returned from
 * {@link #getObject()} based on logic in {@link #createCache()} and
 * {@link #decorateCache(Ehcache)} as orchestrated by {@link #afterPropertiesSet()}.
 */
@Override
public Class<? extends Ehcache> getObjectType() {
	if (this.cache != null) {
		return this.cache.getClass();
	}
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return UpdatingSelfPopulatingCache.class;
		}
		else {
			return SelfPopulatingCache.class;
		}
	}
	if (this.blocking) {
		return BlockingCache.class;
	}
	return Cache.class;
}
 
Example #5
Source File: EhCacheFactoryBean.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Decorate the given Cache, if necessary.
 * @param cache the raw Cache object, based on the configuration of this FactoryBean
 * @return the (potentially decorated) cache object to be registered with the CacheManager
 */
protected Ehcache decorateCache(Ehcache cache) {
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) this.cacheEntryFactory);
		}
		else {
			return new SelfPopulatingCache(cache, this.cacheEntryFactory);
		}
	}
	if (this.blocking) {
		return new BlockingCache(cache);
	}
	return cache;
}
 
Example #6
Source File: EhCacheFactoryBean.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Decorate the given Cache, if necessary.
 * @param cache the raw Cache object, based on the configuration of this FactoryBean
 * @return the (potentially decorated) cache object to be registered with the CacheManager
 */
protected Ehcache decorateCache(Ehcache cache) {
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) this.cacheEntryFactory);
		}
		else {
			return new SelfPopulatingCache(cache, this.cacheEntryFactory);
		}
	}
	if (this.blocking) {
		return new BlockingCache(cache);
	}
	return cache;
}
 
Example #7
Source File: EhCacheFactoryBean.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Decorate the given Cache, if necessary.
 * @param cache the raw Cache object, based on the configuration of this FactoryBean
 * @return the (potentially decorated) cache object to be registered with the CacheManager
 */
protected Ehcache decorateCache(Ehcache cache) {
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) this.cacheEntryFactory);
		}
		else {
			return new SelfPopulatingCache(cache, this.cacheEntryFactory);
		}
	}
	if (this.blocking) {
		return new BlockingCache(cache);
	}
	return cache;
}
 
Example #8
Source File: EhCacheFactoryBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Decorate the given Cache, if necessary.
 * @param cache the raw Cache object, based on the configuration of this FactoryBean
 * @return the (potentially decorated) cache object to be registered with the CacheManager
 */
protected Ehcache decorateCache(Ehcache cache) {
	if (this.cacheEntryFactory != null) {
		if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
			return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) this.cacheEntryFactory);
		}
		else {
			return new SelfPopulatingCache(cache, this.cacheEntryFactory);
		}
	}
	if (this.blocking) {
		return new BlockingCache(cache);
	}
	return cache;
}
 
Example #9
Source File: EhCacheFacade.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Decorate the given Cache, if necessary.
 * <p>The default implementation simply returns the given cache object as-is.
 *
 * @param cache the raw Cache object, based on the configuration of this FactoryBean
 * @param model the model containing the name of the cache to retrieve
 * @return the (potentially decorated) cache object to be registered with the CacheManager
 */
protected Ehcache decorateCache(Cache cache, EhCacheCachingModel model) {
	if (model.getCacheEntryFactory() != null) {
		if (model.getCacheEntryFactory() instanceof UpdatingCacheEntryFactory) {
			return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) model.getCacheEntryFactory());
		} else {
			return new SelfPopulatingCache(cache, model.getCacheEntryFactory());
		}
	}
	if (model.isBlocking()) {
		return new BlockingCache(cache);
	}
	return cache;
}