@@ -69,8 +69,15 @@ final class FireAndForgetRequesterMono extends Mono<Void> implements Subscriptio
69
69
public void subscribe (CoreSubscriber <? super Void > actual ) {
70
70
long previousState = markSubscribed (STATE , this );
71
71
if (isSubscribedOrTerminated (previousState )) {
72
- Operators .error (
73
- actual , new IllegalStateException ("FireAndForgetMono allows only a single Subscriber" ));
72
+ final IllegalStateException e =
73
+ new IllegalStateException ("FireAndForgetMono allows only a single Subscriber" );
74
+
75
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
76
+ if (requestInterceptor != null ) {
77
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
78
+ }
79
+
80
+ Operators .error (actual , e );
74
81
return ;
75
82
}
76
83
@@ -81,14 +88,28 @@ public void subscribe(CoreSubscriber<? super Void> actual) {
81
88
try {
82
89
if (!isValid (mtu , this .maxFrameLength , p , false )) {
83
90
lazyTerminate (STATE , this );
91
+
84
92
p .release ();
85
- actual .onError (
93
+
94
+ final IllegalArgumentException e =
86
95
new IllegalArgumentException (
87
- String .format (INVALID_PAYLOAD_ERROR_MESSAGE , this .maxFrameLength )));
96
+ String .format (INVALID_PAYLOAD_ERROR_MESSAGE , this .maxFrameLength ));
97
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
98
+ if (requestInterceptor != null ) {
99
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
100
+ }
101
+
102
+ actual .onError (e );
88
103
return ;
89
104
}
90
105
} catch (IllegalReferenceCountException e ) {
91
106
lazyTerminate (STATE , this );
107
+
108
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
109
+ if (requestInterceptor != null ) {
110
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
111
+ }
112
+
92
113
actual .onError (e );
93
114
return ;
94
115
}
@@ -98,14 +119,22 @@ public void subscribe(CoreSubscriber<? super Void> actual) {
98
119
streamId = this .requesterResponderSupport .getNextStreamId ();
99
120
} catch (Throwable t ) {
100
121
lazyTerminate (STATE , this );
122
+
101
123
p .release ();
102
- actual .onError (Exceptions .unwrap (t ));
124
+
125
+ final Throwable ut = Exceptions .unwrap (t );
126
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
127
+ if (requestInterceptor != null ) {
128
+ requestInterceptor .onReject (ut , FrameType .REQUEST_FNF );
129
+ }
130
+
131
+ actual .onError (ut );
103
132
return ;
104
133
}
105
134
106
135
final RequestInterceptor interceptor = this .requestInterceptor ;
107
136
if (interceptor != null ) {
108
- interceptor .onStart (streamId , FrameType .REQUEST_FNF , p . sliceMetadata () );
137
+ interceptor .onStart (streamId , FrameType .REQUEST_FNF );
109
138
}
110
139
111
140
try {
@@ -162,19 +191,40 @@ public Void block(Duration m) {
162
191
public Void block () {
163
192
long previousState = markSubscribed (STATE , this );
164
193
if (isSubscribedOrTerminated (previousState )) {
165
- throw new IllegalStateException ("FireAndForgetMono allows only a single Subscriber" );
194
+ final IllegalStateException e =
195
+ new IllegalStateException ("FireAndForgetMono allows only a single Subscriber" );
196
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
197
+ if (requestInterceptor != null ) {
198
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
199
+ }
200
+ throw e ;
166
201
}
167
202
168
203
final Payload p = this .payload ;
169
204
try {
170
205
if (!isValid (this .mtu , this .maxFrameLength , p , false )) {
171
206
lazyTerminate (STATE , this );
207
+
172
208
p .release ();
173
- throw new IllegalArgumentException (
174
- String .format (INVALID_PAYLOAD_ERROR_MESSAGE , this .maxFrameLength ));
209
+
210
+ final IllegalArgumentException e =
211
+ new IllegalArgumentException (
212
+ String .format (INVALID_PAYLOAD_ERROR_MESSAGE , this .maxFrameLength ));
213
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
214
+ if (requestInterceptor != null ) {
215
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
216
+ }
217
+
218
+ throw e ;
175
219
}
176
220
} catch (IllegalReferenceCountException e ) {
177
221
lazyTerminate (STATE , this );
222
+
223
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
224
+ if (requestInterceptor != null ) {
225
+ requestInterceptor .onReject (e , FrameType .REQUEST_FNF );
226
+ }
227
+
178
228
throw Exceptions .propagate (e );
179
229
}
180
230
@@ -183,13 +233,20 @@ public Void block() {
183
233
streamId = this .requesterResponderSupport .getNextStreamId ();
184
234
} catch (Throwable t ) {
185
235
lazyTerminate (STATE , this );
236
+
186
237
p .release ();
238
+
239
+ final RequestInterceptor requestInterceptor = this .requestInterceptor ;
240
+ if (requestInterceptor != null ) {
241
+ requestInterceptor .onReject (t , FrameType .REQUEST_FNF );
242
+ }
243
+
187
244
throw Exceptions .propagate (t );
188
245
}
189
246
190
247
final RequestInterceptor interceptor = this .requestInterceptor ;
191
248
if (interceptor != null ) {
192
- interceptor .onStart (streamId , FrameType .REQUEST_FNF , p . sliceMetadata () );
249
+ interceptor .onStart (streamId , FrameType .REQUEST_FNF );
193
250
}
194
251
195
252
try {
0 commit comments