Skip to content

Commit f89b561

Browse files
committed
IT Tests to cover thread pool monitoring. Some failing.
1 parent cf2cf63 commit f89b561

File tree

3 files changed

+590
-0
lines changed

3 files changed

+590
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
9+
*/
10+
11+
package org.glassfish.main.test.app.monitoring;
12+
13+
import java.io.IOException;
14+
import java.io.PrintWriter;
15+
16+
import jakarta.servlet.ServletException;
17+
import jakarta.servlet.annotation.WebServlet;
18+
import jakarta.servlet.http.HttpServlet;
19+
import jakarta.servlet.http.HttpServletRequest;
20+
import jakarta.servlet.http.HttpServletResponse;
21+
22+
@WebServlet("/slow")
23+
public class SlowServlet extends HttpServlet {
24+
25+
@Override
26+
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
27+
throws ServletException, IOException {
28+
try {
29+
Thread.sleep(2000); // 2 second delay to keep threads busy
30+
} catch (InterruptedException e) {
31+
Thread.currentThread().interrupt();
32+
}
33+
34+
resp.setContentType("text/plain");
35+
try (PrintWriter writer = resp.getWriter()) {
36+
writer.println("Slow response completed");
37+
writer.println("Thread: " + Thread.currentThread().getName());
38+
}
39+
}
40+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
9+
*/
10+
11+
package org.glassfish.main.test.app.monitoring;
12+
13+
import java.io.IOException;
14+
import java.io.PrintWriter;
15+
16+
import jakarta.servlet.ServletException;
17+
import jakarta.servlet.annotation.WebServlet;
18+
import jakarta.servlet.http.HttpServlet;
19+
import jakarta.servlet.http.HttpServletRequest;
20+
import jakarta.servlet.http.HttpServletResponse;
21+
22+
@WebServlet("/test")
23+
public class TestServlet extends HttpServlet {
24+
25+
@Override
26+
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
27+
throws ServletException, IOException {
28+
resp.setContentType("text/plain");
29+
try (PrintWriter writer = resp.getWriter()) {
30+
writer.println("Thread Pool Test Servlet");
31+
writer.println("Thread: " + Thread.currentThread().getName());
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)