diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleRetryExceptionHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleRetryExceptionHandler.java index d02d05019..85c1d8a12 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleRetryExceptionHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleRetryExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2023 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. @@ -23,8 +23,8 @@ import org.springframework.batch.repeat.support.RepeatSynchronizationManager; import org.springframework.classify.BinaryExceptionClassifier; import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; +import org.springframework.retry.RetryListener; import org.springframework.retry.RetryPolicy; -import org.springframework.retry.listener.RetryListenerSupport; import java.util.Collection; @@ -36,7 +36,7 @@ import java.util.Collection; * @author Dave Syer * */ -public class SimpleRetryExceptionHandler extends RetryListenerSupport implements ExceptionHandler { +public class SimpleRetryExceptionHandler implements RetryListener, ExceptionHandler { /** * Attribute key, whose existence signals an exhausted retry. diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java index 9e6bde205..c973344bd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java @@ -41,7 +41,6 @@ import org.springframework.dao.ConcurrencyFailureException; import org.springframework.dao.DeadlockLoserDataAccessException; import org.springframework.dao.PessimisticLockingFailureException; import org.springframework.retry.RetryListener; -import org.springframework.retry.listener.RetryListenerSupport; import org.springframework.retry.policy.SimpleRetryPolicy; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.StringUtils; @@ -228,7 +227,7 @@ class ChunkElementParserTests { boolean g = false; boolean h = false; for (RetryListener o : retryListeners) { - if (o instanceof RetryListenerSupport) { + if (o instanceof SecondDummyRetryListener) { g = true; } else if (o instanceof DummyRetryListener) { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java index b2be498d6..a822d69b8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyRetryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2012 the original author or authors. + * Copyright 2009-2023 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. @@ -30,14 +30,4 @@ public class DummyRetryListener implements RetryListener { return false; } - @Override - public void close(RetryContext context, RetryCallback callback, - Throwable throwable) { - } - - @Override - public void onError(RetryContext context, RetryCallback callback, - Throwable throwable) { - } - } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/SecondDummyRetryListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/SecondDummyRetryListener.java new file mode 100644 index 000000000..ed2db73e5 --- /dev/null +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/SecondDummyRetryListener.java @@ -0,0 +1,22 @@ +/* + * Copyright 2023-2023 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.configuration.xml; + +import org.springframework.retry.RetryListener; + +public class SecondDummyRetryListener implements RetryListener { + +} diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java index 333d52b59..37949ce5f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java @@ -43,7 +43,7 @@ import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate; import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.core.task.SyncTaskExecutor; -import org.springframework.retry.listener.RetryListenerSupport; +import org.springframework.retry.RetryListener; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; @@ -182,7 +182,8 @@ class StepParserStepFactoryBeanTests { fb.setIsReaderTransactionalQueue(true); fb.setRetryLimit(5); fb.setSkipLimit(100); - fb.setRetryListeners(new RetryListenerSupport()); + fb.setRetryListeners(new RetryListener() { + }); fb.setSkippableExceptionClasses(new HashMap<>()); fb.setRetryableExceptionClasses(new HashMap<>()); fb.setHasChunkElement(true); @@ -239,7 +240,8 @@ class StepParserStepFactoryBeanTests { fb.setRetryLimit(5); fb.setSkipLimit(100); fb.setThrottleLimit(10); - fb.setRetryListeners(new RetryListenerSupport()); + fb.setRetryListeners(new RetryListener() { + }); @SuppressWarnings("unchecked") Map, Boolean> exceptionMap = getExceptionMap(Exception.class); fb.setSkippableExceptionClasses(exceptionMap); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 7fe234a8a..541e40226 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -53,7 +53,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.dao.DeadlockLoserDataAccessException; import org.springframework.jdbc.support.JdbcTransactionManager; import org.springframework.retry.RetryListener; -import org.springframework.retry.listener.RetryListenerSupport; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; @@ -433,7 +432,7 @@ public class StepParserTests { retryable.put(FatalSkippableException.class, true); retryable.put(ForceRollbackForWriteSkipException.class, true); List> streams = Arrays.asList(CompositeItemStream.class, TestReader.class); - List> retryListeners = Arrays.asList(RetryListenerSupport.class, + List> retryListeners = Arrays.asList(SecondDummyRetryListener.class, DummyRetryListener.class); List> stepListeners = Arrays.asList(DummyStepExecutionListener.class, CompositeStepExecutionListener.class); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java index a07ddc6f6..e788cbbe7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestRetryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2012 the original author or authors. + * Copyright 2008-2023 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. @@ -21,16 +21,6 @@ import org.springframework.retry.RetryListener; public class TestRetryListener extends AbstractTestComponent implements RetryListener { - @Override - public void close(RetryContext context, RetryCallback callback, - Throwable throwable) { - } - - @Override - public void onError(RetryContext context, RetryCallback callback, - Throwable throwable) { - } - @Override public boolean open(RetryContext context, RetryCallback callback) { executed = true; diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml index 024557bb2..d816b5c75 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml @@ -101,7 +101,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml index ebab24a99..64d7da96d 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml @@ -162,7 +162,7 @@ - +