From a8d89513f554812eea70cc4362c40af4fd1e0d60 Mon Sep 17 00:00:00 2001 From: rickr Date: Thu, 16 Nov 2017 12:53:25 -0500 Subject: [PATCH] FAB-7009 Send orderer provide exception PS 4 Shuffle orderers case first always is failing and provide load balancing. 5 Minor tweak Arraylist probably faster for this. Change-Id: Idcdaaa02a61198b4e55090743ba83ea28e184278 Signed-off-by: rickr --- .../org/hyperledger/fabric/sdk/Channel.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/hyperledger/fabric/sdk/Channel.java b/src/main/java/org/hyperledger/fabric/sdk/Channel.java index bc176732..5da0514c 100644 --- a/src/main/java/org/hyperledger/fabric/sdk/Channel.java +++ b/src/main/java/org/hyperledger/fabric/sdk/Channel.java @@ -2362,7 +2362,11 @@ public CompletableFuture sendTransaction(Collection shuffeldOrderers = new ArrayList<>(orderers); + Collections.shuffle(shuffeldOrderers); + + if (shuffeldOrderers.isEmpty()) { throw new InvalidArgumentException("sendTransaction Orderers to send to is empty."); } @@ -2415,9 +2419,10 @@ public CompletableFuture sendTransaction(Collection sendTransaction(Collection sendTransaction(Collection ret = new CompletableFuture<>(); - ret.completeExceptionally(new Exception(emsg)); + ret.completeExceptionally(lException != null ? new Exception(emsg, lException) : new Exception(emsg)); return ret; } } catch (Exception e) { @@ -2469,6 +2479,7 @@ public CompletableFuture sendTransaction(Collection