diff --git a/server/src/main/java/com/usatiuk/dhfs/storage/objects/repository/distributed/RpcClientFactory.java b/server/src/main/java/com/usatiuk/dhfs/storage/objects/repository/distributed/RpcClientFactory.java index 5464168f..7926db31 100644 --- a/server/src/main/java/com/usatiuk/dhfs/storage/objects/repository/distributed/RpcClientFactory.java +++ b/server/src/main/java/com/usatiuk/dhfs/storage/objects/repository/distributed/RpcClientFactory.java @@ -33,7 +33,8 @@ public class RpcClientFactory { for (UUID target : shuffledList) { var hostinfo = remoteHostManager.getTransientState(target); - boolean shouldTry = remoteHostManager.isReachable(target); + boolean shouldTry = remoteHostManager.isReachable(target) + && hostinfo.getAddr() != null; if (!shouldTry) continue; @@ -54,6 +55,8 @@ public class RpcClientFactory { public R withObjSyncClient(UUID target, ObjectSyncClientFunction fn) { var hostinfo = remoteHostManager.getTransientState(target); + if (hostinfo.getAddr() == null) + throw new IllegalStateException("Address for " + target + " not yet known"); return withObjSyncClient(hostinfo.getAddr(), hostinfo.getPort(), Optional.empty(), fn); } @@ -80,6 +83,8 @@ public class RpcClientFactory { public R withPeerSyncClient(UUID target, PeerSyncClientFunction fn) { var hostinfo = remoteHostManager.getTransientState(target); + if (hostinfo.getAddr() == null) + throw new IllegalStateException("Address for " + target + " not yet known"); return withPeerSyncClient(hostinfo.getAddr(), hostinfo.getPort(), Optional.empty(), fn); }