/** * 加载配置文件 * * @param stormConf * @param context */ public void prepare(Map stormConf, TopologyContext context) { boolean isOnline = Boolean.parseBoolean(stormConf.get("isOnline").toString()); if (isOnline) { _gamecfg = stormConf.get("gamecfg_path").toString(); } else { _gamecfg = "/config/test.games.properties"; } _prop = _cfgLoader.loadConfig(_gamecfg, isOnline); _jedis = new jedisUtil() .getJedis( _prop.getProperty("redis.host"), Integer.parseInt(_prop.getProperty("redis.port")), 11); _dbconnect = new mysql(); }
@Override public void prepare(Map stormConf, TopologyContext context) { if (stormConf.get("isOnline").toString().equals("true")) { _gamecfg = stormConf.get("gamecfg_path").toString(); } else { _gamecfg = "/config/test.games.properties"; } _prop = _cfgLoader.loadConfig(_gamecfg, Boolean.parseBoolean(stormConf.get("isOnline").toString())); // InputStream game_cfg_in = getClass().getResourceAsStream("/config/games.properties"); // InputStream game_cfg_in = getClass().getResourceAsStream(_gamecfg); // try { // _prop.load(game_cfg_in); // } catch (IOException e) { // e.printStackTrace(); // } _dbconnect = new mysql(); }