diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyValue.java b/spring-beans/src/main/java/org/springframework/beans/PropertyValue.java index 62f35cde76..3c2f4e6c5b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyValue.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,7 +145,7 @@ public class PropertyValue extends BeanMetadataAttributeAccessor implements Seri } /** - * Reeurn whether this is an optional value, that is, to be ignored + * Return whether this is an optional value, that is, to be ignored * when no corresponding property exists on the target class. * @since 3.0 */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/Reactor2StompCodec.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/Reactor2StompCodec.java index 4f211d6fc1..91d8c4851b 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/Reactor2StompCodec.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/Reactor2StompCodec.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ package org.springframework.messaging.simp.stomp; import java.nio.ByteBuffer; - -import org.springframework.messaging.Message; -import org.springframework.util.Assert; import reactor.fn.Consumer; import reactor.fn.Function; import reactor.io.buffer.Buffer; import reactor.io.codec.Codec; +import org.springframework.messaging.Message; +import org.springframework.util.Assert; + /** * A Reactor TCP {@link Codec} for sending and receiving STOMP messages. * @@ -35,25 +35,23 @@ import reactor.io.codec.Codec; */ public class Reactor2StompCodec extends Codec, Message> { - private final StompDecoder stompDecoder; - - private final StompEncoder stompEncoder; - private final Function, Buffer> encodingFunction; + private final StompDecoder stompDecoder; + public Reactor2StompCodec() { this(new StompEncoder(), new StompDecoder()); } public Reactor2StompCodec(StompEncoder encoder, StompDecoder decoder) { - Assert.notNull(encoder, "'encoder' is required"); - Assert.notNull(decoder, "'decoder' is required"); - this.stompEncoder = encoder; + Assert.notNull(encoder, "StompEncoder is required"); + Assert.notNull(decoder, "StompDecoder is required"); + this.encodingFunction = new EncodingFunction(encoder); this.stompDecoder = decoder; - this.encodingFunction = new EncodingFunction(this.stompEncoder); } + @Override public Function> decoder(final Consumer> messageConsumer) { return new DecodingFunction(this.stompDecoder, messageConsumer); @@ -66,14 +64,15 @@ public class Reactor2StompCodec extends Codec, Message message) { - return encodingFunction.apply(message); + return this.encodingFunction.apply(message); } + private static class EncodingFunction implements Function, Buffer> { private final StompEncoder encoder; - private EncodingFunction(StompEncoder encoder) { + public EncodingFunction(StompEncoder encoder) { this.encoder = encoder; } @@ -84,6 +83,7 @@ public class Reactor2StompCodec extends Codec, Message> { private final StompDecoder decoder; @@ -103,4 +103,5 @@ public class Reactor2StompCodec extends Codec, Message configList = Arrays.asList(config); + List configList = Collections.singletonList(config); return new ReactorConfiguration(configList, dispatcherName, new Properties()); } } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpClient.java b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpClient.java index 71541dcd79..2cc29a46ba 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpClient.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,15 +151,13 @@ public class Reactor2TcpClient

implements TcpOperations

{ try { ioThreadCount = Integer.parseInt(System.getProperty("reactor.tcp.ioThreadCount")); } - catch (Exception ex) { + catch (Throwable ex) { ioThreadCount = -1; } - if (ioThreadCount <= 0l) { + if (ioThreadCount <= 0) { ioThreadCount = Runtime.getRuntime().availableProcessors(); } - - return new NioEventLoopGroup(ioThreadCount, - new NamedDaemonThreadFactory("reactor-tcp-io")); + return new NioEventLoopGroup(ioThreadCount, new NamedDaemonThreadFactory("reactor-tcp-io")); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpConnection.java b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpConnection.java index 6770aabf97..98c3a9952c 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpConnection.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/Reactor2TcpConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +29,9 @@ import org.springframework.util.concurrent.ListenableFuture; * An implementation of {@link org.springframework.messaging.tcp.TcpConnection * TcpConnection} based on the TCP client support of the Reactor project. * - * @param

the payload type of messages read or written to the TCP stream. - * * @author Rossen Stoyanchev * @since 4.2 + * @param

the payload type of messages read or written to the TCP stream. */ public class Reactor2TcpConnection

implements TcpConnection

{ @@ -41,9 +40,7 @@ public class Reactor2TcpConnection

implements TcpConnection

{ private final Promise closePromise; - public Reactor2TcpConnection(ChannelStream, Message

> channelStream, - Promise closePromise) { - + public Reactor2TcpConnection(ChannelStream, Message

> channelStream, Promise closePromise) { this.channelStream = channelStream; this.closePromise = closePromise; }