Skip to content

Commit f5fcdd7

Browse files
Fix server worker executor initialization.
1 parent a055f07 commit f5fcdd7

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

jooby-jetty/src/main/java/org/jooby/internal/jetty/JettyServer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,11 @@ public class JettyServer implements org.jooby.spi.Server {
7171
private final Logger log = LoggerFactory.getLogger(org.jooby.spi.Server.class);
7272

7373
private Server server;
74-
private Executor executor;
7574

7675
@Inject
7776
public JettyServer(final HttpHandler handler, final Config conf,
7877
final Provider<SSLContext> sslCtx) {
7978
this.server = server(handler, conf, sslCtx);
80-
this.executor = this.server.getThreadPool();
8179
}
8280

8381
private Server server(final HttpHandler handler, final Config conf,
@@ -201,7 +199,7 @@ public void stop() throws Exception {
201199
@Override
202200
public Optional<Executor> executor()
203201
{
204-
return Optional.of(executor);
202+
return Optional.ofNullable(server.getThreadPool());
205203
}
206204

207205
private void tryOption(final Object source, final Config config, final Method option) {

jooby-netty/src/main/java/org/jooby/internal/netty/NettyServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public void join() throws InterruptedException {
157157
@Override
158158
public Optional<Executor> executor()
159159
{
160-
return Optional.of(executor);
160+
return Optional.ofNullable(executor);
161161
}
162162

163163
@SuppressWarnings({"rawtypes", "unchecked" })

jooby-undertow/src/main/java/org/jooby/internal/undertow/UndertowServer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ private interface SetOption {
5656
private static final Logger log = LoggerFactory.getLogger(org.jooby.spi.Server.class);
5757

5858
private Undertow server;
59-
private Executor executor;
6059

6160
private final GracefulShutdownHandler shutdown;
6261

@@ -88,8 +87,6 @@ public UndertowServer(final org.jooby.spi.HttpHandler dispatcher, final Config c
8887

8988
this.server = ubuilder.setHandler(shutdown)
9089
.build();
91-
92-
this.executor = server.getWorker();
9390
}
9491

9592
private String host(final String host) {
@@ -214,7 +211,7 @@ public void stop() throws Exception {
214211
@Override
215212
public Optional<Executor> executor()
216213
{
217-
return Optional.of(executor);
214+
return Optional.ofNullable(server.getWorker());
218215
}
219216

220217
}

0 commit comments

Comments
 (0)