Upgrade to reactor-netty/-ipc to 0.6 snapshots
This commit is contained in:
committed by
Rossen Stoyanchev
parent
57130b2d10
commit
099f5a254e
@@ -17,6 +17,7 @@
|
||||
package org.springframework.http.server.reactive.bootstrap;
|
||||
|
||||
import reactor.core.Loopback;
|
||||
import reactor.ipc.netty.NettyContext;
|
||||
|
||||
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -28,9 +29,9 @@ public class ReactorHttpServer extends HttpServerSupport implements HttpServer,
|
||||
|
||||
private ReactorHttpHandlerAdapter reactorHandler;
|
||||
|
||||
private reactor.ipc.netty.http.HttpServer reactorServer;
|
||||
private reactor.ipc.netty.http.server.HttpServer reactorServer;
|
||||
|
||||
private boolean running;
|
||||
private NettyContext running;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -42,13 +43,16 @@ public class ReactorHttpServer extends HttpServerSupport implements HttpServer,
|
||||
Assert.notNull(getHttpHandler());
|
||||
this.reactorHandler = new ReactorHttpHandlerAdapter(getHttpHandler());
|
||||
}
|
||||
this.reactorServer = reactor.ipc.netty.http.HttpServer.create(getHost(), getPort());
|
||||
this.reactorServer = reactor.ipc.netty.http.server.HttpServer.create(getHost(),
|
||||
getPort());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
NettyContext running = this.running;
|
||||
return running != null && running.channel()
|
||||
.isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,22 +67,19 @@ public class ReactorHttpServer extends HttpServerSupport implements HttpServer,
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (!this.running) {
|
||||
try {
|
||||
this.reactorServer.startAndAwait(reactorHandler);
|
||||
this.running = true;
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
//Should be made thread-safe (compareAndSet..)
|
||||
if (this.running == null) {
|
||||
this.running = this.reactorServer.newHandler(reactorHandler)
|
||||
.block();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (this.running) {
|
||||
this.reactorServer.shutdown();
|
||||
this.running = false;
|
||||
NettyContext running = this.running;
|
||||
if (running != null) {
|
||||
this.running = null;
|
||||
running.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user