Result readValueSet(int type, Object id, boolean delete) {
        final String methodName = "readValueSet()";
        Result result = getFromResultPool();
        ValueSet answer = new ValueSet(4);
        HashtableOnDisk cache_instance = null;
        HashtableOnDisk vshtod = null;
        if (delete) {

            try {
                rwLock.writeLock().lock();
                //if (this.testException) {
                //    throw new FileManagerException("*** Generate filemanager exception");
                //}
                if (type == DEP_ID_DATA) {
                    cache_instance = dependency_cache;
                } else {
                    cache_instance = template_cache;
                }
                Long vsinstid = (Long) cache_instance.get(id);
                if (vsinstid != null) {
                    long vsinstance = vsinstid.longValue();
                    FileManager filemgr = cache_instance.getFileManager();
                    if (vsinstance != -1) {
                        vshtod = cache_instance.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
                        int length = vshtod.size();
                        if (length > 0) {
                            answer = new ValueSet(length);
                            ValueSetReadCallback vscr = new ValueSetReadCallback(answer, null);
                            vshtod.iterateKeys(vscr, 0, length);

                            vshtod.clear(); // remove (deallocate) everything in the htod
                            vshtod.close(); // close it
                            vshtod = null;
                        }
                        HashtableOnDisk.destroyInstance(filemgr, vsinstance); // remove instance (deallocate header on disk)
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "readValueSet()", " id=" + id + " length=" + length + " valueSetSize=" + answer.size());
                    }
                    cache_instance.remove(id); // remove ref to sub-htod from dep/template htod
                }
            } 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, "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.readValueSet", "1432", this);
                }
                try {
                    if (vshtod != null) {
                        vshtod.close();
                    }
                } catch (Exception ex) {
                    com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.HTODDynacache.readValueSet", "1439", this);
                }
                rwLock.writeLock().unlock();
            }

        } else {
            try {
                rwLock.readLock().lock();
                if (type == DEP_ID_DATA) {
                    cache_instance = dependency_cache;
                } else {
                    cache_instance = template_cache;
                }
                Long vsinstid = (Long) cache_instance.get(id);
                if (vsinstid != null) {
                    long vsinstance = vsinstid.longValue();
                    FileManager filemgr = cache_instance.getFileManager();
                    if (vsinstance != -1) {
                        vshtod = cache_instance.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
                        int length = vshtod.size();
                        if (length > 0) {
                            answer = new ValueSet(length);
                            ValueSetReadCallback vscr = new ValueSetReadCallback(answer, null);
                            vshtod.iterateKeys(vscr, 0, length);
                            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) {
                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, "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.readValueSet", "1488", this);
                }
                try {
                    if (vshtod != null) {
                        vshtod.close();
                    }
                } catch (Exception ex) {
                    com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.HTODDynacache.readValueSet", "1495", this);
                }
                rwLock.readLock().unlock();
            }
        }
        result.data = answer;
        return result;
    }
Result readValueSet ( int type , Object id , boolean delete ) { final String methodName = "readValueSet()" ; Result result = getFromResultPool ( ) ; ValueSet answer = new ValueSet ( 4 ) ; HashtableOnDisk cache_instance = null ; HashtableOnDisk vshtod = null ; if ( delete ) { try { rwLock . writeLock ( ) . lock ( ) ; if ( type == DEP_ID_DATA ) { cache_instance = dependency_cache ; } else { cache_instance = template_cache ; } Long vsinstid = ( Long ) cache_instance . get ( id ) ; if ( vsinstid != null ) { long vsinstance = vsinstid . longValue ( ) ; FileManager filemgr = cache_instance . getFileManager ( ) ; if ( vsinstance != - 1 ) { vshtod = cache_instance . getInstance ( filemgr , valueset_rehash , vsinstance , ! HashtableOnDisk . HAS_CACHE_VALUE , this ) ; int length = vshtod . size ( ) ; if ( length > 0 ) { answer = new ValueSet ( length ) ; ValueSetReadCallback vscr = new ValueSetReadCallback ( answer , null ) ; vshtod . iterateKeys ( vscr , 0 , length ) ; vshtod . clear ( ) ; vshtod . close ( ) ; vshtod = null ; } HashtableOnDisk . destroyInstance ( filemgr , vsinstance ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "readValueSet()" , " id=" + id + " length=" + length + " valueSetSize=" + answer . size ( ) ) ; } cache_instance . remove ( id ) ; } } 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 , "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.readValueSet" , "1432" , this ) ; } try { if ( vshtod != null ) { vshtod . close ( ) ; } } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.HTODDynacache.readValueSet" , "1439" , this ) ; } rwLock . writeLock ( ) . unlock ( ) ; } } else { try { rwLock . readLock ( ) . lock ( ) ; if ( type == DEP_ID_DATA ) { cache_instance = dependency_cache ; } else { cache_instance = template_cache ; } Long vsinstid = ( Long ) cache_instance . get ( id ) ; if ( vsinstid != null ) { long vsinstance = vsinstid . longValue ( ) ; FileManager filemgr = cache_instance . getFileManager ( ) ; if ( vsinstance != - 1 ) { vshtod = cache_instance . getInstance ( filemgr , valueset_rehash , vsinstance , ! HashtableOnDisk . HAS_CACHE_VALUE , this ) ; int length = vshtod . size ( ) ; if ( length > 0 ) { answer = new ValueSet ( length ) ; ValueSetReadCallback vscr = new ValueSetReadCallback ( answer , null ) ; vshtod . iterateKeys ( vscr , 0 , length ) ; 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 ) { 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 , "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.readValueSet" , "1488" , this ) ; } try { if ( vshtod != null ) { vshtod . close ( ) ; } } catch ( Exception ex ) { com . ibm . ws . ffdc . FFDCFilter . processException ( ex , "com.ibm.ws.cache.HTODDynacache.readValueSet" , "1495" , this ) ; } rwLock . readLock ( ) . unlock ( ) ; } } result . data = answer ; return result ; }
***********************************************************************
readValueSet()
These are common for both dependencies and templates so we parameterize
the basic operations by HTOD instance.
***********************************************************************