-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add a onClose()
method to the client to indicate the connection has been closed
#1283
Comments
If there is interest, this is something I can look at adding/implementing in RESTEasy. I'll be on PTO for starting Thursday through the following week, but I can likely look in late September or early October. |
Closing a connection is an event like many others. Would it make sense to consider the addition of a more generic event listener instead? |
I agree with @jamezp that adding a method to indicate the connection has been closed will be a nice feature. @spericas, is that what you have in mind when you said "more generic event listener instead" ? -- Nicolas |
@NicoNes Not necessary, my point is that if we identify other useful events to listen for, these should all be grouped in a proper listener instead of creating a method for each one. I'm also not a big fan of using |
@spericas I would be fine with some kind of event listener too. The idea with a CompletionStage is just the API was already there. Did the top of my head the events I could see are:
Closed and Connection Failed seem like the most important though which is why I thought of a CompletionStage. |
It would be nice for users, and implementations, to have something like an
onClose()
method on theClient
API. It could look something like:The
CompletionStage
would be completed when theclose()
method is invoked. While in most cases the user is in control of when theClient
gets closed, there are cases like CDI where the client may be injected and the user wants to know then the client has been closed.Implementations could also use this if the connection has been reset and/or a reconnect is not possible. In this case the
CompletionStage
can end exceptionally.The text was updated successfully, but these errors were encountered: