/**
   * 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);
        }
      }
    }
  }
예제 #2
0
  private <T> CachedRuleSource doExtract(final Class<T> source) {
    final ModelType<T> type = ModelType.of(source);
    DefaultMethodModelRuleExtractionContext context =
        new DefaultMethodModelRuleExtractionContext(type, this);

    // TODO - exceptions thrown here should point to some extensive documentation on the concept of
    // class rule sources

    StructSchema<T> schema = getSchema(source, context);
    if (schema == null) {
      throw new InvalidModelRuleDeclarationException(context.problems.format());
    }

    // sort for determinism
    Set<Method> methods = new TreeSet<Method>(Ordering.usingToString());
    methods.addAll(Arrays.asList(source.getDeclaredMethods()));

    ImmutableList.Builder<ModelProperty<?>> implicitInputs = ImmutableList.builder();
    ModelProperty<?> target = null;
    for (ModelProperty<?> property : schema.getProperties()) {
      if (property.isAnnotationPresent(RuleTarget.class)) {
        target = property;
      } else if (property.isAnnotationPresent(RuleInput.class)
          && !(property.getSchema() instanceof ScalarValueSchema)) {
        implicitInputs.add(property);
      }
      for (WeaklyTypeReferencingMethod<?, ?> method : property.getAccessors()) {
        methods.remove(method.getMethod());
      }
    }

    ImmutableList.Builder<ExtractedRuleDetails> rules = ImmutableList.builder();
    for (Method method : methods) {
      MethodRuleDefinition<?, ?> ruleDefinition =
          DefaultMethodRuleDefinition.create(source, method);
      ExtractedModelRule rule = getMethodHandler(ruleDefinition, method, context);
      if (rule != null) {
        rules.add(new ExtractedRuleDetails(ruleDefinition, rule));
      }
    }

    if (context.hasProblems()) {
      throw new InvalidModelRuleDeclarationException(context.problems.format());
    }

    StructBindings<T> bindings = structBindingsStore.getBindings(schema);

    if (schema.getProperties().isEmpty()) {
      return new StatelessRuleSource(
          rules.build(),
          Modifier.isAbstract(source.getModifiers())
              ? new AbstractRuleSourceFactory<T>(schema, bindings, proxyFactory)
              : new ConcreteRuleSourceFactory<T>(type));
    } else {
      return new ParameterizedRuleSource(
          rules.build(), target, implicitInputs.build(), schema, bindings, proxyFactory);
    }
  }
 public ObjectPropertyAssertion<T> ignoreFields(String... field) {
   Set<String> ignoredFields = new HashSet<String>(this.ignoredFields);
   ignoredFields.addAll(Arrays.asList(field));
   return new ObjectPropertyAssertion<T>(
       type,
       generator,
       refinement,
       creator,
       skipSynthetic,
       skipToString,
       optionalToStringRegex,
       ignoredFields);
 }
예제 #4
0
 private synchronized NameValueMap getCachedAttributes(ObjectName objName, Set<String> attrNames)
     throws InstanceNotFoundException, ReflectionException, IOException {
   NameValueMap values = cachedValues.get(objName);
   if (values != null && values.keySet().containsAll(attrNames)) {
     return values;
   }
   attrNames = new TreeSet<String>(attrNames);
   Set<String> oldNames = cachedNames.get(objName);
   if (oldNames != null) {
     attrNames.addAll(oldNames);
   }
   values = new NameValueMap();
   final AttributeList attrs =
       conn.getAttributes(objName, attrNames.toArray(new String[attrNames.size()]));
   for (Attribute attr : attrs.asList()) {
     values.put(attr.getName(), attr.getValue());
   }
   cachedValues.put(objName, values);
   cachedNames.put(objName, attrNames);
   return values;
 }
  private void discoverAndRunProcs(
      Context context,
      Set<TypeElement> annotationsPresent,
      List<ClassSymbol> topLevelClasses,
      List<PackageSymbol> packageInfoFiles) {
    Map<String, TypeElement> unmatchedAnnotations =
        new HashMap<String, TypeElement>(annotationsPresent.size());

    for (TypeElement a : annotationsPresent) {
      unmatchedAnnotations.put(a.getQualifiedName().toString(), a);
    }

    // Give "*" processors a chance to match
    if (unmatchedAnnotations.size() == 0) unmatchedAnnotations.put("", null);

    DiscoveredProcessors.ProcessorStateIterator psi = discoveredProcs.iterator();
    // TODO: Create proper argument values; need past round
    // information to fill in this constructor.  Note that the 1
    // st round of processing could be the last round if there
    // were parse errors on the initial source files; however, we
    // are not doing processing in that case.

    Set<Element> rootElements = new LinkedHashSet<Element>();
    rootElements.addAll(topLevelClasses);
    rootElements.addAll(packageInfoFiles);
    rootElements = Collections.unmodifiableSet(rootElements);

    RoundEnvironment renv =
        new JavacRoundEnvironment(false, false, rootElements, JavacProcessingEnvironment.this);

    while (unmatchedAnnotations.size() > 0 && psi.hasNext()) {
      ProcessorState ps = psi.next();
      Set<String> matchedNames = new HashSet<String>();
      Set<TypeElement> typeElements = new LinkedHashSet<TypeElement>();

      for (Map.Entry<String, TypeElement> entry : unmatchedAnnotations.entrySet()) {
        String unmatchedAnnotationName = entry.getKey();
        if (ps.annotationSupported(unmatchedAnnotationName)) {
          matchedNames.add(unmatchedAnnotationName);
          TypeElement te = entry.getValue();
          if (te != null) typeElements.add(te);
        }
      }

      if (matchedNames.size() > 0 || ps.contributed) {
        boolean processingResult = callProcessor(ps.processor, typeElements, renv);
        ps.contributed = true;
        ps.removeSupportedOptions(unmatchedProcessorOptions);

        if (printProcessorInfo || verbose) {
          log.printNoteLines(
              "x.print.processor.info",
              ps.processor.getClass().getName(),
              matchedNames.toString(),
              processingResult);
        }

        if (processingResult) {
          unmatchedAnnotations.keySet().removeAll(matchedNames);
        }
      }
    }
    unmatchedAnnotations.remove("");

    if (lint && unmatchedAnnotations.size() > 0) {
      // Remove annotations processed by javac
      unmatchedAnnotations.keySet().removeAll(platformAnnotations);
      if (unmatchedAnnotations.size() > 0) {
        log = Log.instance(context);
        log.warning("proc.annotations.without.processors", unmatchedAnnotations.keySet());
      }
    }

    // Run contributing processors that haven't run yet
    psi.runContributingProcs(renv);

    // Debugging
    if (options.isSet("displayFilerState")) filer.displayState();
  }
 private Set<String> initUnmatchedProcessorOptions() {
   Set<String> unmatchedProcessorOptions = new HashSet<String>();
   unmatchedProcessorOptions.addAll(processorOptions.keySet());
   return unmatchedProcessorOptions;
 }
예제 #7
0
    private Exception doSilentClose(
        Object proxyConnection, boolean pooled_connection_is_dead, boolean known_resolved_txn) {
      if (activeConnection != null) {
        synchronized (
            C3P0PooledConnection
                .this) // uh oh... this is a nested lock acq... is there a deadlock hazard here?
        {
          if (C3P0PooledConnection.this.exposedProxy == proxyConnection) {
            C3P0PooledConnection.this.exposedProxy = null;
            // System.err.println("Reset exposed proxy.");

            // DEBUG
            // origGet = null;
          } else // else case -- DEBUG only
          logger.warning(
                "(c3p0 issue) doSilentClose( ... ) called on a proxyConnection "
                    + "other than the current exposed proxy for its PooledConnection. [exposedProxy: "
                    + exposedProxy
                    + ", proxyConnection: "
                    + proxyConnection);
          // 				System.err.println("[DEBUG] WARNING: doSilentClose( ... ) called on a
          // proxyConnection " +
          // 						   "other than the current exposed proxy for its PooledConnection. [exposedProxy:
          // " +
          // 						   exposedProxy + ", proxyConnection: " + proxyConnection);
        }

        Exception out = null;

        Exception exc1 = null, exc2 = null, exc3 = null, exc4 = null;
        try {
          if (!pooled_connection_is_dead) C3P0PooledConnection.this.reset(known_resolved_txn);
        } catch (Exception e) {
          exc1 = e;
          // 		    if (Debug.DEBUG)
          // 			{
          // 			    System.err.print("exc1 -- ");
          // 			    exc1.printStackTrace();
          // 			}
        }

        exc2 = cleanupUncachedActiveStatements();
        // 	    if (Debug.DEBUG && exc2 != null)
        // 		{
        // 		    System.err.print("exc2 -- ");
        // 		    exc2.printStackTrace();
        // 		}
        String errSource;
        if (doRawResultSets != null) {
          activeMetaDataResultSets.addAll(doRawResultSets);
          errSource = "DataBaseMetaData or raw Connection operation";
        } else errSource = "DataBaseMetaData";

        if (!closeAndRemoveResultSets(activeMetaDataResultSets))
          exc3 = new SQLException("Failed to close some " + errSource + " Result Sets.");
        // 	    if (Debug.DEBUG && exc3 != null)
        // 		{
        // 		    System.err.print("exc3 -- ");
        // 		    exc3.printStackTrace();
        // 		}
        if (scache != null) {
          try {
            scache.checkinAll(physicalConnection);
          } catch (Exception e) {
            exc4 = e;
          }
          // 		    if (Debug.DEBUG && exc4 != null)
          // 			{
          // 			    System.err.print("exc4 -- ");
          // 			    exc4.printStackTrace();
          // 			}
        }

        if (exc1 != null) {
          handleMaybeFatalToPooledConnection(exc1, proxyConnection, true);
          out = exc1;
        } else if (exc2 != null) {
          handleMaybeFatalToPooledConnection(exc2, proxyConnection, true);
          out = exc2;
        } else if (exc3 != null) {
          handleMaybeFatalToPooledConnection(exc3, proxyConnection, true);
          out = exc3;
        } else if (exc4 != null) {
          handleMaybeFatalToPooledConnection(exc4, proxyConnection, true);
          out = exc4;
        }

        // 	    if (out != null)
        // 		{
        // 		    System.err.print("out -- ");
        // 		    out.printStackTrace();
        // 		}

        activeConnection = null;
        return out;
      } else return null;
    }