Unanswered: Connection.isClosed() working in mysql-connector-java-3.0.4?
It appears that Connection.isClosed() may not be detecting closed connection in this latest driver. My connection pool manager is unable to detect the closed state caused by database restarts, or power outages (happens to me occasionaly) :-), and so us returning effectively null connections to my Statements.
I accept that, not internally testing the connection state is permissable behavior, based on reading the API section for isClosed(), but I might also argue that it is "under-achieving", because although the API allows for not actually testing for the connection being closed ---it also does not explicitly say that isClosed *should not* test for a broken connection. It seems to leave it at the discretion of the driver vendor.
In other words, the spec wouldnt be broken if the driver did or (did not) test the actual connection, right?
The main reason I'd argue that the driver's isClosed should internally do the ping is that the ping query is going to be (somewhat) database dependent (but I'm no expert on this topic), and so should be abstracted into the driver.
I do know that some other (albeit primitive) databases do not allow table-less query grammar like "select 'connected'", so there is no universal (non-abstract) 'ping' query by my reckoning (though I'm definately open to advise). I'd prefer not to put a 'ping' query into my connection pool.
I also realize that there is a performance penalty for the driver to do a 'query' test. So, cant the state be checked instead inside of perhaps StandardSocketFactory via some Socket methods; isConnected(), isClosed()? This sounds much more efficient.