This is an automated email from the ASF dual-hosted git repository. martin_s pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/archiva-redback-components-spring-taskqueue.git
commit 544961186e2d118e9ecb5de1ef8512b040eb61fa Author: Olivier Lamy <ol...@apache.org> AuthorDate: Fri Sep 7 08:17:00 2012 +0000 improve a bit logging pattern with .info git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-components/trunk@1381930 13f79535-47bb-0310-9956-ffa450edef68 --- .../taskqueue/execution/ThreadedTaskQueueExecutor.java | 7 +++---- .../taskqueue/execution/BuildProjectTaskExecutor.java | 17 ++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/archiva/redback/components/taskqueue/execution/ThreadedTaskQueueExecutor.java b/src/main/java/org/apache/archiva/redback/components/taskqueue/execution/ThreadedTaskQueueExecutor.java index 6401696..213f6dc 100644 --- a/src/main/java/org/apache/archiva/redback/components/taskqueue/execution/ThreadedTaskQueueExecutor.java +++ b/src/main/java/org/apache/archiva/redback/components/taskqueue/execution/ThreadedTaskQueueExecutor.java @@ -19,9 +19,9 @@ package org.apache.archiva.redback.components.taskqueue.execution; * under the License. */ -import org.apache.commons.lang.StringUtils; import org.apache.archiva.redback.components.taskqueue.Task; import org.apache.archiva.redback.components.taskqueue.TaskQueue; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +38,6 @@ import java.util.concurrent.TimeoutException; /** * @author <a href="mailto:tryg...@inamo.no">Trygve Laugstøl</a> * @author <a href="mailto:ken...@codehaus.org">Kenney Westerhof</a> - * */ public class ThreadedTaskQueueExecutor implements TaskQueueExecutor @@ -307,11 +306,11 @@ public class ThreadedTaskQueueExecutor { if ( System.currentTimeMillis() > endTime ) { - logger.warn( "Timeout waiting for executor thread '" + name + "' to stop, aborting" ); + logger.warn( "Timeout waiting for executor thread '{}' to stop, aborting", name ); break; } - logger.info( "Waiting until task executor '" + name + "' is idling..." ); + logger.info( "Waiting until task executor '{}' is idling...", name ); try { diff --git a/src/test/java/org/apache/archiva/redback/components/taskqueue/execution/BuildProjectTaskExecutor.java b/src/test/java/org/apache/archiva/redback/components/taskqueue/execution/BuildProjectTaskExecutor.java index 48e5c56..48b2b40 100644 --- a/src/test/java/org/apache/archiva/redback/components/taskqueue/execution/BuildProjectTaskExecutor.java +++ b/src/test/java/org/apache/archiva/redback/components/taskqueue/execution/BuildProjectTaskExecutor.java @@ -18,6 +18,7 @@ package org.apache.archiva.redback.components.taskqueue.execution; * specific language governing permissions and limitations * under the License. */ + import org.apache.archiva.redback.components.taskqueue.BuildProjectTask; import org.apache.archiva.redback.components.taskqueue.Task; import org.slf4j.Logger; @@ -25,11 +26,9 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** - * * @author <a href="mailto:ken...@apache.org">Kenney Westerhof</a> - * */ -@Service("taskExecutor#build-project") +@Service ( "taskExecutor#build-project" ) public class BuildProjectTaskExecutor implements TaskExecutor { @@ -43,7 +42,7 @@ public class BuildProjectTaskExecutor task.start(); - logger.info( "Task: " + task + " cancelled: " + task.isCancelled() + "; done: " + task.isDone() ); + logger.info( "Task:{} cancelled: {}; done: {}", task, task.isCancelled(), task.isDone() ); long time = System.currentTimeMillis(); @@ -53,13 +52,13 @@ public class BuildProjectTaskExecutor { try { - logger.info( "Sleeping " + timeToSleep + "ms (interrupts ignored: " + task.ignoreInterrupts() + ")" ); + logger.info( "Sleeping {} ms (interrupts ignored: {} )", timeToSleep, task.ignoreInterrupts() ); Thread.sleep( timeToSleep ); task.done(); - logger.info( "Task completed normally: " + task + " cancelled: " + task.isCancelled() + "; done: " - + task.isDone() ); + logger.info( "Task completed normally: {} cancelled: {}; done: {}", task, task.isCancelled(), + task.isDone() ); } catch ( InterruptedException e ) { @@ -67,8 +66,8 @@ public class BuildProjectTaskExecutor { task.cancel(); - logger.info( - "Task cancelled: " + task + " cancelled: " + task.isCancelled() + "; done: " + task.isDone() ); + logger.info( "Task cancelled: {} cancelled: {} ; done: {}", task, task.isCancelled(), + task.isDone() ); throw new TaskExecutionException( "Never interrupt sleeping threads! :)", e ); } -- To stop receiving notification emails like this one, please contact marti...@apache.org.