Skip to content

Commit

Permalink
moved scheduler initialization to constructor
Browse files Browse the repository at this point in the history
Created a second builder method which allows to configure the scheduler as a parameter. The default builder method now uses the non deprecated <code>Schedulers.boundedElastic()</code>

Fixes #1711
  • Loading branch information
nlsbchmnn committed Feb 12, 2023
1 parent 86ef9e5 commit c3e0595
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions reactive/src/main/java/feign/reactive/ReactorFeign.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@
public class ReactorFeign extends ReactiveFeign {

public static Builder builder() {
return new Builder();
return new Builder(Schedulers.boundedElastic());
}

public static Builder builder(Scheduler scheduler) {
return new Builder(scheduler);
}

public static class Builder extends ReactiveFeign.Builder {

private Scheduler scheduler = Schedulers.boundedElastic();
private final Scheduler scheduler;

Builder(Scheduler scheduler){
this.scheduler = scheduler;
}

@Override
public Feign build() {
Expand All @@ -44,10 +52,6 @@ public Builder invocationHandlerFactory(InvocationHandlerFactory invocationHandl
"Invocation Handler Factory overrides are not supported.");
}

public Builder scheduleOn(Scheduler scheduler) {
this.scheduler = scheduler;
return this;
}
}

private static class ReactorInvocationHandlerFactory implements InvocationHandlerFactory {
Expand Down

0 comments on commit c3e0595

Please sign in to comment.