Skip to content

Commit

Permalink
See what breaks if we just ... put arc back after tearing it down
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Sep 6, 2023
1 parent 2b21ce8 commit 4307712
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public StartupActionImpl(CuratedApplication curatedApplication, BuildResult buil
transformedClasses);
runtimeClassLoader = curatedApplication.createRuntimeClassLoader(
resources, transformedClasses);
System.out.println("HOLLY STARTUP ACTION MADE RUNtime " + runtimeClassLoader);
System.out.println("startup thread is " + Thread.currentThread());
System.out.println("HOLLY FUNQ STARTUP ACTION MADE RUNtime " + runtimeClassLoader);
System.out.println("FUNQ startup thread is " + Thread.currentThread());
// new Exception().printStackTrace();
}
this.runtimeClassLoader = runtimeClassLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ public boolean test(ClassInfo clazz) {
}

/*
* TODO consolidate this with the code above, see if it enables prod test and quarkus test to co-exist, and isolate to its
* own change set?
* TODO I'm not really happy with this as a general solution. Without this, we see classes being transformed twice if a
* QuarkusProdModeTest is used and transformations are needed (such as adding a constructor)
* I followed the model we use for QuarkusComponentTest, but it's limited in how much it will catch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void run() {
}

public void initExecutor(ExecutorService executor) {
System.out.println("FUNQ will set executor on arc, cl is " + Arc.class.getClassLoader());
Arc.setExecutor(executor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ public static ArcContainer initialize() {
* @see #initialize()
*/
public static ArcContainer initialize(ArcInitConfig arcInitConfig) {
System.out.println("HOLLY starting to init arc");
System.out.println("HOLLY FUNQ starting to init arc" + Arc.class.getClassLoader());
ArcContainerImpl container = INSTANCE.get();
if (container == null) {
synchronized (INSTANCE) {
container = INSTANCE.get();
System.out.println("arc container instance is " + container);
System.out.println("FUNQ arc container instance is " + container);
if (container == null) {
// Set the container instance first because Arc.container() can be used within ArcContainerImpl.init()
container = new ArcContainerImpl(arcInitConfig.getCurrentContextFactory(),
arcInitConfig.isStrictCompatibility());
INSTANCE.set(container);
System.out.println("arc did set container");
System.out.println("FUNQ arc did set container");
container.init();
}
}
Expand All @@ -49,6 +49,13 @@ public static ArcContainer initialize(ArcInitConfig arcInitConfig) {
}

public static void setExecutor(ExecutorService executor) {
System.out.println(INSTANCE.get() + "HOLLY FUNQ trying to set the executor " + Arc.class.getClassLoader());
if (INSTANCE.get() == null) {
// TODO this happens because we tear things down and don't put them back properly
// Can we just ... init ourselves?
System.out.println("TODO HACK just putting it back");
initialize();
}
INSTANCE.get().setExecutor(executor);
}

Expand All @@ -67,6 +74,7 @@ public static void shutdown() {
container = INSTANCE.get();
if (container != null) {
container.shutdown();
System.out.println("HOLLY FUNQ shutting down, setting instance to null " + Arc.class.getClassLoader());
INSTANCE.set(null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public Thread newThread(Runnable r) {
// populateDeepCloneField(startupAction);

//must be done after the TCCL has been set
// TODO could we load this with the normal class of this test? I think we could
testResourceManager = (Closeable) Thread.currentThread().getContextClassLoader()
.loadClass(TestResourceManager.class.getName())
.getConstructor(Class.class, Class.class, List.class, boolean.class, Map.class, Optional.class, Path.class)
Expand All @@ -256,9 +257,11 @@ public Thread newThread(Runnable r) {
populateTestMethodInvokers(startupAction.getClassLoader());

if (profileInstance == null || !profileInstance.runMainMethod()) {
System.out.println("HOLLY FUNQ DOING THE STARTUP PATH");
runningQuarkusApplication = startupAction
.run(profileInstance == null ? new String[0] : profileInstance.commandLineParameters());
} else {
System.out.println("HOLLY FUNQ doing the main class path");

Class<?> lifecycleManager = Class.forName(ApplicationLifecycleManager.class.getName(), true,
startupAction.getClassLoader());
Expand Down Expand Up @@ -623,6 +626,13 @@ private QuarkusTestExtensionState ensureStarted(ExtensionContext extensionContex
boolean reloadTestResources = !Objects.equals(extensionContext.getRequiredTestClass(), currentJUnitTestClass)
&& !isNested(currentJUnitTestClass, extensionContext.getRequiredTestClass())
&& (hasPerTestResources || hasPerTestResources(extensionContext));
System.out.println("HOLLY FUNQ reload test resources is " + reloadTestResources);
System.out.println(
"HOLLY FUNQ equality " + Objects.equals(extensionContext.getRequiredTestClass(), currentJUnitTestClass));
System.out.println("HOLLY FUNQ nested " + isNested(currentJUnitTestClass, extensionContext.getRequiredTestClass()));
System.out.println("HOLLY FUNQ pertest " + hasPerTestResources);
System.out.println("HOLLY FUNQ per test for context " + hasPerTestResources(extensionContext));
System.out.println("HOLLY FUNQ is wrong profile is " + wrongProfile);
if ((state == null && !failedBoot) || wrongProfile || reloadTestResources) {
if (wrongProfile || reloadTestResources) {
if (state != null) {
Expand Down

0 comments on commit 4307712

Please sign in to comment.