Refresh list of indexes. Used to be called asynchronously when list changes. New, actual list is read from
IndexInfos.
@throws IOException
188727
public void refreshIndexList() throws IOException
   {
      synchronized (updateMonitor)
      {
         // release reader if any
         releaseMultiReader();
         // prepare added/removed sets
         Set<String> newList = new HashSet<String>(indexNames.getNames());

         // remove removed indexes
         Iterator<PersistentIndex> iterator = indexes.iterator();
         while (iterator.hasNext())
         {
            PersistentIndex index = iterator.next();
            String name = index.getName();
            // if current index not in new list, close it, cause it is deleted.
            if (!newList.contains(name))
            {
               index.close();
               iterator.remove();
            }
            else
            {
               // remove from list, cause this segment of index still present and indexes list contains
               // PersistentIndex instance related to this index..
               newList.remove(name);
               // Release everything to make sure that we see the
               // latest changes
               index.releaseWriterAndReaders();
            }
         }
         // now newList contains ONLY new, added indexes, deleted indexes, are removed from list.
         for (String name : newList)
         {
            // only open if it still exists
            // it is possible that indexNames still contains a name for
            // an index that has been deleted, but indexNames has not been
            // written to disk.
            if (!directoryManager.hasDirectory(name))
            {
               LOG.debug("index does not exist anymore: " + name);
               // move on to next index
               continue;
            }
            PersistentIndex index =
               new PersistentIndex(name, handler.getTextAnalyzer(), handler.getSimilarity(), cache, directoryManager,
                  modeHandler);
            index.setMaxFieldLength(handler.getMaxFieldLength());
            index.setUseCompoundFile(handler.getUseCompoundFile());
            index.setTermInfosIndexDivisor(handler.getTermInfosIndexDivisor());
            indexes.add(index);
         }
          // Reset the volatile index to be exactly like the master
          resetVolatileIndex();
      }
   }
664769
public void flush() throws IOException
   {
      SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
      {
         public Void run() throws Exception
         {
            synchronized (MultiIndex.this)
            {
               // commit volatile index
               executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
               commitVolatileIndex();

               // commit persistent indexes
               for (int i = indexes.size() - 1; i >= 0; i--)
               {
                  PersistentIndex index = indexes.get(i);
                  // only commit indexes we own
                  // index merger also places PersistentIndex instances in
                  // indexes,
                  // but does not make them public by registering the name in
                  // indexNames
                  if (indexNames.contains(index.getName()))
                  {
                     index.commit();
                     // check if index still contains documents
                     if (index.getNumDocuments() == 0)
                     {
                        executeAndLog(new DeleteIndex(getTransactionId(), index.getName()));
                     }
                  }
               }
               executeAndLog(new Commit(getTransactionId()));

               indexNames.write();

               // reset redo log
               redoLog.clear();

               lastFlushTime = System.currentTimeMillis();
               lastFileSystemFlushTime = System.currentTimeMillis();
            }

            // delete obsolete indexes
            attemptDelete();
            return null;
         }
      });
   }
1009108
@Override
    protected void update(List<TableInfo> tableInfos)
    {
        if (!clusterManager.hasBucket(databaseName))
        {
            addBucket(databaseName);
            createIdIndex(databaseName);
        }
    }
1326317
protected void refreshIndexes(Set<String> set)
   {
      // do nothing if null is passed
      if (set == null)
      {
         return;
      }
      setNames(set);
      // callback multiIndex to refresh lists
      try
      {
         MultiIndex multiIndex = getMultiIndex();
         if (multiIndex != null)
         {
            multiIndex.refreshIndexList();
         }
      }
      catch (IOException e)
      {
         LOG.error("Failed to update indexes! " + e.getMessage(), e);
      }
   }
851161
private void update() {
        synchronized (lock) {
            if (!observing) { return; }

            try {
                Log.i(DOMAIN, "%s: Querying...", this);
                final ResultSet oldResultSet = resultSet;
                final ResultSet newResultSet = (oldResultSet == null) ? query.execute() : oldResultSet.refresh();

                willUpdate = false;
                lastUpdatedAt = System.currentTimeMillis();

                if (newResultSet != null) {
                    if (oldResultSet != null) { Log.i(DOMAIN, "%s: Changed!", this); }
                    resultSet = newResultSet;
                    changeNotifier.postChange(new QueryChange(this.query, resultSet, null));
                }
                else {
                    Log.i(DOMAIN, "%s: ...no change", this);
                }
            }
            catch (CouchbaseLiteException e) {
                changeNotifier.postChange(new QueryChange(this.query, null, e));
            }
        }
    }
27839
function refreshIndex () {
    ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);
    ctrl.focusIndex    = getNearestSafeIndex(ctrl.focusIndex);
  }
630233
public void setRefreshDelayInSeconds(int refreshDelayInSeconds) {

    ValueOutOfRangeException.checkRange(Integer.valueOf(refreshDelayInSeconds), MIN_DELAY, Integer.valueOf(Integer.MAX_VALUE),
        getClass().getSimpleName() + ".refreshDelayInSeconds");
    this.refreshDelayInSeconds = refreshDelayInSeconds;
  }
556638
private void refreshTaskDefs() {
        try {
            withTransaction(tx -> {
                Map<String, TaskDef> map = new HashMap<>();
                findAllTaskDefs(tx).forEach(taskDef -> map.put(taskDef.getName(), taskDef));

                synchronized (taskDefCache) {
                    taskDefCache.clear();
                    taskDefCache.putAll(map);
                }

                if (logger.isTraceEnabled()) {
                    logger.trace("Refreshed {} TaskDefs", taskDefCache.size());
                }
            });
        } catch (Exception e){
            Monitors.error(className, "refreshTaskDefs");
            logger.error("refresh TaskDefs failed ", e);
        }
    }
1212464
private void refreshId()
	{
		if (null == getName())
		{
			setId(null);
		}
		else
		{
			if (null == getIdSuffix())
			{
				setId(getName());
			}
			else
			{
				setId(getName() + getIdSuffix());
			}
		}
	}
246345
def reset_index(self):
        
        self.index = list(range(self.__len__()))
        self.index_name = 'index'
1005365
@MainThread
    public void update(@NonNull List<T> newItems, @NonNull DiffUtil.DiffResult diffResult) {
        synchronized (LIST_LOCK) {
            list = newItems;
        }
        diffResult.dispatchUpdatesTo(listCallback);
    }
250037
private void refresh() {
        if (this.previewedThread != null) {
            if (this.previewedThread.isComplete()) {
                setLatestPreview();
                disableRefresh();
            } else {
                this.previewedThread.getPreview(ALPreviewPanel.this);
            }
        }
    }
918409
public void setIndexNames(java.util.Collection<String> indexNames) {
        if (indexNames == null) {
            this.indexNames = null;
            return;
        }

        this.indexNames = new java.util.ArrayList<String>(indexNames);
    }
1179847
@Override
  public void resync() {
    lock.writeLock().lock();
    try {
      if (this.knownObjects == null) {
        return;
      }

      List<String> keys = this.knownObjects.listKeys();
      for (String key : keys) {
        syncKeyLocked(key);
      }
    } finally {
      lock.writeLock().unlock();
    }
  }
61558
void cacheHTIndex()
                    throws IOException {
        //htindex = new long[header.tablesize()];
        PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(header.tablesize());
        htindex = (long[]) longPoolEntry.getArray();
        //byte[] tmp = new byte[header.tablesize() * DWORDSIZE];
        PrimitiveArrayPool.PoolEntry bytePoolEntry = this.htoddc.byteArrayPool.allocate(header.tablesize() * DWORDSIZE);
        byte[] tmp = (byte[]) bytePoolEntry.getArray();

        filemgr.seek(currentTable);
        filemgr.read(tmp);
        DataInputStream das = new DataInputStream(new ByteArrayInputStream(tmp));
        for (int i = 0; i < header.tablesize(); i++) {
            htindex[i] = das.readLong();
        }
        das.close();

        //tmp = null;
        this.htoddc.byteArrayPool.returnToPool(bytePoolEntry);
    }
1082891
public synchronized void reset(int[] intArray) throws IOException {
      _writer.flush();
      _writer.position(DATA_START_POSITION);
      for(int i = 0; i < intArray.length; i++) {
          _writer.writeInt(intArray[i]);
      }
      _writer.flush();
  }
1283414
private void refresh() {
        try {
            // Invoke underlying getTuples unsynchronized.
            // This way it won't block tuple access, in case it is a long
            // running or expensive function.
            final CompletableFuture<? extends Collection<ResolverTuple>> fut = underlying.getTuples();

            // Publish future, needs synchronization, so close() method can cancel properly.
            synchronized(this) {
                // We create the whenCompleteAsync continuation with synchronization locked,
                // because the update code will want to clear the currentFut member-variable.
                // We must ensure it is set before.
                currentFut = fut.whenCompleteAsync(this::update, SCHEDULER);

                if (closed)  // Close may have set close bit while we were creating future.
                    fut.cancel(false);
            }
        } catch (Exception ex) {
            synchronized(this) {
                exception = ex;
            }
            reschedule(FAILURE_RESCHEDULE_DELAY);
        }
    }