diff --git a/README.md b/README.md index 0e9c4c6..0a38d34 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# th2-conn-dirty-fix (1.4.0) +# th2-conn-dirty-fix (1.4.1) This microservice allows sending and receiving messages via FIX protocol @@ -328,6 +328,9 @@ spec: ``` # Changelog +### 1.4.1 +* Use UTC time zone for sending time tag + ### 1.4.0 * Ungraceful session disconnect support. * Removed NPE when session is reset by schedule. diff --git a/gradle.properties b/gradle.properties index dd536e5..749e44a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -release_version=1.4.0 +release_version=1.4.1 jackson_version=2.11.2 diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index d61deed..7de2846 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -159,8 +159,8 @@ public class FixHandler implements AutoCloseable, IHandler { private final MessageLoader messageLoader; private final ReentrantLock recoveryLock = new ReentrantLock(); - private AtomicReference> heartbeatTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); - private AtomicReference> testRequestTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); + private final AtomicReference> heartbeatTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); + private final AtomicReference> testRequestTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); private Future reconnectRequestTimer = CompletableFuture.completedFuture(null); private volatile IChannel channel; protected FixHandlerSettings settings; @@ -294,18 +294,16 @@ public CompletableFuture send(@NotNull RawMessage rawMessage) { } } - CompletableFuture result = CompletableFuture.completedFuture(null); try { recoveryLock.lock(); - result = channel.send(toByteBuf(rawMessage.getBody()), rawMessage.getMetadata().getPropertiesMap(), getEventId(rawMessage), SendMode.HANDLE_AND_MANGLE); + return channel.send(toByteBuf(rawMessage.getBody()), rawMessage.getMetadata().getPropertiesMap(), getEventId(rawMessage), SendMode.HANDLE_AND_MANGLE); } finally { recoveryLock.unlock(); } - return result; } @Override - public ByteBuf onReceive(IChannel channel, ByteBuf buffer) { + public ByteBuf onReceive(@NotNull IChannel channel, ByteBuf buffer) { int offset = buffer.readerIndex(); if (offset == buffer.writerIndex()) return null; @@ -369,7 +367,7 @@ public Map onIncoming(@NotNull IChannel channel, @NotNull ByteBu FixField possDup = findField(message, POSS_DUP_TAG); boolean isDup = false; if(possDup != null) { - isDup = possDup.getValue().equals(IS_POSS_DUP); + isDup = IS_POSS_DUP.equals(possDup.getValue()); } String msgTypeValue = requireNonNull(msgType.getValue()); @@ -522,7 +520,7 @@ private void resetSequence(ByteBuf message) { FixField seqNumValue = findField(message, NEW_SEQ_NO_TAG); if(seqNumValue != null) { - if(gapFillMode == null || gapFillMode.getValue().equals("N")) { + if(gapFillMode == null || "N".equals(gapFillMode.getValue())) { serverMsgSeqNum.set(Integer.parseInt(requireNonNull(seqNumValue.getValue()))); } else { serverMsgSeqNum.set(Integer.parseInt(requireNonNull(seqNumValue.getValue())) - 1); @@ -604,7 +602,7 @@ private void recovery(int beginSeqNo, int endSeqNo) { || msgTypeField == null || msgTypeField.getValue() == null) { return true; } - Integer sequence = Integer.parseInt(seqNum.getValue()); + int sequence = Integer.parseInt(seqNum.getValue()); String msgType = msgTypeField.getValue(); if(sequence < beginSeqNo) return true; @@ -727,7 +725,8 @@ public void onOutgoingUpdateTag(@NotNull ByteBuf message, @NotNull Map "First filed isn't found in message: " + message.toString(US_ASCII)) + .insertPrevious(BEGIN_STRING_TAG, settings.getBeginString()); } FixField bodyLength = findField(message, BODY_LENGTH_TAG, US_ASCII, beginString); @@ -749,7 +748,8 @@ public void onOutgoingUpdateTag(@NotNull ByteBuf message, @NotNull Map