sprint-2 moved event to internal

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

Branch: refs/heads/ignite-298
Commit: bf8c048383d26ec2afe8b487cba8f28b89707847
Parents: 356583e
Author: Yakov Zhdanov <yzhda...@gridgain.com>
Authored: Thu Feb 26 16:22:28 2015 +0300
Committer: Yakov Zhdanov <yzhda...@gridgain.com>
Committed: Thu Feb 26 16:22:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/events/DiscoveryCustomEvent.java     | 57 ----------------
 .../org/apache/ignite/events/EventType.java     | 14 ++--
 .../internal/events/DiscoveryCustomEvent.java   | 68 ++++++++++++++++++++
 .../discovery/GridDiscoveryManager.java         |  7 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  9 ++-
 .../internal/GridDiscoveryEventSelfTest.java    |  9 +--
 6 files changed, 89 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java 
b/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
deleted file mode 100644
index 3752dfb..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.events;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-import java.io.*;
-
-/**
- * Custom event.
- * TODO IGNITE-45 move to internal package
- */
-public class DiscoveryCustomEvent extends DiscoveryEvent {
-    /** */
-    private Serializable data;
-
-    /**
-     * Default constructor.
-     */
-    public DiscoveryCustomEvent() {
-        type(EventType.EVT_DISCOVERY_CUSTOM_EVT);
-    }
-
-    /**
-     * @return Data.
-     */
-    public Serializable data() {
-        return data;
-    }
-
-    /**
-     * @param data New data.
-     */
-    public void data(Serializable data) {
-        this.data = data;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(DiscoveryCustomEvent.class, this, super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/main/java/org/apache/ignite/events/EventType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/EventType.java 
b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
index d9ffc2a..5821da5 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/EventType.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
@@ -155,19 +155,15 @@ public interface EventType {
      */
     public static final int EVT_NODE_SEGMENTED = 14;
 
+    /**
+     * Built-in event type: client node disconnected.
+     */
     public static final int EVT_CLIENT_NODE_DISCONNECTED = 16;
 
-    public static final int EVT_CLIENT_NODE_RECONNECTED = 17;
-
     /**
-     * Built-in event type: custom event sent.
-     * <br>
-     * Generated when someone invoke {@link 
GridDiscoveryManager#sendCustomEvent(Serializable)}.
-     * <p>
-     *
-     * @see DiscoveryCustomEvent
+     * Built-in event type: client node reconnected.
      */
-    public static final int EVT_DISCOVERY_CUSTOM_EVT = 18;
+    public static final int EVT_CLIENT_NODE_RECONNECTED = 17;
 
     /**
      * Built-in event type: task started.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/main/java/org/apache/ignite/internal/events/DiscoveryCustomEvent.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/events/DiscoveryCustomEvent.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/events/DiscoveryCustomEvent.java
new file mode 100644
index 0000000..3a53fc6
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/events/DiscoveryCustomEvent.java
@@ -0,0 +1,68 @@
+/*
+ * 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.events;
+
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.managers.discovery.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Custom event.
+ */
+public class DiscoveryCustomEvent extends DiscoveryEvent {
+    /**
+     * Built-in event type: custom event sent.
+     * <br>
+     * Generated when someone invoke {@link 
GridDiscoveryManager#sendCustomEvent(Serializable)}.
+     * <p>
+     *
+     * @see DiscoveryCustomEvent
+     */
+    public static final int EVT_DISCOVERY_CUSTOM_EVT = 18;
+
+    /** */
+    private Serializable data;
+
+    /**
+     * Default constructor.
+     */
+    public DiscoveryCustomEvent() {
+        type(EVT_DISCOVERY_CUSTOM_EVT);
+    }
+
+    /**
+     * @return Data.
+     */
+    public Serializable data() {
+        return data;
+    }
+
+    /**
+     * @param data New data.
+     */
+    public void data(Serializable data) {
+        this.data = data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DiscoveryCustomEvent.class, this, super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index b65da50..68f0a4a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.events.*;
 import org.apache.ignite.internal.managers.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
@@ -276,7 +277,7 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
                 // Put topology snapshot into discovery history.
                 // There is no race possible between history maintenance and 
concurrent discovery
                 // event notifications, since SPI notifies manager about all 
events from this listener.
-                if (type != EVT_NODE_METRICS_UPDATED && type != 
EVT_DISCOVERY_CUSTOM_EVT) {
+                if (type != EVT_NODE_METRICS_UPDATED && type != 
DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
                     DiscoCache cache = new DiscoCache(locNode, 
F.view(topSnapshot, F.remoteNodes(locNode.id())));
 
                     discoCacheHist.put(topVer, cache);
@@ -1486,7 +1487,7 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
                     break;
                 }
 
-                case EVT_DISCOVERY_CUSTOM_EVT: {
+                case DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT: {
                     DiscoveryCustomEvent customEvt = new 
DiscoveryCustomEvent();
 
                     customEvt.node(ctx.discovery().localNode());
@@ -1495,7 +1496,7 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
                     customEvt.topologySnapshot(topVer, null);
                     customEvt.data(evt.get5());
 
-                    assert ctx.event().isRecordable(EVT_DISCOVERY_CUSTOM_EVT);
+                    assert 
ctx.event().isRecordable(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);
 
                     ctx.event().record(customEvt);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index f910556..ecdc6cc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.events.*;
 import org.apache.ignite.internal.processors.security.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
@@ -4454,8 +4455,12 @@ public class TcpDiscoverySpi extends 
TcpDiscoverySpiAdapter implements TcpDiscov
             TcpDiscoverySpiState spiState = spiStateCopy();
 
             if (lsnr != null && (spiState == CONNECTED || spiState == 
DISCONNECTING))
-                lsnr.onDiscovery(EVT_DISCOVERY_CUSTOM_EVT, 
msg.topologyVersion(), ring.node(msg.creatorNodeId()), null,
-                    null, msg.message());
+                lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
+                    msg.topologyVersion(),
+                    ring.node(msg.creatorNodeId()),
+                    null,
+                    null,
+                    msg.message());
 
             if (ring.hasRemoteNodes())
                 sendMessageAcrossRing(msg);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf8c0483/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
index 64f939c..f17e0a9 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
+import org.apache.ignite.internal.events.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
@@ -439,9 +440,9 @@ public class GridDiscoveryEventSelfTest extends 
GridCommonAbstractTest {
                 }
             };
 
-            g0.events().localListen(lsnr, EVT_DISCOVERY_CUSTOM_EVT);
-            g1.events().localListen(lsnr, EVT_DISCOVERY_CUSTOM_EVT);
-            g2.events().localListen(lsnr, EVT_DISCOVERY_CUSTOM_EVT);
+            g0.events().localListen(lsnr, 
DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);
+            g1.events().localListen(lsnr, 
DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);
+            g2.events().localListen(lsnr, 
DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);
 
             ((IgniteKernal)g1).context().discovery().sendCustomEvent("a");
 
@@ -454,7 +455,7 @@ public class GridDiscoveryEventSelfTest extends 
GridCommonAbstractTest {
 
                     return true;
                 }
-            }, EVT_DISCOVERY_CUSTOM_EVT);
+            }, DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);
         }
         finally {
             stopAllGrids();

Reply via email to