Skip to content

Commit e5c752b

Browse files
committed
Remove JSR-352 implementation
Resolves #3894
1 parent f3a1184 commit e5c752b

File tree

314 files changed

+102
-25738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+102
-25738
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ build
2525
out
2626

2727
/.gradletasknamecache
28-
/spring-batch-jsr352-tck/jsr352-tck-1.0/results/
2928
**/*.flattened-pom.xml

pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<module>spring-batch-test</module>
1919
<module>spring-batch-integration</module>
2020
<module>spring-batch-samples</module>
21-
<module>spring-batch-jsr352-tck</module>
2221
<module>spring-batch-docs</module>
2322
</modules>
2423

@@ -72,7 +71,6 @@
7271
<jakarta.annotation-api.version>2.0.0</jakarta.annotation-api.version>
7372
<jakarta.mail-api.version>2.0.1</jakarta.mail-api.version>
7473
<jakarta.jms-api.version>3.0.0</jakarta.jms-api.version>
75-
<jakarta.batch-api.version>2.0.0</jakarta.batch-api.version>
7674
<jakarta.validation-api.version>3.0.0</jakarta.validation-api.version>
7775
<jakarta.persistence-api.version>3.0.0</jakarta.persistence-api.version>
7876
<neo4j-ogm-core.version>3.2.21</neo4j-ogm-core.version>
@@ -111,7 +109,6 @@
111109
<sqlserver.version>9.2.1.jre8</sqlserver.version>
112110
<jtds.version>1.3.1</jtds.version>
113111
<testcontainers.version>1.16.2</testcontainers.version>
114-
<com.ibm.jbatch-tck-spi.version>1.0</com.ibm.jbatch-tck-spi.version>
115112
<jsonassert.version>1.5.0</jsonassert.version>
116113

117114
<!-- samples dependencies -->

spring-batch-core/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@
5050
<artifactId>jackson-databind</artifactId>
5151
<version>${jackson.version}</version>
5252
</dependency>
53-
<dependency>
54-
<groupId>jakarta.batch</groupId>
55-
<artifactId>jakarta.batch-api</artifactId>
56-
<version>${jakarta.batch-api.version}</version>
57-
</dependency>
5853
<dependency>
5954
<groupId>io.micrometer</groupId>
6055
<artifactId>micrometer-core</artifactId>
@@ -256,12 +251,6 @@
256251
<version>${jaxb-core.version}</version>
257252
<scope>test</scope>
258253
</dependency>
259-
<dependency>
260-
<groupId>com.ibm.jbatch</groupId>
261-
<artifactId>com.ibm.jbatch-tck-spi</artifactId>
262-
<version>${com.ibm.jbatch-tck-spi.version}</version>
263-
<scope>test</scope>
264-
</dependency>
265254
<dependency>
266255
<groupId>jakarta.inject</groupId>
267256
<artifactId>jakarta.inject-api</artifactId>

spring-batch-core/src/main/java/org/springframework/batch/core/BatchStatus.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,6 @@ public boolean isLessThanOrEqualTo(BatchStatus other) {
108108
return this.compareTo(other) <= 0;
109109
}
110110

111-
/**
112-
* Converts the current status to the JSR-352 equivalent
113-
*
114-
* @return JSR-352 equivalent to the current status
115-
*/
116-
public jakarta.batch.runtime.BatchStatus getBatchStatus() {
117-
if(this == ABANDONED) {
118-
return jakarta.batch.runtime.BatchStatus.ABANDONED;
119-
} else if(this == COMPLETED) {
120-
return jakarta.batch.runtime.BatchStatus.COMPLETED;
121-
} else if(this == STARTED) {
122-
return jakarta.batch.runtime.BatchStatus.STARTED;
123-
} else if(this == STARTING) {
124-
return jakarta.batch.runtime.BatchStatus.STARTING;
125-
} else if(this == STOPPED) {
126-
return jakarta.batch.runtime.BatchStatus.STOPPED;
127-
} else if(this == STOPPING) {
128-
return jakarta.batch.runtime.BatchStatus.STOPPING;
129-
} else {
130-
return jakarta.batch.runtime.BatchStatus.FAILED;
131-
}
132-
}
133-
134111
/**
135112
* Find a BatchStatus that matches the beginning of the given value. If no
136113
* match is found, return COMPLETED as the default because has is low

spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public class JobExecution extends Entity {
6565

6666
private transient volatile List<Throwable> failureExceptions = new CopyOnWriteArrayList<>();
6767

68-
private final String jobConfigurationName;
69-
7068
public JobExecution(JobExecution original) {
7169
this.jobParameters = original.getJobParameters();
7270
this.jobInstance = original.getJobInstance();
@@ -79,7 +77,6 @@ public JobExecution(JobExecution original) {
7977
this.exitStatus = original.getExitStatus();
8078
this.executionContext = original.getExecutionContext();
8179
this.failureExceptions = original.getFailureExceptions();
82-
this.jobConfigurationName = original.getJobConfigurationName();
8380
this.setId(original.getId());
8481
this.setVersion(original.getVersion());
8582
}
@@ -91,22 +88,11 @@ public JobExecution(JobExecution original) {
9188
* @param job the job of which this execution is a part
9289
* @param id {@link Long} that represents the id for the JobExecution.
9390
* @param jobParameters {@link JobParameters} instance for this JobExecution.
94-
* @param jobConfigurationName {@link String} instance that represents the
95-
* job configuration name (used with JSR-352).
9691
*/
97-
public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters, String jobConfigurationName) {
92+
public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters) {
9893
super(id);
9994
this.jobInstance = job;
10095
this.jobParameters = jobParameters == null ? new JobParameters() : jobParameters;
101-
this.jobConfigurationName = jobConfigurationName;
102-
}
103-
104-
public JobExecution(JobInstance job, JobParameters jobParameters, String jobConfigurationName) {
105-
this(job, null, jobParameters, jobConfigurationName);
106-
}
107-
108-
public JobExecution(Long id, JobParameters jobParameters, String jobConfigurationName) {
109-
this(null, id, jobParameters, jobConfigurationName);
11096
}
11197

11298
/**
@@ -116,15 +102,15 @@ public JobExecution(Long id, JobParameters jobParameters, String jobConfiguratio
116102
* @param jobParameters {@link JobParameters} instance for this JobExecution.
117103
*/
118104
public JobExecution(JobInstance job, JobParameters jobParameters) {
119-
this(job, null, jobParameters, null);
105+
this(job, null, jobParameters);
120106
}
121107

122108
public JobExecution(Long id, JobParameters jobParameters) {
123-
this(null, id, jobParameters, null);
109+
this(null, id, jobParameters);
124110
}
125111

126112
public JobExecution(Long id) {
127-
this(null, id, null, null);
113+
this(null, id, null);
128114
}
129115

130116
public JobParameters getJobParameters() {
@@ -283,10 +269,6 @@ public void setCreateTime(Date createTime) {
283269
this.createTime = createTime;
284270
}
285271

286-
public String getJobConfigurationName() {
287-
return this.jobConfigurationName;
288-
}
289-
290272
/**
291273
* Package private method for re-constituting the step executions from
292274
* existing instances.

spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @see Job
3131
* @see JobParameters
3232
* @see JobExecution
33-
* @see jakarta.batch.runtime.JobInstance
3433
*
3534
* @author Lucas Ward
3635
* @author Dave Syer
@@ -40,7 +39,7 @@
4039
*
4140
*/
4241
@SuppressWarnings("serial")
43-
public class JobInstance extends Entity implements jakarta.batch.runtime.JobInstance{
42+
public class JobInstance extends Entity {
4443

4544
private final String jobName;
4645

@@ -53,7 +52,6 @@ public JobInstance(Long id, String jobName) {
5352
/**
5453
* @return the job name. (Equivalent to getJob().getName())
5554
*/
56-
@Override
5755
public String getJobName() {
5856
return jobName;
5957
}
@@ -63,7 +61,6 @@ public String toString() {
6361
return super.toString() + ", Job=[" + jobName + "]";
6462
}
6563

66-
@Override
6764
public long getInstanceId() {
6865
return super.getId();
6966
}

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
import java.util.Queue;
2626
import java.util.Set;
2727
import java.util.concurrent.locks.ReentrantLock;
28-
import jakarta.batch.api.chunk.listener.RetryProcessListener;
29-
import jakarta.batch.api.chunk.listener.RetryReadListener;
30-
import jakarta.batch.api.chunk.listener.RetryWriteListener;
31-
import jakarta.batch.api.chunk.listener.SkipProcessListener;
32-
import jakarta.batch.api.chunk.listener.SkipReadListener;
33-
import jakarta.batch.api.chunk.listener.SkipWriteListener;
34-
import jakarta.batch.api.partition.PartitionCollector;
3528

3629
import org.springframework.batch.core.ChunkListener;
3730
import org.springframework.batch.core.ItemProcessListener;
@@ -43,16 +36,6 @@
4336
import org.springframework.batch.core.StepExecutionListener;
4437
import org.springframework.batch.core.StepListener;
4538
import org.springframework.batch.core.job.flow.Flow;
46-
import org.springframework.batch.core.jsr.ChunkListenerAdapter;
47-
import org.springframework.batch.core.jsr.ItemProcessListenerAdapter;
48-
import org.springframework.batch.core.jsr.ItemReadListenerAdapter;
49-
import org.springframework.batch.core.jsr.ItemWriteListenerAdapter;
50-
import org.springframework.batch.core.jsr.RetryProcessListenerAdapter;
51-
import org.springframework.batch.core.jsr.RetryReadListenerAdapter;
52-
import org.springframework.batch.core.jsr.RetryWriteListenerAdapter;
53-
import org.springframework.batch.core.jsr.SkipListenerAdapter;
54-
import org.springframework.batch.core.jsr.StepListenerAdapter;
55-
import org.springframework.batch.core.jsr.partition.PartitionCollectorAdapter;
5639
import org.springframework.batch.core.launch.JobLauncher;
5740
import org.springframework.batch.core.partition.PartitionHandler;
5841
import org.springframework.batch.core.partition.support.Partitioner;
@@ -105,6 +88,7 @@
10588
* @author Josh Long
10689
* @author Michael Minella
10790
* @author Chris Schaefer
91+
* @author Mahmoud Ben Hassine
10892
* @see SimpleStepFactoryBean
10993
* @see FaultTolerantStepFactoryBean
11094
* @see TaskletStep
@@ -159,10 +143,6 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
159143

160144
private int gridSize = DEFAULT_GRID_SIZE;
161145

162-
private Queue<Serializable> partitionQueue;
163-
164-
private ReentrantLock partitionLock;
165-
166146
//
167147
// Tasklet Elements
168148
//
@@ -232,31 +212,13 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
232212

233213
private Set<SkipListener<I, O>> skipListeners = new LinkedHashSet<>();
234214

235-
private Set<org.springframework.batch.core.jsr.RetryListener> jsrRetryListeners = new LinkedHashSet<>();
236-
237215
//
238216
// Additional
239217
//
240218
private boolean hasChunkElement = false;
241219

242220
private StepExecutionAggregator stepExecutionAggregator;
243221

244-
/**
245-
* @param queue The {@link Queue} that is used for communication between {@link jakarta.batch.api.partition.PartitionCollector} and {@link jakarta.batch.api.partition.PartitionAnalyzer}
246-
*/
247-
public void setPartitionQueue(Queue<Serializable> queue) {
248-
this.partitionQueue = queue;
249-
}
250-
251-
/**
252-
* Used to coordinate access to the partition queue between the {@link jakarta.batch.api.partition.PartitionCollector} and {@link jakarta.batch.api.partition.AbstractPartitionAnalyzer}
253-
*
254-
* @param lock a lock that will be locked around accessing the partition queue
255-
*/
256-
public void setPartitionLock(ReentrantLock lock) {
257-
this.partitionLock = lock;
258-
}
259-
260222
/**
261223
* Create a {@link Step} from the configuration provided.
262224
*
@@ -312,8 +274,6 @@ protected void enhanceCommonStep(StepBuilderHelper<?> builder) {
312274
for (Object listener : stepExecutionListeners) {
313275
if(listener instanceof StepExecutionListener) {
314276
builder.listener((StepExecutionListener) listener);
315-
} else if(listener instanceof jakarta.batch.api.listener.StepListener) {
316-
builder.listener(new StepListenerAdapter((jakarta.batch.api.listener.StepListener) listener));
317277
}
318278
}
319279
}
@@ -369,10 +329,6 @@ protected Step createFaultTolerantStep() {
369329
builder.listener(listener);
370330
}
371331

372-
for (org.springframework.batch.core.jsr.RetryListener listener : jsrRetryListeners) {
373-
builder.listener(listener);
374-
}
375-
376332
registerItemListeners(builder);
377333

378334
if (skipPolicy != null) {
@@ -485,10 +441,6 @@ protected void enhanceTaskletStepBuilder(AbstractTaskletStepBuilder<?> builder)
485441

486442
enhanceCommonStep(builder);
487443
for (ChunkListener listener : chunkListeners) {
488-
if(listener instanceof PartitionCollectorAdapter) {
489-
((PartitionCollectorAdapter) listener).setPartitionLock(partitionLock);
490-
}
491-
492444
builder.listener(listener);
493445

494446
}
@@ -817,71 +769,26 @@ public void setListeners(Object[] listeners) {
817769
SkipListener<I, O> skipListener = (SkipListener<I, O>) listener;
818770
skipListeners.add(skipListener);
819771
}
820-
if(listener instanceof SkipReadListener) {
821-
SkipListener<I, O> skipListener = new SkipListenerAdapter<>((SkipReadListener) listener, null, null);
822-
skipListeners.add(skipListener);
823-
}
824-
if(listener instanceof SkipProcessListener) {
825-
SkipListener<I, O> skipListener = new SkipListenerAdapter<>(null, (SkipProcessListener) listener, null);
826-
skipListeners.add(skipListener);
827-
}
828-
if(listener instanceof SkipWriteListener) {
829-
SkipListener<I, O> skipListener = new SkipListenerAdapter<>(null, null, (SkipWriteListener) listener);
830-
skipListeners.add(skipListener);
831-
}
832772
if (listener instanceof StepExecutionListener) {
833773
StepExecutionListener stepExecutionListener = (StepExecutionListener) listener;
834774
stepExecutionListeners.add(stepExecutionListener);
835775
}
836-
if(listener instanceof jakarta.batch.api.listener.StepListener) {
837-
StepExecutionListener stepExecutionListener = new StepListenerAdapter((jakarta.batch.api.listener.StepListener) listener);
838-
stepExecutionListeners.add(stepExecutionListener);
839-
}
840776
if (listener instanceof ChunkListener) {
841777
ChunkListener chunkListener = (ChunkListener) listener;
842778
chunkListeners.add(chunkListener);
843779
}
844-
if(listener instanceof jakarta.batch.api.chunk.listener.ChunkListener) {
845-
ChunkListener chunkListener = new ChunkListenerAdapter((jakarta.batch.api.chunk.listener.ChunkListener) listener);
846-
chunkListeners.add(chunkListener);
847-
}
848780
if (listener instanceof ItemReadListener) {
849781
ItemReadListener<I> readListener = (ItemReadListener<I>) listener;
850782
readListeners.add(readListener);
851783
}
852-
if(listener instanceof jakarta.batch.api.chunk.listener.ItemReadListener) {
853-
ItemReadListener<I> itemListener = new ItemReadListenerAdapter<>((jakarta.batch.api.chunk.listener.ItemReadListener) listener);
854-
readListeners.add(itemListener);
855-
}
856784
if (listener instanceof ItemWriteListener) {
857785
ItemWriteListener<O> writeListener = (ItemWriteListener<O>) listener;
858786
writeListeners.add(writeListener);
859787
}
860-
if(listener instanceof jakarta.batch.api.chunk.listener.ItemWriteListener) {
861-
ItemWriteListener<O> itemListener = new ItemWriteListenerAdapter<>((jakarta.batch.api.chunk.listener.ItemWriteListener) listener);
862-
writeListeners.add(itemListener);
863-
}
864788
if (listener instanceof ItemProcessListener) {
865789
ItemProcessListener<I, O> processListener = (ItemProcessListener<I, O>) listener;
866790
processListeners.add(processListener);
867791
}
868-
if(listener instanceof jakarta.batch.api.chunk.listener.ItemProcessListener) {
869-
ItemProcessListener<I,O> itemListener = new ItemProcessListenerAdapter<>((jakarta.batch.api.chunk.listener.ItemProcessListener) listener);
870-
processListeners.add(itemListener);
871-
}
872-
if(listener instanceof RetryReadListener) {
873-
jsrRetryListeners.add(new RetryReadListenerAdapter((RetryReadListener) listener));
874-
}
875-
if(listener instanceof RetryProcessListener) {
876-
jsrRetryListeners.add(new RetryProcessListenerAdapter((RetryProcessListener) listener));
877-
}
878-
if(listener instanceof RetryWriteListener) {
879-
jsrRetryListeners.add(new RetryWriteListenerAdapter((RetryWriteListener) listener));
880-
}
881-
if(listener instanceof PartitionCollector) {
882-
PartitionCollectorAdapter adapter = new PartitionCollectorAdapter(partitionQueue, (PartitionCollector) listener);
883-
chunkListeners.add(adapter);
884-
}
885792
}
886793
}
887794

0 commit comments

Comments
 (0)