IN PROGRESS - BATCH-858: Pause / resume of Job

used same tx isolation for getLastJobExecution(..) as for createJobExecution(..)

added simple functional test with JobOperator (same id returned after pause and resume)
This commit is contained in:
robokaso
2008-10-21 14:06:37 +00:00
parent b11be9d19d
commit 2d3c928fa3
2 changed files with 33 additions and 9 deletions

View File

@@ -29,8 +29,6 @@ import org.springframework.util.Assert;
*/
public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, InitializingBean {
private PlatformTransactionManager transactionManager;
private ProxyFactory proxyFactory;
@@ -103,6 +101,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
proxyFactory = new ProxyFactory();
TransactionInterceptor advice = new TransactionInterceptor(transactionManager, PropertiesConverter
.stringToProperties("create*=PROPAGATION_REQUIRES_NEW," + isolationLevelForCreate
+ "\ngetLastJobExecution*=PROPAGATION_REQUIRES_NEW," + isolationLevelForCreate
+ "\n*=PROPAGATION_REQUIRED"));
DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(advice);
NameMatchMethodPointcut pointcut = new NameMatchMethodPointcut();
@@ -113,23 +112,23 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
proxyFactory.addInterface(JobRepository.class);
proxyFactory.setTarget(getTarget());
}
public void afterPropertiesSet() throws Exception {
Assert.notNull(transactionManager, "TransactionManager must not be null.");
initializeProxy();
initializeProxy();
}
private Object getTarget() throws Exception {
return new SimpleJobRepository(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(),
createExecutionContextDao());
}
public Object getObject() throws Exception {
if (proxyFactory==null) {
if (proxyFactory == null) {
afterPropertiesSet();
}
return proxyFactory.getProxy();
}
return proxyFactory.getProxy();
}
}