private static @NlsContexts.ListItem CompletableFuture<String> calcRepresentationAsync(ThreadReferenceProxyImpl thread) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    ThreadReference ref = thread.getThreadReference();
    if (!DebuggerUtilsAsync.isAsyncEnabled() || !(ref instanceof ThreadReferenceImpl threadReference)) {
      return CompletableFuture.completedFuture(calcRepresentation(thread));
    }
    CompletableFuture<String> nameFuture = threadReference.nameAsync();
    CompletableFuture<String> groupNameFuture = threadReference.threadGroupAsync().thenCompose(gr -> {
      if (gr instanceof ThreadGroupReferenceImpl) {
        return ((ThreadGroupReferenceImpl)gr).nameAsync();
      }
      return CompletableFuture.completedFuture(null);
    });
    CompletableFuture<String> statusTextFuture = threadReference.statusAsync().thenApply(DebuggerUtilsEx::getThreadStatusText);

    long uniqueID = threadReference.uniqueID();
    return DebuggerUtilsAsync.reschedule(groupNameFuture).thenCompose(grname -> {
      return nameFuture.thenCombine(statusTextFuture, (name, threadStatusText) -> {
        if (grname != null && !"SYSTEM".equalsIgnoreCase(grname)) {
          return JavaDebuggerBundle.message("label.thread.node.in.group", name, uniqueID, threadStatusText, grname);
        }
        return JavaDebuggerBundle.message("label.thread.node", name, uniqueID, threadStatusText);
      });
    });
  }
private static @NlsContexts.ListItem CompletableFuture<String> calcRepresentationAsync(ThreadReferenceProxyImpl thread)