public BootstrapListener(final ServiceContainer serviceContainer, final long startTime, final ServiceTarget serviceTarget, final FutureServiceContainer futureContainer, final String prettyVersion, final File tempDir) { this.serviceContainer = serviceContainer; this.startTime = startTime; this.serviceTarget = serviceTarget; this.prettyVersion = prettyVersion; this.futureContainer = futureContainer; this.tempDir = tempDir; serviceTarget.addMonitor(monitor); }
public BootstrapListener(final ServiceContainer serviceContainer, final long startTime, final ServiceTarget serviceTarget, final FutureServiceContainer futureContainer, final String prettyVersion) { this.serviceContainer = serviceContainer; this.startTime = startTime; this.serviceTarget = serviceTarget; this.prettyVersion = prettyVersion; this.futureContainer = futureContainer; serviceTarget.addMonitor(monitor); }
public BootstrapListener(final ServiceContainer serviceContainer, final long startTime, final ServiceTarget serviceTarget, final FutureServiceContainer futureContainer, final String prettyVersion, final File tempDir) { this.serviceContainer = serviceContainer; this.startTime = startTime; this.serviceTarget = serviceTarget; this.prettyVersion = prettyVersion; this.futureContainer = futureContainer; this.tempDir = tempDir; serviceTarget.addMonitor(monitor); }
/** {@inheritDoc} */ public ServiceTarget addMonitor(final StabilityMonitor monitor) { getDelegate().addMonitor(monitor); return this; }
/** {@inheritDoc} */ public ServiceTarget addMonitor(StabilityMonitor monitor) { getServiceTargetDelegate().addMonitor(monitor); return this; }
/** {@inheritDoc} */ public ServiceTarget addMonitor(StabilityMonitor monitor) { getServiceTargetDelegate().addMonitor(monitor); return this; }
/** {@inheritDoc} */ public ServiceTarget addMonitor(final StabilityMonitor monitor) { getDelegate().addMonitor(monitor); return this; }
private LiveOakFactory(File configDir, File applicationsDir, Vertx vertx, String bindAddress, ServiceContainer serviceContainer, ServiceTarget serviceTarget) { this.configDir = configDir; this.appsDir = applicationsDir; this.vertx = vertx; this.bindAddress = bindAddress; this.serviceContainer = serviceContainer; this.serviceTarget = serviceTarget; this.serviceTarget.addListener(new AbstractServiceListener<Object>() { @Override public void transition(ServiceController<?> controller, ServiceController.Transition transition) { if (transition.getAfter().equals(ServiceController.Substate.START_FAILED)) { log.errorf(controller.getStartException(), "Unable to start service: %s", controller.getName()); } } }); this.stabilityMonitor = new StabilityMonitor(); this.serviceTarget.addMonitor(this.stabilityMonitor); }
@Override public void mountPrivate(ServiceName privateName) { StabilityMonitor monitor = new StabilityMonitor(); target.addMonitor(monitor); MountService<RootResource> mount = new MountService(this.id); SystemResourceWrappingResourceService wrapper = new SystemResourceWrappingResourceService(); target.addService(privateName.append("wrapper"), wrapper) .addDependency(privateName, RootResource.class, wrapper.resourceInjector) .addDependency(Services.systemConfigurationManager(moduleId), ExtensionConfigurationManager.class, wrapper.managerInjector) .addDependency(Services.systemEnvironmentProperties(moduleId), Properties.class, wrapper.environmentPropertiesInjector) .addDependency(Services.CLIENT, Client.class, wrapper.clientInjector) .install(); InitializeResourceService configApply = new InitializeResourceService(); target.addService(privateName.append("apply-config"), configApply) .addDependency(privateName.append("wrapper"), RootResource.class, configApply.resourceInjector()) .addInjection(configApply.configurationInjector(), this.configuration) .install(); RootResourceLifecycleService lifecycle = new RootResourceLifecycleService(); target.addService(privateName.append("lifecycle"), lifecycle) .addDependency(privateName.append("apply-config")) .addDependency(privateName, RootResource.class, lifecycle.resourceInjector()) .install(); ServiceController<? extends Resource> controller = this.target.addService(privateName.append("mount"), mount) .addDependency(privateName.append("lifecycle")) .addDependency(this.systemExtensionMount, MountPointResource.class, mount.mountPointInjector()) .addDependency(privateName.append("wrapper"), RootResource.class, mount.resourceInjector()) .install(); }
/** * Gets a {@code ServiceTarget} {@link org.jboss.msc.service.ServiceTarget#subTarget() scoped to this step}, * with a {@link org.jboss.as.controller.ServiceVerificationHelper} registered, so all services * created by the target will be monitored. * @param parent the parent target. Cannot be {@code null} * @return the service target. Will not be {@code null} */ ServiceTarget getScopedServiceTarget(ServiceTarget parent) { if (serviceTarget == null) { serviceTarget = parent.subTarget(); serviceTarget.addMonitor(getServiceVerificationHelper().getMonitor()); } return serviceTarget; }
/** * Gets a {@code ServiceTarget} {@link org.jboss.msc.service.ServiceTarget#subTarget() scoped to this step}, * with a {@link org.jboss.as.controller.ServiceVerificationHelper} registered, so all services * created by the target will be monitored. * @param parent the parent target. Cannot be {@code null} * @return the service target. Will not be {@code null} */ ServiceTarget getScopedServiceTarget(ServiceTarget parent) { if (serviceTarget == null) { serviceTarget = parent.subTarget(); serviceTarget.addMonitor(getServiceVerificationHelper().getMonitor()); } return serviceTarget; }
public void load(String id, Extension extension, ObjectNode config, ExtensionConfigurationManager extensionConfigManager) throws Exception { ServiceName configManagerName = Services.systemConfigurationManager(id); target.addService(configManagerName, new ValueService<>(new ImmediateValue<>(extensionConfigManager))).install(); target.addService(Services.systemEnvironmentProperties(id), new ValueService<>(new ImmediateValue<>(envProperties()))).install(); StabilityMonitor monitor = new StabilityMonitor(); ServiceTarget target = this.target.subTarget(); target.addMonitor(monitor); ExtensionService extensionService = new ExtensionService(id, extension, config, extensionConfigManager); ServiceBuilder builder = target.addService(Services.extension(id), extensionService); JsonNode deps = config.get("dependencies"); if (deps != null) { for (JsonNode node : deps) { builder.addDependency(Services.extension(node.asText())); } } builder.install(); monitor.awaitStability(); }
public InternalApplicationExtension extend(String extensionId, String resourceId, ObjectNode configuration, boolean boottime) throws Exception { ServiceTarget target = this.target.subTarget(); StabilityMonitor monitor = new StabilityMonitor(); target.addMonitor(monitor); ServiceName resourceServiceName = Services.applicationExtension(this.id, resourceId); ApplicationExtensionService appExt = new ApplicationExtensionService(extensionId, resourceId, configuration, boottime); ServiceController<InternalApplicationExtension> controller = target.addService(resourceServiceName, appExt) .addDependency(Services.extension(extensionId), Extension.class, appExt.extensionInjector()) .addDependency(Services.application(this.id), InternalApplication.class, appExt.applicationInjector()) .addDependency(Services.SERVICE_REGISTRY, ServiceRegistry.class, appExt.serviceRegistryInjector()) .install(); monitor.awaitStability(); InternalApplicationExtension intAppExt = controller.awaitValue(); if (intAppExt.exception() != null) { intAppExt.remove(); log.error(intAppExt.exception()); throw intAppExt.exception(); } target.removeMonitor(monitor); return intAppExt; }
@Override public void start(StartContext context) throws StartException { ServiceTarget target = context.getChildTarget(); InternalApplicationExtension appExtension = this.appExtensionServiceController.getValue(); ApplicationExtensionContextImpl extensionContext = new ApplicationExtensionContextImpl( target, appExtension, null, null, JsonNodeFactory.instance.objectNode(), false); StabilityMonitor monitor = new StabilityMonitor(); target.addMonitor(monitor); try { this.extensionInjector.getValue().unextend(extensionContext); context.complete(); monitor.awaitStability(); } catch (Exception e) { throw new StartException(e); } // remove ourselves context.getController().setMode(ServiceController.Mode.REMOVE); }
@Override public void start(StartContext context) throws StartException { ServiceTarget target = context.getChildTarget(); StabilityMonitor monitor = new StabilityMonitor(); target.addMonitor(monitor); File appDir = this.appServiceController.getValue().directory(); try { context.asynchronous(); this.appServiceController.setMode(ServiceController.Mode.REMOVE); new Thread("ApplicationRemovalService worker thread") { public void run() { try { FileHelper.deleteNonEmpty(appDir.getAbsoluteFile()); context.complete(); } catch (Throwable e) { context.failed(new StartException("Unable to remove application directory: " + appDir.getAbsolutePath(), e)); } } }.start(); monitor.awaitStability(); target.removeMonitor(monitor); } catch (Exception e) { throw new StartException(e); } // remove ourselves context.getController().setMode(ServiceController.Mode.REMOVE); }