Sequence result = var.getResult();
if(result == null) {
result = var.eval(contextSeq, dynEnv);
}
ReturnType rettype = request.getReturnType();
final ShippedVariable shiped;
if(ENV_NOWRAP_VARSHIP || !rettype.isRemoteSequnece()) {
shiped = new ShippedVariable(varname, new MarshalledSequence(result, dynEnv));
} else {
final RemoteSequenceProxy proxy = new RemoteSequenceProxy(result, request);
try {
UnicastRemoteObject.exportObject(proxy, 0, TimeoutSocketProdiver.createClientSocketFactory(), TimeoutSocketProdiver.createServerSocketFactory());
} catch (RemoteException e) {
throw new XQueryException("failed exporting variable: " + varname, e);
}
RemoteSequence remote = new RemoteSequence(proxy, result.getType());
shiped = new ShippedVariable(varname, remote);
}
return shiped;
}