org.apache.ignite.internal.client.balancer

## Class GridClientBalancerAdapter

- java.lang.Object
- - org.apache.ignite.internal.client.balancer.GridClientBalancerAdapter

All Implemented Interfaces:
  GridClientLoadBalancer

Direct Known Subclasses:
  GridClientRandomBalancer, GridClientRoundRobinBalancer

    public abstract class GridClientBalancerAdapter
    extends Object
    implements GridClientLoadBalancer

Base class for balancers. Contains common direct connection handling logic.

### Constructor Summary

Constructors
Constructor and Description
`GridClientBalancerAdapter()`

### Method Summary

Methods
`boolean` `isPreferDirectNodes()` If set to `true` balancer should prefer directly connectable nodes over others.
`protected static Collection<GridClientNode>` `selectDirectNodes(Collection<? extends GridClientNode> nodes)` Returns only directly available nodes from given collection.
`GridClientBalancerAdapter` `setPreferDirectNodes(boolean preferDirectNodes)` Sets prefer direct nodes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.client.balancer.GridClientLoadBalancer

`balancedNode`

### Constructor Detail

#### GridClientBalancerAdapter

    public GridClientBalancerAdapter()

### Method Detail

#### isPreferDirectNodes

    public boolean isPreferDirectNodes()

If set to `true` balancer should prefer directly connectable nodes over others.

In other words when working in router connection mode client will prefer send requests to router nodes if operation projection contains some of them.

Default value is `false`.

Returns:
  Prefer direct nodes.
See Also:
  `GridClientNode.connectable()`

#### setPreferDirectNodes

    public GridClientBalancerAdapter setPreferDirectNodes(boolean preferDirectNodes)

Sets prefer direct nodes.

Parameters:
  `preferDirectNodes` - Prefer direct nodes.
Returns:
  `this` for chaining.

#### selectDirectNodes

    protected static Collection<GridClientNode> selectDirectNodes(Collection<? extends GridClientNode> nodes)

Returns only directly available nodes from given collection.

Parameters:
  `nodes` - Nodes.
Returns:
  Directly available subset.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017