Skip to content

Commit 367e405

Browse files
authored
Make NatsServerPool extendable (#1185)
1 parent 51b9cef commit 367e405

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/io/nats/client/impl/NatsServerPool.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929

3030
public class NatsServerPool implements ServerPool {
3131

32-
private final ReentrantLock listLock;
33-
private List<ServerPoolEntry> entryList;
34-
private Options options;
35-
private int maxConnectAttempts;
36-
private NatsUri lastConnected;
37-
private boolean hasSecureServer;
38-
private String defaultScheme;
32+
protected final ReentrantLock listLock;
33+
protected List<ServerPoolEntry> entryList;
34+
protected Options options;
35+
protected int maxConnectAttempts;
36+
protected NatsUri lastConnected;
37+
protected boolean hasSecureServer;
38+
protected String defaultScheme;
3939

4040
public NatsServerPool() {
4141
listLock = new ReentrantLock();
@@ -148,7 +148,7 @@ public boolean acceptDiscoveredUrls(List<String> discoveredServers) {
148148
}
149149
}
150150

151-
private void afterListChanged() {
151+
protected void afterListChanged() {
152152
// 1. randomize if needed and allowed
153153
if (entryList.size() > 1 && !options.isNoRandomize()) {
154154
Collections.shuffle(entryList, ThreadLocalRandom.current());
@@ -298,7 +298,7 @@ public boolean hasSecureServer() {
298298
return hasSecureServer;
299299
}
300300

301-
private int findEquivalent(List<NatsUri> list, NatsUri toFind) {
301+
protected int findEquivalent(List<NatsUri> list, NatsUri toFind) {
302302
for (int i = 0; i < list.size(); i++) {
303303
NatsUri nuri = list.get(i);
304304
if (nuri.equivalent(toFind)) {

0 commit comments

Comments
 (0)