Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,24 @@ public CatalogConnector createCatalog(CatalogProperties catalogProperties)
catalogProperties.getCatalogHandle(),
factory.getDuplicatePluginClassLoaderFactory(),
handleResolver);
Connector connector = createConnector(
catalogProperties.getCatalogHandle().getCatalogName(),
catalogProperties.getCatalogHandle(),
factory.getConnectorFactory(),
duplicatePluginClassLoaderFactory,
catalogProperties.getProperties());
return createCatalog(
catalogProperties.getCatalogHandle(),
catalogProperties.getConnectorName(),
connector,
duplicatePluginClassLoaderFactory::destroy,
Optional.of(catalogProperties));
try {
Connector connector = createConnector(
catalogProperties.getCatalogHandle().getCatalogName(),
catalogProperties.getCatalogHandle(),
factory.getConnectorFactory(),
duplicatePluginClassLoaderFactory,
catalogProperties.getProperties());
return createCatalog(
catalogProperties.getCatalogHandle(),
catalogProperties.getConnectorName(),
connector,
duplicatePluginClassLoaderFactory::destroy,
Optional.of(catalogProperties));
}
catch (Throwable e) {
duplicatePluginClassLoaderFactory.destroy();
throw e;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
public class PluginClassLoader
extends URLClassLoader
{
private final String id;
private final String pluginName;
private final Optional<CatalogHandle> catalogHandle;
private final ClassLoader spiClassLoader;
Expand Down Expand Up @@ -69,6 +70,7 @@ private PluginClassLoader(
this.spiClassLoader = requireNonNull(spiClassLoader, "spiClassLoader is null");
this.spiPackages = ImmutableList.copyOf(spiPackages);
this.spiResources = ImmutableList.copyOf(spiResources);
this.id = pluginName + catalogHandle.map(name -> ":%s:%s".formatted(name.getCatalogName(), name.getVersion())).orElse("");
}

public PluginClassLoader duplicate(CatalogHandle catalogHandle)
Expand All @@ -91,7 +93,7 @@ public PluginClassLoader withUrl(URL url)

public String getId()
{
return pluginName + catalogHandle.map(name -> ":" + name).orElse("");
return id;
}

@Override
Expand Down