docs: private Result delCacheEntry(Object id, int bufferType, boolean explicitBufferFirst) // 3821
      {
          final String methodName = "delCacheEntry()";
          Result result = getFromResultPool();
          HashtableEntry hte = null;
          EvictionTableEntry evt = null;
          Object currentId;
          boolean fireEvent = false;
          currentId = id;
          String msg = "DCThread";
  
          if (explicitBufferFirst == false) {
              msg = "GCThread";
          }
  
          if (bufferType == HTODInvalidationBuffer.EXPLICIT_BUFFER) {
              if (id instanceof ExplicitIdData) {
                  byte info = ((ExplicitIdData) id).info;
                  currentId = ((ExplicitIdData) id).id;
                  result.cause = (info & HTODInvalidationBuffer.STATUS_CAUSE_MASK);
                  result.source = (info & HTODInvalidationBuffer.STATUS_REMOTE) == 0 ? CachePerf.LOCAL : CachePerf.REMOTE;
                  result.bFromDepIdTemplateInvalidation = (info & HTODInvalidationBuffer.STATUS_FROM_DEPID_TEMPLATE) == 0 ? false : true;
                  fireEvent = (info & HTODInvalidationBuffer.STATUS_FIRE_EVENT) == 0 ? false : true;
              } else {
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " *** ERROR *** id is not ExplicitIdData: " + id.getClass().toString());
                  return result;
              }
          } else if (bufferType == HTODInvalidationBuffer.GC_BUFFER) {
              if (id instanceof EvictionTableEntry) {
                  evt = (EvictionTableEntry) id;
                  if (System.currentTimeMillis() > evt.expirationTime) {
                      result.cause = CachePerf.TIMEOUT;
                  } else {
                      result.cause = CachePerf.DISK_GARBAGE_COLLECTOR;
                  }
                  result.source = CachePerf.LOCAL;
                  fireEvent = true;
              } else {
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " *** ERROR *** id is not EvictionTableEntry: " + id.getClass().toString());
                  return result;
              }
          } else {
              fireEvent = true;
              result.cause = CachePerf.TIMEOUT;
              result.source = CachePerf.LOCAL;
          }
  
          // In this case, we need to convert the id to an EvictionTableEntry
          if (fireEvent && cache.isEnableListener() && cache.getEventSource().getPreInvalidationListenerCount() > 0
                  && (bufferType != HTODInvalidationBuffer.EXPLICIT_BUFFER)) {
              // evt != null ==> bufferType is GC_BUFFER. We need to convert
              // EvictionTableEntry to cache id
              if (evt != null) {
                  // try block used to get cache id from EvictionTableEntry
                  try {
                      currentId = object_cache.getCacheKey(evt);
                      result.returnCode = NO_EXCEPTION;
                  } catch (FileManagerException ex) {
                      this.diskCacheException = ex;
                      result.diskException = ex;
                      result.returnCode = DISK_EXCEPTION;
                  } catch (HashtableOnDiskException ex) {
                      this.diskCacheException = ex;
                      result.diskException = ex;
                      result.returnCode = DISK_EXCEPTION;
                  } catch (IOException ex) {
                      this.diskCacheException = ex;
                      result.diskException = ex;
                      result.returnCode = DISK_EXCEPTION;
                  } catch (Exception ex) {
                      result.returnCode = OTHER_EXCEPTION;
                      result.diskException = ex;
                  } finally {
                      if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
                          com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.delCacheEntry", "655", this);
                      }
                      // handle the exception for getting cache id from
                      // EvictionTableEntry
                      if (result.returnCode != NO_EXCEPTION) {
                          if (tc.isDebugEnabled())
                              Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
                          evictionEntryPool.add(evt); // return evt to the pool
                          return result;
                      }
                  }
              }
  
              if (cache.getEventSource().shouldInvalidate(currentId, result.source, result.cause) == false) {
                  // insert EVT back to EvictionTable 
                  if (bufferType == HTODInvalidationBuffer.GC_BUFFER) {
                      this.EvictionTable.insert(evt);
                  } else {
                      // if running in high performance mode and entry is timeout, the id with 
                      // current time as expiration time will be put back into TimeLimitDaemon 
                      if (this.cod.diskCachePerformanceLevel == CacheConfig.HIGH && result.cause == CachePerf.TIMEOUT)
                          this.cod.cache.addToTimeLimitDaemon(currentId, System.currentTimeMillis(), -1);
                  }
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " Skipping invalidate for id=" +
                                               currentId + " source=" + result.source + " cause=" + result.cause);
                  return result;
              }
          }
  
          if (tc.isDebugEnabled())
              Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " id=" + id + " cause=" + result.cause + " source=" + result.source + " fromDTInv="
                                       + result.bFromDepIdTemplateInvalidation + "  fireEvent=" + fireEvent);
          boolean bRetrieveCacheValue = false;
          if (fireEvent && cache.isEnableListener() && cache.getEventSource().getInvalidationListenerCount() > 0 && this.cod.ignoreValueInInvalidationEvent == false) {
              bRetrieveCacheValue = true;
          }
  
          CacheEntry ce = null;
          if (id != null) {
  
              try {
                  rwLock.writeLock().lock();
                  if (this.invalidationBuffer.isLoopOnce()) {
                      if (evt != null) {
                          evictionEntryPool.add(evt); // return evt to the pool
                      }
                      return result;
                  }
                  //if (this.testException) {
                  //    throw new FileManagerException("*** Generate filemanager exception");
                  //}
                  if (bufferType == HTODInvalidationBuffer.GC_BUFFER) {
                      hte = object_cache.getAndRemove(id, bRetrieveCacheValue);
                  } else {
                      hte = object_cache.getAndRemove(currentId, bRetrieveCacheValue);
                  }
  
                  if (hte != null) {
                      //remove the entry from evictionTable
                      if ((bufferType != HTODInvalidationBuffer.GC_BUFFER) && (this.cod.evictionPolicy != CacheConfig.EVICTION_NONE)) {
                          //Find a matching entry in heap and remove it
                          long expTime = hte.expirationTime();
                          if (expTime <= 0)
                              expTime = Long.MAX_VALUE;
                          int hashcode = (hte.getKey()).hashCode();
                          if (this.invalidationBuffer.findAndRemoveFromGCBuffer(expTime, hashcode, hte.size()) == false) {
                              synchronized (evictionTableMonitor) {
                                  EvictionTableEntry evt1 = EvictionTable.findAndRemove(expTime, hashcode, hte.size());
                                  if (evt1 != null) {
                                      evictionEntryPool.add(evt1); // return evt to the pool
                                  }
                              }
                          }
                      }
                      if (bufferType == HTODInvalidationBuffer.GC_BUFFER) {
                          result.data = hte.getKey();
                          currentId = result.data;
                      } else {
                          result.data = currentId;
                      }
                      result.numDelete = 1;
                      if (hte.size() > 0) {
                          result.deletedSize = hte.size();
                      } else {
                          result.deletedSize = hte.valueLength();
                      }
                      if (this.cod.enableCacheSizeInBytes) {
                          this.cod.currentCacheSizeInBytes = this.cod.currentCacheSizeInBytes - hte.size();
                      }
                      this.cache.getCacheStatisticsListener().deleteEntryFromDisk(currentId, hte.size());
                  }
              } catch (FileManagerException ex) {
                  this.diskCacheException = ex;
                  result.diskException = ex;
                  result.returnCode = DISK_EXCEPTION;
              } catch (HashtableOnDiskException ex) {
                  this.diskCacheException = ex;
                  result.diskException = ex;
                  result.returnCode = DISK_EXCEPTION;
              } catch (IOException ex) {
                  this.diskCacheException = ex;
                  result.diskException = ex;
                  result.returnCode = DISK_EXCEPTION;
              } catch (Exception ex) {
                  result.returnCode = OTHER_EXCEPTION;
                  result.diskException = ex;
              } finally {
                  if (result.returnCode != NO_EXCEPTION) {
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
                  }
                  if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
                      com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.delCacheEntry", "700", this);
                  }
                  rwLock.writeLock().unlock();
              }
  
              if (hte != null) {
                  Object value = hte.getValue();
                  if (value != null) {
                      try {
                          ce = (CacheEntry) SerializationUtility.deserialize((byte[]) value, cacheName);
                      } catch (Exception ex) {
                          result.returnCode = SERIALIZATION_EXCEPTION;
                          result.diskException = ex;
                          if (tc.isDebugEnabled())
                              Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
                          com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.delCacheEntry", "718", this);
                      }
                  }
                  if (ce != null) {
                      if (bufferType == HTODInvalidationBuffer.GC_BUFFER) {
                          this.invalidationBuffer.remove(ce.id);
                      }
                      synchronized (this.cache) {
                          if (ce._dataIds != null) {
                              //removedependencies for all dataIds to the cacheEntry
                              for (int i = 0; i < ce._dataIds.length; i++) {
                                  //if (tc.isDebugEnabled()) Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " dataId=" + ce._dataIds[i]);
                                  result.returnCode = delDependencyEntry(ce._dataIds[i], ce.id);
                                  if (result.returnCode == DISK_EXCEPTION) {
                                      if (evt != null) {
                                          evictionEntryPool.add(evt); // return evt to the pool
                                      }
                                      return result;
                                  }
                              }
                          }
                          if (ce._templates != null) {
                              //remove dependencies for all templates to the cacheEntry
                              for (int i = 0; i < ce._templates.length; i++) {
                                  //if (tc.isDebugEnabled()) Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " template=" + ce._templates[i]);
                                  result.returnCode = delTemplateEntry(ce._templates[i], ce.id);
                                  if (result.returnCode == DISK_EXCEPTION) {
                                      if (evt != null) {
                                          evictionEntryPool.add(evt); // return evt to the pool
                                      }
                                      return result;
                                  }
                              }
                          }
                          //remove dependencies for all aliases to the cacheEntry
                          for (int i = 0; i < ce.aliasList.length; i++) {
  
                              try {
                                  rwLock.writeLock().lock();
                                  if (tc.isDebugEnabled())
                                      Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " deleting alias with id= " + ce.id + " alias=" + ce.aliasList[i]);
                                  object_cache.remove(ce.aliasList[i]);
                                  if (bufferType == HTODInvalidationBuffer.EXPLICIT_BUFFER) {
                                      this.invalidationBuffer.remove(ce.aliasList[i], HTODInvalidationBuffer.EXPLICIT_BUFFER);
                                  }
                                  result.numDelete++;
                              } catch (FileManagerException ex) {
                                  this.diskCacheException = ex;
                                  result.diskException = ex;
                                  result.returnCode = DISK_EXCEPTION;
                              } catch (HashtableOnDiskException ex) {
                                  this.diskCacheException = ex;
                                  result.diskException = ex;
                                  result.returnCode = DISK_EXCEPTION;
                              } catch (IOException ex) {
                                  this.diskCacheException = ex;
                                  result.diskException = ex;
                                  result.returnCode = DISK_EXCEPTION;
                              } catch (Exception ex) {
                                  result.returnCode = OTHER_EXCEPTION;
                                  result.diskException = ex;
                              } finally {
                                  if (result.returnCode != NO_EXCEPTION) {
                                      if (tc.isDebugEnabled())
                                          Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
                                  }
                                  if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
                                      com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.delCacheEntry", "700", this);
                                  }
                                  rwLock.writeLock().unlock();
                              }
  
                          }
                      }
                      if (ce.sharingPolicy == EntryInfo.SHARED_PUSH_PULL || ce.sharingPolicy == EntryInfo.SHARED_PULL) {
                          //if (tc.isDebugEnabled()) Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " call to invalidate PUSH-PULL table with id=" + ce.id);
                          if (bufferType == HTODInvalidationBuffer.EXPLICIT_BUFFER) {
                              if (result.source == CachePerf.LOCAL && result.bFromDepIdTemplateInvalidation) {
                                  this.cache.invalidateById(ce.id, result.cause, result.source, false, !InvalidateByIdEvent.INVOKE_INTERNAL_INVALIDATE_BY_ID);
                              }
                          } else {
                              this.cache.invalidateById(ce.id, result.cause, result.source, false, !InvalidateByIdEvent.INVOKE_INTERNAL_INVALIDATE_BY_ID);
                          }
                      }
                      // fireEvent is set to false in the cache.lruToDisk for the error case.  
                      if (fireEvent && cache.isEnableListener() && cache.getEventSource().getInvalidationListenerCount() > 0) {
                          value = null;
                          // Value is valid if ignoreValueInInvalidationEvent is false. Otherwise, leave the value to NULL.
                          if (this.cod.ignoreValueInInvalidationEvent == false) {
                              value = hte.getSerializedCacheValue();
                              if (value == null) {
                                  value = ce.serializedValue;
                              }
                          }
                          InvalidationEvent ie = null;
                          if (result.cause == CachePerf.DISK_GARBAGE_COLLECTOR) { //321649
                              ie = new InvalidationEvent(ce.id, value, InvalidationEvent.DISK_GARBAGE_COLLECTOR, InvalidationEvent.LOCAL, this.cache.getCacheName());
                          } else {
                              ie = new InvalidationEvent(ce.id, value, InvalidationEvent.DISK_TIMEOUT, InvalidationEvent.LOCAL, this.cache.getCacheName());
                          }
                          cache.getEventSource().fireEvent(ie);
                      }
                      returnToHashtableEntryPool(hte);
                      CachePerf cachePerf = cache.getCachePerf();
                      if (cachePerf != null && cachePerf.isPMIEnabled()) {
                          String template = "";
                          if (ce._templates != null && ce._templates.length > 0) {
                              template = ce._templates[0];
                          }
                          cachePerf.onInvalidate(template, result.cause, CachePerf.DISK, result.source);
                      }
                      this.cache.getCacheStatisticsListener().remove(ce.id, result.cause, CachePerf.DISK, result.source);
                      ce.reset();
                  }
              }
          }
          if (tc.isDebugEnabled())
              Tr.debug(tc, methodName, msg + " cacheName=" + this.cacheName + " id=" + currentId + " cacheSizeInBytes=" + this.cod.currentCacheSizeInBytes + " deleteSize="
                                       + result.deletedSize + " bufferType=" + bufferType + " enable=" + this.cod.enableCacheSizeInBytes);
          if (evt != null) {
              evictionEntryPool.add(evt); // return evt to the pool
          }
          return result;
      }