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:
@@ -98,6 +98,7 @@ public class DefaultTaskConfigurer implements TaskConfigurer {
|
||||
* production use.
|
||||
* @param tablePrefix the prefix to apply to the task table names used by
|
||||
* task infrastructure.
|
||||
* @param context the context to be used.
|
||||
*/
|
||||
public DefaultTaskConfigurer(DataSource dataSource, String tablePrefix, ApplicationContext context) {
|
||||
this.dataSource = dataSource;
|
||||
|
||||
@@ -53,9 +53,10 @@ public interface TaskConfigurer {
|
||||
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
|
||||
* method will return null.
|
||||
* @return {@link DataSource} that will be used for task operations.
|
||||
*/
|
||||
DataSource getTaskDataSource();
|
||||
}
|
||||
|
||||
@@ -103,12 +103,17 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
|
||||
private ApplicationArguments applicationArguments;
|
||||
|
||||
private ApplicationFailedEvent applicationFailedEvent;
|
||||
private Throwable applicationFailedException;
|
||||
|
||||
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,
|
||||
TaskNameResolver taskNameResolver,
|
||||
@@ -143,7 +148,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent applicationEvent) {
|
||||
if(applicationEvent instanceof ApplicationFailedEvent) {
|
||||
this.applicationFailedEvent = (ApplicationFailedEvent) applicationEvent;
|
||||
this.applicationFailedException = ((ApplicationFailedEvent) applicationEvent).getException();
|
||||
doTaskEnd();
|
||||
}
|
||||
else if(applicationEvent instanceof ExitCodeEvent){
|
||||
@@ -167,13 +172,13 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
if((this.listenerFailed || this.started) && !this.finished) {
|
||||
this.taskExecution.setEndTime(new Date());
|
||||
|
||||
if(this.applicationFailedEvent != null) {
|
||||
this.taskExecution.setErrorMessage(stackTraceToString(this.applicationFailedEvent.getException()));
|
||||
if(this.applicationFailedException != null) {
|
||||
this.taskExecution.setErrorMessage(stackTraceToString(this.applicationFailedException));
|
||||
}
|
||||
|
||||
this.taskExecution.setExitCode(calcExitStatus());
|
||||
if (this.applicationFailedEvent != null) {
|
||||
setExitMessage(invokeOnTaskError(this.taskExecution, this.applicationFailedEvent.getException()));
|
||||
if (this.applicationFailedException != null) {
|
||||
setExitMessage(invokeOnTaskError(this.taskExecution, this.applicationFailedException));
|
||||
}
|
||||
|
||||
setExitMessage(invokeOnTaskEnd(this.taskExecution));
|
||||
@@ -204,7 +209,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
if (this.exitCodeEvent != null) {
|
||||
exitCode = this.exitCodeEvent.getExitCode();
|
||||
}
|
||||
else if (this.listenerFailed || this.applicationFailedEvent != null) {
|
||||
else if (this.listenerFailed || this.applicationFailedException != null) {
|
||||
Throwable exception = this.listenerException;
|
||||
if (exception instanceof TaskExecutionException) {
|
||||
TaskExecutionException taskExecutionException = (TaskExecutionException) exception;
|
||||
@@ -273,7 +278,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
}
|
||||
catch (Throwable t) {
|
||||
// This scenario will result in a context that was not startup.
|
||||
|
||||
this.applicationFailedException = t;
|
||||
this.doTaskEnd();
|
||||
throw t;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,10 @@ public interface TaskRepository {
|
||||
* Notifies the repository that a taskExecution has completed.
|
||||
*
|
||||
* @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 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}
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -127,7 +128,8 @@ public interface TaskRepository {
|
||||
* @param externalExecutionId id assigned to the task by the platform.
|
||||
* @param parentExecutionId the parent task execution id.
|
||||
|
||||
* @return
|
||||
* @return A TaskExecution that contains the information available at the
|
||||
* beginning of a TaskExecution.
|
||||
*/
|
||||
@Transactional
|
||||
TaskExecution startTaskExecution(long executionid, String taskName,
|
||||
|
||||
@@ -69,6 +69,7 @@ public interface TaskExecutionDao {
|
||||
* @param startTime the time task began.
|
||||
* @param arguments list of key/value pairs that configure the task.
|
||||
* @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
|
||||
*/
|
||||
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 externalExecutionId id assigned to the task by the platform
|
||||
* @param parentExecutionId the parent task execution id.
|
||||
* @return A TaskExecution containing the information available at task execution start.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
TaskExecution startTaskExecution(long executionId, String taskName,
|
||||
|
||||
@@ -33,6 +33,7 @@ public interface PagingQueryProvider {
|
||||
* Initialize the query provider using the provided {@link DataSource} if necessary.
|
||||
*
|
||||
* @param dataSource DataSource to use for any initialization
|
||||
* @throws Exception throws {@link Exception} if query provider initialize fails.
|
||||
*/
|
||||
void init(DataSource dataSource) throws Exception;
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ public class SqlPagingQueryUtils {
|
||||
* Generates WHERE clause for queries that require sub selects.
|
||||
*
|
||||
* @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,
|
||||
boolean remainingPageQuery, StringBuilder sql) {
|
||||
|
||||
@@ -101,7 +101,7 @@ public class TaskExecutionListenerTests {
|
||||
assertTrue("Exception should have fired", exceptionFired);
|
||||
assertTrue("BeforeTask Listener should have executed", beforeTaskDidFireOnError);
|
||||
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("EndTask Listener should have executed", endTaskDidFireOnError);
|
||||
assertFalse("FailedTask Listener should not have executed", failedTaskDidFireOnError);
|
||||
assertTrue("FailedTask Listener should not have executed", failedTaskDidFireOnError);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user