ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # Ignite
Date Thu, 11 Dec 2014 11:04:22 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/master 7b13de917 -> 5cc74d3eb


# Ignite


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

Branch: refs/heads/master
Commit: 5cc74d3ebde951d6d624a7b66f37d5545fe13624
Parents: 7b13de9
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 11 15:03:50 2014 +0400
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 11 15:03:50 2014 +0400

----------------------------------------------------------------------
 .../ignite/portables/PortableRawReader.java     | 13 +++
 .../ignite/portables/PortableRawWriter.java     | 13 +++
 .../apache/ignite/portables/PortableReader.java | 15 ++++
 .../apache/ignite/portables/PortableWriter.java | 15 ++++
 .../grid/kernal/visor/VisorMultiNodeTask.java   |  3 +-
 .../visor/query/VisorQueryCleanupTask.java      | 94 ++++++++++++++++++++
 .../grid/kernal/visor/util/VisorTaskUtils.java  | 31 +++++++
 7 files changed, 183 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/apache/ignite/portables/PortableRawReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portables/PortableRawReader.java
b/modules/core/src/main/java/org/apache/ignite/portables/PortableRawReader.java
index a4fe957..393b023 100644
--- a/modules/core/src/main/java/org/apache/ignite/portables/PortableRawReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/portables/PortableRawReader.java
@@ -11,6 +11,7 @@ package org.apache.ignite.portables;
 
 import org.jetbrains.annotations.*;
 
+import java.math.*;
 import java.sql.*;
 import java.util.*;
 import java.util.Date;
@@ -70,6 +71,12 @@ public interface PortableRawReader {
     public boolean readBoolean() throws PortableException;
 
     /**
+     * @return Decimal value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal readDecimal() throws PortableException;
+
+    /**
      * @return String value.
      * @throws PortableException In case of error.
      */
@@ -148,6 +155,12 @@ public interface PortableRawReader {
     @Nullable public boolean[] readBooleanArray() throws PortableException;
 
     /**
+     * @return Decimal array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
+
+    /**
      * @return String array.
      * @throws PortableException In case of error.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/apache/ignite/portables/PortableRawWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portables/PortableRawWriter.java
b/modules/core/src/main/java/org/apache/ignite/portables/PortableRawWriter.java
index f3c884b..30c24c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/portables/PortableRawWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/portables/PortableRawWriter.java
@@ -11,6 +11,7 @@ package org.apache.ignite.portables;
 
 import org.jetbrains.annotations.*;
 
+import java.math.*;
 import java.sql.*;
 import java.util.*;
 import java.util.Date;
@@ -73,6 +74,12 @@ public interface PortableRawWriter {
      * @param val Value to write.
      * @throws PortableException In case of error.
      */
+    public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
     public void writeString(@Nullable String val) throws PortableException;
 
     /**
@@ -151,6 +158,12 @@ public interface PortableRawWriter {
      * @param val Value to write.
      * @throws PortableException In case of error.
      */
+    public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
     public void writeStringArray(@Nullable String[] val) throws PortableException;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/apache/ignite/portables/PortableReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portables/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/portables/PortableReader.java
index 5cef5a3..59f63db 100644
--- a/modules/core/src/main/java/org/apache/ignite/portables/PortableReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/portables/PortableReader.java
@@ -11,6 +11,7 @@ package org.apache.ignite.portables;
 
 import org.jetbrains.annotations.*;
 
+import java.math.*;
 import java.sql.*;
 import java.util.*;
 import java.util.Date;
@@ -86,6 +87,13 @@ public interface PortableReader {
 
     /**
      * @param fieldName Field name.
+     * @return Decimal value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
      * @return String value.
      * @throws PortableException In case of error.
      */
@@ -177,6 +185,13 @@ public interface PortableReader {
 
     /**
      * @param fieldName Field name.
+     * @return Decimal array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
      * @return String array.
      * @throws PortableException In case of error.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/apache/ignite/portables/PortableWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portables/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/portables/PortableWriter.java
index d29ef3d..75f7401 100644
--- a/modules/core/src/main/java/org/apache/ignite/portables/PortableWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/portables/PortableWriter.java
@@ -11,6 +11,7 @@ package org.apache.ignite.portables;
 
 import org.jetbrains.annotations.*;
 
+import java.math.*;
 import java.sql.*;
 import java.util.*;
 import java.util.Date;
@@ -89,6 +90,13 @@ public interface PortableWriter {
      * @param val Value to write.
      * @throws PortableException In case of error.
      */
+    public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
     public void writeString(String fieldName, @Nullable String val) throws PortableException;
 
     /**
@@ -180,6 +188,13 @@ public interface PortableWriter {
      * @param val Value to write.
      * @throws PortableException In case of error.
      */
+    public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
     public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
index de6d88b..fe6289d 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
@@ -85,7 +85,8 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
             return map;
         }
         finally {
-            logMapped(g.log(), getClass(), map.values());
+            if (debug)
+                logMapped(g.log(), getClass(), map.values());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryCleanupTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryCleanupTask.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryCleanupTask.java
new file mode 100644
index 0000000..fe298a6
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryCleanupTask.java
@@ -0,0 +1,94 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.kernal.visor.query;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.gridgain.grid.*;
+import org.gridgain.grid.kernal.processors.task.*;
+import org.gridgain.grid.kernal.visor.*;
+import org.gridgain.grid.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+import static org.gridgain.grid.kernal.visor.util.VisorTaskUtils.*;
+
+/**
+ * Task for cleanup not needed SCAN or SQL queries result futures from node local.
+ */
+@GridInternal
+public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collection<String>>,
Void, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorJob<Map<UUID, Collection<String>>, Void> job(Map<UUID,
Collection<String>> arg) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode>
subgrid,
+        @Nullable VisorTaskArgument<Map<UUID, Collection<String>>> arg)
throws GridException {
+        Set<UUID> nodeIds = taskArg.keySet();
+
+        Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
+
+        try {
+            for (ClusterNode node : subgrid)
+                if (nodeIds.contains(node.id()))
+                    map.put(new VisorQueryCleanupJob(taskArg.get(node.id()), debug), node);
+
+            return map;
+        }
+        finally {
+            if (debug)
+                logMapped(g.log(), getClass(), map.values());
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected Void reduce0(List list) throws GridException {
+        return null;
+    }
+
+    /**
+     * Job for cleanup not needed SCAN or SQL queries result futures from node local.
+     */
+    private static class VisorQueryCleanupJob extends VisorJob<Collection<String>,
Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Job argument.
+         * @param debug Debug flag.
+         */
+        protected VisorQueryCleanupJob(Collection<String> arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Void run(Collection<String> qryIds) throws GridException
{
+            ClusterNodeLocalMap<String, VisorQueryTask.VisorFutureResultSetHolder>
locMap = g.nodeLocalMap();
+
+            for (String qryId : qryIds)
+                locMap.remove(qryId);
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorQueryCleanupJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cc74d3e/modules/core/src/main/java/org/gridgain/grid/kernal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/util/VisorTaskUtils.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/util/VisorTaskUtils.java
index b9fa6f7..16f9453 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/util/VisorTaskUtils.java
@@ -747,4 +747,35 @@ public class VisorTaskUtils {
 
         return end;
     }
+
+
+    /**
+     * Checks if address can be reached using one argument InetAddress.isReachable() version
or ping command if failed.
+     *
+     * @param addr Address to check.
+     * @param reachTimeout Timeout for the check.
+     * @return {@code True} if address is reachable.
+     */
+    public static boolean reachableByPing(InetAddress addr, int reachTimeout) {
+        try {
+            if (addr.isReachable(reachTimeout))
+                return true;
+
+            String cmd = String.format("ping -%s 1 %s", U.isWindows() ? "n" : "c", addr.getHostAddress());
+
+            Process myProcess = Runtime.getRuntime().exec(cmd);
+
+            myProcess.waitFor();
+
+            return myProcess.exitValue() == 0;
+        }
+        catch (IOException ignore) {
+            return false;
+        }
+        catch (InterruptedException ignored) {
+            Thread.currentThread().interrupt();
+
+            return false;
+        }
+    }
 }


Mime
View raw message