public FastDFSClient(String conf) throws Exception { if (conf.contains("classpath:")) { conf = conf.replace("classpath:", this.getClass().getResource("/").getPath()); } ClientGlobal.init(conf); trackerClient = new TrackerClient(); trackerServer = trackerClient.getConnection(); storageServer = null; storageClient = new StorageClient1(trackerServer, storageServer); }
/** 只加载一次. */ static { try { logger.info("=== CONF_FILENAME:" + CONF_FILENAME); ClientGlobal.init(CONF_FILENAME); TrackerClient trackerClient = new TrackerClient(ClientGlobal.g_tracker_group); TrackerServer trackerServer = trackerClient.getConnection(); if (trackerServer == null) { logger.error("getConnection return null"); } StorageServer storageServer = trackerClient.getStoreStorage(trackerServer); if (storageServer == null) { logger.error("getStoreStorage return null"); } storageClient1 = new StorageClient1(trackerServer, storageServer); } catch (Exception e) { logger.error(e); } }