Class SyncServerBuilder


  • public final class SyncServerBuilder
    extends java.lang.Object
    Creates a SyncServer and allows to set additional configuration.
    • Method Detail

      • certificatePath

        public SyncServerBuilder certificatePath​(java.lang.String certificatePath)
        Sets the path to a directory that contains a cert.pem and key.pem file to use to establish encrypted connections.

        Use the "wss://" protocol for the server URL to turn on encrypted connections.

      • clusterPeer

        public SyncServerBuilder clusterPeer​(java.lang.String url,
                                             SyncCredentials credentials)
        Adds a (remote) cluster peer, to which this server should connect to as a client using the given credentials.

        To use this, must set a clusterId(String).

      • clusterFlags

        public SyncServerBuilder clusterFlags​(int flags)
        Sets bit flags to configure the cluster behavior of the Sync server (aka cluster peer).

        To use this, must set a clusterId(String).

        Parameters:
        flags - One or more of ClusterFlags.
      • historySizeMaxKb

        public SyncServerBuilder historySizeMaxKb​(long historySizeMaxKb)
        Sets the maximum transaction history size.

        Once the maximum size is reached, old transaction logs are deleted to stay below this limit. This is sometimes also called "history pruning" in the context of Sync.

        If not set or set to 0, defaults to no limit.

        See Also:
        historySizeTargetKb(long)
      • historySizeTargetKb

        public SyncServerBuilder historySizeTargetKb​(long historySizeTargetKb)
        Sets the target transaction history size.

        Once the maximum size (historySizeMaxKb(long)) is reached, old transaction logs are deleted until this size target is reached (lower than the maximum size). Using this target size typically lowers the frequency of history pruning and thus may improve efficiency.

        If not set or set to 0, defaults to historySizeMaxKb(long).

      • syncFlags

        public SyncServerBuilder syncFlags​(int syncFlags)
        Sets bit flags to adjust Sync behavior, like additional logging.
        Parameters:
        syncFlags - One or more of SyncFlags.
      • syncServerFlags

        public SyncServerBuilder syncServerFlags​(int syncServerFlags)
        Sets bit flags to configure the Sync server.
        Parameters:
        syncServerFlags - One or more of SyncServerFlags.
      • workerThreads

        public SyncServerBuilder workerThreads​(int workerThreads)
        Sets the number of workers for the main task pool.

        If not set or set to 0, this uses a hardware-dependant default, e.g. 3 * CPU "cores".

      • build

        public SyncServer build()
        Builds and returns a Sync server ready to SyncServer.start().

        Note: this clears all previously set authenticator credentials.

      • buildAndStart

        public SyncServer buildAndStart()
        Builds, starts and returns a Sync server.