private ServerSelector() { try { { String classname = Silica.getGlobalConfig("server.select.logic"); Class<?> s = ServerSelector.class.getClassLoader().loadClass(classname); selectLogic = (SelectLogic) s.newInstance(); } { String classname = Silica.getGlobalConfig("server.class"); Class<?> s = ServerSelector.class.getClassLoader().loadClass(classname); String[] addresses = Silica.getGlobalConfig("server.addresses").split(","); for (String address : addresses) { if (address == null) { continue; } address = address.trim(); if (address.length() == 0) { continue; } if (serverMap.get(address) == null) { createServer(address, s); } else { LOG.warn("server [{}] is already in silica config file.", address); } } } } catch (Exception e) { LOG.error("Could not initialize ServerSelector.", e); } }
/** * ローカルサーバを返す * * @return ローカルサーバ */ public Server getLocalServer() { return serverMap.get(Silica.getGlobalConfig(Config.KEY_HOST_ADDRESS)); }