单例模式 异常抛出

来源:互联网 发布:notes软件 编辑:程序博客网 时间:2024/05/18 01:18
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;    }}
0 0
原创粉丝点击