req.setNewStringVariable("TYPE",
TransformOptions.COLLECTION_TYPE);
req.setNewStringVariable("PATTERN", "[,\\s]+");
req.setOptions(requestOptions);
ResultSequence res = session.submitRequest(req);
// like a Pascal string, the first item will be the count
total = ((XSInteger) res.next().getItem()).asPrimitiveInt();
logger.info("expecting total " + total);
if (0 == total) {
logger.info("nothing to process");
stop();
return;
}
uriQueue.setExpected(total);
uriQueue.start();
monitor.setTaskCount(total);
monitorThread.start();
// this may return millions of items:
// try to be memory-efficient
count = 0;
String uri;
// check pool occasionally, for fast-fail
while (res.hasNext() && null != pool) {
uri = res.next().asString();
uriQueue.add(uri);
if (null == pool) {
break;
}
count++;