Transactions 为什么spring集成和批处理事务的每个方法(spring批处理作业)的默认隔离级别都设置为SERIALIZABLE?
我有一个spring集成+批处理应用程序 集成用于使用inboun通道适配器读取文件并调用批处理作业。 jobRepository的定义如下: org.springframework.batch.core.repository.support.JobRepositoryFactoryBean 事务管理器是org.springframework.orm.jpa.JpaTransactionManager 当应用程序启动时,我不知道为什么,但我看到了这种奇怪的配置:Transactions 为什么spring集成和批处理事务的每个方法(spring批处理作业)的默认隔离级别都设置为SERIALIZABLE?,transactions,spring-batch,spring-integration,Transactions,Spring Batch,Spring Integration,我有一个spring集成+批处理应用程序 集成用于使用inboun通道适配器读取文件并调用批处理作业。 jobRepository的定义如下: org.springframework.batch.core.repository.support.JobRepositoryFactoryBean 事务管理器是org.springframework.orm.jpa.JpaTransactionManager 当应用程序启动时,我不知道为什么,但我看到了这种奇怪的配置: [5860] [2012-03-
[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [*] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT]
[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [create*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE]
[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [getLastJobExecution*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE]
似乎在默认情况下,每个jobmethod都配置了隔离序列化,但我没有在任何地方设置它。
知道如何将默认隔离级别设置为“隔离默认值”吗?默认情况下,它可以序列化,以防止同一作业实例在两个或多个框上同时执行。如果这不是你关心的问题,你可以放松一下
属性控制create*和getLastJobExecution*方法的传播在使用annotation@enableBackProcessing时如何执行?在这种情况下,您必须提供自己的BatchConfigurer。您可以扩展DefaultBatchConfigurer,只需覆盖createJobRepository()。@gary russell如果要防止作业实例在2个或更多框上同时执行,您有什么建议?事务可序列化不是一个选项。我研究了以下类,并研究了以下应用程序:org.springframework.batch.core.repository.dao.JdbcJobInstanceDao.jobIncrementer
isolation-level-for-create