ForwardDictionaryCache extends AbstractDictionaryCache<K, V> { @Override public List<Dictionary> getAll( List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers) throws CarbonUtilException { boolean exceptionOccurredInDictionaryLoading = false; String exceptionMessage = ""; List<Dictionary> forwardDictionaryObjectList = new ArrayList<Dictionary>(dictionaryColumnUniqueIdentifiers.size()); List<Future<Dictionary>> taskSubmitList = new ArrayList<>(dictionaryColumnUniqueIdentifiers.size()); ExecutorService executorService = Executors.newFixedThreadPool(thread_pool_size); for (final DictionaryColumnUniqueIdentifier uniqueIdent : dictionaryColumnUniqueIdentifiers) { taskSubmitList.add(executorService.submit(new Callable<Dictionary>() { @Override public Dictionary call() throws CarbonUtilException { Dictionary dictionary = getDictionary(uniqueIdent); return dictionary; } })); } try { executorService.shutdown(); executorService.awaitTermination(2, TimeUnit.HOURS); } catch (InterruptedException e) { LOGGER.error("Error loading the dictionary: " + e.getMessage()); } for (int i = 0; i < taskSubmitList.size(); i++) { try { Dictionary columnDictionary = taskSubmitList.get(i).get(); forwardDictionaryObjectList.add(columnDictionary); } catch (Throwable e) { exceptionOccurredInDictionaryLoading = true; exceptionMessage = e.getMessage(); } } if (exceptionOccurredInDictionaryLoading) { clearDictionary(forwardDictionaryObjectList); LOGGER.error(exceptionMessage); throw new CarbonUtilException(exceptionMessage); } return forwardDictionaryObjectList; } ForwardDictionaryCache(String carbonStorePath, CarbonLRUCache carbonLRUCache); @Override Dictionary get(DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier); @Override List<Dictionary> getAll(
      List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers); @Override Dictionary getIfPresent(
      DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier); @Override void invalidate(
      DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier);  }
@Test public void getAll() throws Exception { deleteStorePath(); String columnIdentifier = columnIdentifiers[0]; prepareWriterAndWriteData(dataSet1, columnIdentifier); writeSortIndexFile(dataSet1, columnIdentifier); List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers = new ArrayList<>(3); DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier = createDictionaryColumnUniqueIdentifier(columnIdentifier); dictionaryColumnUniqueIdentifiers.add(dictionaryColumnUniqueIdentifier); columnIdentifier = columnIdentifiers[1]; prepareWriterAndWriteData(dataSet1, columnIdentifier); writeSortIndexFile(dataSet1, columnIdentifier); dictionaryColumnUniqueIdentifier = createDictionaryColumnUniqueIdentifier(columnIdentifier); dictionaryColumnUniqueIdentifiers.add(dictionaryColumnUniqueIdentifier); List<Dictionary> forwardDictionaryList = (List<Dictionary>) forwardDictionaryCache.getAll(dictionaryColumnUniqueIdentifiers); for (Dictionary forwardDictionary : forwardDictionaryList) { assertTrue(null != forwardDictionary); compareSurrogateKeyData(dataSet1, forwardDictionary); forwardDictionary.clear(); } removeKeyFromLRUCache(forwardDictionaryCache); }