单例模式 异常抛出

public class FileUtil {

    private static class SingleFileUtill{
        private static FileSystem fs = null;
        static{
            fs = SingleFileUtill.getInstance();
        }

        private static FileSystem getInstance(){
            Configuration conf = new Configuration();
            FileSystem fs = null;
            try {
                fs = FileSystem.get(conf);
                return fs;
            } catch (IOException e) {
                e.printStackTrace();
            }
            return fs;
        }

    }
    public static FileSystem getFileSystem(){
        return SingleFileUtill.fs;
    }
}
posted @ 2015-10-20 14:40  写昵称不如写代码  阅读(166)  评论(0编辑  收藏  举报