Class CachingMavenRecipeBundleResolver
- All Implemented Interfaces:
AutoCloseable,org.openrewrite.marketplace.RecipeBundleResolver
MavenRecipeBundleResolver instances per package coordinate so that
repeated resolve(RecipeBundle) calls for the same package share one reader
(and therefore one RecipeClassLoader).
Lifetime of handed-out readers. The readers (and the
RecipeClassLoaders they own) returned by
resolve(RecipeBundle) are intended to outlive this resolver. Once a
invalid reference
RecipegetResourceAsStream/inner-class load against those
classes requires the classloader's URLClassPath jar handles to remain open.
For that reason close() only clears the deduplication cache. It does not
close the cached inner MavenRecipeBundleResolvers -- doing so would close their
readers, which would close the underlying URLClassLoaders while consumers still
hold references. The visible failure mode is inner-class NoClassDefFoundError and
silently-null getResourceAsStream returns on a classloader that == identity
confirms is still alive (see
customer-requests#2346).
Consumers that need deterministic cleanup must close the RecipeBundleReaders they
retain (or rely on JVM exit for one-shot processes).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()org.openrewrite.marketplace.RecipeBundleReaderresolve(org.openrewrite.marketplace.RecipeBundle bundle) org.openrewrite.marketplace.RecipeBundleResolverresolverFor(org.openrewrite.marketplace.RecipeBundle bundle)
-
Constructor Details
-
CachingMavenRecipeBundleResolver
public CachingMavenRecipeBundleResolver()
-
-
Method Details
-
getEcosystem
- Specified by:
getEcosystemin interfaceorg.openrewrite.marketplace.RecipeBundleResolver
-
resolve
public org.openrewrite.marketplace.RecipeBundleReader resolve(org.openrewrite.marketplace.RecipeBundle bundle) - Specified by:
resolvein interfaceorg.openrewrite.marketplace.RecipeBundleResolver
-
resolverFor
public org.openrewrite.marketplace.RecipeBundleResolver resolverFor(org.openrewrite.marketplace.RecipeBundle bundle) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.openrewrite.marketplace.RecipeBundleResolver
-