Skip to content

Added default methods in listener interfaces #3934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2021 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.
Expand All @@ -25,7 +25,7 @@
* @author Lucas Ward
* @author Michael Minella
* @author Mahmoud Ben Hassine
*
* @author Parikshit Dutta
*/
public interface ChunkListener extends StepListener {

Expand All @@ -36,14 +36,14 @@ public interface ChunkListener extends StepListener {
*
* @param context The current {@link ChunkContext}
*/
void beforeChunk(ChunkContext context);
default void beforeChunk(ChunkContext context) {}

/**
* Callback after the chunk is executed, outside the transaction.
*
* @param context The current {@link ChunkContext}
*/
void afterChunk(ChunkContext context);
default void afterChunk(ChunkContext context) {}

/**
* Callback after a chunk has been marked for rollback. It is invoked
Expand All @@ -57,5 +57,5 @@ public interface ChunkListener extends StepListener {
* @param context the chunk context containing the exception that caused
* the underlying rollback.
*/
void afterChunkError(ChunkContext context);
default void afterChunkError(ChunkContext context) {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2021 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.
Expand All @@ -22,7 +22,7 @@
* instances themselves are not used by more than one thread.
*
* @author Dave Syer
*
* @author Parikshit Dutta
*/
public interface JobExecutionListener {

Expand All @@ -31,7 +31,7 @@ public interface JobExecutionListener {
*
* @param jobExecution the current {@link JobExecution}
*/
void beforeJob(JobExecution jobExecution);
default void beforeJob(JobExecution jobExecution) {}

/**
* Callback after completion of a job. Called after both both successful and
Expand All @@ -40,6 +40,6 @@ public interface JobExecutionListener {
*
* @param jobExecution the current {@link JobExecution}
*/
void afterJob(JobExecution jobExecution);
default void afterJob(JobExecution jobExecution) {}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2021 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.
Expand All @@ -23,7 +23,7 @@
* @author Lucas Ward
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
* @author Parikshit Dutta
*/
public interface StepExecutionListener extends StepListener {

Expand All @@ -33,7 +33,7 @@ public interface StepExecutionListener extends StepListener {
*
* @param stepExecution instance of {@link StepExecution}.
*/
void beforeStep(StepExecution stepExecution);
default void beforeStep(StepExecution stepExecution) {}

/**
* Give a listener a chance to modify the exit status from a step. The value
Expand All @@ -49,5 +49,7 @@ public interface StepExecutionListener extends StepListener {
* {@code null} to leave the old value unchanged.
*/
@Nullable
ExitStatus afterStep(StepExecution stepExecution);
default ExitStatus afterStep(StepExecution stepExecution) {
return null;
}
}