/**
   * Notifies this <tt>Conference</tt> that the ordered list of <tt>Endpoint</tt>s of {@link
   * #speechActivity} i.e. the dominant speaker history has changed.
   *
   * <p>This instance notifies the video <tt>Channel</tt>s about the change so that they may update
   * their last-n lists and report to this instance which <tt>Endpoint</tt>s are to be asked for
   * video keyframes.
   */
  private void speechActivityEndpointsChanged() {
    List<Endpoint> endpoints = null;

    for (Content content : getContents()) {
      if (MediaType.VIDEO.equals(content.getMediaType())) {
        Set<Endpoint> endpointsToAskForKeyframes = null;

        endpoints = speechActivity.getEndpoints();
        for (Channel channel : content.getChannels()) {
          if (!(channel instanceof RtpChannel)) continue;

          RtpChannel rtpChannel = (RtpChannel) channel;
          List<Endpoint> channelEndpointsToAskForKeyframes =
              rtpChannel.speechActivityEndpointsChanged(endpoints);

          if ((channelEndpointsToAskForKeyframes != null)
              && !channelEndpointsToAskForKeyframes.isEmpty()) {
            if (endpointsToAskForKeyframes == null) {
              endpointsToAskForKeyframes = new HashSet<>();
            }
            endpointsToAskForKeyframes.addAll(channelEndpointsToAskForKeyframes);
          }
        }

        if ((endpointsToAskForKeyframes != null) && !endpointsToAskForKeyframes.isEmpty()) {
          content.askForKeyframes(endpointsToAskForKeyframes);
        }
      }
    }
  }
 public void init(FrameworkListener... listeners) throws BundleException {
   if (listeners != null) {
     if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
       Debug.println(
           "Initializing framework with framework listeners: " + listeners); // $NON-NLS-1$
     }
     initListeners.addAll(Arrays.asList(listeners));
   } else {
     if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
       Debug.println("Initializing framework with framework no listeners"); // $NON-NLS-1$
     }
   }
   try {
     ((SystemModule) getModule()).init();
   } finally {
     if (!initListeners.isEmpty()) {
       getEquinoxContainer().getEventPublisher().flushFrameworkEvents();
       removeInitListeners();
     }
   }
 }
Пример #3
0
  /**
   * Returns a managed instance of a class.
   *
   * @param managedClass The managed class to get instance for.
   * @param size The number of instances.
   */
  protected List<Object> getManagedInstances(Class managedClass, int size) {
    List<Object> managedInstances = this.managedInstances.get(managedClass);
    if (managedInstances == null) {
      managedInstances = new LinkedList<>();
    }

    if (managedInstances.isEmpty()) {
      if (size == -1) throw new IllegalStateException("Expected instances are not available!");
      try {
        for (int i = 0; i < size; i++) {
          Object managedInstance = managedClass.newInstance();
          managedInstances.add(managedInstance);
          this.managedInstances.put(managedClass, managedInstances);
          this.activatorLogger.info(
              "Instantiated '" + managedClass.getName() + "': " + managedInstance);
        }
      } catch (InstantiationException | IllegalAccessException e) {
        throw new APSActivatorException("Failed to instantiate activator managed class!", e);
      }
    }

    return managedInstances;
  }
Пример #4
0
  /*
   * unlocks the global lock and notifies the first waiting thread that they
   * now have the lock
   */
  private static void unlock() {
    Thread waitingThread = null;
    Object loader = null;
    synchronized (BundleLoader.class) {
      lockCount--;
      if (lockCount != 0) return;

      if (waitingList.isEmpty()) {
        lockThread = null;
        return;
      }

      Object[] waiting = (Object[]) waitingList.get(0);
      waitingThread = (Thread) waiting[0];
      loader = waiting[1];
    }
    synchronized (loader) {
      synchronized (BundleLoader.class) {
        lockThread = waitingThread;
        waitingList.remove(0);
        loader.notifyAll();
      }
    }
  }