Package org.apache.ignite.internal.processors.cache.distributed.near.consistency

## Class GridNearReadRepairAbstractFuture

- java.lang.Object
- - org.apache.ignite.internal.util.future.GridFutureAdapter<Map<KeyCacheObject,​EntryGetResult>>
  - - org.apache.ignite.internal.processors.cache.distributed.near.consistency.GridNearReadRepairAbstractFuture

All Implemented Interfaces:
  `IgniteInternalFuture<Map<KeyCacheObject,​EntryGetResult>>`

Direct Known Subclasses:
  `GridNearReadRepairCheckOnlyFuture`, `GridNearReadRepairFuture`

    public abstract class GridNearReadRepairAbstractFuture
    extends GridFutureAdapter<Map<KeyCacheObject,​EntryGetResult>>

### Nested Class Summary

Nested Classes
`protected static class` `GridNearReadRepairAbstractFuture.ByteArrayWrapper`
`protected static class` `GridNearReadRepairAbstractFuture.IgniteConsistencyCheckFailedException`
`protected static class` `GridNearReadRepairAbstractFuture.IgniteConsistencyRepairFailedException`

### Field Summary

Fields
`protected GridCacheContext<?,​?>` `ctx` Context.
`protected boolean` `deserializeBinary` Deserialize binary flag.
`protected IgniteCacheExpiryPolicy` `expiryPlc` Expiry policy flag.
`protected Map<ClusterNode,​GridPartitionedGetFuture<KeyCacheObject,​EntryGetResult>>` `futs` Affinity node's get futures.
`protected Collection<KeyCacheObject>` `keys` Context.
`protected static int` `MAX_REMAP_CNT` Maximum number of attempts to remap key to the same primary node.
`protected Map<KeyCacheObject,​ClusterNode>` `primaries` Primaries per key.
`protected boolean` `readThrough` Read through flag.
`protected boolean` `recovery` Recovery flag.
`protected int` `remapCnt` Remap count.
`protected ReadRepairStrategy` `strategy` Strategy.
`protected String` `taskName` Task name.
`protected IgniteInternalTx` `tx` Tx.

### Constructor Summary

Constructors

`protected`

`GridNearReadRepairAbstractFuture​(AffinityTopologyVersion topVer, GridCacheContext<?,​?> ctx, Collection<KeyCacheObject> keys, ReadRepairStrategy strategy, boolean readThrough, String taskName, boolean deserializeBinary, boolean recovery, IgniteCacheExpiryPolicy expiryPlc, IgniteInternalTx tx, GridNearReadRepairAbstractFuture remappedFut)`

Creates a new instance of GridNearReadRepairAbstractFuture.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected Map<KeyCacheObject,​EntryGetResult>` `check()` Checks consistency.
`protected Map<KeyCacheObject,​EntryGetResult>` `correct​(Set<KeyCacheObject> keys)` Calculates correct values.
`protected Map<KeyCacheObject,​EntryGetResult>` `correctWithPrimary​(Collection<KeyCacheObject> inconsistentKeys)`
`GridNearReadRepairAbstractFuture` `init()`
`protected void` `onResult​(IgniteInternalFuture<Map<KeyCacheObject,​EntryGetResult>> finished)` Collects results of each 'get' future and prepares an overall result of the operation.
`protected void` `recordConsistencyViolation​(Collection<KeyCacheObject> inconsistentKeys, Map<KeyCacheObject,​EntryGetResult> repairedEntries)`
`protected abstract void` `reduce()` Reduces fut's results.
`protected void` `remap​(AffinityTopologyVersion topVer)`
`protected abstract GridNearReadRepairAbstractFuture` `remapFuture​(AffinityTopologyVersion topVer)`

### Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter

`cancel, chain, chain, chain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, listen, logger, onCancelled, onDone, onDone, onDone, onDone, onDone, reset, result, toString`

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

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

### Field Detail

#### MAX_REMAP_CNT

    protected static final int MAX_REMAP_CNT

Maximum number of attempts to remap key to the same primary node.

#### futs

    protected final Map<ClusterNode,​GridPartitionedGetFuture<KeyCacheObject,​EntryGetResult>> futs

Affinity node's get futures.

#### ctx

    protected final GridCacheContext<?,​?> ctx

Context.

#### keys

    protected final Collection<KeyCacheObject> keys

Context.

#### readThrough

    protected final boolean readThrough

Read through flag.

#### taskName

    protected final String taskName

Task name.

#### deserializeBinary

    protected final boolean deserializeBinary

Deserialize binary flag.

#### recovery

    protected final boolean recovery

Recovery flag.

#### expiryPlc

    protected final IgniteCacheExpiryPolicy expiryPlc

Expiry policy flag.

#### tx

    protected final IgniteInternalTx tx

Tx.

#### primaries

    protected final Map<KeyCacheObject,​ClusterNode> primaries

Primaries per key.

#### strategy

    protected final ReadRepairStrategy strategy

Strategy.

#### remapCnt

    protected final int remapCnt

Remap count.

### Constructor Detail

#### GridNearReadRepairAbstractFuture

    protected GridNearReadRepairAbstractFuture​(AffinityTopologyVersion topVer,
                                               GridCacheContext<?,​?> ctx,
                                               Collection<KeyCacheObject> keys,
                                               ReadRepairStrategy strategy,
                                               boolean readThrough,
                                               String taskName,
                                               boolean deserializeBinary,
                                               boolean recovery,
                                               IgniteCacheExpiryPolicy expiryPlc,
                                               IgniteInternalTx tx,
                                               GridNearReadRepairAbstractFuture remappedFut)

Creates a new instance of GridNearReadRepairAbstractFuture.

Parameters:
  `topVer` - Topology version.
  `ctx` - Cache context.
  `keys` - Keys.
  `strategy` - Read repair strategy.
  `readThrough` - Read-through flag.
  `taskName` - Task name.
  `deserializeBinary` - Deserialize binary flag.
  `recovery` - Partition recovery flag.
  `expiryPlc` - Expiry policy.
  `tx` - Transaction. Can be `null` in case of atomic cache.
  `remappedFut` - Remapped future.

### Method Detail

#### init

    public GridNearReadRepairAbstractFuture init()

#### remap

    protected void remap​(AffinityTopologyVersion topVer)

Parameters:
  `topVer` - Topology version.

#### remapFuture

    protected abstract GridNearReadRepairAbstractFuture remapFuture​(AffinityTopologyVersion topVer)

Parameters:
  `topVer` - Topology version.

#### onResult

    protected final void onResult​(IgniteInternalFuture<Map<KeyCacheObject,​EntryGetResult>> finished)

Collects results of each 'get' future and prepares an overall result of the operation.

Parameters:
  `finished` - Future represents a result of GET operation.

#### reduce

    protected abstract void reduce()

Reduces fut's results.

#### check

    protected final Map<KeyCacheObject,​EntryGetResult> check()
                                                            throws IgniteCheckedException

Checks consistency.

Returns:
  Regular `get` result when data is consistent.
Throws:
  `IgniteCheckedException`

#### correct

    protected Map<KeyCacheObject,​EntryGetResult> correct​(Set<KeyCacheObject> keys)
                                                        throws IgniteCheckedException

Calculates correct values.

Parameters:
  `keys` - Keys.
Returns:
  Correctet entries.
Throws:
  `IgniteCheckedException`

#### correctWithPrimary

    protected Map<KeyCacheObject,​EntryGetResult> correctWithPrimary​(Collection<KeyCacheObject> inconsistentKeys)

#### recordConsistencyViolation

    protected final void recordConsistencyViolation​(Collection<KeyCacheObject> inconsistentKeys,
                                                    Map<KeyCacheObject,​EntryGetResult> repairedEntries)

Parameters:
  `repairedEntries` - Repaired map.