11/*
2- * Copyright (c) 2015, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3838import javax .net .ssl .SSLContext ;
3939import javax .net .ssl .SSLParameters ;
4040import javax .net .ssl .SSLServerSocket ;
41+
4142import jdk .internal .net .http .frame .ErrorFrame ;
4243
4344/**
@@ -64,24 +65,22 @@ public class Http2TestServer implements AutoCloseable {
6465 // request approver which takes the server connection key as the input
6566 private volatile Predicate <String > newRequestApprover ;
6667
67- private static ThreadFactory defaultThreadFac =
68- (Runnable r ) -> {
68+ private static ExecutorService createExecutor (String name ) {
69+ String threadNamePrefix = "%s-pool" .formatted (name );
70+ ThreadFactory threadFactory = (Runnable r ) -> {
6971 Thread t = new Thread (r );
70- t .setName ("Test-server-pool" );
72+ t .setName (threadNamePrefix );
7173 return t ;
7274 };
73-
74-
75- private static ExecutorService getDefaultExecutor () {
76- return Executors .newCachedThreadPool (defaultThreadFac );
75+ return Executors .newCachedThreadPool (threadFactory );
7776 }
7877
7978 public Http2TestServer (String serverName , boolean secure , int port ) throws Exception {
80- this (serverName , secure , port , getDefaultExecutor () , 50 , null , null );
79+ this (serverName , secure , port , null , 50 , null , null );
8180 }
8281
8382 public Http2TestServer (boolean secure , int port ) throws Exception {
84- this (null , secure , port , getDefaultExecutor () , 50 , null , null );
83+ this (null , secure , port , null , 50 , null , null );
8584 }
8685
8786 public InetSocketAddress getAddress () {
@@ -197,7 +196,7 @@ public Http2TestServer(InetAddress localAddr,
197196 server = initPlaintext (port , backlog );
198197 }
199198 this .secure = secure ;
200- this .exec = exec == null ? getDefaultExecutor ( ) : exec ;
199+ this .exec = exec == null ? createExecutor ( name ) : exec ;
201200 this .handlers = Collections .synchronizedMap (new HashMap <>());
202201 this .properties = properties == null ? new Properties () : properties ;
203202 this .connections = ConcurrentHashMap .newKeySet ();
0 commit comments