weixin_39572152 2020-11-29 22:33
浏览 0

Remove transaction synchronization and state management from input/output sources (formerly buffering) [BATCH-7]

Lucas Ward opened BATCH-7 and commented

Currently, all input templates (simpleFileInput is an exception) store their state in a threadlocal. However, this impacts readability and is overkill for most cases. It may be a better approach to either remove the thread local with the expectation that either the input or the entire module itself will be wrapped in a threadlocal scope(since many cases may result in a non-thread safe module being created and then needing partitioning for performance reasons) Or the InputState could be created as a dependency to the inputs (something like SqlInputState) which would default to a simple, non thread safe implementation, but could be replaced with an implementation that uses either a wrapper or composite pattern to wrap the state in a thread local.

Affects: 1.0-m1

Issue Links: - BATCH-26 Use of read ahead limit on ResourceLineReader is flawed or at least worrying ("is depended on by") - BATCH-189 Move TransactionSynchronization to base class ("is depended on by")

该提问来源于开源项目:spring-projects/spring-batch

  • 写回答

13条回答 默认 最新

  • weixin_39572152 2020-11-29 22:33
    关注

    Dave Syer commented

    Changed title to reflect current usage / terminology.

    Discussed with Rob: we would prefer the input / output sources to be created as needed, rather than sitting there as Spring beans. This forces a factory/context pattern up the interface layers into the ItemProvider or its implementations.

    评论

报告相同问题?