Skip to content

Commit 00abc35

Browse files
committed
Revert "ServerSocketAppenderBase now uses ExecutorService from context"
This reverts commit 6497104.
1 parent a35cb7a commit 00abc35

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

logback-core/src/main/java/ch/qos/logback/core/net/server/ServerSocketAppenderBase.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void start() {
6363
ServerSocket socket = getServerSocketFactory().createServerSocket(
6464
getPort(), getBacklog(), getInetAddress());
6565
ServerListener<RemoteLoggerClient> listener = createServerListener(socket);
66-
executor = createExecutor();
66+
executor = getThreadPool().createExecutor();
6767
runner = createServerRunner(listener, executor);
6868
runner.setContext(getContext());
6969
runner.start();
@@ -86,24 +86,12 @@ protected ServerRunner<RemoteLoggerClient> createServerRunner(
8686
getClientQueueSize());
8787
}
8888

89-
protected ExecutorService createExecutor() {
90-
if (getThreadPool() == null) {
91-
return getContext().getExecutorService();
92-
}
93-
return getThreadPool().createExecutor();
94-
}
95-
9689
@Override
9790
public void stop() {
9891
if (!isStarted()) return;
9992
try {
10093
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();
10795
super.stop();
10896
}
10997
catch (IOException ex) {
@@ -242,10 +230,13 @@ public void setClientQueueSize(int clientQueueSize) {
242230

243231
/**
244232
* 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
247235
*/
248236
public ThreadPoolFactoryBean getThreadPool() {
237+
if (threadPool == null) {
238+
return new ThreadPoolFactoryBean();
239+
}
249240
return threadPool;
250241
}
251242

0 commit comments

Comments
 (0)