geronimo-jpa_2.1_spec/src/main/java/javax/persistence/spi/PersistenceProviderResolverHolder.java [95:126]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        public List<PersistenceProvider> getPersistenceProviders() {
            // get our class loader
            ClassLoader cl = PrivClassLoader.get(null);
            if (cl == null)
                cl = PrivClassLoader.get(DefaultPersistenceProviderResolver.class);

            // use any previously cached providers
            List<PersistenceProvider> providers = providerCache.get(cl);
            if (providers == null) {
                // need to discover and load them for this class loader
                providers = new ArrayList<PersistenceProvider>();
                try {
                    // add each one to our list
                    List<Object> serviceProviders = ProviderLocator.getServices(PersistenceProvider.class.getName(), this.getClass(), cl);
                    for (Object o : serviceProviders) {
                        providers.add((PersistenceProvider)o);
                    }
                    // cache the discovered providers
                    providerCache.put(cl, providers);
                } catch (ClassNotFoundException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (InstantiationException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (IllegalAccessException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (Exception e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                }
            }
            // caller must handle the case of no providers found
            return providers;
        }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceProviderResolverHolder.java [95:126]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        public List<PersistenceProvider> getPersistenceProviders() {
            // get our class loader
            ClassLoader cl = PrivClassLoader.get(null);
            if (cl == null)
                cl = PrivClassLoader.get(DefaultPersistenceProviderResolver.class);

            // use any previously cached providers
            List<PersistenceProvider> providers = providerCache.get(cl);
            if (providers == null) {
                // need to discover and load them for this class loader
                providers = new ArrayList<PersistenceProvider>();
                try {
                    // add each one to our list
                    List<Object> serviceProviders = ProviderLocator.getServices(PersistenceProvider.class.getName(), this.getClass(), cl);
                    for (Object o : serviceProviders) {
                        providers.add((PersistenceProvider)o);
                    }
                    // cache the discovered providers
                    providerCache.put(cl, providers);
                } catch (ClassNotFoundException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (InstantiationException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (IllegalAccessException e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                } catch (Exception e) {
                    throw new PersistenceException("Failed to load provider from META-INF/services", e);
                }
            }
            // caller must handle the case of no providers found
            return providers;
        }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



