INT-3577: Remove flush() from TCP Serializers
JIRA: https://jira.spring.io/browse/INT-3577 It is no longer necessary to `flush()` the `BufferedOutputStream`. Since INT-3575, the `TcpNetConnection` has flushed the stream. The `TcpNioConnection` now does so too. * Add `id` for the `<section>`s in the `whats-new.xml`
This commit is contained in:
committed by
Artem Bilan
parent
29e65e68af
commit
beeb49d55b
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -145,6 +145,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
|||||||
this.lastSend = System.currentTimeMillis();
|
this.lastSend = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
((Serializer<Object>) this.getSerializer()).serialize(object, this.bufferedOutputStream);
|
((Serializer<Object>) this.getSerializer()).serialize(object, this.bufferedOutputStream);
|
||||||
|
this.bufferedOutputStream.flush();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
this.publishConnectionExceptionEvent(e);
|
this.publishConnectionExceptionEvent(e);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -89,7 +89,6 @@ public class ByteArrayCrLfSerializer extends AbstractByteArraySerializer {
|
|||||||
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.write(CRLF);
|
outputStream.write(CRLF);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -133,7 +133,6 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
|||||||
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
||||||
this.writeHeader(outputStream, bytes.length);
|
this.writeHeader(outputStream, bytes.length);
|
||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,4 +252,5 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,4 +25,5 @@ public class ByteArrayLfSerializer extends ByteArraySingleTerminatorSerializer {
|
|||||||
public ByteArrayLfSerializer() {
|
public ByteArrayLfSerializer() {
|
||||||
super((byte) 0x0a);
|
super((byte) 0x0a);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -39,7 +39,6 @@ public class ByteArrayRawSerializer extends AbstractByteArraySerializer {
|
|||||||
public void serialize(byte[] bytes, OutputStream outputStream)
|
public void serialize(byte[] bytes, OutputStream outputStream)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -91,7 +91,6 @@ public class ByteArraySingleTerminatorSerializer extends AbstractByteArraySerial
|
|||||||
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.write(terminator);
|
outputStream.write(terminator);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -88,7 +88,6 @@ public class ByteArrayStxEtxSerializer extends AbstractByteArraySerializer {
|
|||||||
outputStream.write(STX);
|
outputStream.write(STX);
|
||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.write(ETX);
|
outputStream.write(ETX);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,8 +26,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.springframework.core.serializer.Deserializer;
|
import org.springframework.core.serializer.Deserializer;
|
||||||
import org.springframework.core.serializer.Serializer;
|
import org.springframework.core.serializer.Serializer;
|
||||||
import org.springframework.integration.support.json.JsonObjectMapperProvider;
|
|
||||||
import org.springframework.integration.support.json.JsonObjectMapper;
|
import org.springframework.integration.support.json.JsonObjectMapper;
|
||||||
|
import org.springframework.integration.support.json.JsonObjectMapperProvider;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +107,6 @@ public class MapJsonSerializer implements Serializer<Map<?, ?>>, Deserializer<Ma
|
|||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
this.packetSerializer.serialize(baos.toByteArray(), outputStream);
|
this.packetSerializer.serialize(baos.toByteArray(), outputStream);
|
||||||
outputStream.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
The default attribute value is <code>false</code>.
|
The default attribute value is <code>false</code>.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="4.2-class-package-change">
|
||||||
<title>Class Package Change</title>
|
<title>Class Package Change</title>
|
||||||
<para>
|
<para>
|
||||||
The <classname>ScatterGatherHandler</classname> class has been moved from the
|
The <classname>ScatterGatherHandler</classname> class has been moved from the
|
||||||
@@ -39,6 +39,15 @@
|
|||||||
<code>org.springframework.integration.scattergather</code>.
|
<code>org.springframework.integration.scattergather</code>.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
<section id="4.2-tcp-serializers">
|
||||||
|
<title>TCP Serializers</title>
|
||||||
|
<para>
|
||||||
|
The TCP <interfacename>Serializers</interfacename> no longer <code>flush()</code> the
|
||||||
|
<classname>OutputStream</classname>; this is now done by the <classname>TcpNxxConnection</classname>
|
||||||
|
classes. If you are using the serializers directly within user code, you may have to
|
||||||
|
<code>flush()</code> the <classname>OutputStream</classname>.
|
||||||
|
</para>
|
||||||
|
</section>
|
||||||
<section id="4.2-tcp-server-exceptions">
|
<section id="4.2-tcp-server-exceptions">
|
||||||
<title>Server Socket Exceptions</title>
|
<title>Server Socket Exceptions</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -47,7 +56,7 @@
|
|||||||
See <xref linkend="tcp-events"/> for more information.
|
See <xref linkend="tcp-events"/> for more information.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="4.2-inbound-channel-adapter-annotation">
|
||||||
<title>@InboundChannelAdapter</title>
|
<title>@InboundChannelAdapter</title>
|
||||||
<para>
|
<para>
|
||||||
Previously, the <classname>@Poller</classname> on an inbound channel adapter defaulted
|
Previously, the <classname>@Poller</classname> on an inbound channel adapter defaulted
|
||||||
|
|||||||
Reference in New Issue
Block a user