Skip to content

Commit

Permalink
Thread context class loader
Browse files Browse the repository at this point in the history
  • Loading branch information
pvlasov committed May 25, 2024
1 parent edc6f46 commit 8d41e34
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ActionProviderAdapterFactory(Context context) {
new FunctionAdapterFactory<ActionProvider, Temporal>(
NcorePackage.Literals.TEMPORAL,
ActionProvider.class,
this.getClass().getClassLoader(),
Thread.currentThread().getContextClassLoader(),
e -> new TemporalActionBuilder(e, context) {

@Override
Expand All @@ -44,7 +44,7 @@ protected String getHtmlExtension() {
new FunctionAdapterFactory<ActionProvider, Composite>(
NcorePackage.Literals.COMPOSITE,
ActionProvider.class,
this.getClass().getClassLoader(),
Thread.currentThread().getContextClassLoader(),
e -> new CompositeActionBuilder<Composite>(e, context) {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected EObject getByRefId(EObject eObj, URI baseURI, String refId, int pass,
}

protected ClassLoader getClassLoader(EObject context, URI baseURI, Supplier<ClassLoader> logicalParentClassLoaderSupplier) {
return logicalParentClassLoaderSupplier == null ? getClass().getClassLoader() : logicalParentClassLoaderSupplier.get();
return logicalParentClassLoaderSupplier == null ? Thread.currentThread().getContextClassLoader() : logicalParentClassLoaderSupplier.get();
}

protected URI getAppBase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected ProgressMonitor getProgressMonitor() {
}

protected ClassLoader getClassLoader(EObject context, URI baseURI, Supplier<ClassLoader> logicalParentClassLoaderSupplier) {
return logicalParentClassLoaderSupplier == null ? getClass().getClassLoader() : logicalParentClassLoaderSupplier.get();
return logicalParentClassLoaderSupplier == null ? Thread.currentThread().getContextClassLoader() : logicalParentClassLoaderSupplier.get();
}

protected URI getAppBase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public HtmlAdapterFactory() {
new FunctionAdapterFactory<SupplierFactory<org.nasdanika.html.Tag>, Script>(
HtmlPackage.Literals.SCRIPT,
Util.getSupplierFactoryClass(org.nasdanika.html.Tag.class),
this.getClass().getClassLoader(),
classLoader,
ScriptSupplierFactoryAdapter::new));

registerAdapterFactory(
new FunctionAdapterFactory<SupplierFactory<InputStream>, org.nasdanika.ncore.List>(
NcorePackage.Literals.LIST,
Util.getSupplierFactoryClass(InputStream.class),
this.getClass().getClassLoader(),
classLoader,
ListSupplierFactoryAdapter::new));

}
Expand Down

0 comments on commit 8d41e34

Please sign in to comment.