Examples of FrameworkEvent


Examples of org.osgi.framework.FrameworkEvent

        final Capture<FrameworkListener> capture =  new Capture<FrameworkListener>();
        frameworkWiring.refreshBundles(eq(Collections.singleton(installedBundle1)), capture(capture));
        expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                for (FrameworkListener listener : capture.getValues()) {
                    listener.frameworkEvent(new FrameworkEvent(FrameworkEvent.PACKAGES_REFRESHED, sysBundle, null));
                }
                return null;
            }
        });
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

        }.start();
    }

    public void awaitShutdown() throws Exception {
        while (true) {
            FrameworkEvent event = framework.waitForStop(0);
            if (event.getType() != FrameworkEvent.STOPPED_UPDATE) {
                return;
            }
        }
    }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

            while (timeout > 0) {
                timeout -= step;
                if (shutdownCallback != null) {
                    shutdownCallback.waitingForShutdown(step * 2);
                }
                FrameworkEvent event = framework.waitForStop(step);
                if (event.getType() != FrameworkEvent.WAIT_TIMEDOUT) {
                    return true;
                }
            }
            return false;
        } finally {
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

   * Wait for this Clerezza instance to shut down.
   *
   * After shut down all shutdown listeners are notified.
   */
  public void waitForStop() throws Throwable {
    FrameworkEvent event = null;
    try {
      if (felixInstance != null) {
        event = felixInstance.waitForStop(0);
      }
      setExitCode(0);
    } catch (Throwable t) {
      setExitCode(-1);
      event = new FrameworkEvent(FrameworkEvent.ERROR, null, t);
      throw t;
    } finally {
      notifyShutdownListeners(event);
    }
  }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

    {
        FutureFrameworkEvent futureFrameworkEvent = new FutureFrameworkEvent();

        Assert.assertFalse(futureFrameworkEvent.isDone());

        futureFrameworkEvent.setFrameworkEvent(new FrameworkEvent(FrameworkEvent.STOPPED, MOCK_SYSTEM_BUNDLE, null));

        Assert.assertTrue(futureFrameworkEvent.isDone());
    }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

                }
            });

            Assert.assertEquals(1, countDownLatch.getCount());

            futureFrameworkEvent.setFrameworkEvent(new FrameworkEvent(FrameworkEvent.STOPPED, MOCK_SYSTEM_BUNDLE, null));

            Assert.assertTrue(result.get());
            Assert.assertEquals(0, countDownLatch.getCount());
            Assert.assertTrue(futureFrameworkEvent.isDone());
        }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

                }
            });

            Assert.assertEquals(1, countDownLatch.getCount());

            futureFrameworkEvent.setFrameworkEvent(new FrameworkEvent(FrameworkEvent.STOPPED, MOCK_SYSTEM_BUNDLE, null));

            Assert.assertTrue(result.get());
            Assert.assertEquals(0, countDownLatch.getCount());
            Assert.assertTrue(futureFrameworkEvent.isDone());
        }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

                                bundleManager.beginStart((BundleGeneration) bundleController.getCurrentGeneration(), startedState.getOptions());
                                startedState.clearOptions();
                            }
                            catch (BundleException be)
                            {
                                bundleManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundleController, be));
                            }
                        }
                    }
                }
            }
            else if (startLevel > desiredStartLevel)
            {
                while (startLevel > desiredStartLevel)
                {
                    for (StartedState startedState : started)
                    {
                        BundleController bundleController = startedState.getBundleController();

                        if (startLevel == StartLevelImpl.this.getBundleStartLevel(bundleController))
                        {
                            try
                            {
                                bundleManager.beginStop((BundleGeneration) bundleController.getCurrentGeneration(), Bundle.STOP_TRANSIENT);
                            }
                            catch (Exception e)
                            {
                                bundleManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundleController, e));
                            }
                        }
                    }

                    startLevel--;
                }
            }

            bundleManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, bundleManager.getBundle(0), null));
        }
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

                {
                    bundleManager.beginStart((BundleGeneration) bundleController.getCurrentGeneration(), options);
                }
                catch (BundleException be)
                {
                    bundleManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundleController, be));
                }
            }

            started.add(new StartedState(bundleController, options));
View Full Code Here

Examples of org.osgi.framework.FrameworkEvent

                {
                    bundleManager.beginStop((BundleGeneration) bundleController.getCurrentGeneration(), options);
                }
                catch (BundleException be)
                {
                    bundleManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundleController, be));
                }
            }

            return null;
        }
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.