Class SyncReplRunner


  • public class SyncReplRunner
    extends java.lang.Object
    Class that executes a SyncReplClient and expects to run continuously, reconnecting if the server is unavailable. Consumers must be registered to handle entries, results, and messages as they are returned from the server. If a consumer throws an exception, the runner will be stopped and started, then the sync repl search will execute again. Consumers cannot execute blocking LDAP operations on the same connection because the next incoming message is not read until the consumer has completed.
    Author:
    Middleware Services
    • Constructor Detail

      • SyncReplRunner

        public SyncReplRunner​(ConnectionConfig config,
                              SearchRequest request,
                              CookieManager manager)
        Creates a new sync repl runner. Uses a custom ConnectionFactoryTransport for processing I/O and messages.
        Parameters:
        config - sync repl connection configuration
        request - sync repl search request
        manager - sync repl cookie manager
      • SyncReplRunner

        public SyncReplRunner​(Transport transport,
                              ConnectionConfig config,
                              SearchRequest request,
                              CookieManager manager)
        Creates a new sync repl runner.
        Parameters:
        transport - sync repl connection transport
        config - sync repl connection configuration
        request - sync repl search request
        manager - sync repl cookie manager
    • Method Detail

      • setOnStart

        public void setOnStart​(java.util.function.Supplier<java.lang.Boolean> supplier)
        Sets the onStart supplier.
        Parameters:
        supplier - to invoke on start
      • setOnEntry

        public void setOnEntry​(java.util.function.Consumer<LdapEntry> consumer)
        Sets the onEntry consumer.
        Parameters:
        consumer - to invoke when an entry is received
      • setOnResult

        public void setOnResult​(java.util.function.Consumer<Result> consumer)
        Sets the onResult consumer.
        Parameters:
        consumer - to invoke when a result is received
      • setOnMessage

        public void setOnMessage​(java.util.function.Consumer<SyncInfoMessage> consumer)
        Sets the onMessage consumer.
        Parameters:
        consumer - to invoke when a sync info message is received
      • initialize

        public void initialize​(boolean refreshAndPersist,
                               java.time.Duration reconnectWait)
        Prepare this runner for use.
        Parameters:
        refreshAndPersist - whether to refresh and persist or just refresh
        reconnectWait - time to wait between open attempts
      • start

        public void start()
        Starts this runner.
      • stop

        public void stop()
        Stops this runner.
      • isStarted

        public boolean isStarted()
        Returns whether this runner is started.
        Returns:
        whether this runner is started
      • restartSearch

        public void restartSearch()
        Cancels the sync repl search and sends a new search request.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object