public void removeAndAdd ( final String toRemove , final String toAdd ) { writeLock . lock ( ) ; try { FileListCacheValue fileList = getFileList ( ) ; boolean done = fileList . addAndRemove ( toAdd , toRemove ) ; if ( done ) { updateFileList ( fileList ) ; if ( trace ) { log . trace ( "Updated file listing: added " + toAdd + " and removed " + toRemove ) ; } } } finally { writeLock . unlock ( ) ; } }
Optimized implementation to perform both a remove and an add