You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2018/08/02 11:19:59 UTC
ignite git commit: IGNITE-8715 Problems with Closeable objects from
Factory
Repository: ignite
Updated Branches:
refs/heads/master 1cdf7ef99 -> d632eb6f8
IGNITE-8715 Problems with Closeable objects from Factory
Signed-off-by: Anton Vinogradov <av...@apache.org>
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 <xx...@gmail.com>
Authored: Thu Aug 2 14:19:47 2018 +0300
Committer: Anton Vinogradov <av...@apache.org>
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<K, V> 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<K, V> implements CacheStore<K, V>, 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<K, V> implements CacheEntryUpdatedListener<K, V> {
+ static class JCacheQueryLocalListener<K, V> implements CacheEntryUpdatedListener<K, V>, Closeable {
/** */
final CacheEntryListener<K, V> 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);
+ }
}
/**