本文整理汇总了Java中org.jboss.msc.service.StartContext.asynchronous方法的典型用法代码示例。如果您正苦于以下问题:Java StartContext.asynchronous方法的具体用法?Java StartContext.asynchronous怎么用?Java StartContext.asynchronous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.msc.service.StartContext
的用法示例。
在下文中一共展示了StartContext.asynchronous方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: start
import org.jboss.msc.service.StartContext; //导入方法依赖的package包/类
public synchronized void start(final StartContext context) throws StartException {
try {
context.execute(new Runnable() {
@Override
public void run() {
connectionManagerRegistry.addLdapConnectionManagerService(name, LdapConnectionManagerService.this);
context.complete();
}
});
} finally {
context.asynchronous();
}
}
示例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();
}
}