Package org.osgi.framework

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


                    }
                }
            }.start();
            Thread.sleep(DELAY / 4);
            long t0 = System.currentTimeMillis();
            bundle.stop();
            long t1 = System.currentTimeMillis();

            assertEquals(Bundle.RESOLVED, bundle.getState());
            assertTrue((t1 - t0) > DELAY / 2);
View Full Code Here


            {
                public void run()
                {
                    try
                    {
                        bundle.stop();
                    }
                    catch (BundleException e)
                    {
                        e.printStackTrace();
                    }
View Full Code Here

                    if (sleep > 0) {
                        System.err.println("Shutdown in " + sleep/1000/60 + " minute(s).");
                    }
                    Thread.sleep(sleep);
                    Bundle bundle = getBundleContext().getBundle(0);
                    bundle.stop();
                } catch (Exception e) {
                    log.error("Error when shutting down", e);
                }
            }
        }.start();
View Full Code Here

            if (framework != null) {
                framework.stop();
            } else {
                Bundle bundle = visitor.getBundle(0);
                if (bundle != null) {
                    bundle.stop();
                }
            }
        } catch (Exception e) {
            logVisitor.warning("shutdownFramework error", e);
            throw new IOException(e.getMessage());
View Full Code Here

            Bundle bundle = visitor.getBundle(bundleIdentifier);
            if (bundle == null) {
                throw new IllegalArgumentException("Bundle ID is wrong: " + bundleIdentifier);
            }
            try {
                bundle.stop();
            } catch (Exception e) {
                throw new IOException("Unable to stop bundle: " + bundleIdentifier);
            }
        } catch (IllegalArgumentException e) {
            logVisitor.warning("stopBundle error", e);
View Full Code Here

                try {
                    Bundle bundle = visitor.getBundle(bundleId);
                    if (bundle == null) {
                        throw new IllegalArgumentException("Bundle ID is wrong: " + bundleId);
                    }
                    bundle.stop();
                    completedBundles.add(bundleId);
                } catch (BundleException e) {
                    logVisitor.warning("Bundle stop error", e);
                    isSuccess = false;
                    errorBundleId = bundleId;
View Full Code Here

        Assert.assertNotNull(runningJobs);
        Assert.assertEquals(0, runningJobs.length);

        // get bundle
        Bundle bundle = BundleUtils.findBundle(bc, "org.knowhowlab.osgi.monitoradmin");
        bundle.stop();

        // assert MonitorAdmin Service
        ServiceAssert.assertServiceUnavailable(MonitorAdmin.class);

        // assert MonitorListener Service
View Full Code Here

      public void ended(Coordination coordination) throws Exception {
        // noop
      }
 
      public void failed(Coordination coordination) throws Exception {
        bundle.stop();
      }
    });
  }
 
  private void startResource(Resource resource, Coordination coordination) throws BundleException, IOException {
View Full Code Here

                    if (sleep > 0) {
                        System.err.println("Shutdown in " + sleep/1000/60 + " minute(s).");
                    }
                    Thread.sleep(sleep);
                    Bundle bundle = getBundleContext().getBundle(0);
                    bundle.stop();
                } catch (Exception e) {
                    log.error("Error when shutting down", e);
                }
            }
        }.start();
View Full Code Here

 
  @Test
  public void testSensorRegistrationIsCorrect() throws BundleException {
    assertNotNull("Sensor service not available", context.getServiceReference(TemperatureSensor.class.getName()));
    Bundle bundle = findSensorBundle();
    bundle.stop();
    assertNull("Sensor service is available", context.getServiceReference(TemperatureSensor.class.getName()));
    bundle.start();
    assertNotNull("Sensor service not available", context.getServiceReference(TemperatureSensor.class.getName()));
  }
 
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.