forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java] Allow actor handle to be serialized without forking (ray-proje…
- Loading branch information
1 parent
03fe760
commit 692fdc6
Showing
5 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ public interface RayActor<T> { | |
* @return The id of this actor handle. | ||
*/ | ||
UniqueId getHandleId(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
java/runtime/src/main/java/org/ray/runtime/util/RayActorSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.ray.runtime.util; | ||
|
||
import java.io.IOException; | ||
import org.nustaq.serialization.FSTBasicObjectSerializer; | ||
import org.nustaq.serialization.FSTClazzInfo; | ||
import org.nustaq.serialization.FSTClazzInfo.FSTFieldInfo; | ||
import org.nustaq.serialization.FSTObjectInput; | ||
import org.nustaq.serialization.FSTObjectOutput; | ||
import org.ray.runtime.RayActorImpl; | ||
|
||
public class RayActorSerializer extends FSTBasicObjectSerializer { | ||
|
||
@Override | ||
public void writeObject(FSTObjectOutput out, Object toWrite, FSTClazzInfo clzInfo, | ||
FSTClazzInfo.FSTFieldInfo referencedBy, int streamPosition) throws IOException { | ||
((RayActorImpl) toWrite).fork().writeExternal(out); | ||
} | ||
|
||
@Override | ||
public void readObject(FSTObjectInput in, Object toRead, FSTClazzInfo clzInfo, | ||
FSTFieldInfo referencedBy) throws Exception { | ||
super.readObject(in, toRead, clzInfo, referencedBy); | ||
((RayActorImpl) toRead).readExternal(in); | ||
} | ||
} |
8 changes: 6 additions & 2 deletions
8
java/runtime/src/main/java/org/ray/runtime/util/Serializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters