Liking cljdoc? Tell your friends :D

clj-grpc.impl.netty

Every Netty and grpc-netty construction in the library, quarantined.

This namespace exists for GraalVM native-image. Clojure initializes the classes a compiled namespace references when the namespace loads, and under --initialize-at-build-time namespace loading happens during image build — where Netty's own native-image metadata forbids initializing its native-library and Unsafe-touching classes, correctly. The API namespaces (transport, server, client) therefore reference this one only through requiring-resolve at first construction, never :require, and the library's META-INF/native-image config marks the clj_grpc.impl package initialize-at-run-time and registers this namespace's init class for the runtime require. Net effect: Netty initializes at first server/channel construction — run time in both worlds — and requiring the API namespaces stays Netty-free. lazy_netty_test pins both halves of that contract.

Class names are written fully qualified rather than :import'ed on purpose: imports are interned by the namespace loader through Class.forName, and at run time in a native image every such name would need a reflection entry. Fully-qualified interop compiles to direct method references; only classes used as values (the channel classes below) go through Class.forName, and exactly those are registered in reflect-config.json.

Every Netty and grpc-netty construction in the library, quarantined.

This namespace exists for GraalVM native-image. Clojure initializes the
classes a compiled namespace references when the namespace loads, and under
--initialize-at-build-time namespace loading happens during image build —
where Netty's own native-image metadata forbids initializing its
native-library and Unsafe-touching classes, correctly. The API namespaces
(transport, server, client) therefore reference this one only through
requiring-resolve at first construction, never :require, and the library's
META-INF/native-image config marks the clj_grpc.impl package
initialize-at-run-time and registers this namespace's init class for the
runtime require. Net effect: Netty initializes at first server/channel
construction — run time in both worlds — and requiring the API namespaces
stays Netty-free. lazy_netty_test pins both halves of that contract.

Class names are written fully qualified rather than :import'ed on purpose:
imports are interned by the namespace loader through Class.forName, and at
run time in a native image every such name would need a reflection entry.
Fully-qualified interop compiles to direct method references; only classes
used as *values* (the channel classes below) go through Class.forName, and
exactly those are registered in reflect-config.json.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close