File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
src/main/java/io/emeraldpay/api Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 1- import org.gradle.testing.jacoco.tasks.JacocoReport
2-
31buildscript {
42 repositories {
53 mavenLocal()
@@ -27,7 +25,7 @@ if (System.getenv("ENABLE_GCP") == "true") {
2725}
2826
2927group = ' io.emeraldpay'
30- version = ' 0.12-alpha.3 '
28+ version = ' 0.12-alpha.4 '
3129
3230java {
3331 sourceCompatibility = JavaVersion . VERSION_1_8
@@ -160,4 +158,4 @@ task coverageReport(type: JacocoReport) {
160158 csv. enabled false
161159 html. enabled true
162160 }
163- }
161+ }
Original file line number Diff line number Diff line change 11package io .emeraldpay .api ;
22
3- import io .grpc .Channel ;
4- import io .grpc .ManagedChannelBuilder ;
5- import io .grpc .netty .NettyChannelBuilder ;
3+ import io .grpc .*;
4+ import io .grpc .netty .*;
65
7- import java .io .IOException ;
8- import java .net .InetAddress ;
9- import java .util .function .Function ;
6+ import java .net .*;
7+ import java .util .function .*;
108
119/**
1210 * A connection configuration to access Emerald APIs
@@ -43,6 +41,7 @@ public static class Builder {
4341 private String host ;
4442 private Integer port ;
4543 private boolean usePlaintext = false ;
44+ private boolean useLoadBalancing = true ;
4645
4746 /**
4847 * Default Netty config allows messages up to 4Mb, but in practice Ethereum RPC responses may be larger. Here it allows up to 32Mb by default.
@@ -95,6 +94,11 @@ public Builder usePlaintext() {
9594 return this ;
9695 }
9796
97+ public Builder disableLoadBalancing () {
98+ this .useLoadBalancing = false ;
99+ return this ;
100+ }
101+
98102 /**
99103 * St max inbound message size. Default is 32mb.
100104 *
@@ -153,6 +157,10 @@ public EmeraldConnection build() {
153157 channelBuilder = nettyChannelBuilder ;
154158 }
155159
160+ if (useLoadBalancing ) {
161+ channelBuilder .defaultLoadBalancingPolicy ("round_robin" );
162+ }
163+
156164 return new EmeraldConnection (channelBuilder .build ());
157165 }
158166
You can’t perform that action at this time.
0 commit comments