Fix new Sonar smells
This commit is contained in:
@@ -16,10 +16,8 @@
|
||||
|
||||
package org.springframework.integration.aop;
|
||||
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
|
||||
/**
|
||||
* Advice for a {@link MessageSource#receive()} method to decide whether a poll
|
||||
* Advice for a {@link org.springframework.integration.core.MessageSource#receive()} method to decide whether a poll
|
||||
* should be ignored and/or take action after the receive.
|
||||
*
|
||||
* @author Gary Russell
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
@@ -70,11 +71,7 @@ public class AnnotationGatewayProxyFactoryBean extends GatewayProxyFactoryBean {
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();
|
||||
|
||||
if (getGlobalMethodMetadata() == null) {
|
||||
populateGatewayMethodMetadata();
|
||||
}
|
||||
populateGatewayMethodMetadataIfAny();
|
||||
|
||||
String defaultRequestTimeout = resolveAttribute("defaultRequestTimeout");
|
||||
String defaultReplyTimeout = resolveAttribute("defaultReplyTimeout");
|
||||
@@ -96,15 +93,8 @@ public class AnnotationGatewayProxyFactoryBean extends GatewayProxyFactoryBean {
|
||||
defaultReplyTimeout,
|
||||
value -> setDefaultReplyTimeout(Long.parseLong(value)));
|
||||
|
||||
if (!isAsyncExecutorExplicitlySet()) {
|
||||
String asyncExecutor = resolveAttribute("asyncExecutor");
|
||||
if (asyncExecutor == null || AnnotationConstants.NULL.equals(asyncExecutor)) {
|
||||
setAsyncExecutor(null);
|
||||
}
|
||||
else if (StringUtils.hasText(asyncExecutor)) {
|
||||
setAsyncExecutor(beanFactory.getBean(asyncExecutor, Executor.class));
|
||||
}
|
||||
}
|
||||
populateAsyncExecutorIfAny();
|
||||
|
||||
boolean proxyDefaultMethods = this.gatewayAttributes.getBoolean("proxyDefaultMethods");
|
||||
if (proxyDefaultMethods) {
|
||||
setProxyDefaultMethods(proxyDefaultMethods);
|
||||
@@ -112,7 +102,11 @@ public class AnnotationGatewayProxyFactoryBean extends GatewayProxyFactoryBean {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
private void populateGatewayMethodMetadata() {
|
||||
private void populateGatewayMethodMetadataIfAny() {
|
||||
if (getGlobalMethodMetadata() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();
|
||||
|
||||
String defaultPayloadExpression = resolveAttribute("defaultPayloadExpression");
|
||||
@@ -169,6 +163,19 @@ public class AnnotationGatewayProxyFactoryBean extends GatewayProxyFactoryBean {
|
||||
}
|
||||
}
|
||||
|
||||
private void populateAsyncExecutorIfAny() {
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
if (!isAsyncExecutorExplicitlySet()) {
|
||||
String asyncExecutor = resolveAttribute("asyncExecutor");
|
||||
if (asyncExecutor == null || AnnotationConstants.NULL.equals(asyncExecutor)) {
|
||||
setAsyncExecutor(null);
|
||||
}
|
||||
else if (StringUtils.hasText(asyncExecutor)) {
|
||||
setAsyncExecutor(beanFactory.getBean(asyncExecutor, Executor.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String resolveAttribute(String attributeName) {
|
||||
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.springframework.messaging.rsocket.RSocketRequester;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
|
||||
import io.rsocket.core.RSocketConnector;
|
||||
import io.rsocket.transport.ClientTransport;
|
||||
import io.rsocket.transport.netty.client.TcpClientTransport;
|
||||
import io.rsocket.transport.netty.client.WebsocketClientTransport;
|
||||
@@ -118,9 +117,9 @@ public class ClientRSocketConnector extends AbstractRSocketConnector {
|
||||
* target {@link RSocketRequester} to populate a reference to an internal
|
||||
* {@link IntegrationRSocketMessageHandler#responder()}.
|
||||
* This overrides possible external
|
||||
* {@link RSocketConnector#acceptor(io.rsocket.SocketAcceptor)}
|
||||
* {@link io.rsocket.core.RSocketConnector#acceptor(io.rsocket.SocketAcceptor)}
|
||||
* @param connectorConfigurer the {@link RSocketConnectorConfigurer} to
|
||||
* configure the {@link RSocketConnector}.
|
||||
* configure the {@link io.rsocket.core.RSocketConnector}.
|
||||
* @since 5.2.6
|
||||
* @see RSocketRequester.Builder#rsocketConnector(RSocketConnectorConfigurer)
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
|
||||
import io.rsocket.core.RSocketConnector;
|
||||
import io.rsocket.core.RSocketServer;
|
||||
import io.rsocket.transport.ServerTransport;
|
||||
import io.rsocket.transport.netty.server.CloseableChannel;
|
||||
@@ -48,7 +47,7 @@ import reactor.netty.http.server.HttpServer;
|
||||
*
|
||||
* @since 5.2
|
||||
*
|
||||
* @see RSocketConnector
|
||||
* @see io.rsocket.core.RSocketConnector
|
||||
*/
|
||||
public class ServerRSocketConnector extends AbstractRSocketConnector implements ApplicationEventPublisherAware {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user