You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a connection through the connection factory with automatic recovery enabled returns the correct object (AutorecoveringConnection), but since the return type of the function is Connection, the methods in AutorecoveringConnection are unavailable without casting the return value, which isn't natural. In fact, most users are probably unaware that such a class even exists since it doesn't appear in website's API guide anywhere.
I don't know exactly how many differences there are, but I was specifically looking for the addRecoveryListener method. To not complicate things too much, a simple solution could be to expose the method in the Connection interface, but only implement it in AutorecoveringConnection.
The text was updated successfully, but these errors were encountered:
Those methods are specific to AutorecoveringConnection and do not belong to the Connection interface unless we want to entirely disable non-recovering connections. This has been discussed and asking for a cast for class-specific functionality is not entirely unreasonable.
Fair enough, I never liked casting, but I know it is just a personal preference. It really should at least be in the API guide so users know about the caveat.
Creating a connection through the connection factory with automatic recovery enabled returns the correct object (
AutorecoveringConnection
), but since the return type of the function isConnection
, the methods inAutorecoveringConnection
are unavailable without casting the return value, which isn't natural. In fact, most users are probably unaware that such a class even exists since it doesn't appear in website's API guide anywhere.I don't know exactly how many differences there are, but I was specifically looking for the
addRecoveryListener
method. To not complicate things too much, a simple solution could be to expose the method in theConnection
interface, but only implement it inAutorecoveringConnection
.The text was updated successfully, but these errors were encountered: