BATCH-2004: Updated per review comments
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.batch</groupId>
|
||||
<artifactId>javax.batch-api</artifactId>
|
||||
<version>1.0-b29</version>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.jbatch</groupId>
|
||||
|
||||
@@ -402,7 +402,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAwa
|
||||
CompositeCompletionPolicy completionPolicy = new CompositeCompletionPolicy();
|
||||
CompletionPolicy [] policies = new CompletionPolicy[2];
|
||||
policies[0] = new SimpleCompletionPolicy(commitInterval);
|
||||
policies[1] = new TimeoutTerminationPolicy(timeout);
|
||||
policies[1] = new TimeoutTerminationPolicy(timeout * 1000);
|
||||
completionPolicy.setPolicies(policies);
|
||||
builder.chunk(completionPolicy);
|
||||
} else if(timeout != null) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ChunkListenerAdapter implements ChunkListener {
|
||||
throw new BatchRuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
throw new BatchRuntimeException("Unable to retrieve causing exception");
|
||||
throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Wrapper class for {@link javax.batch.api.chunk.listener.ItemProcessListener}
|
||||
*
|
||||
*
|
||||
* @author Michael Minella
|
||||
*
|
||||
* @param <T> input type
|
||||
@@ -64,7 +64,7 @@ public class ItemProcessListenerAdapter<T,S> implements ItemProcessListener<T, S
|
||||
try {
|
||||
delegate.onProcessError(item, e);
|
||||
} catch (Exception e1) {
|
||||
throw new BatchRuntimeException(e);
|
||||
throw new BatchRuntimeException(e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,18 +31,16 @@ import org.springframework.batch.core.listener.ListenerMetaData;
|
||||
* @since 3.0
|
||||
*/
|
||||
public enum JsrJobListenerMetaData implements ListenerMetaData {
|
||||
BEFORE_JOB("beforeJob", "jsr-before-job", null),
|
||||
AFTER_JOB("afterJob", "jsr-after-job", null);
|
||||
BEFORE_JOB("beforeJob", "jsr-before-job"),
|
||||
AFTER_JOB("afterJob", "jsr-after-job");
|
||||
|
||||
private final String methodName;
|
||||
private final String propertyName;
|
||||
private final Class<? extends Annotation> annotation;
|
||||
private static final Map<String, JsrJobListenerMetaData> propertyMap;
|
||||
|
||||
JsrJobListenerMetaData(String methodName, String propertyName, Class<? extends Annotation> annotation) {
|
||||
JsrJobListenerMetaData(String methodName, String propertyName) {
|
||||
this.methodName = methodName;
|
||||
this.propertyName = propertyName;
|
||||
this.annotation = annotation;
|
||||
}
|
||||
|
||||
static{
|
||||
@@ -59,7 +57,7 @@ public enum JsrJobListenerMetaData implements ListenerMetaData {
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> getAnnotation() {
|
||||
return annotation;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.springframework.batch.core.jsr;
|
||||
import javax.batch.api.chunk.listener.SkipProcessListener;
|
||||
import javax.batch.api.chunk.listener.SkipReadListener;
|
||||
import javax.batch.api.chunk.listener.SkipWriteListener;
|
||||
import javax.batch.operations.BatchRuntimeException;
|
||||
|
||||
import org.springframework.batch.core.SkipListener;
|
||||
|
||||
@@ -24,14 +25,14 @@ public class SkipListenerAdapter<T, S> implements SkipListener<T, S> {
|
||||
try {
|
||||
skipReadDelegate.onSkipReadItem((Exception) t);
|
||||
} catch (Exception e) {
|
||||
//TODO: Do something here
|
||||
throw new BatchRuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSkipInWrite(S item, Throwable t) {
|
||||
//TODO: Awating information on the JSR's method
|
||||
//TODO: This will take more than just wrapping...
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +41,7 @@ public class SkipListenerAdapter<T, S> implements SkipListener<T, S> {
|
||||
try {
|
||||
skipProcessDelegate.onSkipProcessItem(item, (Exception) t);
|
||||
} catch (Exception e) {
|
||||
//TODO: Do something here
|
||||
throw new BatchRuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.batch.operations.BatchRuntimeException;
|
||||
import javax.batch.operations.JobExecutionAlreadyCompleteException;
|
||||
import javax.batch.operations.JobExecutionIsRunningException;
|
||||
import javax.batch.operations.JobExecutionNotMostRecentException;
|
||||
@@ -62,29 +63,29 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
/**
|
||||
* The entrance for executing batch jobs as defined by JSR-352. This class provides
|
||||
* a base {@link ApplicationContext} that is the equivalent to the following:
|
||||
*
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableBatchProcessing
|
||||
* public static class BaseConfiguration extends DefaultBatchConfigurer {
|
||||
*
|
||||
*
|
||||
* @Bean
|
||||
* JobLauncher jobLauncher() { ... }
|
||||
*
|
||||
*
|
||||
* @Bean
|
||||
* org.springframework.batch.core.launch.JobOperator batchJobOperator(JobExplorer jobExplorer,
|
||||
* JobLauncher jobLauncher,
|
||||
* JobRepository jobRepository,
|
||||
* JobRegistry jobRegistry) { ... }
|
||||
*
|
||||
*
|
||||
* @Bean
|
||||
* JobExplorerFactoryBean jobExplorer(final DataSource dataSource) { ... }
|
||||
*
|
||||
*
|
||||
* @Bean
|
||||
* DataSource dataSource() { ... }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
* @see EnableBatchProcessing
|
||||
@@ -105,6 +106,7 @@ public class JsrJobOperator implements JobOperator {
|
||||
((SimpleJobLauncher) jobLauncher).afterPropertiesSet();
|
||||
((SimpleJobOperator) batchJobOperator).afterPropertiesSet();
|
||||
} catch (Exception e) {
|
||||
throw new BatchRuntimeException("Unable to bootstrap JobOperator", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +222,7 @@ public class JsrJobOperator implements JobOperator {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("resource")
|
||||
public long start(String jobName, Properties params) throws JobStartException,
|
||||
JobSecurityException {
|
||||
GenericXmlApplicationContext batchContext = new GenericXmlApplicationContext();
|
||||
|
||||
Reference in New Issue
Block a user