1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
19
19
import java .net .http .HttpClient ;
20
20
import java .util .concurrent .Executor ;
21
+ import java .util .concurrent .ExecutorService ;
21
22
import java .util .concurrent .Executors ;
22
23
import java .util .concurrent .ThreadFactory ;
23
24
24
- import org .eclipse .jetty .util .component .LifeCycle ;
25
- import org .eclipse .jetty .util .thread .QueuedThreadPool ;
26
-
27
25
import org .springframework .beans .factory .DisposableBean ;
28
26
import org .springframework .beans .factory .InitializingBean ;
29
27
import org .springframework .lang .Nullable ;
@@ -70,10 +68,10 @@ public Executor getExecutor() {
70
68
}
71
69
72
70
/**
73
- * Configure the thread prefix to initialize {@link QueuedThreadPool} executor with. This
71
+ * Configure the thread prefix to initialize the executor with. This
74
72
* is used only when a {@link Executor} instance isn't
75
73
* {@link #setExecutor(Executor) provided}.
76
- * <p>By default set to "jetty -http".
74
+ * <p>By default set to "jdk -http".
77
75
* @param threadPrefix the thread prefix to use
78
76
*/
79
77
public void setThreadPrefix (String threadPrefix ) {
@@ -88,20 +86,12 @@ public void afterPropertiesSet() throws Exception {
88
86
String name = this .threadPrefix + "@" + Integer .toHexString (hashCode ());
89
87
this .executor = Executors .newCachedThreadPool (new CustomizableThreadFactory (name ));
90
88
}
91
- if (this .executor instanceof LifeCycle ) {
92
- ((LifeCycle )this .executor ).start ();
93
- }
94
89
}
95
90
96
91
@ Override
97
92
public void destroy () throws Exception {
98
- try {
99
- if (this .executor instanceof LifeCycle ) {
100
- ((LifeCycle )this .executor ).stop ();
101
- }
102
- }
103
- catch (Throwable ex ) {
104
- // ignore
93
+ if (this .executor instanceof ExecutorService executorService ) {
94
+ executorService .shutdown ();
105
95
}
106
96
}
107
97
0 commit comments