Starting to move to java 11[Do Not Merge]
All version changes are present. Fixed all Java-Doc Errors and warnings * Due to the stricter nature of the javadoc compiler we can't wrap <ul> / <ui> in <p> * We will also need to Push up a test app for taklauncher to work with. The old one fails to start now. Or use one of the task starters possibly. * Built on the work from TASK-439C. Wait for that merge before merging this one. * Replaced applicationFailedEvent class attribute with applicaitonFailedException * Also polished the app used by the taskLauncherSink integration test
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -174,7 +174,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.7.5.201505241946</version>
|
<version>0.8.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<!--
|
<!--
|
||||||
Prepares the property pointing to the JaCoCo runtime agent which
|
Prepares the property pointing to the JaCoCo runtime agent which
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import org.springframework.cloud.task.repository.TaskExecution;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map implementation of the {@link TaskBatchDao}. <note>This is intended for testing
|
* Map implementation of the {@link TaskBatchDao}. <p> This is intended for
|
||||||
* purposes only!</note>
|
* testing purposes only!</p>
|
||||||
*
|
*
|
||||||
* @author Michael Minella
|
* @author Michael Minella
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public class DefaultTaskConfigurer implements TaskConfigurer {
|
|||||||
* production use.
|
* production use.
|
||||||
* @param tablePrefix the prefix to apply to the task table names used by
|
* @param tablePrefix the prefix to apply to the task table names used by
|
||||||
* task infrastructure.
|
* task infrastructure.
|
||||||
|
* @param context the context to be used.
|
||||||
*/
|
*/
|
||||||
public DefaultTaskConfigurer(DataSource dataSource, String tablePrefix, ApplicationContext context) {
|
public DefaultTaskConfigurer(DataSource dataSource, String tablePrefix, ApplicationContext context) {
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
|
|||||||
@@ -53,9 +53,10 @@ public interface TaskConfigurer {
|
|||||||
TaskExplorer getTaskExplorer();
|
TaskExplorer getTaskExplorer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the DataSource that will be used for task operations. If a
|
* Retrieves the {@link DataSource} that will be used for task operations. If a
|
||||||
* DataSource is not being used for the implemented TaskConfigurer this
|
* DataSource is not being used for the implemented TaskConfigurer this
|
||||||
* method will return null.
|
* method will return null.
|
||||||
|
* @return {@link DataSource} that will be used for task operations.
|
||||||
*/
|
*/
|
||||||
DataSource getTaskDataSource();
|
DataSource getTaskDataSource();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,12 +103,17 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
|||||||
|
|
||||||
private ApplicationArguments applicationArguments;
|
private ApplicationArguments applicationArguments;
|
||||||
|
|
||||||
private ApplicationFailedEvent applicationFailedEvent;
|
private Throwable applicationFailedException;
|
||||||
|
|
||||||
private ExitCodeEvent exitCodeEvent;
|
private ExitCodeEvent exitCodeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param taskRepository The repository to record executions in.
|
* @param taskRepository {@link TaskRepository} to record executions.
|
||||||
|
* @param taskNameResolver {@link TaskNameResolver} used to determine task name for task execution.
|
||||||
|
* @param applicationArguments {@link ApplicationArguments} to be used for task execution.
|
||||||
|
* @param taskExplorer {@link TaskExplorer} to be used for task execution.
|
||||||
|
* @param taskProperties {@link TaskProperties} to be used for the task execution.
|
||||||
|
* @param taskListenerExecutorObjectFactory {@link TaskListenerExecutorObjectFactory} to initialize TaskListenerExecutor for a task
|
||||||
*/
|
*/
|
||||||
public TaskLifecycleListener(TaskRepository taskRepository,
|
public TaskLifecycleListener(TaskRepository taskRepository,
|
||||||
TaskNameResolver taskNameResolver,
|
TaskNameResolver taskNameResolver,
|
||||||
@@ -143,7 +148,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
|||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationEvent applicationEvent) {
|
public void onApplicationEvent(ApplicationEvent applicationEvent) {
|
||||||
if(applicationEvent instanceof ApplicationFailedEvent) {
|
if(applicationEvent instanceof ApplicationFailedEvent) {
|
||||||
this.applicationFailedEvent = (ApplicationFailedEvent) applicationEvent;
|
this.applicationFailedException = ((ApplicationFailedEvent) applicationEvent).getException();
|
||||||
doTaskEnd();
|
doTaskEnd();
|
||||||
}
|
}
|
||||||
else if(applicationEvent instanceof ExitCodeEvent){
|
else if(applicationEvent instanceof ExitCodeEvent){
|
||||||
@@ -167,13 +172,13 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
|||||||
if((this.listenerFailed || this.started) && !this.finished) {
|
if((this.listenerFailed || this.started) && !this.finished) {
|
||||||
this.taskExecution.setEndTime(new Date());
|
this.taskExecution.setEndTime(new Date());
|
||||||
|
|
||||||
if(this.applicationFailedEvent != null) {
|
if(this.applicationFailedException != null) {
|
||||||
this.taskExecution.setErrorMessage(stackTraceToString(this.applicationFailedEvent.getException()));
|
this.taskExecution.setErrorMessage(stackTraceToString(this.applicationFailedException));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.taskExecution.setExitCode(calcExitStatus());
|
this.taskExecution.setExitCode(calcExitStatus());
|
||||||
if (this.applicationFailedEvent != null) {
|
if (this.applicationFailedException != null) {
|
||||||
setExitMessage(invokeOnTaskError(this.taskExecution, this.applicationFailedEvent.getException()));
|
setExitMessage(invokeOnTaskError(this.taskExecution, this.applicationFailedException));
|
||||||
}
|
}
|
||||||
|
|
||||||
setExitMessage(invokeOnTaskEnd(this.taskExecution));
|
setExitMessage(invokeOnTaskEnd(this.taskExecution));
|
||||||
@@ -204,7 +209,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
|||||||
if (this.exitCodeEvent != null) {
|
if (this.exitCodeEvent != null) {
|
||||||
exitCode = this.exitCodeEvent.getExitCode();
|
exitCode = this.exitCodeEvent.getExitCode();
|
||||||
}
|
}
|
||||||
else if (this.listenerFailed || this.applicationFailedEvent != null) {
|
else if (this.listenerFailed || this.applicationFailedException != null) {
|
||||||
Throwable exception = this.listenerException;
|
Throwable exception = this.listenerException;
|
||||||
if (exception instanceof TaskExecutionException) {
|
if (exception instanceof TaskExecutionException) {
|
||||||
TaskExecutionException taskExecutionException = (TaskExecutionException) exception;
|
TaskExecutionException taskExecutionException = (TaskExecutionException) exception;
|
||||||
@@ -273,7 +278,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
|||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
// This scenario will result in a context that was not startup.
|
// This scenario will result in a context that was not startup.
|
||||||
|
this.applicationFailedException = t;
|
||||||
this.doTaskEnd();
|
this.doTaskEnd();
|
||||||
throw t;
|
throw t;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ public interface TaskRepository {
|
|||||||
* Notifies the repository that a taskExecution has completed.
|
* Notifies the repository that a taskExecution has completed.
|
||||||
*
|
*
|
||||||
* @param executionId to the task execution to be updated.
|
* @param executionId to the task execution to be updated.
|
||||||
* @param exitCode to be stored for this task.
|
* @param exitCode to be stored for this task execution.
|
||||||
* @param endTime designated when the task completed.
|
* @param endTime designated when the task completed.
|
||||||
* @param exitMessage to be stored for the task.
|
* @param exitMessage to be stored for the task execution.
|
||||||
|
* @param errorMessage to be stored for the task execution.
|
||||||
* @return the updated {@link TaskExecution}
|
* @return the updated {@link TaskExecution}
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@@ -127,7 +128,8 @@ public interface TaskRepository {
|
|||||||
* @param externalExecutionId id assigned to the task by the platform.
|
* @param externalExecutionId id assigned to the task by the platform.
|
||||||
* @param parentExecutionId the parent task execution id.
|
* @param parentExecutionId the parent task execution id.
|
||||||
|
|
||||||
* @return
|
* @return A TaskExecution that contains the information available at the
|
||||||
|
* beginning of a TaskExecution.
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
TaskExecution startTaskExecution(long executionid, String taskName,
|
TaskExecution startTaskExecution(long executionid, String taskName,
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public interface TaskExecutionDao {
|
|||||||
* @param startTime the time task began.
|
* @param startTime the time task began.
|
||||||
* @param arguments list of key/value pairs that configure the task.
|
* @param arguments list of key/value pairs that configure the task.
|
||||||
* @param externalExecutionId id assigned to the task by the platform
|
* @param externalExecutionId id assigned to the task by the platform
|
||||||
|
* @return A TaskExecution containing the information available at task execution start.
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
TaskExecution startTaskExecution(long executionId, String taskName,
|
TaskExecution startTaskExecution(long executionId, String taskName,
|
||||||
@@ -83,6 +84,7 @@ public interface TaskExecutionDao {
|
|||||||
* @param arguments list of key/value pairs that configure the task.
|
* @param arguments list of key/value pairs that configure the task.
|
||||||
* @param externalExecutionId id assigned to the task by the platform
|
* @param externalExecutionId id assigned to the task by the platform
|
||||||
* @param parentExecutionId the parent task execution id.
|
* @param parentExecutionId the parent task execution id.
|
||||||
|
* @return A TaskExecution containing the information available at task execution start.
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
TaskExecution startTaskExecution(long executionId, String taskName,
|
TaskExecution startTaskExecution(long executionId, String taskName,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public interface PagingQueryProvider {
|
|||||||
* Initialize the query provider using the provided {@link DataSource} if necessary.
|
* Initialize the query provider using the provided {@link DataSource} if necessary.
|
||||||
*
|
*
|
||||||
* @param dataSource DataSource to use for any initialization
|
* @param dataSource DataSource to use for any initialization
|
||||||
|
* @throws Exception throws {@link Exception} if query provider initialize fails.
|
||||||
*/
|
*/
|
||||||
void init(DataSource dataSource) throws Exception;
|
void init(DataSource dataSource) throws Exception;
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public class SqlPagingQueryUtils {
|
|||||||
* Generates WHERE clause for queries that require sub selects.
|
* Generates WHERE clause for queries that require sub selects.
|
||||||
*
|
*
|
||||||
* @param provider the paging query provider that will provide the base where clause
|
* @param provider the paging query provider that will provide the base where clause
|
||||||
|
* @param remainingPageQuery if true assumes more will be appended to where clause
|
||||||
|
* @param sql the sql statement to be appended.
|
||||||
*/
|
*/
|
||||||
public static void buildWhereClause( AbstractSqlPagingQueryProvider provider,
|
public static void buildWhereClause( AbstractSqlPagingQueryProvider provider,
|
||||||
boolean remainingPageQuery, StringBuilder sql) {
|
boolean remainingPageQuery, StringBuilder sql) {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class TaskExecutionListenerTests {
|
|||||||
assertTrue("Exception should have fired", exceptionFired);
|
assertTrue("Exception should have fired", exceptionFired);
|
||||||
assertTrue("BeforeTask Listener should have executed", beforeTaskDidFireOnError);
|
assertTrue("BeforeTask Listener should have executed", beforeTaskDidFireOnError);
|
||||||
assertTrue("EndTask Listener should have executed", endTaskDidFireOnError);
|
assertTrue("EndTask Listener should have executed", endTaskDidFireOnError);
|
||||||
assertFalse("FailedTask Listener should have executed", failedTaskDidFireOnError);
|
assertTrue("FailedTask Listener should have executed", failedTaskDidFireOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,7 +118,7 @@ public class TaskExecutionListenerTests {
|
|||||||
}
|
}
|
||||||
assertTrue("Exception should have fired", exceptionFired);
|
assertTrue("Exception should have fired", exceptionFired);
|
||||||
assertTrue("EndTask Listener should have executed", endTaskDidFireOnError);
|
assertTrue("EndTask Listener should have executed", endTaskDidFireOnError);
|
||||||
assertFalse("FailedTask Listener should not have executed", failedTaskDidFireOnError);
|
assertTrue("FailedTask Listener should not have executed", failedTaskDidFireOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ import static org.junit.Assert.assertTrue;
|
|||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = {TaskLauncherSinkApplication.class, TaskLauncherSinkTests.TaskLauncherConfiguration.class},
|
@SpringBootTest(classes = {TaskLauncherSinkApplication.class, TaskLauncherSinkTests.TaskLauncherConfiguration.class},
|
||||||
properties = {"maven.remote-repositories.repo1.url=https://repo.spring.io/libs-milestone-local"})
|
properties = {"maven.remote-repositories.repo1.url=https://repo.spring.io/libs-milestone"})
|
||||||
public class TaskLauncherSinkTests {
|
public class TaskLauncherSinkTests {
|
||||||
|
|
||||||
private final static int WAIT_INTERVAL = 500;
|
private final static int WAIT_INTERVAL = 500;
|
||||||
private final static int MAX_WAIT_TIME = 10000;
|
private final static int MAX_WAIT_TIME = 10000;
|
||||||
private final static String URL = "maven://io.spring.cloud:"
|
private final static String URL = "maven://org.springframework.cloud.task.app:"
|
||||||
+ "timestamp-task:jar:1.0.0.RC1";
|
+ "timestamp-task:2.0.0.RELEASE";
|
||||||
private final static String DATASOURCE_URL;
|
private final static String DATASOURCE_URL;
|
||||||
private final static String DATASOURCE_USER_NAME = "SA";
|
private final static String DATASOURCE_USER_NAME = "SA";
|
||||||
private final static String DATASOURCE_USER_PASSWORD = "''";
|
private final static String DATASOURCE_USER_PASSWORD = "''";
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package org.springframework.cloud.task.batch.listener;
|
package org.springframework.cloud.task.batch.listener;
|
||||||
|
|
||||||
import org.springframework.batch.core.ItemProcessListener;
|
import org.springframework.batch.core.ItemProcessListener;
|
||||||
|
import org.springframework.batch.item.ItemProcessor;
|
||||||
import org.springframework.cloud.task.batch.listener.support.BatchJobHeaders;
|
import org.springframework.cloud.task.batch.listener.support.BatchJobHeaders;
|
||||||
import org.springframework.cloud.task.batch.listener.support.MessagePublisher;
|
import org.springframework.cloud.task.batch.listener.support.MessagePublisher;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
@@ -30,7 +31,7 @@ import org.springframework.util.Assert;
|
|||||||
* was filtered ({@link ItemProcessor} returned null), if the result of the processor was
|
* was filtered ({@link ItemProcessor} returned null), if the result of the processor was
|
||||||
* equal to the input (via <code>.equals</code>), or if they were not equal.
|
* equal to the input (via <code>.equals</code>), or if they were not equal.
|
||||||
* {@link ItemProcessListener#onProcessError(Object, Exception)} provides the exception
|
* {@link ItemProcessListener#onProcessError(Object, Exception)} provides the exception
|
||||||
* via the {@link BatchJobHeaders.BATCH_EXCEPTION} message header.
|
* via the {@link BatchJobHeaders#BATCH_EXCEPTION} message header.
|
||||||
*
|
*
|
||||||
* @author Michael Minella
|
* @author Michael Minella
|
||||||
* @author Glenn Renfro
|
* @author Glenn Renfro
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.batch.core.ItemReadListener;
|
import org.springframework.batch.core.ItemReadListener;
|
||||||
|
import org.springframework.batch.item.ItemReader;
|
||||||
import org.springframework.cloud.task.batch.listener.support.BatchJobHeaders;
|
import org.springframework.cloud.task.batch.listener.support.BatchJobHeaders;
|
||||||
import org.springframework.cloud.task.batch.listener.support.MessagePublisher;
|
import org.springframework.cloud.task.batch.listener.support.MessagePublisher;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
@@ -32,7 +33,7 @@ import org.springframework.util.Assert;
|
|||||||
* The {@link ItemReadListener#beforeRead()} and
|
* The {@link ItemReadListener#beforeRead()} and
|
||||||
* {@link ItemReadListener#afterRead(Object)} are both no-ops in this implementation.
|
* {@link ItemReadListener#afterRead(Object)} are both no-ops in this implementation.
|
||||||
* {@link ItemReadListener#onReadError(Exception)} provides the exception
|
* {@link ItemReadListener#onReadError(Exception)} provides the exception
|
||||||
* via the {@link BatchJobHeaders.BATCH_EXCEPTION} message header.
|
* via the {@link BatchJobHeaders#BATCH_EXCEPTION} message header.
|
||||||
*
|
*
|
||||||
* @author Glenn Renfro
|
* @author Glenn Renfro
|
||||||
* @author Ali Shahbour
|
* @author Ali Shahbour
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
|||||||
*
|
*
|
||||||
* Each method provides an informational message.
|
* Each method provides an informational message.
|
||||||
* {@link ItemWriteListener#onWriteError(Exception, List)} provides a message as well as
|
* {@link ItemWriteListener#onWriteError(Exception, List)} provides a message as well as
|
||||||
* the exception's message via the {@link BatchJobHeaders.BATCH_EXCEPTION} message header.
|
* the exception's message via the {@link BatchJobHeaders#BATCH_EXCEPTION} message header.
|
||||||
*
|
*
|
||||||
* @author Glenn Renfro
|
* @author Glenn Renfro
|
||||||
* @author Ali Shahbour
|
* @author Ali Shahbour
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
|||||||
* Setups up the SkipProcessListener to emit events to the spring cloud stream output channel.
|
* Setups up the SkipProcessListener to emit events to the spring cloud stream output channel.
|
||||||
*
|
*
|
||||||
* This listener emits the exception's message via the
|
* This listener emits the exception's message via the
|
||||||
* {@link BatchJobHeaders.BATCH_EXCEPTION} message header for each method. For
|
* {@link BatchJobHeaders#BATCH_EXCEPTION} message header for each method. For
|
||||||
* {@link SkipListener#onSkipInProcess(Object, Throwable)} and
|
* {@link SkipListener#onSkipInProcess(Object, Throwable)} and
|
||||||
* {@link SkipListener#onSkipInWrite(Object, Throwable)} the body of the message consists
|
* {@link SkipListener#onSkipInWrite(Object, Throwable)} the body of the message consists
|
||||||
* of the item that caused the error.
|
* of the item that caused the error.
|
||||||
|
|||||||
@@ -153,14 +153,14 @@ public class JobExecutionEvent extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param exitStatus
|
* @param exitStatus the exit status for the job.
|
||||||
*/
|
*/
|
||||||
public void setExitStatus(ExitStatus exitStatus) {
|
public void setExitStatus(ExitStatus exitStatus) {
|
||||||
this.exitStatus = exitStatus;
|
this.exitStatus = exitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the exitCode
|
* @return the exitCode for the job.
|
||||||
*/
|
*/
|
||||||
public ExitStatus getExitStatus() {
|
public ExitStatus getExitStatus() {
|
||||||
return this.exitStatus;
|
return this.exitStatus;
|
||||||
@@ -230,9 +230,9 @@ public class JobExecutionEvent extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the last time this JobExecution was updated.
|
* Set the last time this {@link JobExecution} was updated.
|
||||||
*
|
*
|
||||||
* @param lastUpdated
|
* @param lastUpdated The date the {@link JobExecution} was updated.
|
||||||
*/
|
*/
|
||||||
public void setLastUpdated(Date lastUpdated) {
|
public void setLastUpdated(Date lastUpdated) {
|
||||||
this.lastUpdated = lastUpdated;
|
this.lastUpdated = lastUpdated;
|
||||||
@@ -245,7 +245,7 @@ public class JobExecutionEvent extends Entity {
|
|||||||
/**
|
/**
|
||||||
* Add the provided throwable to the failure exception list.
|
* Add the provided throwable to the failure exception list.
|
||||||
*
|
*
|
||||||
* @param t
|
* @param t a {@link Throwable} to be added to the exception list.
|
||||||
*/
|
*/
|
||||||
public synchronized void addFailureException(Throwable t) {
|
public synchronized void addFailureException(Throwable t) {
|
||||||
this.failureExceptions.add(t);
|
this.failureExceptions.add(t);
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for number of rollbacks for this execution
|
* Setter for number of rollbacks for this execution
|
||||||
|
* @param rollbackCount the number of rollbacks for this execution
|
||||||
*/
|
*/
|
||||||
public void setRollbackCount(int rollbackCount) {
|
public void setRollbackCount(int rollbackCount) {
|
||||||
this.rollbackCount = rollbackCount;
|
this.rollbackCount = rollbackCount;
|
||||||
@@ -281,7 +282,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param exitStatus
|
* @param exitStatus the {@link ExitStatus} for the step.
|
||||||
*/
|
*/
|
||||||
public void setExitStatus(ExitStatus exitStatus) {
|
public void setExitStatus(ExitStatus exitStatus) {
|
||||||
this.exitStatus = exitStatus;
|
this.exitStatus = exitStatus;
|
||||||
@@ -340,7 +341,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
/**
|
/**
|
||||||
* Set the number of records skipped on read
|
* Set the number of records skipped on read
|
||||||
*
|
*
|
||||||
* @param readSkipCount
|
* @param readSkipCount the number of records to be skipped on read.
|
||||||
*/
|
*/
|
||||||
public void setReadSkipCount(int readSkipCount) {
|
public void setReadSkipCount(int readSkipCount) {
|
||||||
this.readSkipCount = readSkipCount;
|
this.readSkipCount = readSkipCount;
|
||||||
@@ -349,7 +350,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
/**
|
/**
|
||||||
* Set the number of records skipped on write
|
* Set the number of records skipped on write
|
||||||
*
|
*
|
||||||
* @param writeSkipCount
|
* @param writeSkipCount the number of records to be skipped on write.
|
||||||
*/
|
*/
|
||||||
public void setWriteSkipCount(int writeSkipCount) {
|
public void setWriteSkipCount(int writeSkipCount) {
|
||||||
this.writeSkipCount = writeSkipCount;
|
this.writeSkipCount = writeSkipCount;
|
||||||
@@ -365,7 +366,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
/**
|
/**
|
||||||
* Set the number of records skipped during processing.
|
* Set the number of records skipped during processing.
|
||||||
*
|
*
|
||||||
* @param processSkipCount
|
* @param processSkipCount the number of records skip during processing.
|
||||||
*/
|
*/
|
||||||
public void setProcessSkipCount(int processSkipCount) {
|
public void setProcessSkipCount(int processSkipCount) {
|
||||||
this.processSkipCount = processSkipCount;
|
this.processSkipCount = processSkipCount;
|
||||||
@@ -381,7 +382,7 @@ public class StepExecutionEvent extends Entity {
|
|||||||
/**
|
/**
|
||||||
* Set the time when the StepExecution was last updated before persisting
|
* Set the time when the StepExecution was last updated before persisting
|
||||||
*
|
*
|
||||||
* @param lastUpdated
|
* @param lastUpdated the {@link Date} the StepExecution was last updated.
|
||||||
*/
|
*/
|
||||||
public void setLastUpdated(Date lastUpdated) {
|
public void setLastUpdated(Date lastUpdated) {
|
||||||
this.lastUpdated = lastUpdated;
|
this.lastUpdated = lastUpdated;
|
||||||
|
|||||||
@@ -41,20 +41,20 @@ import org.springframework.util.ReflectionUtils;
|
|||||||
/**
|
/**
|
||||||
* Attaches the listeners to the job and its steps.
|
* Attaches the listeners to the job and its steps.
|
||||||
* Based on the type of bean that is being processed will determine what listener is attached.
|
* Based on the type of bean that is being processed will determine what listener is attached.
|
||||||
* <p>
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>If the bean is of type AbstactJob then the JobExecutionListener is registered with this bean.</li>
|
* <li>If the bean is of type AbstactJob then the JobExecutionListener is registered with this bean.</li>
|
||||||
* <li>If the bean is of type AbstactStep then the StepExecutionListener is registered with this bean.</li>
|
* <li>If the bean is of type AbstactStep then the StepExecutionListener is registered with this bean.</li>
|
||||||
* <li>If the bean is of type TaskletStep then the ChunkEventListener is registered with this bean.</li>
|
* <li>If the bean is of type TaskletStep then the ChunkEventListener is registered with this bean.</li>
|
||||||
* <li>If the tasklet for the TaskletStep is of type ChunkOrientedTasklet the following listeners will be registered. </li>
|
* <li>If the tasklet for the TaskletStep is of type ChunkOrientedTasklet the following listeners will be registered. </li>
|
||||||
|
* <li>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>ItemReadListener with the ChunkProvider.</li>
|
* <li>ItemReadListener with the ChunkProvider.</li>
|
||||||
* <li>ItemProcessListener with the ChunkProcessor.</li>
|
* <li>ItemProcessListener with the ChunkProcessor.</li>
|
||||||
* <li>ItemWriteEventsListener with the ChunkProcessor.</li>
|
* <li>ItemWriteEventsListener with the ChunkProcessor.</li>
|
||||||
* <li>SkipEventsListener with the ChunkProcessor.</li>
|
* <li>SkipEventsListener with the ChunkProcessor.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </p>
|
|
||||||
* @author Michael Minella
|
* @author Michael Minella
|
||||||
* @author Glenn Renfro
|
* @author Glenn Renfro
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public class TaskLaunchRequest implements Serializable{
|
|||||||
* @param environmentProperties are the environment variables for this task.
|
* @param environmentProperties are the environment variables for this task.
|
||||||
* @param deploymentProperties are the variables used to setup task on the platform.
|
* @param deploymentProperties are the variables used to setup task on the platform.
|
||||||
* @param applicationName name to be applied to the launched task. If set
|
* @param applicationName name to be applied to the launched task. If set
|
||||||
* to null then the launched task name will be "Task-<hash code of the
|
* to null then the launched task name will be "Task-`hash code of the
|
||||||
* TaskLaunchRequest>.
|
* TaskLaunchRequest`.
|
||||||
*/
|
*/
|
||||||
public TaskLaunchRequest(String uri, List<String> commandlineArguments,
|
public TaskLaunchRequest(String uri, List<String> commandlineArguments,
|
||||||
Map<String, String> environmentProperties,
|
Map<String, String> environmentProperties,
|
||||||
@@ -75,14 +75,14 @@ public class TaskLaunchRequest implements Serializable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current uri to the artifact for this launch request.
|
* @return the current uri to the artifact for this launch request.
|
||||||
*/
|
*/
|
||||||
public String getUri() {
|
public String getUri() {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unmodifiable list of arguments that will be used for the task execution
|
* @return an unmodifiable list of arguments that will be used for the task execution
|
||||||
*/
|
*/
|
||||||
public List<String> getCommandlineArguments() {
|
public List<String> getCommandlineArguments() {
|
||||||
return Collections.unmodifiableList(commandlineArguments);
|
return Collections.unmodifiableList(commandlineArguments);
|
||||||
@@ -117,7 +117,7 @@ public class TaskLaunchRequest implements Serializable{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name to be applied to the launched task. If set
|
* Sets the name to be applied to the launched task. If set
|
||||||
* to null then the launched task name will be "Task-<unique id>".
|
* to null then the launched task name will be "Task-`unique id`".
|
||||||
*
|
*
|
||||||
* @param applicationName the name to be
|
* @param applicationName the name to be
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class TaskLauncherSink {
|
|||||||
* Launches a task upon the receipt of a valid TaskLaunchRequest.
|
* Launches a task upon the receipt of a valid TaskLaunchRequest.
|
||||||
* @param taskLaunchRequest is a TaskLaunchRequest containing the information required to launch
|
* @param taskLaunchRequest is a TaskLaunchRequest containing the information required to launch
|
||||||
* a task.
|
* a task.
|
||||||
|
* @throws Exception if error occurs during task launch.
|
||||||
*/
|
*/
|
||||||
@ServiceActivator(inputChannel = Sink.INPUT)
|
@ServiceActivator(inputChannel = Sink.INPUT)
|
||||||
public void taskLauncherSink(TaskLaunchRequest taskLaunchRequest) throws Exception{
|
public void taskLauncherSink(TaskLaunchRequest taskLaunchRequest) throws Exception{
|
||||||
|
|||||||
Reference in New Issue
Block a user