Skip to content

Commit

Permalink
New Q2 constructor can receive a main classloader.
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Jan 16, 2025
1 parent 03b3bc1 commit 91e0421
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jpos/src/main/java/org/jpos/q2/Q2.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public class Q2 implements FileFilter, Runnable {
private boolean noShutdownHook;
private long shutdownHookDelay = 0L;

public Q2 (String[] args, BundleContext bundleContext) {
public Q2 (String[] args, BundleContext bundleContext, ClassLoader classLoader) {
super();
this.args = args;
startTime = Instant.now();
Expand All @@ -150,10 +150,15 @@ public Q2 (String[] args, BundleContext bundleContext) {
libDir = new File (deployDir, "lib");
dirMap = new TreeMap<>();
deployDir.mkdirs ();
mainClassLoader = getClass().getClassLoader();
mainClassLoader = classLoader == null ? getClass().getClassLoader() : classLoader;
this.bundleContext = bundleContext;
registerQ2();
}

public Q2 (String[] args, BundleContext bundleContext) {
this(args, bundleContext, null);
}

public Q2 () {
this (new String[] {}, null );
}
Expand Down

0 comments on commit 91e0421

Please sign in to comment.