You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/08/26 15:49:40 UTC
[06/14] 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-1124
Commit: 6c46e47b3c04cdf03946168cfff28b759dd44348
Parents: 0e81fd0
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Aug 26 13:43:18 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
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;
+ }
+}