From 60ca279e80e4bafe70b3c359b828c3ce4b87c4e2 Mon Sep 17 00:00:00 2001 From: robokaso Date: Tue, 11 Nov 2008 14:08:17 +0000 Subject: [PATCH] RESOLVED - BATCH-913: Remove the JdkConcurrent* special classes removed the redundant synchronizer factory, kept the synchronizer interface --- ...dkConcurrentStepExecutionSynchronizer.java | 2 +- .../StepExecutionSynchronizerFactory.java | 37 ------------------- .../batch/core/step/tasklet/TaskletStep.java | 6 +-- 3 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizerFactory.java diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java index 442103107..ca286b35c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java @@ -25,7 +25,7 @@ import org.springframework.batch.core.StepExecution; * * @author Ben Hale */ -class JdkConcurrentStepExecutionSynchronizer implements StepExecutionSynchronizer { +public class JdkConcurrentStepExecutionSynchronizer implements StepExecutionSynchronizer { private final Semaphore semaphore = new Semaphore(1); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizerFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizerFactory.java deleted file mode 100644 index be8d21588..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizerFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.step; - -/** - * A factory for {@link StepExecutionSynchronizer} which simply creates one from - * java.util.concurrent components. - * - * @author Ben Hale - * @author Dave Syer - */ -public class StepExecutionSynchronizerFactory { - - private final StepExecutionSynchronizer synchronizer; - - public StepExecutionSynchronizerFactory() { - synchronizer = new JdkConcurrentStepExecutionSynchronizer(); - } - - public StepExecutionSynchronizer getStepExecutionSynchronizer() { - return synchronizer; - } -} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java index 79de7486d..bf72bc24f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java @@ -26,8 +26,8 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.scope.StepContext; import org.springframework.batch.core.scope.StepContextRepeatCallback; import org.springframework.batch.core.step.AbstractStep; +import org.springframework.batch.core.step.JdkConcurrentStepExecutionSynchronizer; import org.springframework.batch.core.step.StepExecutionSynchronizer; -import org.springframework.batch.core.step.StepExecutionSynchronizerFactory; import org.springframework.batch.core.step.StepInterruptionPolicy; import org.springframework.batch.core.step.ThreadStepInterruptionPolicy; import org.springframework.batch.item.ExecutionContext; @@ -86,7 +86,7 @@ public class TaskletStep extends AbstractStep { private Tasklet tasklet; - private StepExecutionSynchronizer synchronizer; + private StepExecutionSynchronizer synchronizer = new JdkConcurrentStepExecutionSynchronizer(); /** * Default constructor. @@ -100,8 +100,6 @@ public class TaskletStep extends AbstractStep { */ public TaskletStep(String name) { super(name); - synchronizer = new StepExecutionSynchronizerFactory() - .getStepExecutionSynchronizer(); } /**