This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new ea45ebb867 Drop the broken test. The StandardContext test is
sufficient.
ea45ebb867 is described below
commit ea45ebb86720018efbc95f78f59b85f1c1c616da
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Apr 23 18:32:37 2026 +0100
Drop the broken test. The StandardContext test is sufficient.
---
.../catalina/ha/context/TestReplicatedContext.java | 57 ----------------------
1 file changed, 57 deletions(-)
diff --git a/test/org/apache/catalina/ha/context/TestReplicatedContext.java
b/test/org/apache/catalina/ha/context/TestReplicatedContext.java
index dffdab05db..3840a19249 100644
--- a/test/org/apache/catalina/ha/context/TestReplicatedContext.java
+++ b/test/org/apache/catalina/ha/context/TestReplicatedContext.java
@@ -18,12 +18,7 @@ package org.apache.catalina.ha.context;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.atomic.AtomicReference;
-import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
@@ -42,58 +37,6 @@ import org.apache.tomcat.util.buf.ByteChunk;
public class TestReplicatedContext extends TomcatBaseTest {
- @Test
- public void testGetServletContextReturnsSameInstanceUnderConcurrency()
throws Exception {
- Tomcat tomcat = getTomcatInstance();
- Host host = tomcat.getHost();
- if (host instanceof StandardHost) {
- ((StandardHost)
host).setContextClass(ReplicatedContext.class.getName());
- }
-
- File root = new File("test/webapp");
- ReplicatedContext replicatedContext =
- (ReplicatedContext) tomcat.addWebapp(host, "",
root.getAbsolutePath());
- tomcat.start();
-
- // Null the context field to simulate the window during reload
- replicatedContext.context = null;
-
- int numThreads = 20;
- CyclicBarrier barrier = new CyclicBarrier(numThreads);
- List<Thread> threads = new ArrayList<>();
- ServletContext[] results = new ServletContext[numThreads];
- AtomicReference<Throwable> failure = new AtomicReference<>();
-
- for (int i = 0; i < numThreads; i++) {
- final int index = i;
- Thread thread = new Thread(() -> {
- try {
- barrier.await();
- results[index] = replicatedContext.getServletContext();
- } catch (Throwable ex) {
- failure.set(ex);
- }
- });
- thread.start();
- threads.add(thread);
- }
-
- for (Thread thread : threads) {
- thread.join(5000);
- }
-
- if (failure.get() != null) {
- Assert.fail("Thread failed: " + failure.get());
- }
-
- ServletContext first = results[0];
- Assert.assertNotNull(first);
- for (int i = 1; i < numThreads; i++) {
- Assert.assertSame(first, results[i]);
- }
- }
-
-
@Test
public void testBug57425() throws LifecycleException, IOException {
Tomcat tomcat = getTomcatInstance();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]