From commits-return-119507-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Thu Aug 2 13:20:01 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6E262180629 for ; Thu, 2 Aug 2018 13:20:00 +0200 (CEST) Received: (qmail 31893 invoked by uid 500); 2 Aug 2018 11:19:59 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 31884 invoked by uid 99); 2 Aug 2018 11:19:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2018 11:19:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0CC9DDFB34; Thu, 2 Aug 2018 11:19:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: av@apache.org To: commits@ignite.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-8715 Problems with Closeable objects from Factory Date: Thu, 2 Aug 2018 11:19:59 +0000 (UTC) Repository: ignite Updated Branches: refs/heads/master 1cdf7ef99 -> d632eb6f8 IGNITE-8715 Problems with Closeable objects from Factory Signed-off-by: Anton Vinogradov Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d632eb6f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d632eb6f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d632eb6f Branch: refs/heads/master Commit: d632eb6f8d5f0f23111042dfab3274ed20052a4a Parents: 1cdf7ef Author: pereslegin-pa Authored: Thu Aug 2 14:19:47 2018 +0300 Committer: Anton Vinogradov Committed: Thu Aug 2 14:19:47 2018 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/GridCacheContext.java | 4 ++++ .../cache/GridCacheLoaderWriterStore.java | 6 ++++++ .../continuous/CacheContinuousQueryManager.java | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d632eb6f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 191734b..61b1878 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import java.io.Closeable; import java.io.Externalizable; import java.io.IOException; import java.io.InvalidObjectException; @@ -2011,6 +2012,9 @@ public class GridCacheContext implements Externalizable { dataStructuresMgr = null; cacheObjCtx = null; + if (expiryPlc instanceof Closeable) + U.closeQuiet((Closeable)expiryPlc); + mgrs.clear(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/d632eb6f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java index 03beaf0..cf07b18 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import java.io.Closeable; import java.io.Serializable; import java.util.Collection; import java.util.Collections; @@ -26,6 +27,7 @@ import javax.cache.integration.CacheLoader; import javax.cache.integration.CacheWriter; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lifecycle.LifecycleAware; import org.jetbrains.annotations.Nullable; @@ -81,9 +83,13 @@ class GridCacheLoaderWriterStore implements CacheStore, LifecycleAwa @Override public void stop() { if (ldr instanceof LifecycleAware) ((LifecycleAware)ldr).stop(); + else if (ldr instanceof Closeable) + U.closeQuiet((Closeable)ldr); if (writer instanceof LifecycleAware) ((LifecycleAware)writer).stop(); + else if (writer instanceof Closeable) + U.closeQuiet((Closeable)writer); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/d632eb6f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java index 1cdc014..c7635e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.query.continuous; +import java.io.Closeable; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -954,6 +955,9 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { /** */ private volatile UUID routineId; + /** */ + private volatile JCacheQueryLocalListener locLsnr; + /** * @param cfg Listener configuration. * @param onStart {@code True} if executed on cache start. @@ -989,7 +993,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { final byte types0 = types; - final CacheEntryUpdatedListener locLsnr = new JCacheQueryLocalListener( + locLsnr = new JCacheQueryLocalListener( locLsnrImpl, log); @@ -1063,13 +1067,15 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { cctx.kernalContext().continuous().stopRoutine(routineId0).get(); cctx.config().removeCacheEntryListenerConfiguration(cfg); + + U.closeQuiet(locLsnr); } } /** * */ - static class JCacheQueryLocalListener implements CacheEntryUpdatedListener { + static class JCacheQueryLocalListener implements CacheEntryUpdatedListener, Closeable { /** */ final CacheEntryListener impl; @@ -1154,6 +1160,12 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { protected boolean async() { return U.hasAnnotation(impl, IgniteAsyncCallback.class); } + + /** {@inheritDoc} */ + @Override public void close() throws IOException { + if (impl instanceof Closeable) + U.closeQuiet((Closeable)impl); + } } /**