javax.enterprise.inject.spi.CDI.findAllProviders()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中javax.enterprise.inject.spi.CDI.findAllProviders()方法的一些代码示例,展示了CDI.findAllProviders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CDI.findAllProviders()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.CDI
类名称:CDI
方法名:findAllProviders

CDI.findAllProviders介绍

暂无

代码示例

代码示例来源:origin: javax.enterprise/cdi-api

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: javax/javaee-web-api

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: weld/core

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: jboss/jboss-javaee-specs

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: weld/core

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

/**
 *
 * Obtain the {@link CDIProvider} the user set with {@link #setCDIProvider(CDIProvider)}, or if it wasn't set, use the
 * serviceloader the retrieve the {@link CDIProvider} with the highest priority.
 *
 * @return the {@link CDIProvider} set by user or retrieved by serviceloader
 */
private static CDIProvider getCDIProvider() {
  if (configuredProvider != null) {
    return configuredProvider;
  } else {
    // Discover providers and cache
    if (discoveredProviders == null) {
      synchronized (lock) {
        if (discoveredProviders == null) {
          findAllProviders();
        }
      }
    }
    configuredProvider = discoveredProviders.stream()
        .filter(c -> c.getCDI() != null)
        .findFirst().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));
    return configuredProvider;
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se

synchronized (lock) {
  if (discoveredProviders == null) {
    findAllProviders();

相关文章