@Override public void execute(final FunctionContext context) { final Set<LuceneIndexDetails> indexDetailsSet = new HashSet<>(); final Cache cache = context.getCache(); final String serverName = cache.getDistributedSystem().getDistributedMember().getName(); LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache); for (LuceneIndexCreationProfile profile : service.getAllDefinedIndexes()) { indexDetailsSet .add(new LuceneIndexDetails(profile, serverName, LuceneIndexStatus.NOT_INITIALIZED)); } for (LuceneIndex index : service.getAllIndexes()) { LuceneIndexStatus initialized; if (index.isIndexingInProgress()) { initialized = LuceneIndexStatus.INDEXING_IN_PROGRESS; } else { initialized = LuceneIndexStatus.INITIALIZED; } indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index, serverName, initialized)); } context.getResultSender().lastResult(indexDetailsSet); } }
@Override public void execute(FunctionContext<Object> context) { RegionFunctionContext ctx = (RegionFunctionContext) context; ResultSender<Boolean> resultSender = ctx.getResultSender(); Region region = ctx.getDataSet(); Cache cache = region.getCache(); String indexName = (String) ctx.getArguments(); if (indexName == null) { throw new IllegalArgumentException("Missing index name"); } LuceneService luceneService = LuceneServiceProvider.get(cache); LuceneIndex luceneIndex = luceneService.getIndex(indexName, region.getFullPath()); if (luceneIndex == null) { resultSender.lastResult(false); } else { resultSender.lastResult(luceneIndex.isIndexingInProgress()); } }