File tree Expand file tree Collapse file tree
kilo-client/src/test/java/org/httprpc/kilo/util/concurrent
kilo-test/src/main/java/org/httprpc/kilo/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515package org .httprpc .kilo .util .concurrent ;
1616
17- import org .junit .jupiter .api .AfterAll ;
18- import org .junit .jupiter .api .BeforeAll ;
1917import org .junit .jupiter .api .Test ;
2018
2119import java .util .concurrent .ExecutorService ;
2523import static org .junit .jupiter .api .Assertions .*;
2624
2725public class PipeTest {
28- private static ExecutorService executorService = null ;
29-
30- @ BeforeAll
31- public static void setUpClass () {
32- executorService = Executors .newSingleThreadExecutor ();
33- }
34-
35- @ AfterAll
36- public static void tearDownClass () {
37- executorService .shutdown ();
38- }
26+ private static ExecutorService executorService = Executors .newSingleThreadExecutor ();
3927
4028 @ Test
4129 public void testBoundedPipe () {
Original file line number Diff line number Diff line change 1414
1515package org .httprpc .kilo .test ;
1616
17- import jakarta .servlet .ServletException ;
1817import jakarta .servlet .annotation .WebServlet ;
1918import org .httprpc .kilo .RequestMethod ;
2019import org .httprpc .kilo .ResourcePath ;
3332
3433@ WebServlet (urlPatterns = {"/employees/*" }, loadOnStartup = 1 )
3534public class EmployeeService extends WebService {
36- private static ExecutorService executorService = null ;
35+ private static ExecutorService executorService = Executors . newCachedThreadPool () ;
3736
3837 @ Override
3938 protected String getDataSourceName () {
4039 return "java:comp/env/jdbc/EmployeeDB" ;
4140 }
4241
43- @ Override
44- public void init () throws ServletException {
45- super .init ();
46-
47- executorService = Executors .newCachedThreadPool ();
48- }
49-
50- @ Override
51- public void destroy () {
52- executorService .shutdown ();
53-
54- super .destroy ();
55- }
56-
5742 @ RequestMethod ("GET" )
5843 public Iterable <Employee > getEmployees (boolean stream ) throws SQLException {
5944 return stream ? getEmployeesStream () : getEmployeesList ();
You can’t perform that action at this time.
0 commit comments