Package io.objectbox.sync.server
Interface SyncServer
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
SyncServerImpl
public interface SyncServer extends java.io.CloseableObjectBox sync server. Build a server withSync.server(io.objectbox.BoxStore, java.lang.String, io.objectbox.sync.SyncCredentials).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes and cleans up all resources used by this sync server.intgetPort()Returns the port this server listens on, or 0 if the server was not yet started.java.lang.StringgetStatsString()Gets some statistics from the sync server.java.lang.StringgetUrl()Returns the URL this server is listening on, including the bound port (seegetPort()).booleanisRunning()Returns if the server is up and running.voidsetSyncChangeListener(SyncChangeListener listener)Sets aSyncChangeListener.voidstart()Starts the server (e.g.voidstop()Stops the server.
-
-
-
Method Detail
-
getUrl
java.lang.String getUrl()
Returns the URL this server is listening on, including the bound port (seegetPort()).
-
getPort
int getPort()
Returns 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).
-
isRunning
boolean isRunning()
Returns if the server is up and running.
-
getStatsString
java.lang.String getStatsString()
Gets some statistics from the sync server.
-
setSyncChangeListener
void setSyncChangeListener(@Nullable SyncChangeListener listener)Sets aSyncChangeListener. Replaces a previously set listener. Set tonullto remove the listener.
-
start
void start()
Starts the server (e.g. bind to port) and gets everything operational.
-
stop
void stop()
Stops the server.
-
close
void close()
Closes 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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-