org.apache.ignite.internal.processors.cache.version

## Class GridCacheVersionManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
  - - org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager

All Implemented Interfaces:
  GridCacheSharedManager

    public class GridCacheVersionManager
    extends GridCacheSharedManagerAdapter

Makes sure that cache lock order values come in proper sequence.

NOTE: this class should not make use of any cache specific structures, like, for example GridCacheContext, as it may be reused between different caches.

### Field Summary

Fields
`static long` `TOP_VER_BASE_TIME` Timestamp used as base time for cache topology version (January 1, 2014).

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`cctx, log`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheVersionManager()`

### Method Summary

Methods
`void` `dataCenterId(byte dataCenterId)` Sets data center ID.
`GridCacheVersion` `isolatedStreamerVersion()` Version for entries loaded with isolated streamer, should be less than any version generated for entries update.
`GridCacheVersion` `last()` Gets last generated version without generating a new one.
`GridCacheVersion` `next()`
`GridCacheVersion` `next(AffinityTopologyVersion topVer)` Gets next version based on given topology version.
`GridCacheVersion` `next(GridCacheVersion ver)` Gets next version based on given cache version.
`GridCacheVersion` `nextForLoad()` Gets next version for cache store load and reload operations.
`GridCacheVersion` `nextForLoad(AffinityTopologyVersion topVer)` Gets next version for cache store load and reload operations.
`GridCacheVersion` `nextForLoad(GridCacheVersion ver)` Gets next version for cache store load and reload operations.
`protected void` `onKernalStart0(boolean reconnect)`
`void` `onReceived(UUID nodeId, GridCacheVersion ver)`
`void` `onReceived(UUID nodeId, long ver)`
`GridCacheVersion` `onReceivedAndNext(UUID nodeId, GridCacheVersion ver)`
`void` `start0()`
`protected void` `stop0(boolean cancel)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`context, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toString`

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

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

### Field Detail

#### TOP_VER_BASE_TIME

    public static final long TOP_VER_BASE_TIME

Timestamp used as base time for cache topology version (January 1, 2014).

See Also:
  Constant Field Values

### Constructor Detail

#### GridCacheVersionManager

    public GridCacheVersionManager()

### Method Detail

#### start0

    public void start0()
                throws IgniteCheckedException

Overrides:
  `start0` in class `GridCacheSharedManagerAdapter`
Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStart0

    protected void onKernalStart0(boolean reconnect)
                           throws IgniteCheckedException

Overrides:
  `onKernalStart0` in class `GridCacheSharedManagerAdapter`
Parameters:
  `reconnect` - `True` if manager restarted after client reconnect.
Throws:
  `IgniteCheckedException` - If failed.

#### stop0

    protected void stop0(boolean cancel)

Overrides:
  `stop0` in class `GridCacheSharedManagerAdapter`
Parameters:
  `cancel` - Cancel flag.

#### dataCenterId

    public void dataCenterId(byte dataCenterId)

Sets data center ID.

Parameters:
  `dataCenterId` - Data center ID.

#### onReceived

    public void onReceived(UUID nodeId,
                  GridCacheVersion ver)

Parameters:
  `nodeId` - Node ID.
  `ver` - Remote version.

#### onReceived

    public void onReceived(UUID nodeId,
                  long ver)

Parameters:
  `nodeId` - Node ID.
  `ver` - Remote version.

#### onReceivedAndNext

    public GridCacheVersion onReceivedAndNext(UUID nodeId,
                                     GridCacheVersion ver)

Parameters:
  `nodeId` - Node ID.
  `ver` - Received version.
Returns:
  Next version.

#### isolatedStreamerVersion

    public GridCacheVersion isolatedStreamerVersion()

Version for entries loaded with isolated streamer, should be less than any version generated for entries update.

Returns:
  Version for entries loaded with isolated streamer.

#### next

    public GridCacheVersion next()

Returns:
  Next version based on current topology.

#### next

    public GridCacheVersion next(AffinityTopologyVersion topVer)

Gets next version based on given topology version. Given value should be real topology version calculated as number of grid topology changes and obtained from discovery manager.

Parameters:
  `topVer` - Topology version for which new version should be obtained.
Returns:
  Next version based on given topology version.

#### nextForLoad

    public GridCacheVersion nextForLoad()

Gets next version for cache store load and reload operations.

Returns:
  Next version for cache store operations.

#### nextForLoad

    public GridCacheVersion nextForLoad(AffinityTopologyVersion topVer)

Gets next version for cache store load and reload operations.

Returns:
  Next version for cache store operations.

#### nextForLoad

    public GridCacheVersion nextForLoad(GridCacheVersion ver)

Gets next version for cache store load and reload operations.

Returns:
  Next version for cache store operations.

#### next

    public GridCacheVersion next(GridCacheVersion ver)

Gets next version based on given cache version.

Parameters:
  `ver` - Cache version for which new version should be obtained.
Returns:
  Next version based on given cache version.

#### last

    public GridCacheVersion last()

Gets last generated version without generating a new one.

Returns:
  Last generated version.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0.final
Release Date | : December 29 2015