WJL3333 commented on a change in pull request #3509:
URL: https://github.com/apache/rocketmq/pull/3509#discussion_r753740780
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
##########
@@ -650,10 +652,13 @@ public void protectBroker() {
public long headSlowTimeMills(BlockingQueue<Runnable> q) {
long slowTimeMills = 0;
- final Runnable peek = q.peek();
- if (peek != null) {
- RequestTask rt = BrokerFastFailure.castRunnable(peek);
- slowTimeMills = rt == null ? 0 : this.messageStore.now() -
rt.getCreateTimestamp();
+ Optional<RequestTask> op = q.stream()
+ .map(BrokerFastFailure::castRunnable)
+ .filter(Objects::nonNull)
+ .findFirst();
+ if (op.isPresent()) {
Review comment:
my bad. the code is right after i check the discussion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]