-
Notifications
You must be signed in to change notification settings - Fork 353
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
Close ReactiveSocket
on DuplexConnection
close.
#128
Comments
It seems a bit of a shame to lose AutoCloseable. it simplifies client usage, where often the synchronous close is useful with try-with-resources blocks. |
@yschimke I would like to hear more of the cases where try-with-resources is useful for real world applications. I would always end up doing Having said that, I think we can always provide a utility method elsewhere which converts asynchronous |
As described in the issue, currently `ReactiveSocket` does not listen to `DuplexConnection` closures. As suggested in the issue, removed `onShutdown()` and `shutdown()` methods, in favor of `close()` and `closeNotifier()` methods. Added `close()` and `closeNotifier()` methods in `DuplexConnection`
technically this wouldn't close until someone request(n) the close - so that could be a little weird. why not use a CompletableFuture? |
As described in the issue, currently `ReactiveSocket` does not listen to `DuplexConnection` closures. As suggested in the issue, removed `onShutdown()` and `shutdown()` methods, in favor of `close()` and `closeNotifier()` methods. Added `close()` and `closeNotifier()` methods in `DuplexConnection`
* Fixes issue #128 (Close on `DuplexConnection`) As described in the issue, currently `ReactiveSocket` does not listen to `DuplexConnection` closures. As suggested in the issue, removed `onShutdown()` and `shutdown()` methods, in favor of `close()` and `onClose()` methods. Added `close()` and `onClose()` methods in `DuplexConnection`
@NiteshKant I agree but would probably differentiate between expert users, and normal users. I think making the simplest most Java idiomatic thing work correctly (but not optimally) is a cost worth paying. e.g. the clarity of the sample code that will be cut and paste everywhere. It's a lot easier for users to go from correct+simpler -> correct+optimal once they care enough. |
0.5.x has |
Problem
Today,
ReactiveSocket
does not know when the underlyingDuplexConnection
is closed. This has two problems:KeepAlive
frame or writing/reading other frames. Although this "works" but is not ideal as that means we have to wait till theKeepAlive
duration or next write to know about something that is easily available from the transport layer.ReactiveSocket
closes.onShutdown()
only handles explicitshutdown()
calls.Proposal
We can add two methods to
ReactiveSocket
, viz.,and
The above can replace the following methods that currently exist:
Same methods will be added to
DuplexConnection
thus wiringclose()
together and providing correct notifications to users when theReactiveSocket
is closed.We can modify
onShutdown()
andshutdown()
methods to the signature of my proposal but I thinkclose()
is more inline with other implementations of connections found elsewhere.Current
close()
method is inherited fromAutoCloseable
which signifies synchronous execution as it returnvoid
.The text was updated successfully, but these errors were encountered: