update tracker info in session.

@param $session
@param string $sessionKey
@param array  $trackInfoArray
@param int    $limit
434774
protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $limit = 5)
    {
        // save the url, controller and action in the session
        $value = json_decode($session->get($sessionKey), true);
        if (is_null($value)) {
            $value = [];
        }
        // add new value as first value (to the top of the stack)
        array_unshift(
            $value,
            $trackInfoArray
        );

        // remove last value, if array has more than limit items
        if ($limit > 0 and count($value) > $limit) {
            array_pop($value);
        }

        // set the session value
        $session->set($sessionKey, json_encode($value));
    }
384055
public function execute($trackId = null, $fieldKey = null)
    {
        $batch  = $this->getBatch();
        $engine = $this->loader->getTracker()->getTrackEngine($trackId);
        $fields = $engine->getFieldsDefinition();
        $model  = $fields->getMaintenanceModel();
        $filter = FieldsDefinition::splitKey($fieldKey);

        $filter['gtf_id_track'] = $trackId;
        $data = $model->loadFirst($filter);
        // \MUtil_Echo::track($fieldKey, $data);

        if ($data) {
            unset($data['sub'], $data['gtf_id_field'], $data['gtf_id_track'],
                    $data['gtf_filter_id'], // TODO: Export track filters
                    $data['gtf_changed'], $data['gtf_changed_by'], $data['gtf_created'], $data['gtf_created_by'],
                    $data['calculation'], $data['htmlUse'], $data['htmlCalc']);

            if (isset($data['gtf_calculate_using']) && $data['gtf_calculate_using']) {
                $calcs = explode(FieldAbstract::FIELD_SEP, $data['gtf_calculate_using']);
                foreach ($calcs as &$key) {
                    $key = $this->translateFieldCode($fields, $key);
                }
                $data['gtf_calculate_using'] = implode(FieldAbstract::FIELD_SEP, $calcs);
            }

            $count = $batch->addToCounter('fields_exported');
            if ($count == 1) {
                $this->exportTypeHeader('fields');
            }
            // The number and order of fields can change per field and installation
            $this->exportFieldHeaders($data);
            $this->exportFieldData($data);
            $this->exportFlush();

            $batch->setMessage('fields_export', sprintf(
                    $this->plural('%d field exported', '%d fields exported', $count),
                    $count
                    ));

        }
    }
277292
public void setTracking (boolean track)
    {
        if (track != _tracking) {
            _tracking = track;
            if (track) {
                _seenKeys = new HashSet<K>();
                _misses = _hits = 0;

                // oh boy, but to properly track we need to clear the hash
                clear();
            } else {
                _seenKeys = null;
            }
        }
    }
896944
protected void updateRecordingManagerCollections(Session session, Recording recording) {
		this.recordingManager.sessionHandler.setRecordingStarted(session.getSessionId(), recording);
		this.recordingManager.sessionsRecordings.put(session.getSessionId(), recording);
		this.recordingManager.startingRecordings.remove(recording.getId());
		this.recordingManager.startedRecordings.put(recording.getId(), recording);
	}
961496
@ProbeAtEntry
    @ProbeSite(clazz="com.ibm.ws.session.SessionEventDispatcher",method="sessionLiveCountInc",args="java.lang.Object")
    public void IncrementLiveCount(@Args Object[] myargs )
    {                      	
        if(tc.isEntryEnabled()){
            Tr.entry(tc, "IncrementLiveCount");
        }
        if(myargs == null){
            if(tc.isEntryEnabled()){
                Tr.exit(tc, "IncrementLiveCount","Args list is null");
            }
            return;
        }
        ISession session = (ISession) myargs[0];
        
        if(session == null){
            if(tc.isEntryEnabled()){
                Tr.exit(tc,"IncrementLiveCount","session object is null"); 
            }
              return;
        }        
        String appName =  session.getIStore().getId();        
        SessionStats sStats = sessionCountByName.get(appName);        
        if(sStats==null){
            sStats = initializeSessionStats(appName ,new SessionStats() );
        }      
        
        sStats.liveCountInc();    
        if(tc.isEntryEnabled()){
            Tr.exit(tc, "IncrementLiveCount");
        }
    }
344722
int delete(Session session, Table table, RowSetNavigator oldRows) {

        if (table.fkMainConstraints.length == 0) {
            deleteRows(session, table, oldRows);
            oldRows.beforeFirst();

            if (table.hasTrigger(Trigger.DELETE_AFTER)) {
                table.fireAfterTriggers(session, Trigger.DELETE_AFTER,
                                        oldRows);
            }

            return oldRows.getSize();
        }

        HashSet path = session.sessionContext.getConstraintPath();
        HashMappedList tableUpdateList =
            session.sessionContext.getTableUpdateList();

        if (session.database.isReferentialIntegrity()) {
            oldRows.beforeFirst();

            while (oldRows.hasNext()) {
                oldRows.next();

                Row row = oldRows.getCurrentRow();

                path.clear();
                checkCascadeDelete(session, table, tableUpdateList, row,
                                   false, path);
            }
        }

        if (session.database.isReferentialIntegrity()) {
            oldRows.beforeFirst();

            while (oldRows.hasNext()) {
                oldRows.next();

                Row row = oldRows.getCurrentRow();

                path.clear();
                checkCascadeDelete(session, table, tableUpdateList, row, true,
                                   path);
            }
        }

        oldRows.beforeFirst();

        while (oldRows.hasNext()) {
            oldRows.next();

            Row row = oldRows.getCurrentRow();

            if (!row.isDeleted(session)) {
                table.deleteNoRefCheck(session, row);
            }
        }

        for (int i = 0; i < tableUpdateList.size(); i++) {
            Table targetTable = (Table) tableUpdateList.getKey(i);
            HashMappedList updateList =
                (HashMappedList) tableUpdateList.get(i);

            if (updateList.size() > 0) {
                targetTable.updateRowSet(session, updateList, null, true);
                updateList.clear();
            }
        }

        oldRows.beforeFirst();

        if (table.hasTrigger(Trigger.DELETE_AFTER)) {
            table.fireAfterTriggers(session, Trigger.DELETE_AFTER, oldRows);
        }

        path.clear();

        return oldRows.getSize();
    }
878839
static void writeTracker(JSONWriter writer, Tracker tracker)
			throws JSONException {
		writer.key("id");
		writer.value(tracker.getId());
		writer.key("name");
		writer.value(tracker.getName());
	}
500597
public function trackByListener($resource, $callback, $eventsMask = FilesystemEvent::ALL)
    {
        $this->track($trackingId = md5((string) $resource.$eventsMask), $resource, $eventsMask);
        $this->addListener($trackingId, $callback);
    }
168196
def setRepCount(self, count):
        """"""
        self._rep_default_cache[0] = count
        self.ui.trackview.model().setRepCount(count)
1068709
synchronized void addTrackerTaskFailure(String trackerName,
                                          TaskTracker taskTracker,
                                          String lastFailureReason) {
    if (flakyTaskTrackers < (clusterSize * CLUSTER_BLACKLIST_PERCENT)) {
      String trackerHostName = convertTrackerNameToHostName(trackerName);

      List<String> trackerFailures = trackerToFailuresMap.get(trackerHostName);

      if (trackerFailures == null) {
        trackerFailures = new LinkedList<String>();
        trackerToFailuresMap.put(trackerHostName, trackerFailures);
      }
      trackerFailures.add(lastFailureReason);

      // Check if this tasktracker has turned 'flaky'
      if (trackerFailures.size() == maxTaskFailuresPerTracker) {
        ++flakyTaskTrackers;

        // Cancel reservations if appropriate
        if (taskTracker != null) {
          if (trackersReservedForMaps.containsKey(taskTracker)) {
            taskTracker.unreserveSlots(TaskType.MAP, this);
          }
          if (trackersReservedForReduces.containsKey(taskTracker)) {
            taskTracker.unreserveSlots(TaskType.REDUCE, this);
          }
        }
        LOG.info("TaskTracker at '" + trackerHostName + "' turned 'flaky'");
      }
    }
  }
927344
final public function modifyLimitQuery($query, $limit, $offset = null)
    {
        if ($limit !== null) {
            $limit = (int) $limit;
        }

        $offset = (int) $offset;

        if ($offset < 0) {
            throw new DBALException(sprintf(
                'Offset must be a positive integer or zero, %d given',
                $offset
            ));
        }

        if ($offset > 0 && ! $this->supportsLimitOffset()) {
            throw new DBALException(sprintf(
                'Platform %s does not support offset values in limit queries.',
                $this->getName()
            ));
        }

        return $this->doModifyLimitQuery($query, $limit, $offset);
    }
1236802
public void setSession(Session newSession) {
        if (newSession == null) {
            if (session != null) {
                // We're current tracking a Session. Remove the callback
                // and start tracking the active Session.
                session.removeCallback(callback);
                session = null;
                addBroadcastReceiver();
                if (getSession() != null) {
                    getSession().addCallback(callback);
                }
            }
        } else {
            if (session == null) {
                // We're currently tracking the active Session, but will be
                // switching to tracking a different Session object.
                Session activeSession = Session.getActiveSession();
                if (activeSession != null) {
                    activeSession.removeCallback(callback);
                }
                broadcastManager.unregisterReceiver(receiver);
            } else {
                // We're currently tracking a Session, but are now switching 
                // to a new Session, so we remove the callback from the old 
                // Session, and add it to the new one.
                session.removeCallback(callback);
            }
            session = newSession;
            session.addCallback(callback);
        }
    }
324488
protected void updateTrackState( SetTrackInfo<Desc> info ) {
		// update tracks
		for( int i = 0; i < info.matches.size; i++ ) {
			AssociatedIndex indexes = info.matches.data[i];
			PointTrack track = info.tracks.get(indexes.src);
			Point2D_F64 loc = info.locDst.data[indexes.dst];
			track.set(loc.x, loc.y);
			tracksActive.add(track);

			// update the description
			if(updateDescription) {
				((Desc)track.getDescription()).setTo(info.featDst.get(indexes.dst));
			}

			info.isAssociated[indexes.src] = true;
		}
	}
1070625
public function write($session_id, $session_data)
    {
        // When create the new session record
        if (! $this->sessions()->where('id', $session_id)->exists()) {
            $insert = $this->sessions()
                ->insert($this->data($session_id, $session_data));

            return $insert == 1;
        }

        // Update the session information
        $update = $this->sessions()->where('id', $session_id)->update([
            'data' => $session_data,
            'id' => $session_id
        ]);

        return $update == 1;
    }
1026079
public function track(TrackableInterface $trackable)
    {
        $tracked = false;
        if ($trackable instanceof Collection) {
            $this->trackCollection($trackable);
            $tracked = true;
        }

        if ($trackable instanceof PageController) {
            $this->trackCollection($trackable->getPageObject());
            $tracked = true;
        }

        if ($trackable instanceof BlockController) {
            if ($collection = $trackable->getCollectionObject()) {
                $this->trackBlocks($trackable->getCollectionObject(), [$trackable]);
                $tracked = true;
            }
        }

        if (!$tracked && $trackable instanceof FileTrackableInterface) {
            $this->trackFileTrackable($trackable);
        }
    }
1150387
protected function _resetTracker($tracker)
    {
        if (!($tracker instanceof Iterator)) {
            throw $this->_createInvalidArgumentException($this->__('Can only reset an Iterator tracker'), null, null, $tracker);
        }

        $tracker->rewind();
    }
762144
public function trackUpdate(Update $update, $eventName = 'Message')
    {
        if (!in_array($update->getUpdateId(), $this->trackedEvents)) {
            $this->trackedEvents[] = $update->getUpdateId();

            $this->track($update->getMessage(), $eventName);

            if (count($this->trackedEvents) > self::MAX_TRACKED_EVENTS) {
                $this->trackedEvents = array_slice($this->trackedEvents, round(self::MAX_TRACKED_EVENTS / 4));
            }
        }
    }