Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleStore ¶
type HandleStore struct {
// contains filtered or unexported fields
}
HandleStore maps opaque int64 handles to JNI global references, allowing Java objects to be referenced across gRPC RPC boundaries.
When a server-side RPC returns a JNI object, it stores the object as a global reference in the HandleStore and returns the int64 handle to the client. When the client later passes that handle in another RPC, the server retrieves the global reference from the HandleStore.
HandleStore is safe for concurrent use.
func (*HandleStore) Get ¶
func (s *HandleStore) Get(handle int64) *jni.Object
Get retrieves the JNI global reference for the given handle. Returns nil if the handle is invalid or 0 (the zero handle represents nil).
type Server ¶
type Server struct {
pb.UnimplementedHandleStoreServiceServer
VM *jni.VM
Handles *HandleStore
}
Server implements the HandleStoreService gRPC server.
func (*Server) ReleaseHandle ¶
func (s *Server) ReleaseHandle(_ context.Context, req *pb.ReleaseHandleRequest) (*pb.ReleaseHandleResponse, error)
ReleaseHandle releases a previously-stored JNI global reference.