Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6414018103 for ; Wed, 8 Jul 2015 06:20:59 +0000 (UTC) Received: (qmail 9247 invoked by uid 500); 8 Jul 2015 06:20:59 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 9215 invoked by uid 500); 8 Jul 2015 06:20:59 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 9206 invoked by uid 99); 8 Jul 2015 06:20:59 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2015 06:20:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 94B3FD2EF1 for ; Wed, 8 Jul 2015 06:20:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.989 X-Spam-Level: X-Spam-Status: No, score=0.989 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.812, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id LmK-2gvLNGJT for ; Wed, 8 Jul 2015 06:20:51 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id BA5334E200 for ; Wed, 8 Jul 2015 06:20:50 +0000 (UTC) Received: (qmail 9165 invoked by uid 99); 8 Jul 2015 06:20:50 -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; Wed, 08 Jul 2015 06:20:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0CCF1E35D1; Wed, 8 Jul 2015 06:20:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 08 Jul 2015 06:20:51 -0000 Message-Id: In-Reply-To: <9f3e3d6d54754b508a34ffe76c7fc75c@git.apache.org> References: <9f3e3d6d54754b508a34ffe76c7fc75c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/8] incubator-ignite git commit: GG-10469: Done. GG-10469: Done. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96fa3002 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96fa3002 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96fa3002 Branch: refs/heads/ignite-747 Commit: 96fa3002904fcad50dafc1f19655c2d44eaece40 Parents: 96c9695 Author: vozerov-gridgain Authored: Tue Jul 7 18:07:05 2015 +0300 Committer: vozerov-gridgain Committed: Tue Jul 7 18:07:05 2015 +0300 ---------------------------------------------------------------------- .../ignite/internal/interop/InteropIgnition.java | 17 ++++++++++++++++- .../ignite/internal/interop/InteropProcessor.java | 7 +++++++ 2 files changed, 23 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96fa3002/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 2989a17..faae72b 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 @@ -50,6 +50,9 @@ public class InteropIgnition { */ public static synchronized InteropProcessor start(@Nullable String springCfgPath, @Nullable String gridName, int factoryId, long envPtr, long dataPtr) { + if (envPtr <= 0) + throw new IgniteException("Environment pointer must be positive."); + ClassLoader oldClsLdr = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(InteropIgnition.class.getClassLoader()); @@ -83,13 +86,25 @@ public class InteropIgnition { * Get instance by environment pointer. * * @param gridName Grid name. - * @return Instance or {@code null} if it doesn't exists (never started or stopped). + * @return Instance or {@code null} if it doesn't exist (never started or stopped). */ @Nullable public static synchronized InteropProcessor instance(@Nullable String gridName) { return instances.get(gridName); } /** + * Get environment pointer of the given instance. + * + * @param gridName Grid name. + * @return Environment pointer or {@code 0} in case grid with such name doesn't exist. + */ + public static synchronized long environmentPointer(@Nullable String gridName) { + InteropProcessor proc = instance(gridName); + + return proc != null ? proc.environmentPointer() : 0; + } + + /** * Stop single instance. * * @param gridName Grid name, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96fa3002/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 325a464..94b733f 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 @@ -32,6 +32,13 @@ public interface InteropProcessor { public Ignite ignite(); /** + * Get environment pointer associated with this processor. + * + * @return Environment pointer. + */ + public long environmentPointer(); + + /** * Get stop runnable to perform cleanup when interop is not longer used. *

* NOTE! This runnable is called when current instance of interop processor is eligible for garbage