Class SyncHybrid

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class SyncHybrid
    extends java.lang.Object
    implements java.io.Closeable
    Combines the functionality of a Sync client and a Sync server.

    It is typically used in local cluster setups, in which a "hybrid" functions as a client & cluster peer (server).

    Call getStore() to retrieve the store. To set sync listeners use the SyncClient that is available from getClient().

    This class implements the Closeable interface, ensuring that resources are cleaned up properly.

    • Method Detail

      • getClient

        public SyncClient getClient()
        Returns the SyncClient of this hybrid, typically only to set Sync listeners.

        Note: do not stop or close the client directly. Instead, use the stop() and close() methods of this hybrid.

      • getServer

        public SyncServer getServer()
        Returns the SyncServer of this hybrid.

        Typically, the server should not be touched. Yet, it is still exposed for advanced use cases.

        Note: do not stop or close the server directly. Instead, use the stop() and close() methods of this hybrid.

      • stop

        public void stop()
        Stops the client and server.
      • close

        public void close()
        Closes and cleans up all resources used by this Sync hybrid.

        It can no longer be used afterward, build a new one instead.

        Does nothing if this has already been closed.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Users of this class should explicitly call close() instead to avoid expensive finalization.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable