Skip to content

Now throttlerLimit() is deprecated everywhere, providing a ThrottlerRepeatOperations could be convenient #4531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nightswimmings opened this issue Jan 8, 2024 · 8 comments
Labels
status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details

Comments

@nightswimmings
Copy link

nightswimmings commented Jan 8, 2024

As per the note "@deprecated with no replacement since 5.0, scheduled for removal in 6.0. Use a custom {@link RepeatOperations} implementation (based on a {@link TaskExecutor} with a bounded task queue) and set it on the step with {@link #stepOperations(RepeatOperations)}.", I think it would be convenient to have some built-in replacement.

IMO this is pertinent because:

  • It saves a significant effort to anyone that wants to upgrade
  • I believe it is really something quite intrinsical to an expected Batch API
  • It implies one of the most sensible ways of dealing with low-level stuff, concurrency and synchronization, and you all are much more aware of how things work in behind

My 2 cents, but thanks either way!

@nightswimmings nightswimmings added status: waiting-for-triage Issues that we did not analyse yet type: feature labels Jan 8, 2024
@Mom0aut
Copy link

Mom0aut commented Apr 15, 2024

Could someone provide an real example of how i can set the "old" throttleLimit with the "new" RepeatOperations.

Thanks!

@rmaheshk
Copy link

rmaheshk commented Jun 3, 2024

The document is unclear on how to use custom RepeatOperation to replace the deprecation of throttleLimit however, I have implemented as follows after going through few documentation but still no use

 @Bean
    public RepeatOperations createRepeatOperations() {
        TaskExecutorRepeatTemplate repeatOperations = new TaskExecutorRepeatTemplate();
        repeatOperations.setTaskExecutor(taskExecutor());
        return repeatOperations;
    }

and use the createRepeatOperations() through AbstractTaskletStepBuilder.stepOperation()

@NaitYoussef
Copy link

The solution you provided @rmaheshk won't work since you're using TaskExecutorRepeatTemplate which it self uses the deprecated method. You should implement your own custom RepeatOperations for it to work.
Check this post it says the same thing #4389 (comment)

@advaidg
Copy link

advaidg commented Sep 11, 2024

@NaitYoussef Any samples?
@rmaheshk - If you were able to fix this please share the details

@RT-1904129
Copy link

RT-1904129 commented Sep 30, 2024

Hi @NaitYoussef ,@rmaheshk
Can you give me some Tips or examples on how to implement this ???

@overlinden
Copy link

@NaitYoussef @rmaheshk @RT-1904129

I would appreciate to have some valuable hints how to get a functional equivialent to the throttleLimit in the step configuration.
I have a computation based job and it is a waste of capacity to use 4 cores only instead of all available ones.

I could implement a workaround to use chunkSize(1) from spring batch perspective and modify the item reader / processor / writer to process a List of items at once. Within the item processor I use a Fork Join Pool implementation for parallelization.

I know that this is not a perfect solution but wasting a lot of CPU capacities is not feasible for me; the job would run for days instead of a couple of hours.

@harshalh10
Copy link

Hi @fmbenhassine, If you could assist us implementing in custom RepeatOperations it would be a great help.

@fmbenhassine
Copy link
Contributor

There is no replacement for that API because the concept of a parallel iteration is flawed by design (see "Concurrency model" in #3950). I saw no reason to invest time in providing a temporary replacement for a flawed approach (ie providing another RepeatOperations implementation) that is going to last a short period of time.

The new approach to concurrency is coming in the next major release v6 which is planned for later this year. In the meantime, and if it were up to me, I would continue using the deprecated API until the official replacement is provided by Spring Batch.

I am closing this issue for now, keep tuned for #3950 !

@fmbenhassine fmbenhassine closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2025
@fmbenhassine fmbenhassine added status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details and removed status: waiting-for-triage Issues that we did not analyse yet type: feature labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined Features that we don't intend to implement or Bug reports that are invalid or missing enough details
Projects
None yet
Development

No branches or pull requests

9 participants