mirror of https://github.com/apache/activemq.git
AMQ-7191 - Prevent extra creation of openwire verifier objects per new
connection when using the auto transport
This commit is contained in:
parent
aff9413cdb
commit
bf3a9f44f6
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package org.apache.activemq.transport.protocol;
|
||||
|
||||
import org.apache.activemq.command.WireFormatInfo;
|
||||
import org.apache.activemq.openwire.OpenWireFormat;
|
||||
import org.apache.activemq.openwire.OpenWireFormatFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -26,10 +24,10 @@ import org.apache.activemq.openwire.OpenWireFormatFactory;
|
|||
*/
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue