[Java] Pass large object by reference (#7595)

This commit is contained in:
Qing Wang
2020-03-13 18:38:03 +08:00
committed by GitHub
parent 552cfb37ea
commit 575c89cf47
@@ -2,8 +2,13 @@ package org.ray.runtime.task;
import java.util.ArrayList;
import java.util.List;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.id.ObjectId;
import org.ray.api.runtime.RayRuntime;
import org.ray.runtime.AbstractRayRuntime;
import org.ray.runtime.RayMultiWorkerNativeRuntime;
import org.ray.runtime.generated.Common.Language;
import org.ray.runtime.object.NativeRayObject;
import org.ray.runtime.object.ObjectSerializer;
@@ -38,7 +43,13 @@ public class ArgumentsBuilder {
} else {
value = ObjectSerializer.serialize(arg);
if (value.data.length > LARGEST_SIZE_PASS_BY_VALUE) {
// Do nothing since we are not support pass by reference in direct call.
RayRuntime runtime = Ray.internal();
if (runtime instanceof RayMultiWorkerNativeRuntime) {
runtime = ((RayMultiWorkerNativeRuntime) runtime).getCurrentRuntime();
}
id = ((AbstractRayRuntime) runtime).getObjectStore()
.putRaw(value);
value = null;
}
}
if (language == Language.PYTHON) {