# IGNITE-891 - Cache store improvements
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d4bcd19b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d4bcd19b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d4bcd19b Branch: refs/heads/ignite-sprint-5 Commit: d4bcd19b6b68355e37fa446319030112b0e52d65 Parents: 2c28381 Author: Valentin Kulichenko <vkuliche...@gridgain.com> Authored: Wed May 20 17:35:00 2015 -0700 Committer: Valentin Kulichenko <vkuliche...@gridgain.com> Committed: Wed May 20 17:35:00 2015 -0700 ---------------------------------------------------------------------- .../store/GridCacheStoreManagerAdapter.java | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d4bcd19b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java index a4a4212..79ac86d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java @@ -105,40 +105,6 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt sesHolder = sesHolder0; locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class); - - sesLsnrs = createSessionListeners(cfg.getCacheStoreSessionListenerFactories()); - - if (sesLsnrs == null) - sesLsnrs = createSessionListeners(ctx.config().getCacheStoreSessionListenerFactories()); - } - - /** - * Creates session listeners. - * - * @param factories Factories. - * @return Listeners. - */ - private Collection<CacheStoreSessionListener> createSessionListeners(Factory<CacheStoreSessionListener>[] factories) - throws IgniteCheckedException { - if (factories == null) - return null; - - Collection<CacheStoreSessionListener> lsnrs = new ArrayList<>(factories.length); - - for (Factory<CacheStoreSessionListener> factory : factories) { - CacheStoreSessionListener lsnr = factory.create(); - - if (lsnr != null) { - cctx.kernalContext().resource().injectGeneric(lsnr); - - if (lsnr instanceof LifecycleAware) - ((LifecycleAware)lsnr).start(); - - lsnrs.add(lsnr); - } - } - - return lsnrs; } /** {@inheritDoc} */ @@ -200,6 +166,40 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt "case, ignore this warning. Otherwise, fix the configuration for cache: " + cfg.getName(), "Persistence store is configured, but both read-through and write-through are disabled."); } + + sesLsnrs = createSessionListeners(cfg.getCacheStoreSessionListenerFactories()); + + if (sesLsnrs == null) + sesLsnrs = createSessionListeners(cctx.kernalContext().config().getCacheStoreSessionListenerFactories()); + } + + /** + * Creates session listeners. + * + * @param factories Factories. + * @return Listeners. + */ + private Collection<CacheStoreSessionListener> createSessionListeners(Factory<CacheStoreSessionListener>[] factories) + throws IgniteCheckedException { + if (factories == null) + return null; + + Collection<CacheStoreSessionListener> lsnrs = new ArrayList<>(factories.length); + + for (Factory<CacheStoreSessionListener> factory : factories) { + CacheStoreSessionListener lsnr = factory.create(); + + if (lsnr != null) { + cctx.kernalContext().resource().injectGeneric(lsnr); + + if (lsnr instanceof LifecycleAware) + ((LifecycleAware)lsnr).start(); + + lsnrs.add(lsnr); + } + } + + return lsnrs; } /** {@inheritDoc} */