ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [06/50] [abbrv] incubator-ignite git commit: #IGNITE-857 Code format
Date Fri, 29 May 2015 18:11:43 GMT
#IGNITE-857 Code format


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

Branch: refs/heads/ignite-218
Commit: b7ef1a83d9bf6cec33d2c8a36ba163f281a55a41
Parents: 29710de
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Wed May 27 12:26:08 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Wed May 27 12:26:08 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/mesos/ClusterProperties.java  | 28 ++++++++++++++++++--
 .../apache/ignite/mesos/IgniteScheduler.java    | 14 +++++-----
 .../ignite/mesos/resource/IgniteProvider.java   |  4 +--
 .../ignite/mesos/resource/ResourceHandler.java  |  4 +--
 4 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ef1a83/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
index e659509..c23fcea 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
@@ -38,6 +38,15 @@ public class ClusterProperties {
     private String mesosUrl = DEFAULT_MESOS_MASTER_URL;
 
     /** */
+    public static final String IGNITE_CLUSTER_NAME = "IGNITE_CLUSTER_NAME";
+
+    /** */
+    public static final String DEFAULT_CLUSTER_NAME = "ignite-cluster";
+
+    /** Mesos master url. */
+    private String clusterName = DEFAULT_CLUSTER_NAME;
+
+    /** */
     public static final String IGNITE_HTTP_SERVER_HOST = "IGNITE_HTTP_SERVER_HOST";
 
     /** Http server host. */
@@ -166,6 +175,13 @@ public class ClusterProperties {
     }
 
     /**
+     * @return Cluster name.
+     */
+    public String clusterName() {
+        return clusterName;
+    }
+
+    /**
      * @return CPU count limit.
      */
     public double cpus(){
@@ -350,8 +366,16 @@ public class ClusterProperties {
             prop.mesosUrl = getStringProperty(MESOS_MASTER_URL, props, DEFAULT_MESOS_MASTER_URL);
 
             prop.httpServerHost = getStringProperty(IGNITE_HTTP_SERVER_HOST, props, getNonLoopbackAddress());
-            prop.httpServerPort = Integer.valueOf(getStringProperty(IGNITE_HTTP_SERVER_PORT,
props,
-                DEFAULT_HTTP_SERVER_PORT));
+
+            String port = System.getProperty("PORT0");
+
+            if (port != null && !port.isEmpty())
+                prop.httpServerPort = Integer.valueOf(port);
+            else
+                prop.httpServerPort = Integer.valueOf(getStringProperty(IGNITE_HTTP_SERVER_PORT,
props,
+                    DEFAULT_HTTP_SERVER_PORT));
+
+            prop.clusterName = getStringProperty(IGNITE_CLUSTER_NAME, props, DEFAULT_CLUSTER_NAME);
 
             prop.userLibsUrl = getStringProperty(IGNITE_USERS_LIBS_URL, props, null);
             prop.ignitePackageUrl = getStringProperty(IGNITE_PACKAGE_URL, props, null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ef1a83/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
index ad48189..05d8c4f 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteScheduler.java
@@ -87,7 +87,7 @@ public class IgniteScheduler implements Scheduler {
 
                 // Generate a unique task ID.
                 Protos.TaskID taskId = Protos.TaskID.newBuilder()
-                    .setValue(Integer.toString(taskIdGenerator.incrementAndGet())).build();
+                    .setValue(taskIdGenerator.incrementAndGet() + "-" + clusterProps.clusterName()).build();
 
                 log.info("Launching task: [{}]", igniteTask);
 
@@ -143,10 +143,10 @@ public class IgniteScheduler implements Scheduler {
                     builder.addUris(Protos.CommandInfo.URI.newBuilder().setValue(url));
 
                 builder.setValue("cp *.jar ./gridgain-community-*/libs/ "
-                        + "&& ./gridgain-community-*/bin/ignite.sh "
-                        + resourceProvider.configName()
-                        + " -J-Xmx" + String.valueOf((int)igniteTask.mem() + "m")
-                        + " -J-Xms" + String.valueOf((int)igniteTask.mem()) + "m");
+                    + "&& ./gridgain-community-*/bin/ignite.sh "
+                    + resourceProvider.configName()
+                    + " -J-Xmx" + String.valueOf((int)igniteTask.mem() + "m")
+                    + " -J-Xms" + String.valueOf((int)igniteTask.mem()) + "m");
             }
         }
         else
@@ -172,7 +172,7 @@ public class IgniteScheduler implements Scheduler {
                 .setName(DISK)
                 .setType(Protos.Value.Type.SCALAR)
                 .setScalar(Protos.Value.Scalar.newBuilder().setValue(igniteTask.disk())))
-                .build();
+            .build();
     }
 
     /**
@@ -231,7 +231,7 @@ public class IgniteScheduler implements Scheduler {
         }
 
         // Check that slave satisfies min requirements.
-        if (cpus < clusterProps.minCpuPerNode() || mem < clusterProps.minMemoryPerNode()
) {
+        if (cpus < clusterProps.minCpuPerNode() || mem < clusterProps.minMemoryPerNode())
{
             log.debug("Offer not sufficient for slave request: {}", offer.getResourcesList());
 
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ef1a83/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
index 2887112..f459e5d 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
@@ -155,7 +155,8 @@ public class IgniteProvider {
                 outFile.close();
 
                 return parseVersion(redirectUrl);
-            } else if (code == 304)
+            }
+            else if (code == 304)
                 // This version is latest.
                 return currentVersion;
             else
@@ -199,7 +200,6 @@ public class IgniteProvider {
         }
     }
 
-
     /**
      * @return Download folder.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ef1a83/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceHandler.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceHandler.java
b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceHandler.java
index ea883e3..cb8c773 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceHandler.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceHandler.java
@@ -73,7 +73,7 @@ public class ResourceHandler extends AbstractHandler {
 
         String[] path = url.split("/");
 
-        String fileName = path[path.length -1];
+        String fileName = path[path.length - 1];
 
         String servicePath = url.substring(0, url.length() - fileName.length());
 
@@ -131,7 +131,7 @@ public class ResourceHandler extends AbstractHandler {
      * @throws IOException If failed.
      */
     private static void handleRequest(HttpServletResponse response, String type, InputStream
stream,
-                                      String attachmentName) throws IOException {
+        String attachmentName) throws IOException {
         response.setContentType(type);
         response.setHeader("Content-Disposition", "attachment; filename=\"" + attachmentName
+ "\"");
 


Mime
View raw message