Class RefreshableCachedProductRetrieveStrategyImpl

  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.catalogview.impl.AbstractProductRetrieveStrategyImpl
          extended by com.elasticpath.service.catalogview.impl.SingleCachingProductRetrieveStrategyImpl
              extended by com.elasticpath.service.catalogview.impl.RefreshableCachedProductRetrieveStrategyImpl
All Implemented Interfaces:
ProductRetrieveStrategy, RefreshableCachedProductRetrieveStrategy, EpService

public class RefreshableCachedProductRetrieveStrategyImpl
extends SingleCachingProductRetrieveStrategyImpl
implements RefreshableCachedProductRetrieveStrategy

Provides an implementation of ProductRetrieveStrategy with JBoss tree caching ability. This service will return the same instance of a product for all customers. Catalog promotion rules have already been applied on the returned products.

Notice: since the Product is not thread-safe, you must not make any changes on the return product in your code. Otherwise, the application may have some unexpected problem. Clients may optionally call refreshCacheEntry(..) to refresh the entry for a product from disk. To use this feature, you must specify a default product load tuner.

Nested Class Summary
Nested classes/interfaces inherited from class com.elasticpath.service.catalogview.impl.SingleCachingProductRetrieveStrategyImpl
Constructor Summary
Method Summary
 void refreshCacheEntry(long productUid)
          Refresh the cache entry from disk for the product with the given UID.
 Product retrieveProduct(long productUid, ShoppingCart shoppingCart, ProductLoadTuner productLoadTuner)
          Retrieve a Product with the given product uid.
 void setDefaultProductLoadTuner(ProductLoadTuner defaultProductLoadTuner)
          Set the default product load tuner to be used when refreshing the cache from disk.
 void setRuleExecutionIntervalSeconds(long seconds)
          Set the rule execution interval.
Methods inherited from class com.elasticpath.service.catalogview.impl.SingleCachingProductRetrieveStrategyImpl
retrieveProducts, start, stop
Methods inherited from class com.elasticpath.service.catalogview.impl.AbstractProductRetrieveStrategyImpl
getProductService, setEpRuleEngine, setProductService
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.elasticpath.service.catalogview.ProductRetrieveStrategy
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath

Constructor Detail


public RefreshableCachedProductRetrieveStrategyImpl()
Method Detail


public void refreshCacheEntry(long productUid)
Refresh the cache entry from disk for the product with the given UID.

Specified by:
refreshCacheEntry in interface RefreshableCachedProductRetrieveStrategy
productUid - the UID of the product whose cache entry is to be refreshed.


public Product retrieveProduct(long productUid,
                               ShoppingCart shoppingCart,
                               ProductLoadTuner productLoadTuner)
Retrieve a Product with the given product uid. Return null if a product with the given uid doesn't exist or the product is not displayable.

Specified by:
retrieveProduct in interface ProductRetrieveStrategy
retrieveProduct in class SingleCachingProductRetrieveStrategyImpl
productUid - a product uid
shoppingCart - the customer shopping cart
productLoadTuner - the product load tuner
a Product with the given product uid.


public void setDefaultProductLoadTuner(ProductLoadTuner defaultProductLoadTuner)
Set the default product load tuner to be used when refreshing the cache from disk.

defaultProductLoadTuner - the ProductLoadTuner.


public void setRuleExecutionIntervalSeconds(long seconds)
Set the rule execution interval. If rules have not been fired within the specified number of seconds, rules are re-executed on any product returned.

seconds - the interval in seconds