ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [33/50] [abbrv] incubator-ignite git commit: #IGNITE-857 Removed log4j.
Date Mon, 01 Jun 2015 12:37:06 GMT
#IGNITE-857 Removed log4j.


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

Branch: refs/heads/ignite-648-windows
Commit: bac7f79af721874e8d36a01471e0b0362c54e442
Parents: 73c519e
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu May 28 19:01:49 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu May 28 19:01:49 2015 +0300

----------------------------------------------------------------------
 modules/mesos/pom.xml                           |  7 --
 .../apache/ignite/mesos/ClusterProperties.java  |  7 +-
 .../apache/ignite/mesos/IgniteFramework.java    |  8 +-
 .../apache/ignite/mesos/IgniteScheduler.java    | 83 ++++++++------------
 modules/mesos/src/main/resources/log4j2.xml     | 35 ---------
 5 files changed, 40 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bac7f79a/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 3cf9028..eca4fa9 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -30,7 +30,6 @@
     <properties>
         <jetty.version>9.2.10.v20150310</jetty.version>
         <mesos.version>0.22.0</mesos.version>
-        <log4j.version>2.0.2</log4j.version>
     </properties>
 
     <dependencies>
@@ -41,12 +40,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-core</artifactId>
-            <version>${log4j.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
             <version>${jetty.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bac7f79a/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 956dd6e..6663625 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
@@ -17,11 +17,10 @@
 
 package org.apache.ignite.mesos;
 
-import org.apache.logging.log4j.*;
-
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import java.util.logging.*;
 import java.util.regex.*;
 
 /**
@@ -29,7 +28,7 @@ import java.util.regex.*;
  */
 public class ClusterProperties {
     /** */
-    private static final Logger log = LogManager.getLogger(ClusterProperties.class);
+    private static final Logger log = Logger.getLogger(ClusterProperties.class.getSimpleName());
 
     /** Unlimited. */
     public static final double UNLIMITED = Double.MAX_VALUE;
@@ -448,7 +447,7 @@ public class ClusterProperties {
                     prop.hostnameConstraint = Pattern.compile(pattern);
                 }
                 catch (PatternSyntaxException e) {
-                    log.warn("IGNITE_HOSTNAME_CONSTRAINT has invalid pattern. It will be
ignore.", e);
+                    log.log(Level.WARNING, "IGNITE_HOSTNAME_CONSTRAINT has invalid pattern.
It will be ignore.", e);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bac7f79a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
index c30d206..3d582d9 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
@@ -19,17 +19,17 @@ package org.apache.ignite.mesos;
 
 import com.google.protobuf.*;
 import org.apache.ignite.mesos.resource.*;
-import org.apache.logging.log4j.*;
 import org.apache.mesos.*;
 
 import java.net.*;
+import java.util.logging.*;
 
 /**
  * Ignite mesos framework.
  */
 public class IgniteFramework {
     /** */
-    public static final Logger log = LogManager.getLogger(IgniteFramework.class);
+    public static final Logger log = Logger.getLogger(IgniteFramework.class.getSimpleName());
 
     /** Framework name. */
     public static final String IGNITE_FRAMEWORK_NAME = "Ignite";
@@ -80,13 +80,13 @@ public class IgniteFramework {
             log.info("Enabling authentication for the framework");
 
             if (System.getenv("DEFAULT_PRINCIPAL") == null) {
-                log.error("Expecting authentication principal in the environment");
+                log.log(Level.SEVERE, "Expecting authentication principal in the environment");
 
                 System.exit(1);
             }
 
             if (System.getenv("DEFAULT_SECRET") == null) {
-                log.error("Expecting authentication secret in the environment");
+                log.log(Level.SEVERE, "Expecting authentication secret in the environment");
 
                 System.exit(1);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bac7f79a/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 6bd3aa7..fbb9994 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
@@ -18,11 +18,11 @@
 package org.apache.ignite.mesos;
 
 import org.apache.ignite.mesos.resource.*;
-import org.apache.logging.log4j.*;
 import org.apache.mesos.*;
 
 import java.util.*;
 import java.util.concurrent.atomic.*;
+import java.util.logging.*;
 
 /**
  * Ignite scheduler receives offers from Mesos and decides how many resources will be occupied.
@@ -44,10 +44,7 @@ public class IgniteScheduler implements Scheduler {
     public static final String DELIM = ",";
 
     /** Logger. */
-    private static final Logger log = LogManager.getLogger(IgniteScheduler.class);
-
-    /** Mutex. */
-    private final Object mux = new Object();
+    private static final Logger log = Logger.getLogger(IgniteScheduler.class.getSimpleName());
 
     /** ID generator. */
     private AtomicInteger taskIdGenerator = new AtomicInteger();
@@ -71,33 +68,27 @@ public class IgniteScheduler implements Scheduler {
     }
 
     /** {@inheritDoc} */
-    @Override public void resourceOffers(SchedulerDriver schedulerDriver, List<Protos.Offer>
offers) {
-        log.debug("Offers resources: {} ", offers.size());
+    @Override public synchronized void resourceOffers(SchedulerDriver schedulerDriver, List<Protos.Offer>
offers) {
+        log.log(Level.FINE, "Offers resources: {0}", offers.size());
 
         for (Protos.Offer offer : offers) {
-            Protos.TaskID taskId;
-            Protos.TaskInfo task;
-            IgniteTask igniteTask;
+            IgniteTask igniteTask = checkOffer(offer);
 
-            synchronized (mux) {
-                igniteTask = checkOffer(offer);
+            // Decline offer which doesn't match by mem or cpu.
+            if (igniteTask == null) {
+                schedulerDriver.declineOffer(offer.getId());
 
-                // Decline offer which doesn't match by mem or cpu.
-                if (igniteTask == null) {
-                    schedulerDriver.declineOffer(offer.getId());
+                continue;
+            }
 
-                    continue;
-                }
+            // Generate a unique task ID.
+            Protos.TaskID taskId = Protos.TaskID.newBuilder()
+                .setValue(Integer.toString(taskIdGenerator.incrementAndGet())).build();
 
-                // Generate a unique task ID.
-                taskId = Protos.TaskID.newBuilder()
-                    .setValue(Integer.toString(taskIdGenerator.incrementAndGet())).build();
+            log.log(Level.INFO, "Launching task: {0}", igniteTask);
 
-                log.info("Launching task: {}", igniteTask);
-
-                // Create task to run.
-                task = createTask(offer, igniteTask, taskId);
-            }
+            // Create task to run.
+            Protos.TaskInfo task = createTask(offer, igniteTask, taskId);
 
             try {
                 schedulerDriver.launchTasks(Collections.singletonList(offer.getId()),
@@ -105,14 +96,13 @@ public class IgniteScheduler implements Scheduler {
                     Protos.Filters.newBuilder().setRefuseSeconds(1).build());
             }
             catch (RuntimeException e) {
-                log.error("Failed launch task. Task id: {}. Task info: {}", taskId, task);
+                log.log(Level.SEVERE, "Failed launch task. Task id: {0}. Task info: {1}",
+                    new Object[]{taskId, task, e});
 
                 throw e;
             }
 
-            synchronized (mux) {
-                tasks.put(taskId.getValue(), igniteTask);
-            }
+            tasks.put(taskId.getValue(), igniteTask);
         }
     }
 
@@ -124,7 +114,7 @@ public class IgniteScheduler implements Scheduler {
      * @param taskId Task id.
      * @return Task.
      */
-    protected Protos.TaskInfo createTask(Protos.Offer offer, IgniteTask igniteTask, Protos.TaskID
taskId) {
+    private Protos.TaskInfo createTask(Protos.Offer offer, IgniteTask igniteTask, Protos.TaskID
taskId) {
         String cfgUrl = clusterProps.igniteConfigUrl() != null ?
             clusterProps.igniteConfigUrl() : resourceProvider.igniteConfigUrl();
 
@@ -189,8 +179,6 @@ public class IgniteScheduler implements Scheduler {
      * @return Address running nodes.
      */
     private String getAddress(String address) {
-        assert Thread.holdsLock(mux);
-
         if (tasks.isEmpty()) {
             if (address != null && !address.isEmpty())
                 return address + DEFAULT_PORT;
@@ -213,8 +201,6 @@ public class IgniteScheduler implements Scheduler {
      * @return Ignite task description.
      */
     private IgniteTask checkOffer(Protos.Offer offer) {
-        assert Thread.holdsLock(mux);
-
         // Check limit on running nodes.
         if (clusterProps.instances() <= tasks.size())
             return null;
@@ -234,24 +220,24 @@ public class IgniteScheduler implements Scheduler {
                 if (resource.getType().equals(Protos.Value.Type.SCALAR))
                     cpus = resource.getScalar().getValue();
                 else
-                    log.debug("Cpus resource was not a scalar: {}" + resource.getType());
+                    log.log(Level.FINE, "Cpus resource was not a scalar: {0}" + resource.getType());
             }
             else if (resource.getName().equals(MEM)) {
                 if (resource.getType().equals(Protos.Value.Type.SCALAR))
                     mem = resource.getScalar().getValue();
                 else
-                    log.debug("Mem resource was not a scalar: {}", resource.getType());
+                    log.log(Level.FINE, "Mem resource was not a scalar: {0}", resource.getType());
             }
             else if (resource.getName().equals(DISK))
                 if (resource.getType().equals(Protos.Value.Type.SCALAR))
                     disk = resource.getScalar().getValue();
                 else
-                    log.debug("Disk resource was not a scalar: {}", resource.getType());
+                    log.log(Level.FINE, "Disk resource was not a scalar: {0}", resource.getType());
         }
 
         // Check that slave satisfies min requirements.
         if (cpus < clusterProps.minCpuPerNode() || mem < clusterProps.minMemoryPerNode())
{
-            log.debug("Offer not sufficient for slave request: {}", offer.getResourcesList());
+            log.log(Level.FINE, "Offer not sufficient for slave request: {0}", offer.getResourcesList());
 
             return null;
         }
@@ -273,7 +259,7 @@ public class IgniteScheduler implements Scheduler {
 
         if ((clusterProps.cpusPerNode() != ClusterProperties.UNLIMITED && clusterProps.cpusPerNode()
!= cpus)
             || (clusterProps.memoryPerNode() != ClusterProperties.UNLIMITED && clusterProps.memoryPerNode()
!= mem)) {
-            log.debug("Offer not sufficient for slave request: {}", offer.getResourcesList());
+            log.log(Level.FINE, "Offer not sufficient for slave request: {0}", offer.getResourcesList());
 
             return null;
         }
@@ -281,28 +267,25 @@ public class IgniteScheduler implements Scheduler {
         if (cpus > 0 && mem > 0)
             return new IgniteTask(offer.getHostname(), cpus, mem, disk);
         else {
-            log.debug("Offer not sufficient for slave request: {}", offer.getResourcesList());
+            log.log(Level.FINE, "Offer not sufficient for slave request: {0}", offer.getResourcesList());
 
             return null;
         }
     }
 
     /** {@inheritDoc} */
-    @Override public void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus
taskStatus) {
+    @Override public synchronized void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus
taskStatus) {
         final String taskId = taskStatus.getTaskId().getValue();
 
-        log.info("Received update event task: {} is in state: {}", taskId, taskStatus.getState());
+        log.log(Level.INFO, "Received update event task: {0} is in state: {1}",
+            new Object[]{taskId, taskStatus.getState()});
 
         if (taskStatus.getState().equals(Protos.TaskState.TASK_FAILED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_ERROR)
             || taskStatus.getState().equals(Protos.TaskState.TASK_FINISHED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_KILLED)
             || taskStatus.getState().equals(Protos.TaskState.TASK_LOST)) {
-            IgniteTask failedTask;
-
-            synchronized (mux) {
-                failedTask = tasks.remove(taskId);
-            }
+            IgniteTask failedTask = tasks.remove(taskId);
 
             if (failedTask != null) {
                 List<Protos.Request> requests = new ArrayList<>();
@@ -335,8 +318,8 @@ public class IgniteScheduler implements Scheduler {
     /** {@inheritDoc} */
     @Override public void registered(SchedulerDriver schedulerDriver, Protos.FrameworkID
frameworkID,
         Protos.MasterInfo masterInfo) {
-        log.info("Scheduler registered. Master: {}:{}, framework={}", masterInfo.getIp(),
masterInfo.getPort(),
-            frameworkID);
+        log.log(Level.INFO, "Scheduler registered. Master: {0}:{1}, framework={2}", new Object[]{masterInfo.getIp(),
+            masterInfo.getPort(), frameworkID});
     }
 
     /** {@inheritDoc} */
@@ -346,7 +329,7 @@ public class IgniteScheduler implements Scheduler {
 
     /** {@inheritDoc} */
     @Override public void error(SchedulerDriver schedulerDriver, String s) {
-        log.error("Failed. Error message: {}", s);
+        log.log(Level.SEVERE, "Failed. Error message: {0}", s);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bac7f79a/modules/mesos/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/resources/log4j2.xml b/modules/mesos/src/main/resources/log4j2.xml
deleted file mode 100644
index d66a83f..0000000
--- a/modules/mesos/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<configuration strict="true" status="OFF" monitorInterval="30"  shutdownHook="disable">
-
-    <appenders>
-        <appender type="Console" name="STDOUT">
-            <layout type="PatternLayout" pattern="%d %p %C{1.} [%t] %m%n %ex"/>
-        </appender>
-    </appenders>
-
-    <loggers>
-        <root level="info">
-            <appender-ref ref="STDOUT"/>
-        </root>
-
-    </loggers>
-
-</configuration>
\ No newline at end of file


Mime
View raw message