Skip to content

Commit 562d1df

Browse files
committed
Polishing
1 parent b95a95f commit 562d1df

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/config/StompBrokerRelayRegistration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -231,8 +231,8 @@ protected String getUserRegistryBroadcast() {
231231
}
232232

233233

234+
@Override
234235
protected StompBrokerRelayMessageHandler getMessageHandler(SubscribableChannel brokerChannel) {
235-
236236
StompBrokerRelayMessageHandler handler = new StompBrokerRelayMessageHandler(
237237
getClientInboundChannel(), getClientOutboundChannel(),
238238
brokerChannel, getDestinationPrefixes());

spring-webflux/src/main/java/org/springframework/web/reactive/socket/WebSocketSession.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,7 +58,6 @@ public interface WebSocketSession {
5858
* is closed. In a typical {@link WebSocketHandler} implementation this
5959
* stream is composed into the overall processing flow, so that when the
6060
* connection is closed, handling will end.
61-
*
6261
* <p>See the class-level doc of {@link WebSocketHandler} and the reference
6362
* for more details and examples of how to handle the session.
6463
*/
@@ -68,7 +67,6 @@ public interface WebSocketSession {
6867
* Give a source of outgoing messages, write the messages and return a
6968
* {@code Mono<Void>} that completes when the source completes and writing
7069
* is done.
71-
*
7270
* <p>See the class-level doc of {@link WebSocketHandler} and the reference
7371
* for more details and examples of how to handle the session.
7472
*/

spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
164164
ClassUtils.isPresent("javax.validation.Validator",
165165
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
166166

167-
private static boolean romePresent =
167+
private static final boolean romePresent =
168168
ClassUtils.isPresent("com.rometools.rome.feed.WireFeed",
169169
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
170170

@@ -213,7 +213,7 @@ public BeanDefinition parse(Element element, ParserContext context) {
213213
handlerMappingDef.getPropertyValues().add("contentNegotiationManager", contentNegotiationManager);
214214

215215
if (element.hasAttribute("enable-matrix-variables")) {
216-
Boolean enableMatrixVariables = Boolean.valueOf(element.getAttribute("enable-matrix-variables"));
216+
boolean enableMatrixVariables = Boolean.parseBoolean(element.getAttribute("enable-matrix-variables"));
217217
handlerMappingDef.getPropertyValues().add("removeSemicolonContent", !enableMatrixVariables);
218218
}
219219

@@ -574,7 +574,7 @@ private ManagedList<?> getMessageConverters(Element element, @Nullable Object so
574574
}
575575
}
576576

577-
if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
577+
if (convertersElement == null || Boolean.parseBoolean(convertersElement.getAttribute("register-defaults"))) {
578578
messageConverters.setSource(source);
579579
messageConverters.add(createConverterDefinition(ByteArrayHttpMessageConverter.class, source));
580580

spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
8181

8282
private static final String RESOURCE_URL_PROVIDER = "mvcResourceUrlProvider";
8383

84-
private static final boolean isWebJarsAssetLocatorPresent = ClassUtils.isPresent(
84+
private static final boolean webJarsPresent = ClassUtils.isPresent(
8585
"org.webjars.WebJarAssetLocator", ResourcesBeanDefinitionParser.class.getClassLoader());
8686

8787

@@ -331,7 +331,7 @@ private void parseResourceResolversTransformers(boolean isAutoRegistration,
331331
}
332332

333333
if (isAutoRegistration) {
334-
if (isWebJarsAssetLocatorPresent) {
334+
if (webJarsPresent) {
335335
RootBeanDefinition webJarsResolverDef = new RootBeanDefinition(WebJarsResourceResolver.class);
336336
webJarsResolverDef.setSource(source);
337337
webJarsResolverDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);

spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -120,6 +120,12 @@ public interface WebSocketSession extends Closeable {
120120

121121
/**
122122
* Send a WebSocket message: either {@link TextMessage} or {@link BinaryMessage}.
123+
* <p><strong>Note:</strong> The underlying standard WebSocket session (JSR-356) does
124+
* not allow concurrent sending. Therefore sending must be synchronized. To ensure
125+
* that, one option is to wrap the {@code WebSocketSession} with the
126+
* {@link org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator
127+
* ConcurrentWebSocketSessionDecorator}.
128+
* @see org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator
123129
*/
124130
void sendMessage(WebSocketMessage<?> message) throws IOException;
125131

0 commit comments

Comments
 (0)