You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2009/01/14 11:20:59 UTC

[jira] Created: (JCR-1934) DbDataStore: delete temporary files using finalize()

DbDataStore: delete temporary files using finalize()
----------------------------------------------------

                 Key: JCR-1934
                 URL: https://issues.apache.org/jira/browse/JCR-1934
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
          Components: jackrabbit-core
            Reporter: Thomas Mueller
            Assignee: Thomas Mueller


Currently, reading from the DbDataStore creates a temporary file by default. If the application doesn't fully read or close the input stream, the file is not deleted. The best solution is to use finally { in.close() } in the application, but this is easily forgotten.

I suggest to delete the temp file using finalize(). There is a small performance penalty when creating the temporary object, but compared to I/O it is very small. Note that FileInputStream and FileOutputStream also use finalize().

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


[jira] Resolved: (JCR-1934) DbDataStore: delete temporary files using finalize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller resolved JCR-1934.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6.0

Committed in revision 740262 (trunk).
Temporary files are now deleted when the input stream is garbage collected.
Database resources are released when the input stream is garbage collected.

> DbDataStore: delete temporary files using finalize()
> ----------------------------------------------------
>
>                 Key: JCR-1934
>                 URL: https://issues.apache.org/jira/browse/JCR-1934
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 1.6.0
>
>
> Currently, reading from the DbDataStore creates a temporary file by default. If the application doesn't fully read or close the input stream, the file is not deleted. The best solution is to use finally { in.close() } in the application, but this is easily forgotten.
> I suggest to delete the temp file using finalize(). There is a small performance penalty when creating the temporary object, but compared to I/O it is very small. Note that FileInputStream and FileOutputStream also use finalize().

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


[jira] Commented: (JCR-1934) DbDataStore: delete temporary files using finalize()

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663717#action_12663717 ] 

Jukka Zitting commented on JCR-1934:
------------------------------------

We may want to leverage the AutoCloseInputStream class [1] I wrote for Commons IO 1.4. It will automatically call close() on the stream when the last byte is read or when the stream is finalized.

[1] http://commons.apache.org/io/api-release/org/apache/commons/io/input/AutoCloseInputStream.html

> DbDataStore: delete temporary files using finalize()
> ----------------------------------------------------
>
>                 Key: JCR-1934
>                 URL: https://issues.apache.org/jira/browse/JCR-1934
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>
> Currently, reading from the DbDataStore creates a temporary file by default. If the application doesn't fully read or close the input stream, the file is not deleted. The best solution is to use finally { in.close() } in the application, but this is easily forgotten.
> I suggest to delete the temp file using finalize(). There is a small performance penalty when creating the temporary object, but compared to I/O it is very small. Note that FileInputStream and FileOutputStream also use finalize().

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


[jira] Commented: (JCR-1934) DbDataStore: delete temporary files using finalize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663724#action_12663724 ] 

Thomas Mueller commented on JCR-1934:
-------------------------------------

AutoCloseInputStream: good idea!

> DbDataStore: delete temporary files using finalize()
> ----------------------------------------------------
>
>                 Key: JCR-1934
>                 URL: https://issues.apache.org/jira/browse/JCR-1934
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>
> Currently, reading from the DbDataStore creates a temporary file by default. If the application doesn't fully read or close the input stream, the file is not deleted. The best solution is to use finally { in.close() } in the application, but this is easily forgotten.
> I suggest to delete the temp file using finalize(). There is a small performance penalty when creating the temporary object, but compared to I/O it is very small. Note that FileInputStream and FileOutputStream also use finalize().

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


[jira] Commented: (JCR-1934) DbDataStore: delete temporary files using finalize()

Posted by "James Abley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664546#action_12664546 ] 

James Abley commented on JCR-1934:
----------------------------------

And another commons IO suggestion - FileCleaner[1]

[1] http://commons.apache.org/io/api-release/org/apache/commons/io/FileCleaner.html

> DbDataStore: delete temporary files using finalize()
> ----------------------------------------------------
>
>                 Key: JCR-1934
>                 URL: https://issues.apache.org/jira/browse/JCR-1934
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>
> Currently, reading from the DbDataStore creates a temporary file by default. If the application doesn't fully read or close the input stream, the file is not deleted. The best solution is to use finally { in.close() } in the application, but this is easily forgotten.
> I suggest to delete the temp file using finalize(). There is a small performance penalty when creating the temporary object, but compared to I/O it is very small. Note that FileInputStream and FileOutputStream also use finalize().

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