activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject [activemq] branch activemq-5.15.x updated: AMQ-7191 - Prevent extra creation of openwire verifier objects per new connection when using the auto transport
Date Tue, 30 Apr 2019 12:42:19 GMT
This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
     new b4cd70b  AMQ-7191 - Prevent extra creation of openwire verifier objects per new connection
when using the auto transport
b4cd70b is described below

commit b4cd70b1fcc40fa6e5b033135d4130a38e6091dd
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
AuthorDate: Tue Apr 30 08:41:08 2019 -0400

    AMQ-7191 - Prevent extra creation of openwire verifier objects per new
    connection when using the auto transport
    
    (cherry picked from commit bf3a9f44f625ef26e3c687be92e73ee1e9288d6f)
---
 .../activemq/transport/auto/AutoTcpTransportServer.java      |  7 ++-----
 .../transport/protocol/OpenWireProtocolVerifier.java         | 12 +++++-------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/activemq-broker/src/main/java/org/apache/activemq/transport/auto/AutoTcpTransportServer.java
b/activemq-broker/src/main/java/org/apache/activemq/transport/auto/AutoTcpTransportServer.java
index 309e368..7ec4de8 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/transport/auto/AutoTcpTransportServer.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/transport/auto/AutoTcpTransportServer.java
@@ -99,9 +99,6 @@ public class AutoTcpTransportServer extends TcpTransportServer {
                 }
                 IntrospectionSupport.setProperties(wff, wfOptions);
             }
-            if (wff instanceof OpenWireFormatFactory) {
-                protocolVerifiers.put(AutoTransportUtils.OPENWIRE, new OpenWireProtocolVerifier((OpenWireFormatFactory)
wff));
-            }
             return wff;
         } catch (Throwable e) {
            throw IOExceptionSupport.create("Could not create wire format factory for: " +
scheme + ", reason: " + e, e);
@@ -238,9 +235,9 @@ public class AutoTcpTransportServer extends TcpTransportServer {
         if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) {
             OpenWireProtocolVerifier owpv;
             if (wireFormatFactory instanceof OpenWireFormatFactory) {
-                owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory);
+                owpv = new OpenWireProtocolVerifier(((OpenWireFormatFactory) wireFormatFactory).isSizePrefixDisabled());
             } else {
-                owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory());
+                owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory().isSizePrefixDisabled());
             }
             protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv);
         }
diff --git a/activemq-broker/src/main/java/org/apache/activemq/transport/protocol/OpenWireProtocolVerifier.java
b/activemq-broker/src/main/java/org/apache/activemq/transport/protocol/OpenWireProtocolVerifier.java
index 71277c2..fe47745 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/transport/protocol/OpenWireProtocolVerifier.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/transport/protocol/OpenWireProtocolVerifier.java
@@ -17,19 +17,17 @@
 package org.apache.activemq.transport.protocol;
 
 import org.apache.activemq.command.WireFormatInfo;
-import org.apache.activemq.openwire.OpenWireFormat;
-import org.apache.activemq.openwire.OpenWireFormatFactory;
 
 /**
  *
  *
  */
-public class OpenWireProtocolVerifier  implements ProtocolVerifier {
+public class OpenWireProtocolVerifier implements ProtocolVerifier {
 
-    protected final OpenWireFormatFactory wireFormatFactory;
+    protected final boolean sizePrefixDisabled;
 
-    public OpenWireProtocolVerifier(OpenWireFormatFactory wireFormatFactory) {
-        this.wireFormatFactory = wireFormatFactory;
+    public OpenWireProtocolVerifier(final boolean sizePrefixDisabled) {
+        this.sizePrefixDisabled = sizePrefixDisabled;
     }
 
     /* (non-Javadoc)
@@ -42,7 +40,7 @@ public class OpenWireProtocolVerifier  implements ProtocolVerifier {
                                                  + value.length);
         }
 
-        int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled()
? 4 : 0;
+        int start = !sizePrefixDisabled ? 4 : 0;
         int j = 0;
         // type
         if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) {


Mime
View raw message