jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1388) Jackrabbit does not allow concurrent reads to the data store if copyWhenReading=false
Date Mon, 10 Mar 2008 09:29:46 GMT

    [ https://issues.apache.org/jira/browse/JCR-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576912#action_12576912
] 

Thomas Mueller commented on JCR-1388:
-------------------------------------

Hi,

In TestTwoGetStreams there are many 'if' without {}:

            if (i2 != null)
                i2.close();

According to the code style, this should be written

            if (i2 != null) {
                i2.close();
            }

As I wrote before, I suggest you use Checkstyle so that you can find such problems yourself.


What is the reason for the following code?

        i1.close();
        i2.close();
        try {
            if (i1 != null)
                i1.close();
        } catch (IOException e) {
            log.info("Could not close first input stream: ", e);
        }
        try {
            if (i2 != null)
                i2.close();
        } catch (IOException e) {
            log.info("Could not close second input stream: ", e);
        }

Why do you close i1 and i2 twice? Why do you check for null?

The line
private final static int BLOCK_SIZE = 4 * 1024;
should be (according to Checkstyle):
private static final int BLOCK_SIZE = 4 * 1024;

Your method assertEquals is incorrect:

            while (n1 != -1 || n2 != -1) {
                n1 = i1.read(b1);
                n2 = i2.read(b2);
                for (int i = 0; i < n1; i++) {
                    assertEquals(message + "; byte #" + i + " mismatch!", b2[i], b1[i]);
                }
                count1 += n1;
                count2 += n2;
            }

i1 and i2 may not return the same number of bytes (n1 != n2). I suggest to test byte by byte.

Otherwise everything looks very good to me.

Regards,
Thomas


> Jackrabbit does not allow concurrent reads to the data store if copyWhenReading=false
> -------------------------------------------------------------------------------------
>
>                 Key: JCR-1388
>                 URL: https://issues.apache.org/jira/browse/JCR-1388
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>    Affects Versions: 1.4
>         Environment: WinXP x64, Eclipse, remote SQL Server 2005
>            Reporter: Esteban Franqueiro
>         Attachments: JCR-1388-datastore-concurrent-reads.2.patch, JCR-1388-datastore-concurrent-reads.4.patch,
JCR-1388-datastore-concurrent-reads.8.patch, JCR-1388-datastore-concurrent-reads.patch, TestTwoGetStreams.java
>
>
> Jackrabbit does not allow concurrent reads to the data store if copyWhenReading=false,
even if maxConnections>1.
> See JCR-1184 for a test for this problem (run it with copyWhenReading=false).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message