Package org.osgi.framework

Examples of org.osgi.framework.Bundle.stop()


       
        // We could potentially use Felix.stopAndWait, but use timed wait for now because
        // stopAndWait hangs with Felix 1.0.0
        if (felix instanceof Bundle) {
            Bundle felixBundle = (Bundle)felix;
            felixBundle.stop();
            int retries = 50;
            synchronized (felix) {
                while (retries-- > 0 && felixBundle.getState() != Bundle.UNINSTALLED) {
                    felix.wait(100);
                }
View Full Code Here


        Class<?> testClass = testBundle.loadClass(this.getClass().getName());
        Method testMethod = testClass.getMethod("runAllTestsFromBundle", Bundle.class);
        Object testObject = testClass.newInstance();
        testMethod.invoke(testObject, testBundle);
       
        testBundle.stop();
        testBundle.uninstall();
    }
   
    // Create and install a bundle with the specified manifest file
    // The bundle contains all files from the list of directories specified
View Full Code Here

       
        jarOut.close();
        out.close();
       
        if (existingBundle != null) {
            existingBundle.stop();
            existingBundle.uninstall();
        }

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
View Full Code Here

    public void testClientBlueprintContainerOnlyStartsWhenServiceStarted() throws Exception
    {
       // Stop everything before we start
       Bundle bcli = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.client");
       assertNotNull(bcli);
       bcli.stop();

       Bundle bser = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.server");
       assertNotNull(bser);
       bser.stop();
View Full Code Here

       assertNotNull(bcli);
       bcli.stop();

       Bundle bser = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.server");
       assertNotNull(bser);
       bser.stop();

       // Wait for everything to shut down
       Thread.sleep(1000);
      
       // When everything is stopped, there should be no blueprint container for either the client or the server
View Full Code Here

        // 10000 iterations would be close to OutOfMemory however by that stage the test runs very slowly
        for (int i=0; i<3000; i++) {
            b.start();
            // give the container some time to operate, otherwise it probably won't even get to create a future
            Thread.sleep(10);
            b.stop();
        }
       
        for (int i=0; i<16; i++) System.gc();
        long endFreeMemory = Runtime.getRuntime().freeMemory();
       
View Full Code Here

        Thread.sleep(200);
       
        Assert.assertTrue("Quiesce callback B should have occurred; calls should be 1, but it is "+callbackB.getCalls(), callbackB.getCalls()==1);
        Assert.assertTrue("Quiesce callback A should not have occurred yet; calls should be 0, but it is "+callbackA.getCalls(), callbackA.getCalls()==0);
       
        bundleb.stop();
       
        participant.quiesce(callbackA, Collections.singletonList(getBundle(
      "org.apache.aries.blueprint.testbundlea")));
           
        Thread.sleep(1000);
View Full Code Here

     
      DestroyTest dt = (DestroyTest) blueprintContainer.getComponentInstance("destroyCallingReference");
     
      Bundle b = findBundle("org.apache.aries.blueprint.sample");
      assertNotNull(b);
      b.stop();
     
      assertTrue("The destroy method was called", dt.waitForDestruction(1000));
     
      Exception e = dt.getDestroyFailure();
     
View Full Code Here

   
    assertNull("No context should exist",refs);
   
    //Restart the bundle to check the unit gets re-registered and is not immediately unregistered
    Bundle b = context().getBundleByName("org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle");
    b.stop();
    b.start();
   
    emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
        + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
   
View Full Code Here

                if (isFragmentBundle(bundle)) {
                    log.log(LogService.LOG_INFO, "Skipping fragment bundle '" + symbolicName + "'");
                } else {
                    addRollback(new StartBundleRunnable(session, bundle));
                    try {
                        bundle.stop();
                    }
                    catch (Exception e) {
                        log.log(LogService.LOG_WARNING, "Could not stop bundle '" + symbolicName + "'", e);
                    }
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.