本文整理汇总了Java中org.jboss.msc.service.StartException类的典型用法代码示例。如果您正苦于以下问题:Java StartException类的具体用法?Java StartException怎么用?Java StartException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StartException类属于org.jboss.msc.service包,在下文中一共展示了StartException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例2: start
import org.jboss.msc.service.StartException; //导入依赖的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();
}
示例3: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例4: start
import org.jboss.msc.service.StartException; //导入依赖的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));
}
}
示例5: startNest
import org.jboss.msc.service.StartException; //导入依赖的package包/类
protected void startNest() throws StartException {
if (isStarted()) {
return; // nothing to do, already started
}
msglog.infoNestName(getNestName());
// // we don't necessarily need the broker, but if it is not started, log that fact.
// BrokerService broker = this.brokerService.getValue();
// if (broker.isBrokerStarted()) {
// try {
// setupMessaging(broker);
// } catch (Exception e) {
// throw new StartException("Cannot initialize messaging client", e);
// }
// } else {
// msglog.infoBrokerServiceNotStarted();
// }
this.started = true;
}
示例6: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例7: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例8: createConnectorManagers
import org.jboss.msc.service.StartException; //导入依赖的package包/类
private void createConnectorManagers(ConnectorManagerRepository cmr, final TranslatorRepository repo, final VDBMetaData deployment) throws StartException {
final IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
try {
ConnectorManagerRepository.ExecutionFactoryProvider provider = new ConnectorManagerRepository.ExecutionFactoryProvider() {
@Override
public ExecutionFactory<Object, Object> getExecutionFactory(String name) throws ConnectorManagerException {
return VDBService.getExecutionFactory(name, repo, getTranslatorRepository(), deployment, map, new HashSet<String>());
}
};
cmr.setProvider(provider);
cmr.createConnectorManagers(deployment, provider);
} catch (ConnectorManagerException e) {
if (e.getCause() != null) {
throw new StartException(IntegrationPlugin.Event.TEIID50035.name()+" "+e.getMessage(), e.getCause()); //$NON-NLS-1$
}
throw new StartException(e.getMessage());
}
}
示例9: start
import org.jboss.msc.service.StartException; //导入依赖的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();
}
示例10: start
import org.jboss.msc.service.StartException; //导入依赖的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));
}
}
示例11: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例12: start
import org.jboss.msc.service.StartException; //导入依赖的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();
}
}
示例13: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
}
示例14: start
import org.jboss.msc.service.StartException; //导入依赖的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);
}
示例15: start
import org.jboss.msc.service.StartException; //导入依赖的package包/类
@Override
public synchronized void start(StartContext context) throws StartException {
try {
this.jarFile = new JarFile(file);
} catch (IOException e) {
throw new StartException(e);
}
final ModuleSpec.Builder specBuilder = ModuleSpec.build(moduleIdentifier);
addResourceRoot(specBuilder, jarFile);
//TODO: We need some way of configuring module dependencies for external archives
ModuleIdentifier javaee = ModuleIdentifier.create("javaee.api");
specBuilder.addDependency(DependencySpec.createModuleDependencySpec(javaee));
specBuilder.addDependency(DependencySpec.createLocalDependencySpec());
// TODO: external resource need some kind of dependency mechanism
ModuleSpec moduleSpec = specBuilder.create();
this.moduleDefinition = new ModuleDefinition(moduleIdentifier, Collections.<ModuleDependency>emptySet(), moduleSpec);
ServiceModuleLoader.installModuleResolvedService(context.getChildTarget(), moduleIdentifier);
}