This commit is contained in:
Phillip Webb
2019-04-11 13:39:26 -07:00
parent dabe75a281
commit 2dfd916c96
34 changed files with 517 additions and 451 deletions

View File

@@ -38,15 +38,12 @@ class FlywayMigrationScriptMissingFailureAnalyzer
.append("no migration scripts location is configured").toString(),
"Check your Flyway configuration", cause);
}
else {
description.append(String.format(
"none of the following migration scripts locations could be found:%n%n"));
cause.getLocations().forEach((location) -> description
.append(String.format("\t- %s%n", location)));
return new FailureAnalysis(description.toString(),
"Review the locations above or check your Flyway configuration",
cause);
}
description.append(String.format(
"none of the following migration scripts locations could be found:%n%n"));
cause.getLocations().forEach(
(location) -> description.append(String.format("\t- %s%n", location)));
return new FailureAnalysis(description.toString(),
"Review the locations above or check your Flyway configuration", cause);
}
}

View File

@@ -74,41 +74,44 @@ public class MongoReactiveAutoConfiguration {
return new NettyDriverMongoClientSettingsBuilderCustomizer(settings);
}
private static final class NettyDriverMongoClientSettingsBuilderCustomizer
implements MongoClientSettingsBuilderCustomizer, DisposableBean {
}
private final ObjectProvider<MongoClientSettings> settings;
/**
* {@link MongoClientSettingsBuilderCustomizer} to apply Mongo client settings.
*/
private static final class NettyDriverMongoClientSettingsBuilderCustomizer
implements MongoClientSettingsBuilderCustomizer, DisposableBean {
private volatile EventLoopGroup eventLoopGroup;
private final ObjectProvider<MongoClientSettings> settings;
private NettyDriverMongoClientSettingsBuilderCustomizer(
ObjectProvider<MongoClientSettings> settings) {
this.settings = settings;
private volatile EventLoopGroup eventLoopGroup;
private NettyDriverMongoClientSettingsBuilderCustomizer(
ObjectProvider<MongoClientSettings> settings) {
this.settings = settings;
}
@Override
public void customize(Builder builder) {
if (!isStreamFactoryFactoryDefined(this.settings.getIfAvailable())) {
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
this.eventLoopGroup = eventLoopGroup;
builder.streamFactoryFactory(NettyStreamFactoryFactory.builder()
.eventLoopGroup(eventLoopGroup).build());
}
}
@Override
public void customize(Builder builder) {
if (!isStreamFactoryFactoryDefined(this.settings.getIfAvailable())) {
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
this.eventLoopGroup = eventLoopGroup;
builder.streamFactoryFactory(NettyStreamFactoryFactory.builder()
.eventLoopGroup(eventLoopGroup).build());
}
}
@Override
public void destroy() {
EventLoopGroup eventLoopGroup = this.eventLoopGroup;
if (eventLoopGroup != null) {
eventLoopGroup.shutdownGracefully().awaitUninterruptibly();
this.eventLoopGroup = null;
}
}
private boolean isStreamFactoryFactoryDefined(MongoClientSettings settings) {
return settings != null && settings.getStreamFactoryFactory() != null;
@Override
public void destroy() {
EventLoopGroup eventLoopGroup = this.eventLoopGroup;
if (eventLoopGroup != null) {
eventLoopGroup.shutdownGracefully().awaitUninterruptibly();
this.eventLoopGroup = null;
}
}
private boolean isStreamFactoryFactoryDefined(MongoClientSettings settings) {
return settings != null && settings.getStreamFactoryFactory() != null;
}
}

View File

@@ -43,7 +43,7 @@ class RSocketNettyServerCustomizer implements NettyServerCustomizer {
@Override
public HttpServer apply(HttpServer httpServer) {
final ServerTransport.ConnectionAcceptor acceptor = RSocketFactory.receive()
ServerTransport.ConnectionAcceptor acceptor = RSocketFactory.receive()
.acceptor(this.messageHandlerAcceptor).toConnectionAcceptor();
return httpServer.route((routes) -> routes.ws(this.mappingPath,
WebsocketRouteTransport.newHandler(acceptor)));

View File

@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("spring.rsocket")
public class RSocketProperties {
private Server server = new Server();
private final Server server = new Server();
public Server getServer() {
return this.server;