if(LOG.isInfoEnabled()) {
LOG.info("Invoking remote query at [" + endpoint + "]:\n " + query);
}
XQEngineClient client = new XQEngineClient(endpoint);
QueryRequest request = new QueryRequest(query, RETURN_TYPE);
StaticContext statEnv = dynEnv.getStaticContext();
URI baseUri = statEnv.getBaseURI();
if(baseUri == null) {
baseUri = statEnv.getSystemBaseURI();
}
request.setBaseUri(baseUri);
prepareVariablesToShip(request, argv, dynEnv);
final Object result;
try {
result = client.execute(request);
} catch (RemoteException e) {
throw new XQueryException(e.getMessage(), e.getCause());
} finally {
try {
client.close();
} catch (RemoteException e) {
LOG.warn("shutdown failed for `" + endpoint + '\'', e);
}
}
Sequence resultSeq = (Sequence) result;