This brings this CacheEntry back to the same state it had when it
was first created. It does not change its lruArray index.
It is called by the Cache when one of the preallocated
CacheEntry instances is about to be reused for another logical
entry.
167297
public void reset() {

        if (refCount.get() > 0 && isRefCountingEnabled()) {
            Tr.warning(tc, "reset called on " + id + " with a refCount of " + refCount);
            Thread.dumpStack();
        }

        cacheName = null;
        drsClock = -1;
        timeStamp = -1;
        serializedId = null;
        id = null;
        if (useByteBuffer && this.value != null) {
            if (this.value instanceof DistributedNioMapObject) {
                ((DistributedNioMapObject) this.value).release();
            }
        }
        serializedValue = null;
        value = null;
        clock = CacheConfig.DEFAULT_PRIORITY;
        refCount.set(0);
        priority = CacheConfig.DEFAULT_PRIORITY;
        timeLimit = -1;
        inactivity = -1;
        expirationTime = -1;
        validatorExpirationTime = -1;
        removeWhenUnpinned = false;
        _templates = EMPTY_STRING_ARRAY;
        _dataIds = EMPTY_OBJECT_ARRAY;
        _serializedDataIds = null;
        pendingRemoval = false;
        sharingPolicy = EntryInfo.NOT_SHARED;
        persistToDisk = true;
        isOverflowEntry = false;
        lruEvicted = false;
        lruHead = null;
        useByteBuffer = false;
        aliasList = EMPTY_OBJECT_ARRAY;
        serializedAliasList = null;
        userMetaData = null;
        serializedUserMetaData = null;
        loadedFromDisk = false;
        cacheType = CACHE_TYPE_DEFAULT;
        skipValueSerialized = false;
        skipMemoryAndWriteToDisk = false;
        skipMemoryAndWriteToDiskErrorCode = HTODDynacache.NO_EXCEPTION;
        valueHashcode = 0;
        externalCacheGroupId = null;
    }
545649
protected CacheEntry<K, V> returnEntry(final ExaminationEntry<K, V> e) {
    if (e == null) {
      return null;
    }
    return returnCacheEntry(e);
  }
894363
public function next()
    {
        // fetch next entry.
        // if we have no entrys anymore, we add false (which is
        // returned by shiftEntry()) so current() will complain.
        if (count($this->_iteratorCache) - 1 <= $this->count()) {
            $this->_iteratorCache[] = $this->shiftEntry();
        }

        // move on array pointer to current element.
        // even if we have added all entries, this will
        // ensure proper operation in case we rewind()
        next($this->_iteratorCache);
    }
1363987
public boolean inOrder() {
        SortedSet<Integer> prev = null;
        for (SortedSet<Integer> cell : cells) {
            if (prev == null) {
                prev = cell;
            } else {
                int first = cell.first();
                int last = cell.last();
                if (first > prev.first() && last > prev.last()) {
                    prev = cell;
                } else {
                    return false;
                }
            }
        }
        return true;
    }
368417
public function EntryNext()
    {
        if (!is_array($this->RarEntries)) {
            $this->RarEntries = scandir('rar://' . $this->PointerSelf);
        }
        if (is_array($this->RarEntries) && !empty($this->RarEntries)) {
            $this->RarEntry = $this->RarObject->getEntry(array_shift($this->RarEntries));
            return true;
        }
        return false;
    }
1309969
public boolean previous()
	{
		if( indexes.length <= 1 || permutation <= 0 )
			return false;

		int N = indexes.length-2;
		int k = N;

		while( counters[k] <= k ) {
			k--;
		}

		swap(counters[k], k);
		counters[k]--;
		swap(k, counters[k]);
		int foo = k+1;
		while( counters[k+1] == k+1 && k < indexes.length-2) {
			k++;
			swap(k, indexes.length-1);
		}

		for (int i = foo; i < indexes.length - 1; i++) {
			counters[i] = indexes.length - 1;
		}

		permutation--;
		return true;
	}
890939
public synchronized Entry getNextEntry()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "getNextEntry");
    
    checkEntryParent();
    
    Entry nextEntry = null;
    
    synchronized(parentList)
    {
      if(atTop)
      {
        //if the cursor is at the top of the list, return the first entry in the list
        nextEntry = parentList.first;
      }
      else if(!atBottom)                        
      {
        //otherwise just return the next entry in the list
        nextEntry = current.getNext();                        
      }
      //if the cursor is at the bottom of the list then we should
      //just drop through and the next entry is null
    }
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "getNextEntry", nextEntry);
    
    return nextEntry;
  }
1274862
@Override
    public boolean retainAll(Collection<?> c) {
        boolean modified = false;
        for(Map.Entry<Integer, Record> e : entries()) {
            Integer rId = e.getKey();
            Record r = e.getValue();
            if(!c.contains(r)) {
                remove(rId);
                modified = true;
            }
        }
        if(modified) {
            recalculateMeta();
        }
        return modified;
    }
441335
protected boolean checkNextIndexOffset() {
		if (this.currentSortIndexOffset > this.lastIndexEntryOffset) {
			MemorySegment returnSegment = nextMemorySegment();
			if (returnSegment != null) {
				this.currentSortIndexSegment = returnSegment;
				this.sortIndex.add(this.currentSortIndexSegment);
				this.currentSortIndexOffset = 0;
			} else {
				return false;
			}
		}
		return true;
	}
1240262
public void copy(CacheEntry cacheEntry) {

        if (cacheEntry == this)
            return;

        if (useByteBuffer && this.value != null) {
            if (this.value instanceof DistributedNioMapObject) {
                ((DistributedNioMapObject) this.value).release();
            }
        }

        this.value = cacheEntry.value;
        this.valueHashcode = cacheEntry.valueHashcode;
        this.serializedValue = cacheEntry.serializedValue;
        this.serializedId = cacheEntry.serializedId;
        timeStamp = cacheEntry.timeStamp;
        expirationTime = cacheEntry.expirationTime;
        validatorExpirationTime = cacheEntry.validatorExpirationTime;
        timeLimit = cacheEntry.timeLimit;
        inactivity = cacheEntry.inactivity;
        drsClock = cacheEntry.drsClock;
        id = cacheEntry.id;
        priority = cacheEntry.priority;
        if (priority < 0)
            priority = 0;
        if (priority > CacheConfig.MAX_PRIORITY)
            priority = CacheConfig.MAX_PRIORITY;
        _templates = cacheEntry._templates;
        _dataIds = cacheEntry._dataIds;
        _serializedDataIds = cacheEntry._serializedDataIds;
        sharingPolicy = cacheEntry.sharingPolicy;
        persistToDisk = cacheEntry.persistToDisk;
        refCount = new AtomicInteger(cacheEntry.refCount.get());
        aliasList = cacheEntry.aliasList;
        serializedAliasList = cacheEntry.serializedAliasList;
        useByteBuffer = cacheEntry.useByteBuffer;
        userMetaData = cacheEntry.userMetaData;
        serializedUserMetaData = cacheEntry.serializedUserMetaData;
        loadedFromDisk = cacheEntry.loadedFromDisk;
        cacheType = cacheEntry.cacheType;
        skipValueSerialized = cacheEntry.skipValueSerialized;
        skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk;
        skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode;
        vbcSource = cacheEntry.vbcSource;
        externalCacheGroupId = cacheEntry.externalCacheGroupId;
        //Note: clock is not set here because it's really owned
        //by the cache.  Only the cache should say when the clock
        //changes.  It makes the cache code more readable.
    }
516282
protected void replaceEntry(T oldEntry, T newEntry) {
        T prev = oldEntry.getPrev();
        T next = newEntry.getNext();
        if (prev != null) {
            prev.setNext(newEntry);
        } else {
            head = newEntry;
        }
        if (next != null) {
            next.setPrev(newEntry);
        } else {
            last = newEntry;
        }
    }
520163
protected boolean removeEldestEntry(Map.Entry<K, V> pEldest) {
        // NOTE: As removeLRU() may remove more than one entry, this is better
        // than simply removing the eldest entry.
        if (size() >= maxSize) {
            removeLRU();
        }
        return false;
    }
1106655
private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) {
    long  nrt = e.getRefreshProbationNextRefreshTime();
    if (nrt > now) {
      reviveRefreshedEntry(e, nrt);
      return true;
    }
    return false;
  }
428739
protected boolean doReindexing(boolean dropExisting, int nThreads) {
    boolean successful = false;
    Integer oldPoolSize = ((SearchIndex) handler).getIndexingThreadPoolSize();
    String newIndexPath = null;

    hotReindexingState = "Running. Started at " + LocalDateTime.now().format(sdf);
    try {

      isResponsibleForResuming.set(true);

      //hot async reindexing with drop exiting index data
      // set offline index state
      if (dropExisting) {
        // set offline cluster wide (will make merger disposed and volatile flushed)
        if (rpcService != null && changesFilter.isShared()) {
          rpcService.executeCommandOnAllNodes(changeIndexState, true, false, false);
        } else {
          handler.setOnline(false, false, true);
        }
      }
      // launch reindexing thread safely, resume nodes if any exception occurs
      if (handler instanceof SearchIndex) {
        if (dropExisting) {
          ((SearchIndex) handler).getIndex().reindex(itemMgr);
        } else {
          String oldIndexPath = ((SearchIndex) handler).getPath();
          newIndexPath = oldIndexPath + SUFFIX_ASYNC_REINDEXING;

          //try remove new index directory if already exist
          cleanIndexDirectory(oldIndexPath + SUFFIX_ASYNC_REINDEXING);

          //hot async reindexing without remove old index
          //create new index and register it
          MultiIndex newIndex = ((SearchIndex) handler).createNewIndex(SUFFIX_ASYNC_REINDEXING);
          ErrorLog errorLog = ((SearchIndex) handler).doInitErrorLog(newIndexPath);
          ((SearchIndex) handler).getIndexRegister().register(newIndex, errorLog);
          ((SearchIndex) handler).setIndexingThreadPoolSize(nThreads > 1 ? nThreads : 1);

          //set offline the new index
          newIndex.setOnline(false, true, false);

          //start create new index
          newIndex.reindex(itemMgr);

          //set  online to flush offline index
          newIndex.setOnline(true, true, false);

          //Suspend component, on cluster mode stop all index nodes
          //All the working threads will be suspended until the resume operation is performed.
          suspend();
          ((SearchIndex) handler).getIndexRegister().unregister(newIndex);

          final File indexDir = new File(oldIndexPath);
          final File newIndexDir = new File(oldIndexPath + SUFFIX_ASYNC_REINDEXING);

          //try remove old index directory
          LOG.info("Try to clean old lucene indexes of the workspace '" + workspaceName + "'");
          cleanIndexDirectory(oldIndexPath);

          //try rename new index folder .new
          LOG.info("try to rename new lucene indexes of the workspace '" + workspaceName + "'");
          SecurityHelper.doPrivilegedIOExceptionAction((PrivilegedExceptionAction<Void>) () -> {
            DirectoryHelper.renameFile(newIndexDir, indexDir);
            return null;
          });

          // Resume all the working threads that have been previously suspended.
          resume();
        }

        successful = true;
      } else {
        LOG.error("This kind of QuerHandler class doesn't support hot reindxing.");
      }
    } catch (RepositoryException e) {
      LOG.error("Error while reindexing the workspace", e);
    } catch (SecurityException e) {
      LOG.error("Can't change state to offline.", e);
    } catch (RPCException e) {
      LOG.error("Can't change state to offline.", e);
    } catch (IOException e) {
      LOG.error("Error while reindexing the workspace", e);
    }
    // safely change state back
    catch (SuspendException e) {
      LOG.error("Can't suspend SearchIndex component, " +
              "impossible to switch to newly created index, the old index still used", e);

    } catch (ResumeException e) {
      LOG.error("Can't resume SearchIndex component, impossible to set the index online", e);
    } finally {
      if (dropExisting) {
        // finish, setting indexes back online
        if (rpcService != null && changesFilter.isShared()) {
          try {
            // if dropExisting, then queries are no allowed
            rpcService.executeCommandOnAllNodes(changeIndexState, true, true, true);
          } catch (SecurityException e) {
            LOG.error("Error setting index back online in a cluster", e);
          } catch (RPCException e) {
            LOG.error("Error setting index back online in a cluster", e);
          }
        } else {
          try {
            handler.setOnline(true, true, true);
          } catch (IOException e) {
            LOG.error("Error setting index back online locally");
          }
        }
      } else {
        ((SearchIndex) handler).setIndexingThreadPoolSize(oldPoolSize);
      }
      if (successful) {
        hotReindexingState = "Finished at " + LocalDateTime.now().format(sdf);
        LOG.info("Reindexing finished successfully.");
      } else {
        hotReindexingState = "Stopped with errors at " + LocalDateTime.now().format(sdf);
        LOG.info("Reindexing halted with errors.");
        if (!dropExisting) {
          try {
            if (newIndexPath != null)
              cleanIndexDirectory(newIndexPath);
          } catch (IOException e) {
            LOG.error("Error while removing the folder of the index used for the hot reindexing", e);

          }
        }
      }
      isResponsibleForResuming.set(false);

      return successful;
    }
  }
434253
private boolean isRefreshIndexes()
    {

        if (clientProperties != null)
        {

            Object refreshIndexes = clientProperties.get(ESConstants.ES_REFRESH_INDEXES);

            if (refreshIndexes != null && refreshIndexes instanceof Boolean)
            {
                return (boolean) refreshIndexes;
            }
            else
            {
                return Boolean.parseBoolean((String) refreshIndexes);
            }

        }
        else
        {
            return this.setRereshIndexes;
        }
    }
1298317
void cache(ManagedObject managedObject) {
        // Make a local reference to cachedManagedObjects in case it is changing, there is a risk that 
        // the same slot in cachedMangedObjects will be used twice, in that case the Object is not 
        // cached and will be read again when referenced.
        java.lang.ref.SoftReference[] localCachedManagedObjects = cachedManagedObjects;
        int localICache = iCache++;
        if (localICache >= localCachedManagedObjects.length) {
            iCache = 0;
            localICache = 0;
        }

        localCachedManagedObjects[localICache] = new java.lang.ref.SoftReference(managedObject);
        managedObject.objectStoreCacheIndex = localICache;
    }
222053
@Override
	public void cacheResult(List<CommercePriceEntry> commercePriceEntries) {
		for (CommercePriceEntry commercePriceEntry : commercePriceEntries) {
			if (entityCache.getResult(
						CommercePriceEntryModelImpl.ENTITY_CACHE_ENABLED,
						CommercePriceEntryImpl.class,
						commercePriceEntry.getPrimaryKey()) == null) {
				cacheResult(commercePriceEntry);
			}
			else {
				commercePriceEntry.resetOriginalValues();
			}
		}
	}