org.apache.tinkerpop.gremlin.driver

## Interface LoadBalancingStrategy

- All Superinterfaces:
    Host.Listener
  All Known Implementing Classes:
    LoadBalancingStrategy.RoundRobin

      public interface LoadBalancingStrategy
      extends Host.Listener

  Provides a method for selecting the host from a `Cluster`.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `LoadBalancingStrategy.RoundRobin` A simple round-robin strategy that simply selects the next host in the `Cluster` to send the `RequestMessage` to.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `initialize(Cluster cluster, Collection<Host> hosts)` Initialize the strategy with the `Cluster` instance and the expected host list.
    `Iterator<Host>` | `select(RequestMessage msg)` Provide an ordered list of hosts to send the given `RequestMessage` to.

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.driver.Host.Listener

      `onAvailable, onNew, onRemove, onUnavailable`

- - ### Method Detail

    - #### initialize

          void initialize(Cluster cluster,
                          Collection<Host> hosts)

      Initialize the strategy with the `Cluster` instance and the expected host list.

    - #### select

          Iterator<Host> select(RequestMessage msg)

      Provide an ordered list of hosts to send the given `RequestMessage` to.

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.