@Nullable
    public static TNetworkAddress getBackendHost(ImmutableMap<Long, ComputeNode> backendMap,
                                                 Reference<Long> backendIdRef) {
        ComputeNode node = getBackend(backendMap);
        if (node != null) {
            backendIdRef.setRef(node.getId());
            return new TNetworkAddress(node.getHost(), node.getBePort());
        }
        return null;
    }
@Test
    public void testChooseBackendConcurrently() throws InterruptedException {
        ImmutableMap.Builder<Long, ComputeNode> builder = ImmutableMap.builder();
        for (int i = 0; i < 6; i++) {
            Backend backend = new Backend(i, "address" + i, 0);
            backend.setAlive(i == 0);
            builder.put(backend.getId(), backend);
        }
        ImmutableMap<Long, ComputeNode> backends = builder.build();
        List<Thread> threads = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            Thread t = new Thread(() -> {
                for (int i1 = 0; i1 < 50; i1++) {
                    Reference<Long> idRef = new Reference<>();
                    TNetworkAddress address = SimpleScheduler.getBackendHost(backends, idRef);
                    Assert.assertNotNull(address);
                    Assert.assertEquals("address0", address.hostname);
                }
            });
            threads.add(t);
        }

        for (Thread t : threads) {
            t.start();
        }

        for (Thread t : threads) {
            t.join();
        }
    }