Skip to content

Commit fd1d653

Browse files
committed
Rename socket factory processor methods on NettyRSocketServerFactory
Previously, the methods were named addServerProcessors and setServerProcessors which wasn't aligned with them taking socket factory processors (ServerRSocketFactoryProcessor) as an argument. This commit renames the methods to align them more closely with the type of their arguments. Closes gh-18617
1 parent 7104b83 commit fd1d653

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorR
9797
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
9898
map.from(properties.getServer().getAddress()).to(factory::setAddress);
9999
map.from(properties.getServer().getPort()).to(factory::setPort);
100-
factory.setServerProcessors(processors.orderedStream().collect(Collectors.toList()));
100+
factory.setSocketFactoryProcessors(processors.orderedStream().collect(Collectors.toList()));
101101
return factory;
102102
}
103103

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.List;
2626

2727
import io.rsocket.RSocketFactory;
28+
import io.rsocket.RSocketFactory.ServerRSocketFactory;
2829
import io.rsocket.SocketAcceptor;
2930
import io.rsocket.transport.ServerTransport;
3031
import io.rsocket.transport.netty.server.CloseableChannel;
@@ -60,7 +61,7 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
6061

6162
private Duration lifecycleTimeout;
6263

63-
private List<ServerRSocketFactoryProcessor> serverProcessors = new ArrayList<>();
64+
private List<ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>();
6465

6566
@Override
6667
public void setPort(int port) {
@@ -86,23 +87,25 @@ public void setResourceFactory(ReactorResourceFactory resourceFactory) {
8687
}
8788

8889
/**
89-
* Set {@link ServerRSocketFactoryProcessor}s that should be applied to the RSocket
90-
* server builder. Calling this method will replace any existing customizers.
91-
* @param serverProcessors server processors to apply before the server starts
90+
* Set {@link ServerRSocketFactoryProcessor}s that should be called to process the
91+
* {@link ServerRSocketFactory} while building the server. Calling this method will
92+
* replace any existing processors.
93+
* @param socketFactoryProcessors processors to apply before the server starts
9294
*/
93-
public void setServerProcessors(Collection<? extends ServerRSocketFactoryProcessor> serverProcessors) {
94-
Assert.notNull(serverProcessors, "ServerProcessors must not be null");
95-
this.serverProcessors = new ArrayList<>(serverProcessors);
95+
public void setSocketFactoryProcessors(
96+
Collection<? extends ServerRSocketFactoryProcessor> socketFactoryProcessors) {
97+
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
98+
this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors);
9699
}
97100

98101
/**
99-
* Add {@link ServerRSocketFactoryProcessor}s that should applied while building the
100-
* server.
101-
* @param serverProcessors server processors to apply before the server starts
102+
* Add {@link ServerRSocketFactoryProcessor}s that should be called to process the
103+
* {@link ServerRSocketFactory} while building the server.
104+
* @param socketFactoryProcessors processors to apply before the server starts
102105
*/
103-
public void addServerProcessors(ServerRSocketFactoryProcessor... serverProcessors) {
104-
Assert.notNull(serverProcessors, "ServerProcessors must not be null");
105-
this.serverProcessors.addAll(Arrays.asList(serverProcessors));
106+
public void addSocketFactoryProcessors(ServerRSocketFactoryProcessor... socketFactoryProcessors) {
107+
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
108+
this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors));
106109
}
107110

108111
/**
@@ -118,7 +121,7 @@ public void setLifecycleTimeout(Duration lifecycleTimeout) {
118121
public NettyRSocketServer create(SocketAcceptor socketAcceptor) {
119122
ServerTransport<CloseableChannel> transport = createTransport();
120123
RSocketFactory.ServerRSocketFactory factory = RSocketFactory.receive();
121-
for (ServerRSocketFactoryProcessor processor : this.serverProcessors) {
124+
for (ServerRSocketFactoryProcessor processor : this.socketFactoryProcessors) {
122125
factory = processor.process(factory);
123126
}
124127
Mono<CloseableChannel> starter = factory.acceptor(socketAcceptor).transport(transport).start();

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void serverProcessors() {
137137
given(processors[i].process(any(RSocketFactory.ServerRSocketFactory.class)))
138138
.will((invocation) -> invocation.getArgument(0));
139139
}
140-
factory.setServerProcessors(Arrays.asList(processors));
140+
factory.setSocketFactoryProcessors(Arrays.asList(processors));
141141
this.server = factory.create(new EchoRequestResponseAcceptor());
142142
InOrder ordered = inOrder((Object[]) processors);
143143
for (ServerRSocketFactoryProcessor processor : processors) {

0 commit comments

Comments
 (0)