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


Java StartContext.asynchronous方法代码示例

本文整理汇总了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();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:22,代码来源:MyService.java

示例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();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:LdapConnectionManagerService.java

示例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();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:58,代码来源:ProcessStateListenerService.java


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