From 7be8b8a10538421c2214ce62906c51beed3d63b5 Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Fri, 2 Nov 2018 11:56:42 -0500 Subject: [PATCH] Polish --- .../task/configuration/DefaultTaskConfigurer.java | 15 ++++++++------- .../cloud/task/configuration/TaskConfigurer.java | 2 +- .../task/listener/TaskLifecycleListener.java | 4 ++-- .../cloud/task/repository/TaskRepository.java | 2 +- .../repository/database/PagingQueryProvider.java | 2 +- .../database/support/SqlPagingQueryUtils.java | 2 +- .../task/listener/TaskExecutionListenerTests.java | 1 - 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/DefaultTaskConfigurer.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/DefaultTaskConfigurer.java index 39a8ab92..f95465b3 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/DefaultTaskConfigurer.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/DefaultTaskConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,8 +58,6 @@ public class DefaultTaskConfigurer implements TaskConfigurer { private PlatformTransactionManager transactionManager; - private TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean; - private DataSource dataSource; private ApplicationContext context; @@ -104,15 +102,18 @@ public class DefaultTaskConfigurer implements TaskConfigurer { this.dataSource = dataSource; this.context = context; + TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean; + if(this.dataSource != null) { - this.taskExecutionDaoFactoryBean = new + taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(this.dataSource, tablePrefix); } else { - this.taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(); + taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(); } - this.taskRepository = new SimpleTaskRepository(this.taskExecutionDaoFactoryBean); - this.taskExplorer = new SimpleTaskExplorer(this.taskExecutionDaoFactoryBean); + + this.taskRepository = new SimpleTaskRepository(taskExecutionDaoFactoryBean); + this.taskExplorer = new SimpleTaskExplorer(taskExecutionDaoFactoryBean); } @Override diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/TaskConfigurer.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/TaskConfigurer.java index f9b2425f..53e0a788 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/TaskConfigurer.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/TaskConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java index 5d2e3320..76327983 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java @@ -287,7 +287,7 @@ public class TaskLifecycleListener implements ApplicationListener startupListenerList = new ArrayList<>(this.taskExecutionListeners); - if (startupListenerList != null) { + if (!CollectionUtils.isEmpty(startupListenerList)) { try { Collections.reverse(startupListenerList); for (TaskExecutionListener taskExecutionListener : startupListenerList) { @@ -400,7 +400,7 @@ public class TaskLifecycleListener implements ApplicationListener