code: private CacheProvider initSecondLevelCache(final PersistenceUnitMetadata puMetadata)
      {
  
          String classResourceName = (String) getProperties().get(PersistenceProperties.KUNDERA_CACHE_CONFIG_RESOURCE);
  
          classResourceName = classResourceName != null ? classResourceName : puMetadata
                  .getProperty(PersistenceProperties.KUNDERA_CACHE_CONFIG_RESOURCE);
  
          String cacheProviderClassName = (String) getProperties()
                  .get(PersistenceProperties.KUNDERA_CACHE_PROVIDER_CLASS);
  
          cacheProviderClassName = cacheProviderClassName != null ? cacheProviderClassName : puMetadata
                  .getProperty(PersistenceProperties.KUNDERA_CACHE_PROVIDER_CLASS);
  
          CacheProvider cacheProvider = null;
          if (cacheProviderClassName != null)
          {
              try
              {
                  Class<CacheProvider> cacheProviderClass = (Class<CacheProvider>) Class.forName(cacheProviderClassName);
                  cacheProvider = cacheProviderClass.newInstance();
                  cacheProvider.init(classResourceName);
              }
              catch (ClassNotFoundException e)
              {
                  throw new CacheException("Could not find class " + cacheProviderClassName
                          + ". Check whether you spelled it correctly in persistence.xml", e);
              }
              catch (InstantiationException e)
              {
                  throw new CacheException("Could not instantiate " + cacheProviderClassName, e);
              }
              catch (IllegalAccessException e)
              {
                  throw new CacheException(e);
              }
          }
          if (cacheProvider == null)
          {
              cacheProvider = new NonOperationalCacheProvider();
          }
          return cacheProvider;
      }
docs: Inits the second level cache.
  
  @return the cache provider