コード例 #1
0
 private void EnterInitial()
 {
     _completed = false;
     _partitionStateCache.Initialize();
     _projectionProcessingPhase = null;
     _checkpointManager         = _projectionProcessingPhases[0].CheckpointManager;
     _checkpointManager.Initialize();
     _checkpointReader.Initialize();
     _tickPending = false;
     if (_requiresRootPartition)
     {
         _partitionStateCache.CacheAndLockPartitionState("", new PartitionState("", null, CheckpointTag.Empty), null);
     }
     // NOTE: this is to workaround exception in GetState requests submitted by client
 }
コード例 #2
0
 private void EnterInitial()
 {
     _handlerPartition = null;
     foreach (var requestId in _loadStateRequests)
     {
         _readDispatcher.Cancel(requestId);
     }
     _loadStateRequests.Clear();
     _partitionStateCache.Initialize();
     _processingQueue.Initialize();
     _checkpointManager.Initialize();
     _tickPending = false;
     _partitionStateCache.CacheAndLockPartitionState("", new PartitionStateCache.State("", null), null);
     _expectedSubscriptionMessageSequenceNumber = -1; // this is to be overridden when subscribing
     // NOTE: this is to workaround exception in GetState requests submitted by client
 }
        public void setup()
        {
            //given
            _cache = new PartitionStateCache(10);
            _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(0, 1000, 900);
            for (var i = 0; i < 15; i++)
            {
                CheckpointTag at = CheckpointTag.FromPosition(0, 1000 + (i*100), 1000 + (i*100) - 50);
                _cache.CacheAndLockPartitionState("partition1", new PartitionState("data1", null, at), at);
            }

            _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(0, 20100, 20050);
            _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(0, 20200, 20150);
            _cache.CacheAndLockPartitionState(
                "partition1", new PartitionState("data1", null, _cachedAtCheckpointTag1), _cachedAtCheckpointTag1);
            _cache.CacheAndLockPartitionState(
                "partition2", new PartitionState("data2", null, _cachedAtCheckpointTag2), _cachedAtCheckpointTag2);
            _cache.CacheAndLockPartitionState(
                "partition3", new PartitionState("data3", null, _cachedAtCheckpointTag3), _cachedAtCheckpointTag3);
            _cache.Unlock(_cachedAtCheckpointTag2);
            // when
            _cache.Initialize();
        }