code: public void loadLibrary(Class<?> clazz, String name, LoadPolicy policy) {
          if (loaded.contains(name)) {
              return;
          }
  
          switch (policy) {
              case PREFER_SHIPPED:
                  try {
                      loadShippedLibrary(clazz, name);
                  } catch (LoadLibraryException ex) {
                      try {
                          loadSystemLibrary(name);
                      } catch (LoadLibraryException ex2) {
                          throw ex;
                      }
                  }
                  break;
              case PREFER_SYSTEM:
                  try {
                      loadSystemLibrary(name);
                  } catch (LoadLibraryException ex) {
                      try {
                          loadShippedLibrary(clazz, name);
                      } catch (LoadLibraryException ex2) {
                          throw ex;
                      }
                  }
                  break;
              case SHIPPED_ONLY:
                  loadShippedLibrary(clazz, name);
                  break;
              case SYSTEM_ONLY:
                  loadSystemLibrary(name);
                  break;
              default:
                  throw new IllegalStateException("Unknown policy " + policy);
          }
  
          loaded.add(name);
      }
docs: Loads a native library with the given {@link LoadPolicy load policy}.
  
  @param clazz
  The class whose classloader should be used to resolve shipped libraries
  @param name
  The name of the class.
  @param policy
  The load policy.