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:
Glenn Renfro
2018-10-02 14:18:03 -04:00
parent 90c88c52e6
commit c7ef7fbff4
30 changed files with 71 additions and 53 deletions

View File

@@ -174,7 +174,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -208,7 +208,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<version>0.8.2</version>
<executions>
<!--
Prepares the property pointing to the JaCoCo runtime agent which

View File

@@ -25,8 +25,8 @@ import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.util.Assert;
/**
* Map implementation of the {@link TaskBatchDao}. <note>This is intended for testing
* purposes only!</note>
* Map implementation of the {@link TaskBatchDao}. <p> This is intended for
* testing purposes only!</p>
*
* @author Michael Minella
*/

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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);
}
/**

View File

@@ -60,13 +60,13 @@ import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.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 {
private final static int WAIT_INTERVAL = 500;
private final static int MAX_WAIT_TIME = 10000;
private final static String URL = "maven://io.spring.cloud:"
+ "timestamp-task:jar:1.0.0.RC1";
private final static String URL = "maven://org.springframework.cloud.task.app:"
+ "timestamp-task:2.0.0.RELEASE";
private final static String DATASOURCE_URL;
private final static String DATASOURCE_USER_NAME = "SA";
private final static String DATASOURCE_USER_PASSWORD = "''";

View File

@@ -82,7 +82,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -113,7 +113,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -126,7 +126,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -112,7 +112,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -87,7 +87,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -48,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -62,7 +62,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -116,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -67,7 +67,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -126,7 +126,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.task.batch.listener;
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.MessagePublisher;
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
* equal to the input (via <code>.equals</code>), or if they were not equal.
* {@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 Glenn Renfro

View File

@@ -20,6 +20,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.MessagePublisher;
import org.springframework.core.Ordered;
@@ -32,7 +33,7 @@ import org.springframework.util.Assert;
* The {@link ItemReadListener#beforeRead()} and
* {@link ItemReadListener#afterRead(Object)} are both no-ops in this implementation.
* {@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 Ali Shahbour

View File

@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
*
* Each method provides an informational message.
* {@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 Ali Shahbour

View File

@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
* Setups up the SkipProcessListener to emit events to the spring cloud stream output channel.
*
* 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#onSkipInWrite(Object, Throwable)} the body of the message consists
* of the item that caused the error.

View File

@@ -153,14 +153,14 @@ public class JobExecutionEvent extends Entity {
}
/**
* @param exitStatus
* @param exitStatus the exit status for the job.
*/
public void setExitStatus(ExitStatus exitStatus) {
this.exitStatus = exitStatus;
}
/**
* @return the exitCode
* @return the exitCode for the job.
*/
public ExitStatus getExitStatus() {
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) {
this.lastUpdated = lastUpdated;
@@ -245,7 +245,7 @@ public class JobExecutionEvent extends Entity {
/**
* 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) {
this.failureExceptions.add(t);

View File

@@ -229,6 +229,7 @@ public class StepExecutionEvent extends Entity {
/**
* Setter for number of rollbacks for this execution
* @param rollbackCount the number of rollbacks for this execution
*/
public void setRollbackCount(int 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) {
this.exitStatus = exitStatus;
@@ -340,7 +341,7 @@ public class StepExecutionEvent extends Entity {
/**
* 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) {
this.readSkipCount = readSkipCount;
@@ -349,7 +350,7 @@ public class StepExecutionEvent extends Entity {
/**
* 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) {
this.writeSkipCount = writeSkipCount;
@@ -365,7 +366,7 @@ public class StepExecutionEvent extends Entity {
/**
* Set the number of records skipped during processing.
*
* @param processSkipCount
* @param processSkipCount the number of records skip during processing.
*/
public void setProcessSkipCount(int processSkipCount) {
this.processSkipCount = processSkipCount;
@@ -381,7 +382,7 @@ public class StepExecutionEvent extends Entity {
/**
* 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) {
this.lastUpdated = lastUpdated;

View File

@@ -41,20 +41,20 @@ import org.springframework.util.ReflectionUtils;
/**
* 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.
* <p>
* <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 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 tasklet for the TaskletStep is of type ChunkOrientedTasklet the following listeners will be registered. </li>
* <li>
* <ul>
* <li>ItemReadListener with the ChunkProvider.</li>
* <li>ItemProcessListener with the ChunkProcessor.</li>
* <li>ItemWriteEventsListener with the ChunkProcessor.</li>
* <li>SkipEventsListener with the ChunkProcessor.</li>
* </ul>
* </li>
* </ul>
* </p>
* @author Michael Minella
* @author Glenn Renfro
*/

View File

@@ -50,8 +50,8 @@ public class TaskLaunchRequest implements Serializable{
* @param environmentProperties are the environment variables for this task.
* @param deploymentProperties are the variables used to setup task on the platform.
* @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
* TaskLaunchRequest>.
* to null then the launched task name will be "Task-`hash code of the
* TaskLaunchRequest`.
*/
public TaskLaunchRequest(String uri, List<String> commandlineArguments,
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() {
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() {
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
* 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
*/

View File

@@ -52,6 +52,7 @@ public class TaskLauncherSink {
* Launches a task upon the receipt of a valid TaskLaunchRequest.
* @param taskLaunchRequest is a TaskLaunchRequest containing the information required to launch
* a task.
* @throws Exception if error occurs during task launch.
*/
@ServiceActivator(inputChannel = Sink.INPUT)
public void taskLauncherSink(TaskLaunchRequest taskLaunchRequest) throws Exception{