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
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 @@
* 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 @@
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @author <a href="mailto:kenney@codehaus.org">Kenney Westerhof</a>
- *
*/
public class ThreadedTaskQueueExecutor
implements TaskQueueExecutor
@@ -307,11 +306,11 @@
{
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 @@
* 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.springframework.stereotype.Service;
/**
- *
* @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
- *
*/
-@Service("taskExecutor#build-project")
+@Service ( "taskExecutor#build-project" )
public class BuildProjectTaskExecutor
implements TaskExecutor
{
@@ -43,7 +42,7 @@
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 @@
{
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 @@
{
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 );
}