本文整理汇总了Java中org.jboss.msc.service.StartContext.failed方法的典型用法代码示例。如果您正苦于以下问题:Java StartContext.failed方法的具体用法?Java StartContext.failed怎么用?Java StartContext.failed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.msc.service.StartContext
的用法示例。
在下文中一共展示了StartContext.failed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
}
示例2: start
import org.jboss.msc.service.StartContext; //导入方法依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
try {
CassandraLogger.LOGGER.infof("Starting embedded cassandra service '%s'", clusterName);
// resolve the path location
// includes the _clusterName_ suffix to avid conflicts when different configurations are started on the same base system
if (null == serviceConfig.data_file_directories) {
serviceConfig.data_file_directories = new String[]{resolve(pathManager.getValue(),
CASSANDRA_DATA_FILE_DIR, ServerEnvironment.SERVER_DATA_DIR) + "/" + clusterName};
}
if (null == serviceConfig.saved_caches_directory) {
serviceConfig.saved_caches_directory = resolve(pathManager.getValue(), CASSANDRA_SAVED_CACHES_DIR,
ServerEnvironment.SERVER_DATA_DIR) + "/" + clusterName;
}
if (null == serviceConfig.commitlog_directory) {
serviceConfig.commitlog_directory = resolve(pathManager.getValue(), CASSANDRA_COMMIT_LOG_DIR,
ServerEnvironment.SERVER_DATA_DIR) + "/" + clusterName;
}
// static injection needed due to the way C* initialises it's ConfigLoader
DMRConfigLoader.CASSANDRA_CONFIG = serviceConfig;
System.setProperty("cassandra.config.loader", DMRConfigLoader.class.getName());
cassandraDaemon = instantiateCassandraDaemon();
cassandraDaemon.activate();
} catch (Throwable e) {
context.failed(new StartException(e));
}
}
示例3: start
import org.jboss.msc.service.StartContext; //导入方法依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
Runnable task = () -> {
try {
ProcessStateListenerService.this.listener.init(parameters);
controlledProcessStateService.getValue().addPropertyChangeListener(propertyChangeListener);
SuspendController controller = ProcessStateListenerService.this.suspendControllerInjectedValue.getOptionalValue();
if (controller != null) {
controller.addListener(operationListener);
CoreManagementLogger.ROOT_LOGGER.debugf("Starting ProcessStateListenerService with a SuspendControllerState %s", controller.getState());
switch (controller.getState()) {
case PRE_SUSPEND:
this.runningState = Process.RunningState.PRE_SUSPEND;
break;
case RUNNING:
if (parameters.getRunningMode() == Process.RunningMode.NORMAL) {
this.runningState = Process.RunningState.NORMAL;
} else {
this.runningState = Process.RunningState.ADMIN_ONLY;
}
break;
case SUSPENDED:
if (controlledProcessStateService.getValue().getCurrentState() == State.STARTING) {
this.runningState = Process.RunningState.STARTING;
} else {
this.runningState = Process.RunningState.SUSPENDED;
}
break;
case SUSPENDING:
this.runningState = Process.RunningState.SUSPENDING;
break;
}
} else {
CoreManagementLogger.ROOT_LOGGER.debugf("Starting ProcessStateListenerService with a ControllerProcessState of %s", controlledProcessStateService.getValue().getCurrentState());
if (controlledProcessStateService.getValue().getCurrentState() == State.STARTING) {
this.runningState = Process.RunningState.STARTING;
} else {
if (parameters.getRunningMode() == Process.RunningMode.NORMAL) {
this.runningState = Process.RunningState.NORMAL;
} else {
this.runningState = Process.RunningState.ADMIN_ONLY;
}
}
}
context.complete();
} catch (RuntimeException t) {
context.failed(new StartException(CoreManagementLogger.ROOT_LOGGER.processStateInitError(t, name)));
}
};
try {
executorServiceValue.getValue().execute(task);
} catch (RejectedExecutionException e) {
task.run();
} finally {
context.asynchronous();
}
}