2222import io .objectbox .sync .server .SyncServer ;
2323
2424/**
25- * The SyncHybrid combines the functionality of a Sync Client and a Sync Server.
25+ * Combines the functionality of a Sync client and a Sync server.
26+ * <p>
2627 * It is typically used in local cluster setups, in which a "hybrid" functions as a client & cluster peer (server).
27- * <p/ >
28- * Call {@link #getStore()} to retrieve the store.
29- * To set sync listeners use the {@link SyncClient} that is available from {@link #getClient()}.
30- * <p/ >
31- * This class implements the Closeable interface, ensuring that resources are cleaned up properly.
28+ * <p>
29+ * Call {@link #getStore()} to retrieve the store. To set sync listeners use the {@link SyncClient} that is available
30+ * from {@link #getClient()}.
31+ * <p>
32+ * This class implements the {@link Closeable} interface, ensuring that resources are cleaned up properly.
3233 */
3334public final class SyncHybrid implements Closeable {
3435 private BoxStore store ;
@@ -48,39 +49,50 @@ public BoxStore getStore() {
4849 }
4950
5051 /**
51- * Typically only used to set sync listeners.
52- * <p/ >
53- * Note: you should not directly call start(), stop(), close() on the {@link SyncClient} directly.
54- * Instead, call {@link #stop()} or {@link #close()} on this instance (it is already started during creation) .
52+ * Returns the {@link SyncClient} of this hybrid, typically only to set Sync listeners.
53+ * <p>
54+ * Note: do not stop or close the client directly. Instead, use the {@link # stop()} and {@link #close()} methods of
55+ * this hybrid .
5556 */
5657 public SyncClient getClient () {
5758 return client ;
5859 }
5960
6061 /**
61- * Typically, you won't need access to the SyncServer.
62- * It is still exposed for advanced use cases if you know what you are doing.
63- * <p/>
64- * Note: you should not directly call start(), stop(), close() on the {@link SyncServer} directly.
65- * Instead, call {@link #stop()} or {@link #close()} on this instance (it is already started during creation).
62+ * Returns the {@link SyncServer} of this hybrid.
63+ * <p>
64+ * Typically, the server should not be touched. Yet, it is still exposed for advanced use cases.
65+ * <p>
66+ * Note: do not stop or close the server directly. Instead, use the {@link #stop()} and {@link #close()} methods of
67+ * this hybrid.
6668 */
6769 public SyncServer getServer () {
6870 return server ;
6971 }
7072
73+ /**
74+ * Stops the client and server.
75+ */
7176 public void stop () {
7277 client .stop ();
7378 server .stop ();
7479 }
7580
81+ /**
82+ * Closes and cleans up all resources used by this Sync hybrid.
83+ * <p>
84+ * It can no longer be used afterward, build a new one instead.
85+ * <p>
86+ * Does nothing if this has already been closed.
87+ */
7688 @ Override
7789 public void close () {
7890 // Clear reference to boxStore but do not close it (same behavior as SyncClient and SyncServer)
7991 store = null ;
8092 client .close ();
8193 server .close ();
8294 if (storeServer != null ) {
83- storeServer .close (); // The server store is "internal", so we can close it
95+ storeServer .close (); // The server store is "internal", so can safely close it
8496 storeServer = null ;
8597 }
8698 }
0 commit comments