public class ConnectedObjectUtils {
public static boolean waitForRootInstall(Heap heap, long timeoutMillis) {
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean result = new AtomicBoolean(false);
// adds the listener first
HeapListener listener = new HeapListener() {
@Override
public void applyUpdate(UpdateBlock update) {
for (Update u : update.list()) {
if (u.getUpdateType() == Update.UpdateType.INSTALL_ROOT) {
result.set(true);