Skip to content

Commit

Permalink
try to fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
lprimak committed Dec 6, 2024
1 parent 4272f61 commit d9255a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ public DelegatingClassLoader run() {
}
return currentValue;
};
if (DeploymentUtils.useWarLibraries(Globals.getDefaultHabitat().getService(Deployment.class)
.getCurrentDeploymentContext())) {
if (DeploymentUtils.useWarLibraries(DeploymentUtils.getCurrentDeploymentContext())) {
return globalConnectorWithWarLibCL.updateAndGet(updateOperator);
} else {
return globalConnectorCL.updateAndGet(updateOperator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ public Collection<ConnectorClassFinder> getSystemRARClassLoaders() throws Connec
}

public ClassLoader getCommonClassLoader() {
if (DeploymentUtils.useWarLibraries(Globals.getDefaultHabitat().getService(Deployment.class)
.getCurrentDeploymentContext())) {
if (DeploymentUtils.useWarLibraries(DeploymentUtils.getCurrentDeploymentContext())) {
return warLibClassLoader.updateAndGet(currentValue -> {
if (currentValue == null) {
var newValue = new CurrentBeforeParentClassLoader(InstalledLibrariesResolver.getWarLibraries()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.glassfish.hk2.classmodel.reflect.Type;
import org.glassfish.internal.api.Globals;
import org.glassfish.internal.deployment.Deployment;
import org.glassfish.internal.deployment.ExtendedDeploymentContext;
import org.glassfish.loader.util.ASClassLoaderUtil;


Expand Down Expand Up @@ -463,14 +462,18 @@ public static List<URI> getExternalLibraries(ReadableArchive archive) {
} catch (Exception e) {
Logger.getAnonymousLogger().log(Level.WARNING, e.getMessage(), e);
}
ExtendedDeploymentContext context = null;
try {
context = Globals.getDefaultHabitat().getService(Deployment.class).getCurrentDeploymentContext();
} catch (Exception e) { }
externalLibURIs.addAll(getWarLibraryURIs(context));
externalLibURIs.addAll(getWarLibraryURIs(getCurrentDeploymentContext()));
return externalLibURIs;
}

public static DeploymentContext getCurrentDeploymentContext() {
try {
return Globals.getDefaultHabitat().getService(Deployment.class).getCurrentDeploymentContext();
} catch (Exception e) {
return null;
}
}

public static List<URI> getWarLibraryURIs(DeploymentContext context) {
if(useWarLibraries(context)) {
return InstalledLibrariesResolver.getWarLibraries().stream()
Expand Down

0 comments on commit d9255a1

Please sign in to comment.