public AbstractHollowHashIndex(HollowConsumer consumer, boolean isListenToDataRefreah, String queryType, String selectFieldPath, String... matchFieldPaths) { this.consumer = consumer; this.queryType = queryType; this.selectFieldPath = selectFieldPath; this.matchFieldPaths = matchFieldPaths; consumer.getRefreshLock().lock(); try { this.api = castAPI(consumer.getAPI()); this.idx = new HollowHashIndex(consumer.getStateEngine(), queryType, selectFieldPath, matchFieldPaths); this.refreshListener = new RefreshListener(); if (isListenToDataRefreah) { listenToDataRefresh(); } } catch(ClassCastException cce) { throw new ClassCastException("The HollowConsumer provided was not created with the PackageErgoTestAPI generated API class."); } finally { consumer.getRefreshLock().unlock(); } }