Copying in Java_java_net_SocketOutputStream_socketWrite0
Alan Bateman
Alan.Bateman at oracle.com
Wed Apr 1 13:26:12 UTC 2015
On 01/04/2015 13:37, Robert Stupp wrote:
> :
>
> Just want to understand ”the magic” here (sure, NIO is the way to go)…
>
> Where’s the ”trick” to avoid GC pauses for socketWrite0 and similar
> methods?
> Is it something hard coded like ”if JNI method is from jdk source tree”?
>
> AFAIK there’s always a safe point w/ JNI calls. socketWrite0 is simply
> declared as ”JNIEXPORT void JNICALL
> Java_java_net_SocketOutputStream_socketWrite0” and I could not find
> anything in the source tree declaring ”socketWrite0” or
> ”SocketOutputStream” to be special (in jdk8u tree).
There isn't anything special here. In HotSpot then threads in JNI
methods are considered to be a safepoint and so continue to execute even
if the VM is brought to a safepoint, say for a stop-the-world GC. If the
thread attempts to call back into VM or return from the native method
then it will block until the safepoint completes. So nothing special for
socketWrite0.
-Alan.
More information about the core-libs-dev
mailing list