static ManagementHost createManagementHost(String[] args) throws Throwable { ManagementHost h = new ManagementHost(); h.initialize(args); h.registerOperationInterceptors(); h.start(); h.setAuthorizationContext(h.getSystemAuthorizationContext()); h.log(Level.INFO, "**** Management host starting ... ****"); h.startFabricServices(); h.startManagementServices(); waitForDefaultRegistryCreated(h); h.log(Level.INFO, "**** Management host started. ****"); h.setAuthorizationContext(null); Runtime.getRuntime().addShutdownHook(new Thread(() -> { h.log(Level.WARNING, "Host stopping ..."); h.stop(); h.log(Level.WARNING, "Host is stopped"); })); return h; }
protected ManagementHost initializeHostAndServices(String[] args) throws Throwable { log(Level.INFO, "Initializing ..."); initialize(args); log(Level.INFO, "Registering service interceptors ..."); registerOperationInterceptors(); log(Level.INFO, "Starting ..."); start(); log(Level.INFO, "Setting authorization context ..."); // Set system user's authorization context to allow the services start privileged access. setAuthorizationContext(getSystemAuthorizationContext()); log(Level.INFO, "**** Management host starting ... ****"); startFabricServices(); startManagementServices(); startClosureServices(this, startMockHostAdapterInstance); startSwaggerService(); startCustomSwaggerService(); log(Level.INFO, "**** Management host started. ****"); log(Level.INFO, "**** Migration service starting... ****"); super.startFactory(new LegacyMigrationTaskService()); super.startFactory(new MigrationTaskService()); // Clean up authorization context to avoid privileged access. setAuthorizationContext(null); return this; }