Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5549

Questionable behaviour of PooledConnection after receiving an interrupt



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • JDBC
    • Windows 7 64-bit
    • Normal
    • Repro attached, Workaround attached
    • Seen in production


      If using pooled connections and a connection is interrupted while doing some work, the underlying connection is closed, but none of this information is relayed to the pooled connection itself.

      As a result, attempting to use the pooled connection after interrupting a previous caller caused the connection to be closed results in a "No current connection." exception every time getConnection() is called on it.

      The exception handed to callers is a proxy of sorts and isClosed() on this connection returns false, which appears to be in contradiction with the documentation about how interrupts are handled. Additionally, even though a connection error occurs, the appropriate ConnectionEventListener method, connectionErrorOccurred, is not called. So there appears to be no way to know if this has occurred from the outside, short of looking for the interrupt flag itself (which makes the assumption that it hasn't been cleared since the connection was closed.)

      The workaround in our particular case is to check for the flag, because it happens to still be set when we get to the listener (at least for now.)




            Unassigned Unassigned
            trejkaz Trejkaz
            0 Vote for this issue
            0 Start watching this issue