File tree Expand file tree Collapse file tree 3 files changed +590
-0
lines changed
appserver/tests/application/src/test/java/org/glassfish/main/test/app/monitoring Expand file tree Collapse file tree 3 files changed +590
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments