File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
rsocket-core/src/main/java/io/rsocket/core Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -345,15 +345,17 @@ private void terminate(Throwable e) {
345
345
requesterLeaseTracker .dispose (e );
346
346
}
347
347
348
+ final Collection <FrameHandler > activeStreamsCopy ;
348
349
synchronized (this ) {
349
350
final IntObjectMap <FrameHandler > activeStreams = this .activeStreams ;
350
- final Collection <FrameHandler > activeStreamsCopy = new ArrayList <>(activeStreams .values ());
351
- for (FrameHandler handler : activeStreamsCopy ) {
352
- if (handler != null ) {
353
- try {
354
- handler .handleError (e );
355
- } catch (Throwable ignored ) {
356
- }
351
+ activeStreamsCopy = new ArrayList <>(activeStreams .values ());
352
+ }
353
+
354
+ for (FrameHandler handler : activeStreamsCopy ) {
355
+ if (handler != null ) {
356
+ try {
357
+ handler .handleError (e );
358
+ } catch (Throwable ignored ) {
357
359
}
358
360
}
359
361
}
Original file line number Diff line number Diff line change @@ -185,15 +185,18 @@ final void doOnDispose() {
185
185
requestHandler .dispose ();
186
186
}
187
187
188
- private synchronized void cleanUpSendingSubscriptions () {
189
- final IntObjectMap <FrameHandler > activeStreams = this .activeStreams ;
190
- final Collection <FrameHandler > activeStreamsCopy = new ArrayList <>(activeStreams .values ());
188
+ private void cleanUpSendingSubscriptions () {
189
+ final Collection <FrameHandler > activeStreamsCopy ;
190
+ synchronized (this ) {
191
+ final IntObjectMap <FrameHandler > activeStreams = this .activeStreams ;
192
+ activeStreamsCopy = new ArrayList <>(activeStreams .values ());
193
+ }
194
+
191
195
for (FrameHandler handler : activeStreamsCopy ) {
192
196
if (handler != null ) {
193
197
handler .handleCancel ();
194
198
}
195
199
}
196
- activeStreams .clear ();
197
200
}
198
201
199
202
final void handleFrame (ByteBuf frame ) {
You can’t perform that action at this time.
0 commit comments