Home | History | Annotate | Download | only in util

Lines Matching refs:service

42  * A simple service-provider loading facility.
44 * <p> A <i>service</i> is a well-known set of interfaces and (usually
45 * abstract) classes. A <i>service provider</i> is a specific implementation
46 * of a service. The classes in a provider typically implement the interfaces
47 * and subclass the classes defined in the service itself. Service providers
53 * <p> For the purpose of loading, a service is represented by a single type,
55 * used, but this is not recommended.) A provider of a given service contains
56 * one or more concrete classes that extend this <i>service type</i> with data
61 * The details of provider classes tend to be highly service-specific; no
67 * <p><a name="format"> A service provider is identified by placing a
70 * href="../lang/ClassLoader.html#name">binary name</a> of the service's type.
89 * service loader maintains a cache of the providers that have been loaded so
96 * <p> Service loaders always execute in the security context of the caller.
109 * Suppose we have a service type <tt>com.example.CodecSet</tt> which is
122 * <tt>CodecSet</tt> service then its jar file also contains a file named
132 * <p> The <tt>CodecSet</tt> class creates and saves a single service instance
177 * The type of the service to be loaded by this loader
189 // The class or interface representing the service being loaded
190 private final Class<S> service;
218 lookupIterator = new LazyIterator(service, loader);
222 service = Objects.requireNonNull(svc, "Service interface cannot be null");
230 private static void fail(Class<?> service, String msg, Throwable cause)
233 throw new ServiceConfigurationError(service.getName() + ": " + msg,
237 private static void fail(Class<?> service, String msg)
240 throw new ServiceConfigurationError(service.getName() + ": " + msg);
243 private static void fail(Class<?> service, URL u, int line, String msg)
246 fail(service, u + ":" + line + ": " + msg);
252 private int parseLine(Class<?> service, URL u, BufferedReader r, int lc,
266 fail(service, u, lc, "Illegal configuration-file syntax");
269 fail(service, u, lc, "Illegal provider-class name: " + ln);
273 fail(service, u, lc, "Illegal provider-class name: " + ln);
283 // @param service
284 // The service type for which providers are being sought;
298 private Iterator<String> parse(Class<?> service, URL u)
308 while ((lc = parseLine(service, u, r, lc, names)) >= 0);
310 fail(service, "Error reading configuration file", x);
316 fail(service, "Error closing configuration file", y);
328 Class<S> service;
334 private LazyIterator(Class<S> service, ClassLoader loader) {
335 this.service = service;
345 String fullName = PREFIX + service.getName();
351 fail(service, "Error locating configuration files", x);
358 pending = parse(service, configs.nextElement());
373 fail(service,
378 if (!service.isAssignableFrom(c)) {
381 service.getCanonicalName() + " is not assignable from " + c.getCanonicalName());
382 fail(service,
384 // fail(service,
388 service.cast(c.newInstance());
392 fail(service,
434 * Lazily loads the available providers of this loader's service.
448 * class is not assignable to the service type, or if any other kind of
451 * ServiceConfigurationError} when using a service iterator.
473 * ClassLoader.getResources(String)} method finds the service configuration
477 * service
505 * Creates a new service loader for the given service type and class
508 * @param <S> the class of the service type
510 * @param service
511 * The interface or abstract class representing the service
519 * @return A new service loader
521 public static <S> ServiceLoader<S> load(Class<S> service,
524 return new ServiceLoader<>(service, loader);
528 * Creates a new service loader for the given service type, using the
535 * ServiceLoader.load(<i>service</i>)</pre></blockquote>
540 * ServiceLoader.load(<i>service</i>,
543 * @param <S> the class of the service type
545 * @param service
546 * The interface or abstract class representing the service
548 * @return A new service loader
550 public static <S> ServiceLoader<S> load(Class<S> service) {
552 return ServiceLoader.load(service, cl);
556 * Creates a new service loader for the given service type, using the
563 * ServiceLoader.load(<i>service</i>, <i>extClassLoader</i>)</pre></blockquote>
570 * desired. The resulting service will only find and load providers that
574 * @param <S> the class of the service type
576 * @param service
577 * The interface or abstract class representing the service
579 * @return A new service loader
581 public static <S> ServiceLoader<S> loadInstalled(Class<S> service) {
588 return ServiceLoader.load(service, prev);
599 public static <S> S loadFromSystemProperty(final Class<S> service) {
601 final String className = System.getProperty(service.getName());
614 * Returns a string describing this service.
619 return "java.util.ServiceLoader[" + service.getName() + "]";