try { Injector injector = app.strictConfig().initialize(); logLocation(log, "Working directory", Paths.get(".")); logLocation(log, "Etc directory", Paths.get("etc")); injector.getInstance(PluginManager.class).loadPlugins(); // 变更代码 presto原生加载catalog // injector.getInstance(StaticCatalogStore.class).loadCatalogs(); // 变更代码 动态加载catalog injector.getInstance(CatalogStore.class).loadCatalogs(); // // 变更代码 去掉在Server类加载ConnectorIds信息,统一在热加载模版更新 // updateConnectorIds(injector.getInstance(Announcer.class), injector.getInstance(CatalogManager.class)); injector.getInstance(SessionPropertyDefaults.class).loadConfigurationManager(); injector.getInstance(ResourceGroupManager.class).loadConfigurationManager(); injector.getInstance(AccessControlManager.class).loadSystemAccessControl(); injector.getInstance(PasswordAuthenticatorManager.class).loadPasswordAuthenticator(); injector.getInstance(EventListenerManager.class).loadEventListeners(); injector.getInstance(GroupProviderManager.class).loadConfiguredGroupProvider(); injector.getInstance(CertificateAuthenticatorManager.class).loadCertificateAuthenticator(); injector.getInstance(Announcer.class).start(); injector.getInstance(ServerInfoResource.class).startupComplete(); log.info("======== SERVER STARTED ========"); } catch (Throwable e) { log.error(e); System.exit(1); }远程加载流程 presto监听远程catalog配置变化做热加载 配置类,配置写在config.properties
public class DynamicCatalogStoreConfig { private boolean dynamic; private String restUrl; private long timerPeriod= 5L; private String secretKey; @Config("catalog.dynamic") public DynamicCatalogStoreConfig setDynamic(boolean dynamic) { this.dynamic = dynamic; return this; } @Config("catalog.dynamic.rest-url") public DynamicCatalogStoreConfig setRestUrl(String restUrl) { this.restUrl = restUrl; return this; } @Config("catalog.dynamic.timer-period-minutes") public DynamicCatalogStoreConfig setTimerPeriod(long timerPeriod) { this.timerPeriod = timerPeriod * 60 * 1000; return this; } @Config("catalog.dynamic.secret-key") public DynamicCatalogStoreConfig setSecretKey(String secretKey) { this.secretKey = secretKey; return this; } public boolean isDynamic() { return dynamic; } public String getRestUrl() { return restUrl; } public long getTimerPeriod() { return timerPeriod; } public String getSecretKey() { return secretKey; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)