[ https://issues.apache.org/jira/browse/HDFS-16605?focusedWorklogId=791181&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-791181 ]
ASF GitHub Bot logged work on HDFS-16605: ----------------------------------------- Author: ASF GitHub Bot Created on: 14/Jul/22 23:20 Start Date: 14/Jul/22 23:20 Worklog Time Spent: 10m Work Description: goiri commented on code in PR #4375: URL: https://github.com/apache/hadoop/pull/4375#discussion_r921680900 ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/PeriodicService.java: ########## @@ -167,21 +167,18 @@ protected synchronized void startPeriodic() { stopPeriodic(); // Create the runnable service - Runnable updateRunnable = new Runnable() { - @Override - public void run() { - LOG.debug("Running {} update task", serviceName); - try { - if (!isRunning) { - return; - } - periodicInvoke(); - runCount++; - lastRun = Time.now(); - } catch (Exception ex) { - errorCount++; - LOG.warn(serviceName + " service threw an exception", ex); + Runnable updateRunnable = () -> { + LOG.debug("Running {} update task", serviceName); + try { + if (!isRunning) { + return; } + periodicInvoke(); + runCount++; + lastRun = Time.now(); + } catch (Exception ex) { + errorCount++; + LOG.warn(serviceName + " service threw an exception", ex); Review Comment: Use {} ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterClientRejectOverload.java: ########## @@ -206,33 +206,30 @@ private void testOverloaded(int expOverloadMin, int expOverloadMax, for (int i = 0; i < numOps; i++) { // Stagger the operations a little (50ms) final int sleepTime = i * 50; - Future<?> future = exec.submit(new Runnable() { - @Override - public void run() { - DFSClient routerClient = null; - try { - Thread.sleep(sleepTime); - routerClient = new DFSClient(address, conf); - String clientName = routerClient.getClientName(); - ClientProtocol routerProto = routerClient.getNamenode(); - routerProto.renewLease(clientName, null); - } catch (RemoteException re) { - IOException ioe = re.unwrapRemoteException(); - assertTrue("Wrong exception: " + ioe, - ioe instanceof StandbyException); - assertExceptionContains("is overloaded", ioe); - overloadException.incrementAndGet(); - } catch (IOException e) { - fail("Unexpected exception: " + e); - } catch (InterruptedException e) { - fail("Cannot sleep: " + e); - } finally { - if (routerClient != null) { - try { - routerClient.close(); - } catch (IOException e) { - LOG.error("Cannot close the client"); - } + Future<?> future = exec.submit(() -> { + DFSClient routerClient = null; + try { + Thread.sleep(sleepTime); + routerClient = new DFSClient(address, conf); + String clientName = routerClient.getClientName(); + ClientProtocol routerProto = routerClient.getNamenode(); + routerProto.renewLease(clientName, null); + } catch (RemoteException re) { + IOException ioe = re.unwrapRemoteException(); + assertTrue("Wrong exception: " + ioe, Review Comment: Single line ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterFaultTolerant.java: ########## @@ -168,7 +169,7 @@ public void cleanup() throws Exception { } namenodes.clear(); - routers.forEach(router -> router.stop()); + routers.forEach(AbstractService::stop); Review Comment: Can we do `Router::stop`? Issue Time Tracking ------------------- Worklog Id: (was: 791181) Time Spent: 3h 50m (was: 3h 40m) > Improve Code With Lambda in hadoop-hdfs-rbf moudle > -------------------------------------------------- > > Key: HDFS-16605 > URL: https://issues.apache.org/jira/browse/HDFS-16605 > Project: Hadoop HDFS > Issue Type: Improvement > Components: rbf > Affects Versions: 3.4.0 > Reporter: fanshilun > Assignee: fanshilun > Priority: Minor > Labels: pull-request-available > Time Spent: 3h 50m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org