jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2749) Closing a session twice shouldn't write a warning in the log
Date Thu, 16 Sep 2010 08:39:35 GMT

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

Jukka Zitting commented on JCR-2749:
------------------------------------

a) It's not illegal, but doing so is practically always a sign of some resource management
error. Thus I think a warning is in place, just like when we log a warning when a client forgets
to close a session (see JCR-1216).

b) Since a duplicate logout() is not strictly speaking illegal (see a), an assertion is IMHO
the wrong thing to use. Generally speaking nothing that a JCR client can produce by invoking
standard JCR methods should ever be able to trigger an assertion. StackOverflow summarizes
this nicely: "Use assertions for internal logic checks within your code, and normal exceptions
for error conditions outside your immediate code's control." (http://stackoverflow.com/questions/1276308/exception-vs-assertion)

Also, I'd rather avoid extra behaviour that's only activated during test runs (I know we have
some of them in the codebase), since such code erodes the purpose of testing by making the
test system behave differently than a production system. If we want a way for the test suite
to check against these situations, we should either make it scan the log file for logged warnings
or add a more generic mechanism by which a client application can specify custom handling
of problems like this.

> Closing a session twice shouldn't write a warning in the log
> ------------------------------------------------------------
>
>                 Key: JCR-2749
>                 URL: https://issues.apache.org/jira/browse/JCR-2749
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>    Affects Versions: 2.2.0
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: sessionClose.txt
>
>
> When closing a session twice the following warning is written to the log file as of JCR-2741:
> "This session has already been closed. See the chained exception for a trace of where
the session was closed."
> I think the second "close()" should simply be ignored, without warning.

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