Package io.objectbox.sync.server
Class SyncServerImpl
java.lang.Object
io.objectbox.sync.server.SyncServerImpl
- All Implemented Interfaces:
SyncServer,Closeable,AutoCloseable
Internal sync server implementation. Use
SyncServer to access functionality,
this class may change without notice.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes and cleans up all resources used by this sync server.protected voidfinalize()Users of this class should explicitly callclose()instead to avoid expensive finalization.intgetPort()Returns the port this server listens on, or 0 if the server was not yet started.Gets some statistics from the sync server.getUrl()Returns the URL this server is listening on, including the bound port (seeSyncServer.getPort()).booleanReturns if the server is up and running.voidsetSyncChangeListener(SyncChangeListener changesListener) Sets aSyncChangeListener.voidstart()Starts the server (e.g.voidstop()Stops the server.
-
Method Details
-
getUrl
Description copied from interface:SyncServerReturns the URL this server is listening on, including the bound port (seeSyncServer.getPort()).- Specified by:
getUrlin interfaceSyncServer
-
getPort
public int getPort()Description copied from interface:SyncServerReturns the port this server listens on, or 0 if the server was not yet started.This is especially useful if the port was assigned arbitrarily (a "0" port was used in the URL when building the server).
- Specified by:
getPortin interfaceSyncServer
-
isRunning
public boolean isRunning()Description copied from interface:SyncServerReturns if the server is up and running.- Specified by:
isRunningin interfaceSyncServer
-
getStatsString
Description copied from interface:SyncServerGets some statistics from the sync server.- Specified by:
getStatsStringin interfaceSyncServer
-
setSyncChangeListener
Description copied from interface:SyncServerSets aSyncChangeListener. Replaces a previously set listener. Set tonullto remove the listener.- Specified by:
setSyncChangeListenerin interfaceSyncServer
-
start
public void start()Description copied from interface:SyncServerStarts the server (e.g. bind to port) and gets everything operational.- Specified by:
startin interfaceSyncServer
-
stop
public void stop()Description copied from interface:SyncServerStops the server.- Specified by:
stopin interfaceSyncServer
-
close
public void close()Description copied from interface:SyncServerCloses and cleans up all resources used by this sync server. It can no longer be used afterwards, build a new sync server instead. Does nothing if this sync server has already been closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSyncServer
-
finalize
Users of this class should explicitly callclose()instead to avoid expensive finalization.
-