java.util.ServiceLoader.toString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(130)

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

ServiceLoader.toString介绍

[英]Returns a string describing this service.
[中]返回描述此服务的字符串。

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map)
 */
@Override
public String[] getMechanismNames(Map<String, ?> properties) {
  Set<String> names = new LinkedHashSet<>();
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        Collections.addAll(names, current.getMechanismNames(properties));
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return names.toArray(new String[names.size()]);
}

代码示例来源:origin: wildfly/wildfly

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
 */
@Override
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties,
    CallbackHandler callbackHandler) throws HttpAuthenticationException {
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        HttpServerAuthenticationMechanism authenticationMechanism = current.createAuthenticationMechanism(mechanismName, properties, callbackHandler);
        if (authenticationMechanism != null) {
          return authenticationMechanism;
        }
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return null;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map)
 */
@Override
public String[] getMechanismNames(Map<String, ?> properties) {
  Set<String> names = new LinkedHashSet<>();
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        Collections.addAll(names, current.getMechanismNames(properties));
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return names.toArray(new String[names.size()]);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-http-util

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map)
 */
@Override
public String[] getMechanismNames(Map<String, ?> properties) {
  Set<String> names = new LinkedHashSet<>();
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        Collections.addAll(names, current.getMechanismNames(properties));
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return names.toArray(new String[names.size()]);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map)
 */
@Override
public String[] getMechanismNames(Map<String, ?> properties) {
  Set<String> names = new LinkedHashSet<>();
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        Collections.addAll(names, current.getMechanismNames(properties));
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return names.toArray(new String[names.size()]);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
 */
@Override
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties,
    CallbackHandler callbackHandler) throws HttpAuthenticationException {
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        HttpServerAuthenticationMechanism authenticationMechanism = current.createAuthenticationMechanism(mechanismName, properties, callbackHandler);
        if (authenticationMechanism != null) {
          return authenticationMechanism;
        }
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return null;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-http-util

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
 */
@Override
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties,
    CallbackHandler callbackHandler) throws HttpAuthenticationException {
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        HttpServerAuthenticationMechanism authenticationMechanism = current.createAuthenticationMechanism(mechanismName, properties, callbackHandler);
        if (authenticationMechanism != null) {
          return authenticationMechanism;
        }
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return null;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
 */
@Override
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties,
    CallbackHandler callbackHandler) throws HttpAuthenticationException {
  synchronized(serviceLoader) {
    Iterator<HttpServerAuthenticationMechanismFactory> factoryIterator = serviceLoader.iterator();
    try {
      while (factoryIterator.hasNext()) {
        HttpServerAuthenticationMechanismFactory current = factoryIterator.next();
        HttpServerAuthenticationMechanism authenticationMechanism = current.createAuthenticationMechanism(mechanismName, properties, callbackHandler);
        if (authenticationMechanism != null) {
          return authenticationMechanism;
        }
      }
    } catch (ServiceConfigurationError e) {
      log.debug("Unable to read service configuration", e);
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by service loader in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), serviceLoader.toString());
  }
  return null;
}

相关文章