[
https://issues.apache.org/jira/browse/HDFS-16661?focusedWorklogId=791823&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-791823
]
ASF GitHub Bot logged work on HDFS-16661:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Jul/22 02:47
Start Date: 18/Jul/22 02:47
Worklog Time Spent: 10m
Work Description: ZanderXu commented on code in PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#discussion_r922941580
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto>
getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
Review Comment:
Thanks @goiri for your review.
`nsInfo` is never used. HDFS-12553 started using `nsInfo` in
`IPCLoggerChannel.class` as follows:
```
@Override
public ListenableFuture<NewEpochResponseProto> newEpoch(
final long epoch) {
return singleThreadExecutor.submit(new Callable<NewEpochResponseProto>()
{
@Override
public NewEpochResponseProto call() throws IOException {
return getProxy().newEpoch(journalId, nameServiceId, nsInfo, epoch);
}
});
}
```
So we can get rid of the useless `nsInfo` here.
Issue Time Tracking
-------------------
Worklog Id: (was: 791823)
Time Spent: 1h (was: 50m)
> Improve Code With Lambda in AsyncLoggerSet class
> ------------------------------------------------
>
> Key: HDFS-16661
> URL: https://issues.apache.org/jira/browse/HDFS-16661
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Improve Code With Lambda in AsyncLoggerSet class
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]