You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Hong Tang (JIRA)" <ji...@apache.org> on 2008/11/23 01:17:44 UTC

[jira] Issue Comment Edited: (HADOOP-4655) FileSystem.CACHE should be ref-counted

    [ https://issues.apache.org/jira/browse/HADOOP-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649987#action_12649987 ] 

hong.tang edited comment on HADOOP-4655 at 11/22/08 4:16 PM:
-------------------------------------------------------------

I have a better idea to fix the current problem with minimum change of the API:

- Make FileSystem.CACHE ref-counted.
- FileSystem.close() is no-op, and knows nothing about FileSystem.CACHE.
- Add two static methods whose names clearly reflect the shared nature of the FileSystem objects:
    - static FileSystem getFileSystem(Path, Configuration)
    - static void returnFileSystem(FileSystem)
- Deprecate Path.getFileSystem(Configuration), and suggest to use FileSystem.getFileSystem instead.

The recommended usage pattern would be:
- If a FileSystem object is created by new, then people should release resources by FileSystem.close().
- If a FileSystem object is obtained by getFileSystem, then the resource should be released through returnFileSystem.



      was (Author: hong.tang):
    I have a better idea to fix the current problem with minimum change of the API:

- Make FileSystem.CACHE ref-counted.
- FileSystem.close() is no-op, and knows nothing about FileSystem.CACHE.
- Add two static methods whose names clearly reflect the shared nature of the FileSystem objects:
    - static FileSystem getFileSystem(Path, Configuration)
    - static void returnFileSystem(FileSystem)
- Deprecate Path.getFileSystem(Configuration), and suggest to use FileSystem.borrowFileSystem instead.

The recommended usage pattern would be:
- If a FileSystem object is created by new, then people should release resources by FileSystem.close().
- If a FileSystem object is obtained by getFileSystem, then the resource should be released through returnFileSystem.


  
> FileSystem.CACHE should be ref-counted
> --------------------------------------
>
>                 Key: HADOOP-4655
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4655
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: dfs, fs
>    Affects Versions: 0.18.1, 0.18.2, 0.19.0, 0.19.1, 0.20.0
>            Reporter: Hong Tang
>
> FileSystem.CACHE is not ref-counted, and could lead to resource leakage.

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