db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepa Remesh (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-1002) Check that DRDAStatement and DRDAResultSet states are reset when they are re-used
Date Sat, 25 Feb 2006 01:40:38 GMT
     [ http://issues.apache.org/jira/browse/DERBY-1002?page=all ]

Deepa Remesh updated DERBY-1002:
--------------------------------

    Attachment: derby1002-patch1-draft1.diff
                derby1002-patch1-draft1.status

Attaching a draft patch 'derby1002-patch1-draft1.diff'. This patch is only for review.

Summary of patch: 
* Adds reset() methods to DRDAStatement and DRDAResultSet objects. The purpose of reset method
is to reset  the states of all variables so that the objects can be re-used and will not have
left-over states. 

* In case of DRDAStatement, the following variables are not reset:
+     * 1. database - This variable gets initialized in the constructor and by
+     * call to setDatabase.
+     * 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn, 
+     * pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to 
+     * find if the DRDAStatement can be re-used. Hence its value will not change 
+     * when the object is re-used.

* close() methods are changed to only close and dereference objects. 

* DRDAStatement.rsClose() method is not used in close() or reset(). This method has some checks
which were causing the method to return without resetting currentDrdaRs. Now, close() calls
currentDrdaRs.close() and reset() calls currentDrdaRs.reset().

* In Database.newDrdaStatement, close() method is called followed by reset() when the server
finds the statement can be re-used.

Initially, I was thinking reset should also call close methods for the jdbc objects instead
of just resetting them to null so that the jdbc objects get cleaned up properly if just reset()
is called. Any comments on how it is done now? I was also thinking about calling reset at
places where DRDAStatement.initialize is currently called to re-use default statements. On
looking more into the code, I find default statements are different in the way they get initialized
and used. e.g: stmt variable used in default statement is created only once in Database.makeConnection.
I have to see the usage of default statements to see what exactly it means to re-initialize
them. 

There are some TODO items identified in discussion with Knut and Kathey in the following mail
thread: 
http://www.nabble.com/-DRDA-Question-about-DRDAStatement.initialize%28%29-method-t1177861.html

TODOs:
* Add the repro to test suite.
* pkgcnstkn, pkgid, pkgsn variables can be removed from DRDAStatement since these are derived
from pkgnamcsn object.
* Look into what is required by initialize() of default statement. Currently, initialize just
calls setTypDefValues().

I ran my repro with this patch. derbyall is not complete. I will update with results of test
run later. Please take a look at this patch. Thanks.

> Check that DRDAStatement and DRDAResultSet states are reset when they are re-used
> ---------------------------------------------------------------------------------
>
>          Key: DERBY-1002
>          URL: http://issues.apache.org/jira/browse/DERBY-1002
>      Project: Derby
>         Type: Bug
>   Components: Network Server
>     Reporter: Deepa Remesh
>     Assignee: Deepa Remesh
>      Fix For: 10.2.0.0
>  Attachments: derby1002-patch1-draft1.diff, derby1002-patch1-draft1.status, derby1002.java
>
> Network server re-uses DRDAStatement and DRDAResultSet objects when client sends a request
with same section number. When re-using DRDAStatement, it's close() method is called which
inturn calls close() method of DRDAResultSet. For re-use to work properly, we have to ensure
the states of these objects are reset. This is not a bug but it is an area for possible improvements
like:
> * The reset of all states are not in the close() methods. The states get re-initialized
at different places in the code. Fo example, in case of DRDAResultSet, they get initialized
in some other DRDAStatement methods - like addResultSet, setRsDefaultOptions, setOPNQRYOptions,
setQueryOptions etc. It will be good to have all resets in one method.
> * The method name "close" is confusing since it is also called when objects get re-used.
For clarity, it may be good to have a method named reset(). And then have the close method
call reset.

-- 
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


Mime
View raw message