当前位置: 首页>>代码示例>>Java>>正文


Java StartContext类代码示例

本文整理汇总了Java中org.jboss.msc.service.StartContext的典型用法代码示例。如果您正苦于以下问题:Java StartContext类的具体用法?Java StartContext怎么用?Java StartContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StartContext类属于org.jboss.msc.service包,在下文中一共展示了StartContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext startContext) throws StartException {

    Consul.Builder builder = Consul.builder();


    // pool because of multiple threads.
    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder = clientBuilder.connectionPoolSize(20);

    builder.withClientBuilder(clientBuilder);
    builder.withUrl(this.url);

    try {
        this.consul = builder.build();
    } catch (Exception e) {
        throw new StartException("Failed to connect consul at " + url, e);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology-consul,代码行数:20,代码来源:ConsulService.java

示例2: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    ServiceTarget target = context.getChildTarget();

    ClientService clientService = new ClientService();
    target.addService(ClientService.SERVICE_NAME, clientService)
            .install();

    NamespaceService namespaceService = new NamespaceService();
    target.addService(NamespaceService.SERVICE_NAME, namespaceService)
            .addDependency(ClientService.SERVICE_NAME, IClient.class, namespaceService.getClientInjector())
            .install();

    ServiceWatcher watcher = new ServiceWatcher();
    target.addService(ServiceWatcher.SERVICE_NAME, watcher)
            .addDependency(ClientService.SERVICE_NAME, IClient.class, watcher.getClientInjector())
            .addDependency(NamespaceService.SERVICE_NAME, String.class, watcher.getNamespaceInjector())
            .addDependency(TopologyManagerActivator.SERVICE_NAME, TopologyManager.class, watcher.getTopologyManagerInjector())
            .install();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:OpenShiftTopologyConnector.java

示例3: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    int port = Integer.getInteger(SwarmProperties.ARQUILLIAN_DAEMON_PORT, 12345);

    try {
        this.server = Server.create("localhost", port);
        this.server.start();
    } catch (Exception e) {
        // this shouldn't be possible per Java control flow rules, but there is a "sneaky throw" somewhere
        //noinspection ConstantConditions
        if (e instanceof BindException) {
            log.log(Level.SEVERE, "Couldn't bind Arquillian Daemon on localhost:" + port
                    + "; you can change the port using system property '"
                    + SwarmProperties.ARQUILLIAN_DAEMON_PORT + "'", e);
        }

        throw new StartException(e);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:20,代码来源:DaemonService.java

示例4: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    parser = new HCIDumpParser(cmdArgs);
    final ServiceContainer serviceContainer = context.getController().getServiceContainer();

    try {
        log.infof("Begin scanning");
        // Start the scanner parser handler threads other than the native stack handler
        parser.start();
        // Setup the native bluetooth stack integration, callbacks, and stack thread
        HCIDump.setRawEventCallback(parser::beaconEvent);
        HCIDump.initScanner(cmdArgs.hciDev);
        // Schedule a thread to wait for a shutdown marker
        Thread shutdownMonitor = new Thread(() -> awaitShutdown(serviceContainer), "ShutdownMonitor");
        shutdownMonitor.setDaemon(true);
        shutdownMonitor.start();
    } catch (Exception e) {
        log.error("Scanner exiting on exception", e);
        context.failed(new StartException(e));
    }
}
 
开发者ID:RHioTResearch,项目名称:SwarmBeaconScanner,代码行数:22,代码来源:ScannerService.java

示例5: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    try {
        final String artifactName = System.getProperty(BootstrapProperties.APP_ARTIFACT);
        if (artifactName == null) {
            throw new StartException("Failed to find artifact name under " + BootstrapProperties.APP_ARTIFACT);
        }

        final ModuleLoader serviceLoader = this.serviceLoader.getValue();
        final String moduleName = "deployment." + artifactName;
        final Module module = serviceLoader.loadModule(ModuleIdentifier.create(moduleName));
        if (module == null) {
            throw new StartException("Failed to find deployment module under " + moduleName);
        }

        //TODO: allow overriding the default port?
        this.server = Server.create("localhost", 12345, module.getClassLoader());
        this.server.start();
    } catch (ModuleLoadException | ServerLifecycleException e) {
        throw new StartException(e);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:23,代码来源:DaemonServiceActivator.java

示例6: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext startContext) throws StartException {

    Consul.Builder builder = Consul.builder();


    // pool because of multiple threads.
    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder = clientBuilder.connectionPoolSize(20);

    builder.withClientBuilder(clientBuilder);
    builder.withUrl(this.url);

    try {
        this.consul = builder.build();
    } catch (Exception e) {
        throw new StartException("Failed to connect consul at "+url, e);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:20,代码来源:ConsulService.java

示例7: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
public void start(final StartContext startContext) throws StartException {
    startContext.asynchronous();
    this.active = true;
    this.thread = new Thread(new Runnable() {
        public void run() {
            startContext.complete();

            while (active) {
                System.err.println(message);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                	Thread.currentThread().interrupt();
                }
            }

        }
    });

    this.thread.start();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:22,代码来源:MyService.java

示例8: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    ModelNode propertiesModel = _model.hasDefined(CommonAttributes.PROPERTIES) ? _model.get(CommonAttributes.PROPERTIES) : null;
    Properties securityProps = toProperties(propertiesModel);
    _securityConfig = new SecurityConfig(securityProps);
    DefaultSystemSecurity systemSecurity = (DefaultSystemSecurity)getSystemSecurity().getValue();
    if (SecurityContext.class.getName().equals(_moduleId)) {
        String timeoutMillis = Strings.trimToNull(securityProps.getProperty("timeoutMillis"));
        if (timeoutMillis != null) {
            systemSecurity.setSecurityContextTimeoutMillis(Long.valueOf(timeoutMillis));
        }
    }
    if (PrivateCrypto.class.getName().equals(_moduleId)) {
        systemSecurity.setPrivateCrypto(new PrivateCrypto(securityProps));
    }
    if (PublicCrypto.class.getName().equals(_moduleId)) {
        systemSecurity.setPublicCrypto(new PublicCrypto(securityProps));
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:20,代码来源:SwitchYardSecurityConfigService.java

示例9: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    Class<?> componentClass;
    String className = _model.get(CommonAttributes.IMPLCLASS).asString();
    try {
        componentClass = Module.loadClassFromCallerModuleLoader(ModuleIdentifier.fromString(_moduleId), className);
        try {
            _component = (Component) componentClass.newInstance();
            ModelNode properties = _model.hasDefined(CommonAttributes.PROPERTIES) ? _model.get(CommonAttributes.PROPERTIES) : null;
            _component.init(createEnvironmentConfig(properties));
            LOG.debug("Initialized component " + _component);
            _component.addResourceDependency(_resourceAdapterRepository.getValue());
        } catch (InstantiationException ie) {
            ExtensionLogger.ROOT_LOGGER.unableToInstantiateClass(className, ie);
        } catch (IllegalAccessException iae) {
            ExtensionLogger.ROOT_LOGGER.unableToAccessConstructor(className, iae);
        }
    } catch (ClassNotFoundException cnfe) {
        ExtensionLogger.ROOT_LOGGER.unableToLoadClass(className, cnfe);
    } catch (ModuleLoadException mle) {
        ExtensionLogger.ROOT_LOGGER.unableToLoadModule(_moduleId, mle);
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:24,代码来源:SwitchYardComponentService.java

示例10: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void start(StartContext context) throws StartException {
    try {
        NamespaceContextSelector selector = _namespaceSelector.getValue();
        NamespaceContextSelector.pushCurrentSelector(selector);
        LOG.info("Starting SwitchYard service");
        List<Component> components = new ArrayList<Component>();
        for (InjectedValue<Component> component : _components) {
            components.add(component.getValue());
        }
        _switchyardDeployment.setNamespaceContextSelector(selector);
        _switchyardDeployment.start(components);
    } catch (Exception e) {
        try {
            _switchyardDeployment.stop();
        } catch (Exception ex) {
            LOG.error(ex);
        }
        throw new StartException(e);
    } finally {
        NamespaceContextSelector.popCurrentSelector();
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:25,代码来源:SwitchYardService.java

示例11: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
/**
 * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
 */
@Override
public void start(StartContext context) throws StartException {
    try {
        log.debug("Creating model controller client");
        modelControllerClient = injectedModelController.getValue().createClient(managementOperationExecutor);

        log.debug("Adding model controller client to scheduler context");
        scheduler.getContext().put(MODEL_CONTROLLER_CLIENT, modelControllerClient);

        log.info("Starting metrics scheduler");
        scheduler.start();
    } catch(SchedulerException e) {
        throw new StartException("Error starting scheduler", e);
    }
}
 
开发者ID:ncdc,项目名称:jboss-openshift-metrics-module,代码行数:19,代码来源:MetricsService.java

示例12: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
public synchronized void start(final StartContext context) throws StartException {
    ServerEnvironment serverEnvironment = configuration.getServerEnvironment();
    Bootstrap.ConfigurationPersisterFactory configurationPersisterFactory = configuration.getConfigurationPersisterFactory();
    extensibleConfigurationPersister = configurationPersisterFactory.createConfigurationPersister(serverEnvironment, getExecutorServiceInjector().getOptionalValue());
    setConfigurationPersister(extensibleConfigurationPersister);
    rootResourceDefinition.setDelegate(
            new ServerRootResourceDefinition(injectedContentRepository.getValue(),
                    extensibleConfigurationPersister, configuration.getServerEnvironment(), processState,
                    runningModeControl, vaultReader, configuration.getExtensionRegistry(),
                    getExecutorServiceInjector().getOptionalValue() != null,
                    (PathManagerService)injectedPathManagerService.getValue(),
                    new DomainServerCommunicationServices.OperationIDUpdater() {
                        @Override
                        public void updateOperationID(final int operationID) {
                            DomainServerCommunicationServices.updateOperationID(operationID);
                        }
                    },
                    authorizer,
                    securityIdentitySupplier,
                    super.getAuditLogger(),
                    getMutableRootResourceRegistrationProvider(),
                    super.getBootErrorCollector(),
                    configuration.getCapabilityRegistry()));
    super.start(context);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:ServerService.java

示例13: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public synchronized void start(StartContext context) throws StartException {
    InputStream is = getClass().getResourceAsStream("/" + propertiesResource);
    if (is != null) {
        try {
            System.out.println("Properties found");
            properties.load(is);
        } catch (IOException e) {
            throw new StartException(e);
        } finally {
            try {
                is.close();
            } catch (IOException ignored) {
                //
            }

        }
    } else {
        properties.setProperty(DEFAULT_SYS_PROP_NAME, DEFAULT_SYS_PROP_VALUE);
    }
    for (String name : properties.stringPropertyNames()) {
        System.setProperty(name, properties.getProperty(name));
        System.out.println("Setting "+ name + " to " + properties.getProperty(name));
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:ServiceActivatorDeployment.java

示例14: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    ExtensibleHttpManagement httpManagement = httpManagementInjector.getValue();

    ResourceManager rm = new ClassPathResourceManager(getClass().getClassLoader(), getClass().getPackage());
    httpManagement.addStaticContext("static", rm);
    log.info("Added context 'static'");

    ExtensibleHttpManagement.PathRemapper remapper = new ExtensibleHttpManagement.PathRemapper() {
        @Override
        public String remapPath(String originalPath) {
            if ("/foo".equals(originalPath)) {
                String prefix = forServer ? "" : "/host/master";
                return prefix + "/extension/" + EXTENSION_NAME;
            }
            return null;
        }
    };
    httpManagement.addManagementGetRemapContext("remap", remapper);
    log.info("Added context 'remap'");
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:CustomContextExtension.java

示例15: start

import org.jboss.msc.service.StartContext; //导入依赖的package包/类
@Override
public void start(final StartContext startContext) throws StartException {


    if (this.enabled) {


        // deferred startup: we have to wait until the server is running before we can monitor the subsystems (parallel service startup)
        ControlledProcessStateService stateService = processStateValue.getValue();
        serverStateListener = new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (ControlledProcessState.State.RUNNING.equals(evt.getNewValue())) {

                    MonitorLogger.LOGGER.infof("Starting monitoring subsystem");
                    startScheduler(startContext);
                }
            }
        };
        stateService.addPropertyChangeListener(serverStateListener);

    }

}
 
开发者ID:hawkular,项目名称:wildfly-monitor,代码行数:25,代码来源:RhqMetricsService.java


注:本文中的org.jboss.msc.service.StartContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。