33import io .ably .lib .object .path .types .LiveMapPathObject ;
44import io .ably .lib .object .state .ObjectStateChange ;
55import io .ably .lib .object .state .ObjectStateEvent ;
6- import io .ably .lib .objects .ObjectsSubscription ;
76import io .ably .lib .types .AblyException ;
87import io .ably .lib .types .ErrorInfo ;
9- import org .jetbrains .annotations .Blocking ;
108import org .jetbrains .annotations .NotNull ;
119
10+ import java .util .concurrent .CompletableFuture ;
11+
1212/**
1313 * The RealtimeObject interface is the entry point to the strongly-typed, path-based
1414 * LiveObjects API on a channel. It exposes the root of the objects graph as a
@@ -33,16 +33,17 @@ public interface RealtimeObject extends ObjectStateChange {
3333 * when working with multiple channels with different underlying data structures.
3434 *
3535 * <p>This operation requires the {@code OBJECT_SUBSCRIBE} channel mode. It implicitly
36- * attaches the channel if it is not already attached, and waits for the objects
37- * synchronization state to transition to {@code SYNCED} before returning.
36+ * attaches the channel if it is not already attached; the returned future completes once
37+ * the objects synchronization state has transitioned to {@code SYNCED}, and completes
38+ * exceptionally with an {@code AblyException} if synchronization fails.
3839 *
3940 * <p>Spec: RTO23, RTO23f (typed SDKs return a {@link LiveMapPathObject})
4041 *
41- * @return the root {@link LiveMapPathObject} for this channel's objects graph.
42+ * @return a future that completes with the root {@link LiveMapPathObject} for this
43+ * channel's objects graph.
4244 */
43- @ Blocking
4445 @ NotNull
45- LiveMapPathObject get ();
46+ CompletableFuture < LiveMapPathObject > get ();
4647
4748 /**
4849 * Null-Object guard for {@link RealtimeObject}, used as the value of {@code channel.object}
@@ -64,12 +65,12 @@ final class Unavailable implements RealtimeObject {
6465 private Unavailable () {}
6566
6667 @ Override
67- public @ NotNull LiveMapPathObject get () {
68+ public @ NotNull CompletableFuture < LiveMapPathObject > get () {
6869 throw missing ();
6970 }
7071
7172 @ Override
72- public ObjectsSubscription on (@ NotNull ObjectStateEvent event , ObjectStateChange .@ NotNull Listener listener ) {
73+ public Subscription on (@ NotNull ObjectStateEvent event , ObjectStateChange .@ NotNull Listener listener ) {
7374 throw missing ();
7475 }
7576
0 commit comments