Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SearchEngineTaggerServlet.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SearchEngineTaggerServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SearchEngineTaggerServlet.java
index 8651c21aafc..35692aaa3e6 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SearchEngineTaggerServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SearchEngineTaggerServlet.java
@@ -22,6 +22,8 @@ import org.eclipse.osee.framework.manager.servlet.internal.ApplicationContextFac
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.search.IndexerCollector;
+import org.eclipse.osee.orcs.search.IndexerCollectorAdapter;
import org.eclipse.osee.orcs.search.QueryIndexer;
/**
@@ -51,8 +53,33 @@ public class SearchEngineTaggerServlet extends SecureOseeHttpServlet {
boolean waitForTags = Boolean.parseBoolean(request.getParameter("wait"));
QueryIndexer indexer = getQueryIndexer(request);
if (waitForTags) {
- Callable<?> callable = indexer.indexXmlStream(request.getInputStream());
+ IndexerCollector collector = new IndexerCollectorAdapter() {
+
+ int totalToProcess = 0;
+ int currentCount = 0;
+
+ @Override
+ public void onIndexTaskComplete(int indexerId, long waitTime, long processingTime) {
+ currentCount++;
+ if (currentCount >= totalToProcess) {
+ synchronized (this) {
+ notify();
+ }
+ }
+ }
+
+ @Override
+ public void onIndexTaskTotalToProcess(int totalQueries) {
+ totalToProcess = totalQueries;
+ }
+
+ };
+
+ Callable<?> callable = indexer.indexXmlStream(collector, request.getInputStream());
callable.call();
+ synchronized (collector) {
+ collector.wait();
+ }
} else {
byte[] bytes = Lib.inputStreamToBytes(request.getInputStream());
indexer.submitXmlStream(new ByteArrayInputStream(bytes));

Back to the top