-
Notifications
You must be signed in to change notification settings - Fork 353
Use static errors in RSocket default method implementations #933
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
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7a4602c
bumps reactor and netty version
OlegDokuka 5a3dc4b
updates project versions and docs
OlegDokuka 18050ed
Avoid queueing in UnicastProcessor receivers
rstoyanchev 38a38e9
Refactoring in RequestOperator
rstoyanchev b5952f6
Fix formatting
rstoyanchev c4f5467
Use static errors in default RSocket methods
rstoyanchev 4698adb
Turn off suppressed exceptions (to squash)
rstoyanchev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use static errors in default RSocket methods
Closes gh-865 Signed-off-by: Rossen Stoyanchev <rstoyanchev@vmware.com>
- Loading branch information
commit c4f54673320eb14a2a24624e11087df89072afce
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright 2015-2020 the original author or authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.rsocket; | ||
|
|
||
| import org.reactivestreams.Publisher; | ||
| import reactor.core.publisher.Flux; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** | ||
| * Package private class with default implementations for use in {@link RSocket}. The main purpose | ||
| * is to hide static {@link UnsupportedOperationException} declarations. | ||
| */ | ||
| class RSocketAdapter { | ||
|
|
||
| private static final Mono<Void> UNSUPPORTED_FIRE_AND_FORGET = | ||
| Mono.error(new UnsupportedOperationException("Fire-and-Forget not implemented.")); | ||
|
|
||
| private static final Mono<Payload> UNSUPPORTED_REQUEST_RESPONSE = | ||
| Mono.error(new UnsupportedOperationException("Request-Response not implemented.")); | ||
|
|
||
| private static final Flux<Payload> UNSUPPORTED_REQUEST_STREAM = | ||
| Flux.error(new UnsupportedOperationException("Request-Stream not implemented.")); | ||
|
|
||
| private static final Flux<Payload> UNSUPPORTED_REQUEST_CHANNEL = | ||
| Flux.error(new UnsupportedOperationException("Request-Channel not implemented.")); | ||
|
|
||
| private static final Mono<Void> UNSUPPORTED_METADATA_PUSH = | ||
| Mono.error(new UnsupportedOperationException("Metadata-Push not implemented.")); | ||
|
|
||
| static Mono<Void> fireAndForget(Payload payload) { | ||
| payload.release(); | ||
| return RSocketAdapter.UNSUPPORTED_FIRE_AND_FORGET; | ||
| } | ||
|
|
||
| static Mono<Payload> requestResponse(Payload payload) { | ||
| payload.release(); | ||
| return RSocketAdapter.UNSUPPORTED_REQUEST_RESPONSE; | ||
| } | ||
|
|
||
| static Flux<Payload> requestStream(Payload payload) { | ||
| payload.release(); | ||
| return RSocketAdapter.UNSUPPORTED_REQUEST_STREAM; | ||
| } | ||
|
|
||
| static Flux<Payload> requestChannel(Publisher<Payload> payloads) { | ||
| return RSocketAdapter.UNSUPPORTED_REQUEST_CHANNEL; | ||
| } | ||
|
|
||
| static Mono<Void> metadataPush(Payload payload) { | ||
| payload.release(); | ||
| return RSocketAdapter.UNSUPPORTED_METADATA_PUSH; | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.