mirror of
https://github.com/apache/activemq.git
synced 2025-02-16 23:16:52 +00:00
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);
|
IntrospectionSupport.setProperties(wff, wfOptions);
|
||||||
}
|
}
|
||||||
if (wff instanceof OpenWireFormatFactory) {
|
|
||||||
protocolVerifiers.put(AutoTransportUtils.OPENWIRE, new OpenWireProtocolVerifier((OpenWireFormatFactory) wff));
|
|
||||||
}
|
|
||||||
return wff;
|
return wff;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw IOExceptionSupport.create("Could not create wire format factory for: " + scheme + ", reason: " + e, 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)) {
|
if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) {
|
||||||
OpenWireProtocolVerifier owpv;
|
OpenWireProtocolVerifier owpv;
|
||||||
if (wireFormatFactory instanceof OpenWireFormatFactory) {
|
if (wireFormatFactory instanceof OpenWireFormatFactory) {
|
||||||
owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory);
|
owpv = new OpenWireProtocolVerifier(((OpenWireFormatFactory) wireFormatFactory).isSizePrefixDisabled());
|
||||||
} else {
|
} else {
|
||||||
owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory());
|
owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory().isSizePrefixDisabled());
|
||||||
}
|
}
|
||||||
protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv);
|
protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv);
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
package org.apache.activemq.transport.protocol;
|
package org.apache.activemq.transport.protocol;
|
||||||
|
|
||||||
import org.apache.activemq.command.WireFormatInfo;
|
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 {
|
public class OpenWireProtocolVerifier implements ProtocolVerifier {
|
||||||
|
|
||||||
protected final OpenWireFormatFactory wireFormatFactory;
|
protected final boolean sizePrefixDisabled;
|
||||||
|
|
||||||
public OpenWireProtocolVerifier(OpenWireFormatFactory wireFormatFactory) {
|
public OpenWireProtocolVerifier(final boolean sizePrefixDisabled) {
|
||||||
this.wireFormatFactory = wireFormatFactory;
|
this.sizePrefixDisabled = sizePrefixDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@ -42,7 +40,7 @@ public class OpenWireProtocolVerifier implements ProtocolVerifier {
|
|||||||
+ value.length);
|
+ value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled() ? 4 : 0;
|
int start = !sizePrefixDisabled ? 4 : 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
// type
|
// type
|
||||||
if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) {
|
if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user