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 TypeMethodDescriptionvoid
close()
Closes and cleans up all resources used by this sync server.protected void
finalize()
Users of this class should explicitly callclose()
instead to avoid expensive finalization.int
getPort()
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()
).boolean
Returns if the server is up and running.void
setSyncChangeListener
(SyncChangeListener changesListener) Sets aSyncChangeListener
.void
start()
Starts the server (e.g.void
stop()
Stops the server.
-
Method Details
-
getUrl
Description copied from interface:SyncServer
Returns the URL this server is listening on, including the bound port (seeSyncServer.getPort()
).- Specified by:
getUrl
in interfaceSyncServer
-
getPort
public int getPort()Description copied from interface:SyncServer
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).
- Specified by:
getPort
in interfaceSyncServer
-
isRunning
public boolean isRunning()Description copied from interface:SyncServer
Returns if the server is up and running.- Specified by:
isRunning
in interfaceSyncServer
-
getStatsString
Description copied from interface:SyncServer
Gets some statistics from the sync server.- Specified by:
getStatsString
in interfaceSyncServer
-
setSyncChangeListener
Description copied from interface:SyncServer
Sets aSyncChangeListener
. Replaces a previously set listener. Set tonull
to remove the listener.- Specified by:
setSyncChangeListener
in interfaceSyncServer
-
start
public void start()Description copied from interface:SyncServer
Starts the server (e.g. bind to port) and gets everything operational.- Specified by:
start
in interfaceSyncServer
-
stop
public void stop()Description copied from interface:SyncServer
Stops the server.- Specified by:
stop
in interfaceSyncServer
-
close
public void close()Description copied from interface:SyncServer
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSyncServer
-
finalize
Users of this class should explicitly callclose()
instead to avoid expensive finalization.
-