List of usage examples for java.rmi.server UnicastRemoteObject exportObject
public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
From source file:xbird.xquery.func.ext.RemoteEval.java
private static ShippedVariable wrapVariableToShip(QueryRequest request, VarRef ref, ValueSequence contextSeq, DynamicContext dynEnv) throws XQueryException { QualifiedName varname = ref.getName(); Variable var = ref.getValue(); Sequence result = var.getResult(); if (result == null) { result = var.eval(contextSeq, dynEnv); }/*from w w w . j a v a2 s .co m*/ 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; }