home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.io.IOException;
- import java.net.URL;
- import java.util.Enumeration;
- import java.util.Iterator;
- import java.util.NoSuchElementException;
- import java.util.Set;
- import java.util.TreeSet;
-
- class Service$LazyIterator implements Iterator {
- Class service;
- ClassLoader loader;
- Enumeration configs;
- Iterator pending;
- Set returned;
- String nextName;
-
- private Service$LazyIterator(Class var1, ClassLoader var2) {
- this.configs = null;
- this.pending = null;
- this.returned = new TreeSet();
- this.nextName = null;
- this.service = var1;
- this.loader = var2;
- }
-
- public boolean hasNext() throws ServiceConfigurationError {
- if (this.nextName != null) {
- return true;
- } else {
- if (this.configs == null) {
- try {
- String var1 = "META-INF/services/" + this.service.getName();
- if (this.loader == null) {
- this.configs = ClassLoader.getSystemResources(var1);
- } else {
- this.configs = this.loader.getResources(var1);
- }
- } catch (IOException var2) {
- Service.access$000(this.service, ": " + var2);
- }
- }
-
- while(this.pending == null || !this.pending.hasNext()) {
- if (!this.configs.hasMoreElements()) {
- return false;
- }
-
- this.pending = Service.access$100(this.service, (URL)this.configs.nextElement(), this.returned);
- }
-
- this.nextName = (String)this.pending.next();
- return true;
- }
- }
-
- public Object next() throws ServiceConfigurationError {
- if (!this.hasNext()) {
- throw new NoSuchElementException();
- } else {
- String var1 = this.nextName;
- this.nextName = null;
-
- try {
- return Class.forName(var1, true, this.loader).newInstance();
- } catch (ClassNotFoundException var4) {
- Service.access$000(this.service, "Provider " + var1 + " not found");
- } catch (Exception var5) {
- Service.access$000(this.service, "Provider " + var1 + " could not be instantiated: " + var5);
- }
-
- return null;
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- // $FF: synthetic method
- Service$LazyIterator(Class var1, ClassLoader var2, Service.1 var3) {
- this(var1, var2);
- }
- }
-