You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/08/08 13:49:38 UTC

[GitHub] [accumulo] dlmarion opened a new issue, #2856: Remove use of Guava from ScanAttemptsImpl

dlmarion opened a new issue, #2856:
URL: https://github.com/apache/accumulo/issues/2856

   Replace use of Guava with Java Streams API
   


-- 
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: notifications-unsubscribe@accumulo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on issue #2856: Remove use of Guava from ScanAttemptsImpl

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on issue #2856:
URL: https://github.com/apache/accumulo/issues/2856#issuecomment-1208311006

   This issue is a bit overly broad. Most of our code has already done this, because the modernizer plugin catches most instances of this. So, there's only likely a few occurrences that are safe to change. The original issue that prompted this is linked above, but not the specific comment/area of code that caused this issue to be created. So, it's not clear which specific occurrences should be addressed here.


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] DomGarguilo closed issue #2856: Remove use of Guava from ScanAttemptsImpl

Posted by GitBox <gi...@apache.org>.
DomGarguilo closed issue #2856: Remove use of Guava from ScanAttemptsImpl
URL: https://github.com/apache/accumulo/issues/2856


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] DomGarguilo commented on issue #2856: Remove use of Guava from ScanAttemptsImpl

Posted by GitBox <gi...@apache.org>.
DomGarguilo commented on issue #2856:
URL: https://github.com/apache/accumulo/issues/2856#issuecomment-1213317340

   I came up with two alternatives for replacement logic:
   
   create new map then use for loop to iterate over `attempts` to fill it:
   ```java
       Map<TabletId,Collection<ScanAttemptImpl>> result = new ConcurrentHashMap<>();
   
       for (var entry : attempts.entrySet()) {
         TabletId tabletId = entry.getKey();
   
         // filter out ScanAttempt objects that were added after this call
         List<ScanAttemptImpl> scanAttemptList = entry.getValue().stream()
             .filter(sai -> sai.getMutationCount() < snapMC).collect(Collectors.toList());
   
         // only add an entry to the resulting map if there are ScanAttempt objects for the TabletId
         if (!scanAttemptList.isEmpty())
           result.put(tabletId, scanAttemptList);
   
       }
   
       return result;
   ```
   
   using streams to filter and collect:
   ```java
       // @formatter:off
       return attempts.entrySet().stream()
           .map(entry ->
                   new AbstractMap.SimpleEntry<>(
                     entry.getKey(),
                     // filter out ScanAttempt objects that were added after this call
                     entry.getValue().stream().filter(sai -> sai.getMutationCount() < snapMC).collect(Collectors.toList())
                   )
               )
           // filter out entries if there are no ScanAttempts for the TabletId
           .filter(entry -> !entry.getValue().isEmpty())
           .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
       // @formatter:on
   ```
   
   Both behave the same. Any preferences?


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] dlmarion commented on issue #2856: Remove use of Guava from ScanAttemptsImpl

Posted by GitBox <gi...@apache.org>.
dlmarion commented on issue #2856:
URL: https://github.com/apache/accumulo/issues/2856#issuecomment-1208324755

   See https://github.com/apache/accumulo/pull/2665/files#r880805988


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org