@@ -63,7 +63,7 @@ public void start() {
63
63
ServerSocket socket = getServerSocketFactory ().createServerSocket (
64
64
getPort (), getBacklog (), getInetAddress ());
65
65
ServerListener <RemoteLoggerClient > listener = createServerListener (socket );
66
- executor = createExecutor ();
66
+ executor = getThreadPool (). createExecutor ();
67
67
runner = createServerRunner (listener , executor );
68
68
runner .setContext (getContext ());
69
69
runner .start ();
@@ -86,24 +86,12 @@ protected ServerRunner<RemoteLoggerClient> createServerRunner(
86
86
getClientQueueSize ());
87
87
}
88
88
89
- protected ExecutorService createExecutor () {
90
- if (getThreadPool () == null ) {
91
- return getContext ().getExecutorService ();
92
- }
93
- return getThreadPool ().createExecutor ();
94
- }
95
-
96
89
@ Override
97
90
public void stop () {
98
91
if (!isStarted ()) return ;
99
92
try {
100
93
runner .stop ();
101
-
102
- // shutdown the executor only if we created our own
103
- if (executor != getContext ().getExecutorService ()) {
104
- executor .shutdownNow ();
105
- }
106
-
94
+ executor .shutdownNow ();
107
95
super .stop ();
108
96
}
109
97
catch (IOException ex ) {
@@ -242,10 +230,13 @@ public void setClientQueueSize(int clientQueueSize) {
242
230
243
231
/**
244
232
* Gets the server's thread pool configuration.
245
- * @return thread pool configuration or {@code null} if no configuration was
246
- * provided
233
+ * @return thread pool configuration; if no thread pool configuration was
234
+ * provided, a default configuration is returned
247
235
*/
248
236
public ThreadPoolFactoryBean getThreadPool () {
237
+ if (threadPool == null ) {
238
+ return new ThreadPoolFactoryBean ();
239
+ }
249
240
return threadPool ;
250
241
}
251
242
0 commit comments