File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
mqtt_jmeter/src/main/java/net/xmeter/samplers/mqtt/hivemq Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class HiveMQTTConnection implements MQTTConnection {
2828 private static final Logger logger = Logger .getLogger (HiveMQTTConnection .class .getCanonicalName ());
2929
3030 private static final Charset charset = Charset .forName ("UTF-8" );
31- private static final CharsetDecoder decoder = charset .newDecoder ();
31+ private static ThreadLocal < CharsetDecoder > decoder = ThreadLocal . withInitial (() -> charset .newDecoder () );
3232
3333 private final Mqtt3BlockingClient client ;
3434 private final String clientId ;
@@ -112,7 +112,7 @@ private void handlePublishReceived(Mqtt3Publish received) {
112112
113113 private String decode (ByteBuffer value ) {
114114 try {
115- return decoder .decode (value ).toString ();
115+ return decoder .get (). decode (value ).toString ();
116116 } catch (CharacterCodingException e ) {
117117 throw new RuntimeException (new MQTTClientException ("Failed to decode" , e ));
118118 }
You can’t perform that action at this time.
0 commit comments