Class SyncHybrid
- java.lang.Object
-
- io.objectbox.sync.SyncHybrid
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class SyncHybrid extends java.lang.Object implements java.io.Closeable
Combines the functionality of a Sync client and a Sync server.It is typically used in local cluster setups, in which a "hybrid" functions as a client & cluster peer (server).
Call
getStore()
to retrieve the store. To set sync listeners use theSyncClient
that is available fromgetClient()
.This class implements the
Closeable
interface, ensuring that resources are cleaned up properly.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes and cleans up all resources used by this Sync hybrid.protected void
finalize()
Users of this class should explicitly callclose()
instead to avoid expensive finalization.SyncClient
getClient()
Returns theSyncClient
of this hybrid, typically only to set Sync listeners.SyncServer
getServer()
Returns theSyncServer
of this hybrid.BoxStore
getStore()
void
stop()
Stops the client and server.
-
-
-
Method Detail
-
getStore
public BoxStore getStore()
-
getClient
public SyncClient getClient()
Returns theSyncClient
of this hybrid, typically only to set Sync listeners.Note: do not stop or close the client directly. Instead, use the
stop()
andclose()
methods of this hybrid.
-
getServer
public SyncServer getServer()
Returns theSyncServer
of this hybrid.Typically, the server should not be touched. Yet, it is still exposed for advanced use cases.
Note: do not stop or close the server directly. Instead, use the
stop()
andclose()
methods of this hybrid.
-
stop
public void stop()
Stops the client and server.
-
close
public void close()
Closes and cleans up all resources used by this Sync hybrid.It can no longer be used afterward, build a new one instead.
Does nothing if this has already been closed.
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
finalize
protected void finalize() throws java.lang.Throwable
Users of this class should explicitly callclose()
instead to avoid expensive finalization.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-