23
23
/**
24
24
* Package private class with default implementations for use in {@link RSocket}. The main purpose
25
25
* is to hide static {@link UnsupportedOperationException} declarations.
26
+ *
27
+ * @since 1.0.3
26
28
*/
27
29
class RSocketAdapter {
28
30
29
31
private static final Mono <Void > UNSUPPORTED_FIRE_AND_FORGET =
30
- Mono .error (new UnsupportedOperationException ("Fire-and-Forget not implemented. " ));
32
+ Mono .error (new UnsupportedInteractionException ("Fire-and-Forget" ));
31
33
32
34
private static final Mono <Payload > UNSUPPORTED_REQUEST_RESPONSE =
33
- Mono .error (new UnsupportedOperationException ("Request-Response not implemented. " ));
35
+ Mono .error (new UnsupportedInteractionException ("Request-Response" ));
34
36
35
37
private static final Flux <Payload > UNSUPPORTED_REQUEST_STREAM =
36
- Flux .error (new UnsupportedOperationException ("Request-Stream not implemented. " ));
38
+ Flux .error (new UnsupportedInteractionException ("Request-Stream" ));
37
39
38
40
private static final Flux <Payload > UNSUPPORTED_REQUEST_CHANNEL =
39
- Flux .error (new UnsupportedOperationException ("Request-Channel not implemented. " ));
41
+ Flux .error (new UnsupportedInteractionException ("Request-Channel" ));
40
42
41
43
private static final Mono <Void > UNSUPPORTED_METADATA_PUSH =
42
- Mono .error (new UnsupportedOperationException ("Metadata-Push not implemented. " ));
44
+ Mono .error (new UnsupportedInteractionException ("Metadata-Push" ));
43
45
44
46
static Mono <Void > fireAndForget (Payload payload ) {
45
47
payload .release ();
@@ -64,4 +66,13 @@ static Mono<Void> metadataPush(Payload payload) {
64
66
payload .release ();
65
67
return RSocketAdapter .UNSUPPORTED_METADATA_PUSH ;
66
68
}
69
+
70
+ private static class UnsupportedInteractionException extends RuntimeException {
71
+
72
+ private static final long serialVersionUID = 5084623297446471999L ;
73
+
74
+ UnsupportedInteractionException (String interactionName ) {
75
+ super (interactionName + " not implemented." , null , false , false );
76
+ }
77
+ }
67
78
}
0 commit comments