Repository: incubator-ignite Updated Branches: refs/heads/ignite-gg-9615-1 9e5fc85ac -> 8786075ee
Removed interop finalizer as this was a bad design decision. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7a96a4be Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7a96a4be Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7a96a4be Branch: refs/heads/ignite-gg-9615-1 Commit: 7a96a4be5220954514c323e33e4f64f6c6f68f9a Parents: e18147d Author: vozerov-gridgain <voze...@gridgain.com> Authored: Thu Aug 20 10:06:24 2015 +0300 Committer: vozerov-gridgain <voze...@gridgain.com> Committed: Thu Aug 20 10:06:24 2015 +0300 ---------------------------------------------------------------------- .../internal/interop/InteropIgnition.java | 55 -------------------- .../internal/interop/InteropProcessor.java | 12 ----- 2 files changed, 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7a96a4be/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java index faae72b..35e9bc9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; -import java.lang.ref.*; import java.net.*; import java.security.*; import java.util.*; @@ -69,8 +68,6 @@ public class InteropIgnition { InteropProcessor proc = bootstrap.start(cfg, envPtr, dataPtr); - trackFinalization(proc); - InteropProcessor old = instances.put(gridName, proc); assert old == null; @@ -181,58 +178,6 @@ public class InteropIgnition { } /** - * Track processor finalization. - * - * @param proc Processor. - */ - private static void trackFinalization(InteropProcessor proc) { - Thread thread = new Thread(new Finalizer(proc)); - - thread.setDaemon(true); - - thread.start(); - } - - /** - * Finalizer runnable. - */ - private static class Finalizer implements Runnable { - /** Queue where we expect notification to appear. */ - private final ReferenceQueue<InteropProcessor> queue; - - /** Phantom reference to processor. */ - private final PhantomReference<InteropProcessor> proc; - - /** Cleanup runnable. */ - private final Runnable cleanup; - - /** - * Constructor. - * - * @param proc Processor. - */ - public Finalizer(InteropProcessor proc) { - queue = new ReferenceQueue<>(); - - this.proc = new PhantomReference<>(proc, queue); - - cleanup = proc.cleanupCallback(); - } - - /** {@inheritDoc} */ - @Override public void run() { - try { - queue.remove(0); - - cleanup.run(); - } - catch (InterruptedException ignore) { - // No-op. - } - } - } - - /** * Private constructor. */ private InteropIgnition() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7a96a4be/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java index 94b733f..2551047 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.interop; import org.apache.ignite.*; -import org.jetbrains.annotations.*; /** * Interop processor. @@ -37,15 +36,4 @@ public interface InteropProcessor { * @return Environment pointer. */ public long environmentPointer(); - - /** - * Get stop runnable to perform cleanup when interop is not longer used. - * <p/> - * <b>NOTE!</b> This runnable is called when current instance of interop processor is eligible for garbage - * collection. Therefore you should <b>never</b> store any references to Ignite internal inside it. Otherwise - * this runnable will never be called. - * - * @return Stop runnable. If {@code null} is returned, then no cleanup is expected. - */ - @Nullable public Runnable cleanupCallback(); }