artemis/artemis-netty-4.1.patch
2020-10-28 16:02:34 +08:00

157 lines
7.3 KiB
Diff

From fcb70f3f60fd4c3eaf8b2fe3fdf11f0b82d91655 Mon Sep 17 00:00:00 2001
From: Paul Gallagher <pgallagh@redhat.com>
Date: Mon, 10 Oct 2016 12:35:25 +0100
Subject: [PATCH] ARTEMIS-779 upgrade to netty 4.1.5.Final
---
.../impl/netty/PartialPooledByteBufAllocator.java | 5 +++++
artemis-distribution/pom.xml | 2 +-
artemis-distribution/src/main/assembly/dep.xml | 1 -
artemis-protocols/artemis-mqtt-protocol/pom.xml | 19 +------------------
.../core/protocol/mqtt/MQTTProtocolHandler.java | 2 +-
.../core/protocol/mqtt/MQTTProtocolManager.java | 2 +-
pom.xml | 9 +--------
tests/integration-tests/pom.xml | 2 +-
8 files changed, 11 insertions(+), 31 deletions(-)
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/PartialPooledByteBufAllocator.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/PartialPooledByteBufAllocator.java
index aeede30dab..d6b9251c3e 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/PartialPooledByteBufAllocator.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/PartialPooledByteBufAllocator.java
@@ -130,4 +130,9 @@ public CompositeByteBuf compositeDirectBuffer(int maxNumComponents) {
public boolean isDirectBufferPooled() {
return true;
}
+
+ @Override
+ public int calculateNewCapacity(int minNewCapacity, int maxCapacity) {
+ return UNPOOLED.calculateNewCapacity(minNewCapacity, maxCapacity);
+ }
}
diff --git a/artemis-distribution/pom.xml b/artemis-distribution/pom.xml
index 36c219e738..46203e8c2e 100644
--- a/artemis-distribution/pom.xml
+++ b/artemis-distribution/pom.xml
@@ -186,7 +186,7 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
- <artifactId>netty-codec-mqtt</artifactId>
+ <artifactId>netty-all</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
diff --git a/artemis-distribution/src/main/assembly/dep.xml b/artemis-distribution/src/main/assembly/dep.xml
index a50fe79081..d21f1e0d6f 100644
--- a/artemis-distribution/src/main/assembly/dep.xml
+++ b/artemis-distribution/src/main/assembly/dep.xml
@@ -92,7 +92,6 @@
<include>commons-collections:commons-collections</include>
<include>org.fusesource.hawtbuf:hawtbuf</include>
<include>org.jgroups:jgroups</include>
- <include>io.netty:netty-codec-mqtt</include>
<include>org.apache.geronimo.specs:geronimo-json_1.0_spec</include>
<include>org.apache.johnzon:johnzon-core</include>
</includes>
diff --git a/artemis-protocols/artemis-mqtt-protocol/pom.xml b/artemis-protocols/artemis-mqtt-protocol/pom.xml
index 2260d51481..2349e16e57 100644
--- a/artemis-protocols/artemis-mqtt-protocol/pom.xml
+++ b/artemis-protocols/artemis-mqtt-protocol/pom.xml
@@ -46,7 +46,7 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
- <artifactId>netty-codec-mqtt</artifactId>
+ <artifactId>netty-all</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -54,21 +54,4 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.0.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Embed-Dependency>netty-codec-mqtt</Embed-Dependency>
- <Export-Package>!*</Export-Package>
- <Import-Package>io.netty.*;version="[4,6)", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
index 5d73f576ed..80923e9b3c 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
@@ -170,7 +170,7 @@ void disconnect() {
void sendConnack(MqttConnectReturnCode returnCode) {
MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
- MqttConnAckVariableHeader varHeader = new MqttConnAckVariableHeader(returnCode);
+ MqttConnAckVariableHeader varHeader = new MqttConnAckVariableHeader(returnCode, true);
MqttConnAckMessage message = new MqttConnAckMessage(fixedHeader, varHeader);
ctx.write(message);
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
index f8bdf2aacd..1f435ff686 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
@@ -111,7 +111,7 @@ public void handleBuffer(RemotingConnection connection, ActiveMQBuffer buffer) {
@Override
public void addChannelHandlers(ChannelPipeline pipeline) {
- pipeline.addLast(new MqttEncoder());
+ pipeline.addLast(MqttEncoder.INSTANCE);
pipeline.addLast(new MqttDecoder(MQTTUtil.MAX_MESSAGE_SIZE));
pipeline.addLast(new MQTTProtocolHandler(server, this));
diff --git a/pom.xml b/pom.xml
index 319132e244..5a05c4f46e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,7 +79,7 @@
<jetty.version>9.3.10.v20160621</jetty.version>
<jgroups.version>3.6.9.Final</jgroups.version>
<maven.assembly.plugin.version>2.4</maven.assembly.plugin.version>
- <netty.version>4.0.39.Final</netty.version>
+ <netty.version>4.1.5.Final</netty.version>
<proton.version>0.12.2</proton.version>
<resteasy.version>3.0.17.Final</resteasy.version>
<slf4j.version>1.7.12</slf4j.version>
@@ -400,12 +400,6 @@
<!-- License: Apache 2.0 -->
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-codec-mqtt</artifactId>
- <version>5.0.0.Alpha2</version>
- <!-- License: Apache 2.0 -->
- </dependency>
- <dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>proton-j</artifactId>
<version>${proton.version}</version>
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index ced7814f06..9ba87dc562 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -184,7 +184,7 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
- <artifactId>netty-codec-mqtt</artifactId>
+ <artifactId>netty-all</artifactId>
</dependency>
<!-- END MQTT Deps -->