ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject incubator-ignite git commit: # GG-9614 remote listen cleanup
Date Tue, 12 May 2015 08:21:26 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-9614 f6012f1e8 -> e2a0a41b8


# GG-9614 remote listen cleanup


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e2a0a41b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e2a0a41b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e2a0a41b

Branch: refs/heads/ignite-gg-9614
Commit: e2a0a41b8b3ad9bd59fc969ef42bc93c3c8f3032
Parents: f6012f1
Author: ptupitsyn <ptupitsyn@gridgain.com>
Authored: Tue May 12 11:13:15 2015 +0300
Committer: ptupitsyn <ptupitsyn@gridgain.com>
Committed: Tue May 12 11:13:15 2015 +0300

----------------------------------------------------------------------
 .../internal/GridEventConsumeHandler.java       |  6 ++++
 .../internal/GridLifecycleAwareEventFilter.java | 35 ++++++++++++++++++++
 2 files changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a0a41b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
index c60646e..42043f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
@@ -124,6 +124,9 @@ class GridEventConsumeHandler implements GridContinuousHandler {
         if (filter != null)
             ctx.resource().injectGeneric(filter);
 
+        if (filter instanceof GridLifecycleAwareEventFilter)
+            ((GridLifecycleAwareEventFilter)filter).initialize();
+
         final boolean loc = nodeId.equals(ctx.localNodeId());
 
         lsnr = new GridLocalEventListener() {
@@ -188,6 +191,9 @@ class GridEventConsumeHandler implements GridContinuousHandler {
 
         if (lsnr != null)
             ctx.event().removeLocalEventListener(lsnr, types);
+
+        if (filter instanceof GridLifecycleAwareEventFilter)
+            ((GridLifecycleAwareEventFilter)filter).close();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a0a41b/modules/core/src/main/java/org/apache/ignite/internal/GridLifecycleAwareEventFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridLifecycleAwareEventFilter.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridLifecycleAwareEventFilter.java
new file mode 100644
index 0000000..86a0e7a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridLifecycleAwareEventFilter.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import org.apache.ignite.lang.*;
+
+/**
+ * Special version of predicate for events with initialize/close callbacks.
+ */
+public interface GridLifecycleAwareEventFilter<E> extends IgnitePredicate<E>
{
+    /**
+     * Initializes the filter.
+     */
+    public void initialize();
+
+    /**
+     * Closes the filter.
+     */
+    public void close();
+}


Mime
View raw message