Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #382] Fix java.lang.NumberFormatException when parsing Long #383

Merged
merged 20 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ba67c5c
Merge pull request #1 from apache/develop
jinrongluo May 10, 2021
d638ec4
[Issue #337] Fix HttpSubscriber startup issue
May 10, 2021
5ebfb54
[Issue #337] test commit
jinrongluo May 10, 2021
a3afff3
[Issue #337] revert test commit
jinrongluo May 10, 2021
50f959d
[Issue #337] Enhance Http Demo Subscriber by using ExecutorService, C…
jinrongluo May 11, 2021
7adc322
Merge remote-tracking branch 'origin/develop' into develop
jinrongluo May 11, 2021
d48ead5
[Issue #337] Enhance Http Demo Subscriber by using ExecutorService, C…
jinrongluo May 11, 2021
c9021fe
[Issue #337] Address code review comment for Subscriber Demo App
jinrongluo May 12, 2021
c6d732e
Merge branch 'apache:develop' into develop
jinrongluo May 14, 2021
c613be8
Merge branch 'apache:develop' into develop
jinrongluo May 18, 2021
66ac95e
Merge branch 'apache:develop' into develop
jinrongluo May 19, 2021
9e636c0
Merge branch 'apache:develop' into develop
jinrongluo May 26, 2021
cb2cd82
[Issue #368] Fix Racing condition and memory leak issue in EventMesh …
jinrongluo May 26, 2021
1f98932
[Issue #368] fix build issue
jinrongluo May 26, 2021
7fd5373
[Issue #368] use try with resource statement for HttpClient
jinrongluo May 27, 2021
378454e
[Issue #368] fix TLS1.1 and use TLS1.2 in HttpClient
jinrongluo May 27, 2021
a0f44b0
Merge branch 'apache:develop' into develop
jinrongluo Jun 4, 2021
d4757ad
Merge remote-tracking branch 'origin/develop' into develop-httpclient
jinrongluo Jun 7, 2021
1fe7655
[Issue #382] Fix java.lang.NumberFormatException when parsing Long
jinrongluo Jun 7, 2021
d6604a1
[Issue #382] Fix java.lang.NumberFormatException when parsing Integer
jinrongluo Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@

import io.openmessaging.api.Message;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.eventmesh.api.AbstractContext;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
import org.apache.eventmesh.runtime.constants.EventMeshConstants;
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupConf;
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupTopicConf;
import org.slf4j.Logger;
Expand Down Expand Up @@ -79,7 +81,8 @@ public HandleMsgContext(String msgRandomNo, String consumerGroup, EventMeshConsu
this.bizSeqNo = bizSeqNo;
this.uniqueId = uniqueId;
this.consumeTopicConfig = consumeTopicConfig;
this.ttl = Integer.parseInt(msg.getUserProperties(Constants.PROPERTY_MESSAGE_TIMEOUT));
String ttlStr = msg.getUserProperties(Constants.PROPERTY_MESSAGE_TIMEOUT);
this.ttl = StringUtils.isNumeric(ttlStr)? Integer.parseInt(ttlStr): EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;
}

public void addProp(String key, String val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>
return;
}

eventMeshHTTPServer.metrics.summaryMetrics.recordSendBatchMsg(Integer.parseInt(sendMessageBatchRequestBody.getSize()));
String sizeStr = sendMessageBatchRequestBody.getSize();
long delta = StringUtils.isNumeric(sizeStr)? Integer.parseInt(sizeStr) : 0;
eventMeshHTTPServer.metrics.summaryMetrics.recordSendBatchMsg(delta);

if (eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshServerBatchMsgBatchEnabled) {
for (List<Message> batchMsgs : topicBatchMessageMappings.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.openmessaging.api.Message;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.eventmesh.api.AbstractContext;
import org.apache.eventmesh.common.Constants;
Expand Down Expand Up @@ -53,7 +54,9 @@ public ClientAckContext(String seq, AbstractContext context, List<Message> msgs,
this.msgs = msgs;
this.consumer = consumer;
this.createTime = System.currentTimeMillis();
this.expireTime = System.currentTimeMillis() + Long.parseLong(msgs.get(0).getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL));
String ttlStr = msgs.get(0).getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL);
long ttl = StringUtils.isNumeric(ttlStr)? Long.parseLong(ttlStr) : EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;
this.expireTime = System.currentTimeMillis() + ttl;
}

public boolean isExpire() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import io.openmessaging.api.Message;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.eventmesh.api.AbstractContext;
import org.apache.eventmesh.common.Constants;
Expand Down Expand Up @@ -70,7 +71,9 @@ public DownStreamMsgContext(Message msgExt, Session session, MQConsumerWrapper c
this.lastPushTime = System.currentTimeMillis();
this.executeTime = System.currentTimeMillis();
this.createTime = System.currentTimeMillis();
this.expireTime = System.currentTimeMillis() + Long.parseLong(msgExt.getUserProperties("TTL"));
String ttlStr = msgExt.getUserProperties("TTL");
long ttl = StringUtils.isNumeric(ttlStr) ? Long.parseLong(ttlStr) : EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;
this.expireTime = System.currentTimeMillis() + ttl;
this.msgFromOtherEventMesh = msgFromOtherEventMesh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext) {

private boolean isRetryMsgTimeout(DownStreamMsgContext downStreamMsgContext) {
boolean flag = false;
long ttl = Long.parseLong(downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL));
//TODO 关注是否能取到
long storeTimestamp = Long.parseLong(downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.STORE_TIME));
String ttlStr = downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.PROPERTY_MESSAGE_TTL);
long ttl = StringUtils.isNumeric(ttlStr)? Long.parseLong(ttlStr) : EventMeshConstants.DEFAULT_TIMEOUT_IN_MILLISECONDS;;

String storeTimeStr = downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.STORE_TIME);
long storeTimestamp = StringUtils.isNumeric(storeTimeStr)? Long.parseLong(storeTimeStr) : 0;
String leaveTimeStr = downStreamMsgContext.msgExt.getUserProperties(EventMeshConstants.LEAVE_TIME);
long brokerCost = StringUtils.isNumeric(leaveTimeStr) ? Long.parseLong(leaveTimeStr) - storeTimestamp : 0;

Expand Down