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 C137C17CD0 for ; Wed, 26 Aug 2015 11:36:11 +0000 (UTC) Received: (qmail 80802 invoked by uid 500); 26 Aug 2015 11:36:11 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 80752 invoked by uid 500); 26 Aug 2015 11:36:11 -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 80411 invoked by uid 99); 26 Aug 2015 11:36:11 -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, 26 Aug 2015 11:36:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DBAFBE046A; Wed, 26 Aug 2015 11:36:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Wed, 26 Aug 2015 11:36:30 -0000 Message-Id: <3f26129bc0ad42ad915c19a240f509ad@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [21/22] ignite git commit: Moved platform lifecycle bean to Ignite. Moved platform lifecycle bean to Ignite. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c46e47b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c46e47b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c46e47b Branch: refs/heads/ignite-843 Commit: 6c46e47b3c04cdf03946168cfff28b759dd44348 Parents: 0e81fd0 Author: vozerov-gridgain Authored: Wed Aug 26 13:43:18 2015 +0300 Committer: vozerov-gridgain Committed: Wed Aug 26 13:43:18 2015 +0300 ---------------------------------------------------------------------- .../lifecycle/PlatformLifecycleBean.java | 72 ++++++++++++++++++++ 1 file changed, 72 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6c46e47b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java new file mode 100644 index 0000000..c6a83e6 --- /dev/null +++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.platform.lifecycle; + +import org.apache.ignite.*; +import org.apache.ignite.internal.processors.platform.callback.*; +import org.apache.ignite.lifecycle.*; + +/** + * Lifecycle aware bean for interop. + */ +public class PlatformLifecycleBean implements LifecycleBean { + /** Native gateway. */ + public PlatformCallbackGateway gate; + + /** Holder pointer. */ + public long ptr; + + /** + * Constructor. + */ + protected PlatformLifecycleBean() { + // No-op. + } + + /** + * Constructor. + * + * @param gate Native gateway. + * @param ptr Holder pointer. + */ + public PlatformLifecycleBean(PlatformCallbackGateway gate, long ptr) { + initialize(gate, ptr); + } + + /** {@inheritDoc} */ + @Override public void onLifecycleEvent(LifecycleEventType evt) { + if (gate == null) + throw new IgniteException("Interop lifecycle bean can only be used in interop mode (did " + + "you start the node with native platform bootstrapper?"); + + assert ptr != 0; + + gate.lifecycleEvent(ptr, evt.ordinal()); + } + + /** + * Set pointers. + * + * @param gate Native gateway. + * @param ptr Target pointer. + */ + public void initialize(PlatformCallbackGateway gate, long ptr) { + this.gate = gate; + this.ptr = ptr; + } +}