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


Java Framework.waitForStop方法代码示例

本文整理汇总了Java中org.osgi.framework.launch.Framework.waitForStop方法的典型用法代码示例。如果您正苦于以下问题:Java Framework.waitForStop方法的具体用法?Java Framework.waitForStop怎么用?Java Framework.waitForStop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.launch.Framework的用法示例。


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

示例1: test2InstallBundle

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
@Test
public void test2InstallBundle() throws Exception
{
    Framework fw = getFramework();
    fw.start();
    
    // install bundle w/o dependency
    Bundle newBundle = installBundle(fw, getClass().getResource("/test-nodep.jar").toString(), "org.sensorhub.test");
            
    // attempt to start it
    newBundle.start();
    assertEquals("Bundle should be in ACTIVE state", Bundle.ACTIVE, newBundle.getState());
    
    fw.stop();
    fw.waitForStop(0);
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:17,代码来源:TestOsgi.java

示例2: test3BundleDependencies

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
@Test
public void test3BundleDependencies() throws Exception
{
    Framework fw = getFramework();
    fw.start();
    
    assertEquals("Wrong number of loaded bundles", 1, fw.getBundleContext().getBundles().length);
    
    // install 1st bundle
    installBundle(fw, getClass().getResource("/test-nodep.jar").toString(), "org.sensorhub.test");
    
    // install 2nd bundle
    Bundle bundle2 = installBundle(fw, getClass().getResource("/test-withdep.jar").toString(), "org.sensorhub.test2");
    
    bundle2.start();
    assertEquals("Bundle " + bundle2.getSymbolicName() + " should be in ACTIVE state", Bundle.ACTIVE, bundle2.getState());
    
    fw.stop();
    fw.waitForStop(0);
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:21,代码来源:TestOsgi.java

示例3: waitForServerStop

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
/**
 * Wait until this Framework has completely stopped.
 *
 * @param framework OSGi framework
 * @throws java.lang.Exception
 */
private void waitForServerStop(Framework framework) throws Exception {
    if (!isFrameworkActive()) {
        return;
    }

    while (true) {
        FrameworkEvent event = framework.waitForStop(0);

        // We should not stop the framework if the user has updated the system bundle via the OSGi console or
        //  programmatically. In this case, framework will shutdown and start itself.
        if (event.getType() != FrameworkEvent.STOPPED_UPDATE) {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "OSGi framework is stopped for update.");
            }
            break;
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:25,代码来源:CarbonServer.java

示例4: test1StartStopFramework

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
@Test
public void test1StartStopFramework() throws Exception
{
    Framework fw = getFramework();
    fw.start();
    Thread.sleep(500);
    fw.stop();
    fw.waitForStop(0);
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:10,代码来源:TestOsgi.java

示例5: initialize

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
private void initialize() throws BundleException, URISyntaxException {

        Map<String, String> configMap = loadProperties();
        System.setProperty(LOG_CONFIG_FILE_PROPERTY, configMap.get(LOG_CONFIG_FILE_PROPERTY));
   
        System.out.println("Building OSGi Framework");
        FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
        Framework framework = frameworkFactory.newFramework(configMap);

        framework.init();
        // (9) Use the system bundle context to process the auto-deploy
        // and auto-install/auto-start properties.
        AutoProcessor.process(configMap, framework.getBundleContext());
        // (10) Start the framework.
        System.out.println("Starting OSGi Framework");
        framework.start();
     
        BundleContext context = framework.getBundleContext();
        // declarative services dependency is necessary, otherwise they won't be picked up!
        loadScrBundle(context);

        try {
            framework.waitForStop(0);
        } catch (InterruptedException e) {
        	appendToFile(e);
        	showErrorMessage();
        }
        System.exit(0);
    }
 
开发者ID:burningrain,项目名称:planetBot,代码行数:30,代码来源:Launcher.java

示例6: exit

import org.osgi.framework.launch.Framework; //导入方法依赖的package包/类
public void exit() {
    try {
        Bundle bnd = context.getBundle(0);
        Framework fw = (Framework) bnd;
        fw.stop();
        fw.waitForStop(0);
    } catch (BundleException | InterruptedException ex) {
        Logger.getLogger(MainFrame.class.getName()).log(Level.INFO, null, ex);
    }
}
 
开发者ID:danecek,项目名称:mvn-osgi-library-2013,代码行数:11,代码来源:MainFrame.java


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