incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1463858 - in /incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids: parse/SimpleLinkParser.java taskmaster/MultiThreadedTaskMaster.java
Date Wed, 03 Apr 2013 07:54:19 GMT
Author: tobr
Date: Wed Apr  3 07:54:18 2013
New Revision: 1463858

URL: http://svn.apache.org/r1463858
Log:
changed to private members
renamed logger to LOGGER to fit the naming convention for statics

Modified:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/parse/SimpleLinkParser.java
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/taskmaster/MultiThreadedTaskMaster.java

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/parse/SimpleLinkParser.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/parse/SimpleLinkParser.java?rev=1463858&r1=1463857&r2=1463858&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/parse/SimpleLinkParser.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/parse/SimpleLinkParser.java
Wed Apr  3 07:54:18 2013
@@ -36,11 +36,11 @@ import org.slf4j.LoggerFactory;
  * @version 1.0
  */
 public class SimpleLinkParser implements Parser<LinkedTask> {
-    Logger logger = LoggerFactory.getLogger(SimpleLinkParser.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(SimpleLinkParser.class);
 
     @Override
     public void parse(LinkedTask task) throws DroidsException {
-        logger.info("parse " + task.getURI());
+        LOGGER.info("parse " + task.getURI());
         InputStream inStream = task.getContentEntity().getContent();
         if (inStream != null) {
             Scanner s = new Scanner(inStream).useDelimiter("\\A");

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/taskmaster/MultiThreadedTaskMaster.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/taskmaster/MultiThreadedTaskMaster.java?rev=1463858&r1=1463857&r2=1463858&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/taskmaster/MultiThreadedTaskMaster.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/taskmaster/MultiThreadedTaskMaster.java
Wed Apr  3 07:54:18 2013
@@ -39,41 +39,41 @@ import org.slf4j.LoggerFactory;
  */
 public class MultiThreadedTaskMaster<T extends Task> implements TaskMaster<T>
{
 
-    protected static final Logger LOG = LoggerFactory.getLogger(MultiThreadedTaskMaster.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(MultiThreadedTaskMaster.class);
     private static final long TICKLE_TIME = 1000L;
 
     /**
      * The execution state
      */
-    protected volatile ExecutionState state = ExecutionState.STOPPED;
+    private volatile ExecutionState state = ExecutionState.STOPPED;
     /**
      * The delay timer
      */
-    protected DelayTimer delayTimer;
+    private DelayTimer delayTimer;
     /**
      * The start time
      */
-    protected Date startTime;
+    private Date startTime;
     /**
      * The end time
      */
-    protected Date endTime;
+    private Date endTime;
     /**
      * The last completed task
      */
-    protected T lastCompletedTask;
+    private T lastCompletedTask;
     /**
      * The completed task counter
      */
-    protected AtomicLong completedTasks = new AtomicLong();
+    private AtomicLong completedTasks = new AtomicLong();
     /**
      * The monitor that that records the processing of tasks
      */
-    protected WorkMonitor<T> monitor;
+    private WorkMonitor<T> monitor;
     /**
      * The task exception handler
      */
-    protected TaskExceptionHandler exceptionHandler;
+    private TaskExceptionHandler exceptionHandler;
 
     /*
      * The pool size
@@ -86,8 +86,8 @@ public class MultiThreadedTaskMaster<T e
 
     @Override
     public void start(Queue<T> queue, Droid<T> droid) {
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Start the executor service.");
+        if (LOGGER.isInfoEnabled()) {
+            LOGGER.info("Start the executor service.");
         }
 
         state = ExecutionState.RUNNING;
@@ -102,7 +102,7 @@ public class MultiThreadedTaskMaster<T e
             try {
                 Thread.sleep(TICKLE_TIME);
             } catch (InterruptedException ignored) {
-                LOG.error("", ignored);
+                LOGGER.error("", ignored);
             }
             pool.execute(new TaskExecutor(queue, droid));
         }
@@ -113,8 +113,8 @@ public class MultiThreadedTaskMaster<T e
      */
     public void stop() {
         // debug
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Stop the executor service.");
+        if (LOGGER.isInfoEnabled()) {
+            LOGGER.info("Stop the executor service.");
         }
 
         state = ExecutionState.STOPPED;
@@ -131,15 +131,15 @@ public class MultiThreadedTaskMaster<T e
 
                 // Wait a while for to respond to being canceled
                 if (!pool.awaitTermination(1, TimeUnit.SECONDS)) {
-                    if (LOG.isInfoEnabled()) {
-                        LOG.info("Scheduler did not stop.");
+                    if (LOGGER.isInfoEnabled()) {
+                        LOGGER.info("Scheduler did not stop.");
                     }
                 }
             }
         } catch (InterruptedException ex) {
 
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Force scheduler to stop.");
+            if (LOGGER.isInfoEnabled()) {
+                LOGGER.info("Force scheduler to stop.");
             }
 
             // (Re-)Cancel if current thread also interrupted
@@ -150,8 +150,8 @@ public class MultiThreadedTaskMaster<T e
         }
 
         // debug
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Scheduler stopped.");
+        if (LOGGER.isInfoEnabled()) {
+            LOGGER.info("Scheduler stopped.");
         }
 
     }
@@ -234,8 +234,9 @@ public class MultiThreadedTaskMaster<T e
      */
     public void setPoolSize(int poolSize) {
         this.poolSize = poolSize;
-        if (pool != null)
+        if (pool != null) {
             pool.setCorePoolSize(this.poolSize);
+        }
     }
 
     private class TaskExecutorPool extends ThreadPoolExecutor {
@@ -266,7 +267,7 @@ public class MultiThreadedTaskMaster<T e
                 try {
                     Thread.sleep(TICKLE_TIME);
                 } catch (InterruptedException e) {
-                    LOG.error("", e);
+                    LOGGER.error("", e);
                 }
             }
 
@@ -316,7 +317,7 @@ public class MultiThreadedTaskMaster<T e
                 try {
                     Thread.sleep(TICKLE_TIME);
                 } catch (InterruptedException e) {
-                    LOG.error("", e);
+                    LOGGER.error("", e);
                 }
                 task = queue.poll();
             }
@@ -330,8 +331,8 @@ public class MultiThreadedTaskMaster<T e
                     }
 
                     // debug
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Worker [" + worker + "] execute task [" + task + "].");
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug("Worker [" + worker + "] execute task [" + task + "].");
                     }
 
                     // execute the task
@@ -340,8 +341,8 @@ public class MultiThreadedTaskMaster<T e
                     }
 
                     // debug
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Worker [" + worker + "] executed task [" + task + "] with
success.");
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug("Worker [" + worker + "] executed task [" + task + "]
with success.");
                     }
 
                     // monitor the execution of the task
@@ -355,13 +356,13 @@ public class MultiThreadedTaskMaster<T e
 
                 } catch (Exception ex) {
                     // debug
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Worker [" + worker + "] executed task [" + task + "] without
success.");
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug("Worker [" + worker + "] executed task [" + task + "]
without success.");
                     }
 
                     // debug
-                    if (LOG.isErrorEnabled()) {
-                        LOG.error("", ex);
+                    if (LOGGER.isErrorEnabled()) {
+                        LOGGER.error("", ex);
                     }
 
                     // monitor the exception



Mime
View raw message