Package io.objectbox.sync.server
Class SyncServerImpl
- java.lang.Object
-
- io.objectbox.sync.server.SyncServerImpl
-
- All Implemented Interfaces:
SyncServer,java.io.Closeable,java.lang.AutoCloseable
@Internal public class SyncServerImpl extends java.lang.Object implements SyncServer
Internal sync server implementation. UseSyncServerto access functionality, this class may change without notice.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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()Gets the port the server has bound to.java.lang.StringgetStatsString()Gets some statistics from the sync server.java.lang.StringgetUrl()Gets the URL the server is running at.booleanisRunning()Returns if the server is up and running.voidsetSyncChangeListener(SyncChangeListener changesListener)Sets aSyncChangeListener.voidstart()Starts the server (e.g.voidstop()Stops the server.
-
-
-
Method Detail
-
getUrl
public java.lang.String getUrl()
Description copied from interface:SyncServerGets the URL the server is running at.- Specified by:
getUrlin interfaceSyncServer
-
getPort
public int getPort()
Description copied from interface:SyncServerGets the port the server has bound to.- 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
public java.lang.String getStatsString()
Description copied from interface:SyncServerGets some statistics from the sync server.- Specified by:
getStatsStringin interfaceSyncServer
-
setSyncChangeListener
public void setSyncChangeListener(@Nullable SyncChangeListener changesListener)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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceSyncServer
-
finalize
protected void finalize() throws java.lang.ThrowableUsers of this class should explicitly callclose()instead to avoid expensive finalization.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-