Skip to content

Commit

Permalink
Merge branch 'OpenFeign:master' into issue/1264/jaxrs2_support_bean_p…
Browse files Browse the repository at this point in the history
…aram
  • Loading branch information
JKomoroski committed Feb 13, 2023
2 parents 6088721 + fd4befa commit bde77f8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<properties>
<main.basedir>${project.basedir}/..</main.basedir>
<reactor.version>3.4.24</reactor.version>
<reactor.version>3.5.2</reactor.version>
<reactive.streams.version>1.0.4</reactive.streams.version>
<reactivex.version>2.2.21</reactivex.version>
</properties>
Expand Down
17 changes: 10 additions & 7 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.elastic();
private final Scheduler scheduler;

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

@Override
public Feign build() {
Expand All @@ -43,11 +51,6 @@ public Builder invocationHandlerFactory(InvocationHandlerFactory invocationHandl
throw new UnsupportedOperationException(
"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
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setUp() throws NoSuchMethodException {
public void invokeOnSubscribeReactor() throws Throwable {
given(this.methodHandler.invoke(any())).willReturn("Result");
ReactorInvocationHandler handler = new ReactorInvocationHandler(this.target,
Collections.singletonMap(method, this.methodHandler), Schedulers.elastic());
Collections.singletonMap(method, this.methodHandler), Schedulers.boundedElastic());

Object result = handler.invoke(method, this.methodHandler, new Object[] {});
assertThat(result).isInstanceOf(Mono.class);
Expand All @@ -74,7 +74,7 @@ public void invokeOnSubscribeReactor() throws Throwable {
public void invokeOnSubscribeEmptyReactor() throws Throwable {
given(this.methodHandler.invoke(any())).willReturn(null);
ReactorInvocationHandler handler = new ReactorInvocationHandler(this.target,
Collections.singletonMap(method, this.methodHandler), Schedulers.elastic());
Collections.singletonMap(method, this.methodHandler), Schedulers.boundedElastic());

Object result = handler.invoke(method, this.methodHandler, new Object[] {});
assertThat(result).isInstanceOf(Mono.class);
Expand All @@ -91,7 +91,7 @@ public void invokeOnSubscribeEmptyReactor() throws Throwable {
public void invokeFailureReactor() throws Throwable {
given(this.methodHandler.invoke(any())).willThrow(new IOException("Could Not Decode"));
ReactorInvocationHandler handler = new ReactorInvocationHandler(this.target,
Collections.singletonMap(this.method, this.methodHandler), Schedulers.elastic());
Collections.singletonMap(this.method, this.methodHandler), Schedulers.boundedElastic());

Object result = handler.invoke(this.method, this.methodHandler, new Object[] {});
assertThat(result).isInstanceOf(Mono.class);
Expand Down

0 comments on commit bde77f8

Please sign in to comment.