Finalization of statements in client driver should handle sending of CLSQRY to 
close result sets on network server
------------------------------------------------------------------------------------------------------------------

         Key: DERBY-1104
         URL: http://issues.apache.org/jira/browse/DERBY-1104
     Project: Derby
        Type: Sub-task
  Components: Network Client  
    Reporter: Deepa Remesh
    Priority: Minor


Currently, the finalizer in client driver's statement classes do only 
client-side cleanup. Cleanup of statements and result sets on network server 
will happen only when the client driver re-uses a section number for a new 
statement. DRDA has CLSQRY command which can be sent to close the result sets 
on the server. This command has to be sent as part of statement finalization so 
that result sets will get cleaned up immediately on the server without waiting 
for the re-use to happen.

The code to send CLSQRY needs to be  synchronized. Hence it cannot be added 
directly to finalize method. Dan pointed out that we should avoid any 
synchronized operation in the finalizer since there is a potential to block the 
finalizer thread and potentially the JVM. Embedded driver performs the cleanup 
actions outside the finalizer. See EmbedPreparedStatement.finalize. A similar 
mechanism needs to be used in client driver.

The comments in DERBY-210 has more details, specifically the following comments:
http://www.nabble.com/Re%3A-jira-Commented%3A-%28DERBY-210%29-Network-Server-will-leak-prepared-statements-if-not-explicitly-closed-by-the-user-until-the-connection-is-closed-p3039721.html
http://www.nabble.com/-jira-Commented%3A-%28DERBY-210%29-Network-Server-will-leak-prepared-statements-if-not-explicitly-closed-by-the-user-until-the-connection-is-closed-p3030678.html
http://www.nabble.com/-jira-Commented%3A-%28DERBY-210%29-Network-Server-will-leak-prepared-statements-if-not-explicitly-closed-by-the-user-until-the-connection-is-closed-p3039390.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to