[jira] [Commented] (RATIS-93) Filter peers from the iteration before random selection

2017-07-11 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/RATIS-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16082979#comment-16082979
 ] 

Tsz Wo Nicholas Sze commented on RATIS-93:
--

Just have pushed an amend commit for fixing the wrong import.
{code}
commit 9ed2652d298f5b9f77f8d866bbc829f215418be9 (HEAD -> master, origin/master, 
origin/HEAD)
Author: Tsz-Wo Nicholas Sze 
Date:   Tue Jul 11 13:59:19 2017 -0700

Amend previous commit of RATIS-93: replace netty ThreadLocalRandom import 
with Java ThreadLocalRandom.

diff --git 
a/ratis-common/src/main/java/org/apache/ratis/util/CollectionUtils.java 
b/ratis-common/src/main/java/org/apache/ratis/util/CollectionUtils.java
index 2fdb502..d8eb674 100644
--- a/ratis-common/src/main/java/org/apache/ratis/util/CollectionUtils.java
+++ b/ratis-common/src/main/java/org/apache/ratis/util/CollectionUtils.java
@@ -20,9 +20,8 @@
 
 package org.apache.ratis.util;
 
-import org.apache.ratis.shaded.io.netty.util.internal.ThreadLocalRandom;
-
 import java.util.*;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
{code}

> Filter peers from the iteration before random selection
> ---
>
> Key: RATIS-93
> URL: https://issues.apache.org/jira/browse/RATIS-93
> Project: Ratis
>  Issue Type: Improvement
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
>Priority: Minor
> Fix For: 0.2.0-alpha
>
> Attachments: r93_20170710.patch
>
>
> When randomly selecting a peer, we first copy the peer list and then select a 
> peer in a loop indefinitely until a new peer is found.
> We could first filter the peers when copying the list.  Then, we can 
> eliminate the loop.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RATIS-93) Filter peers from the iteration before random selection

2017-07-11 Thread Jing Zhao (JIRA)

[ 
https://issues.apache.org/jira/browse/RATIS-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16082860#comment-16082860
 ] 

Jing Zhao commented on RATIS-93:


+1

> Filter peers from the iteration before random selection
> ---
>
> Key: RATIS-93
> URL: https://issues.apache.org/jira/browse/RATIS-93
> Project: Ratis
>  Issue Type: Improvement
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
>Priority: Minor
> Attachments: r93_20170710.patch
>
>
> When randomly selecting a peer, we first copy the peer list and then select a 
> peer in a loop indefinitely until a new peer is found.
> We could first filter the peers when copying the list.  Then, we can 
> eliminate the loop.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)