docs: Result writeValueSetEntry(int type,
                                Object id,
                                Object entry,
                                ValueSet valueSet,
                                boolean addIfNew) {
          final String methodName = "writeValueSetEntry()";
          Result result = getFromResultPool();
          HashtableOnDisk cache_instance = null;
          HashtableOnDisk vshtod = null;
          try {
              rwLock.writeLock().lock();
              if (type == DEP_ID_DATA) {
                  cache_instance = dependency_cache;
              } else {
                  cache_instance = template_cache;
              }
              //if (this.testException) {
              //    throw new FileManagerException("*** Generate filemanager exception");
              //}
              Long vsinstid = (Long) cache_instance.get(id);
              long vsinstance = 0;
              FileManager filemgr = cache_instance.getFileManager();
              if (vsinstid == null) {
                  //
                  // no such instance as yet.  Make one and put its pointer into the main valueset htod.
                  //
                  if (addIfNew && entry != null) {
                      vsinstance = HashtableOnDisk.createInstance(filemgr, initial_valueset_size, hashtable_threshold);
                      cache_instance.put(id, new Long(vsinstance));
                      vshtod = HashtableOnDisk.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
                      vshtod.put(entry, null); // value is null - better performance by skipping serialization and deserialization
                  } else {
                      cache_instance.put(id, new Long(-1));
                  }
              } else {
                  //
                  // Existing instance.  Get it.
                  //
                  result.bExist = EXIST;
                  vsinstance = vsinstid.longValue();
                  if (vsinstance != -1) {
                      vshtod = HashtableOnDisk.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
                  } else {
                      vsinstance = HashtableOnDisk.createInstance(filemgr, initial_valueset_size, hashtable_threshold);
                      vshtod = HashtableOnDisk.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
                      cache_instance.put(id, new Long(vsinstance));
                  }
                  if (valueSet != null) {
                      int length = vshtod.size();
                      if (length > 0) {
                          if ((valueSet.size() + length) > this.cod.delayOffloadEntriesLimit) {
                              vshtod.tempTableSize = calculateTableSize(id, vshtod.size() + valueSet.size());
                              entry = null;
                              do {
                                  entry = valueSet.getOne();
                                  if (entry != null) {
                                      vshtod.put(entry, null); // value is null - better performance by skipping serialization and deserialization
                                      valueSet.remove(entry);
                                  }
                              } while (entry != null);
                              result.bComplete = true;
                          } else {
                              ValueSet vs = new ValueSet(length);
                              ValueSetReadCallback vscr = new ValueSetReadCallback(vs, null);
                              vshtod.iterateKeys(vscr, 0, length);
                              valueSet.union(vs);
                              vshtod.clear();
                          }
                      }
                  } else {
                      if (entry != null) {
                          vshtod.put(entry, null); // value is null - better performance by skipping serialization and deserialization
                      }
                  }
              }
  
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "writeValueSetEntry()", ": cachename=" + this.cacheName + " id=" + id + " entry=" + entry + " size=" + ((vshtod != null) ? vshtod.size() : 0));
  
              if (vshtod != null) {
                  vshtod.close();
                  vshtod = null;
              }
          } 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) {
              result.diskException = ex;
              if (ex.getMessage().equals(DISK_CACHE_IN_GB_OVER_LIMIT_MSG)) {
                  result.returnCode = DISK_SIZE_OVER_LIMIT_EXCEPTION;
              } else {
                  this.diskCacheException = 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, "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.writeValueSetEntry", "1967", this);
              }
              try {
                  if (vshtod != null) {
                      vshtod.close();
                  }
              } catch (Exception ex) {
                  com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.HTODDynacache.writeValueSetEntry", "1974", this);
              }
              rwLock.writeLock().unlock();
          }
  
          return result;
      }