Liking cljdoc? Tell your friends :D

jdk.lang.invoke.VolatileCallSite

A VolatileCallSite is a CallSite whose target acts like a volatile variable. An invokedynamic instruction linked to a VolatileCallSite sees updates to its call site target immediately, even if the update occurs in another thread. There may be a performance penalty for such tight coupling between threads.

Unlike MutableCallSite, there is no syncAll operation on volatile call sites, since every write to a volatile variable is implicitly synchronized with reader threads.

In other respects, a VolatileCallSite is interchangeable with MutableCallSite.

A VolatileCallSite is a CallSite whose target acts like a volatile variable.
An invokedynamic instruction linked to a VolatileCallSite sees updates
to its call site target immediately, even if the update occurs in another thread.
There may be a performance penalty for such tight coupling between threads.

Unlike MutableCallSite, there is no
syncAll operation on volatile
call sites, since every write to a volatile variable is implicitly
synchronized with reader threads.

In other respects, a VolatileCallSite is interchangeable
with MutableCallSite.
raw docstring

->volatile-call-siteclj

(->volatile-call-site type)

Constructor.

Creates a call site with a volatile binding to its target. The initial target is set to a method handle of the given type which will throw an IllegalStateException if called.

type - the method type that this call site will have - java.lang.invoke.MethodType

throws: java.lang.NullPointerException - if the proposed type is null

Constructor.

Creates a call site with a volatile binding to its target.
 The initial target is set to a method handle
 of the given type which will throw an IllegalStateException if called.

type - the method type that this call site will have - `java.lang.invoke.MethodType`

throws: java.lang.NullPointerException - if the proposed type is null
raw docstring

dynamic-invokerclj

(dynamic-invoker this)

Produces a method handle equivalent to an invokedynamic instruction which has been linked to this call site.

This method is equivalent to the following code:

MethodHandle getTarget, invoker, result; getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class)); invoker = MethodHandles.exactInvoker(this.type()); result = MethodHandles.foldArguments(invoker, getTarget)

returns: a method handle which always invokes this call site's current target - java.lang.invoke.MethodHandle

Produces a method handle equivalent to an invokedynamic instruction
 which has been linked to this call site.

 This method is equivalent to the following code:


 MethodHandle getTarget, invoker, result;
 getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class));
 invoker = MethodHandles.exactInvoker(this.type());
 result = MethodHandles.foldArguments(invoker, getTarget)

returns: a method handle which always invokes this call site's current target - `java.lang.invoke.MethodHandle`
raw docstring

get-targetclj

(get-target this)

Returns the target method of the call site, which behaves like a volatile field of the VolatileCallSite.

The interactions of getTarget with memory are the same as of a read from a volatile field.

In particular, the current thread is required to issue a fresh read of the target from memory, and must not fail to see a recent update to the target by another thread.

returns: the linkage state of this call site, a method handle which can change over time - java.lang.invoke.MethodHandle

Returns the target method of the call site, which behaves
 like a volatile field of the VolatileCallSite.

 The interactions of getTarget with memory are the same
 as of a read from a volatile field.

 In particular, the current thread is required to issue a fresh
 read of the target from memory, and must not fail to see
 a recent update to the target by another thread.

returns: the linkage state of this call site, a method handle which can change over time - `java.lang.invoke.MethodHandle`
raw docstring

set-targetclj

(set-target this new-target)

Updates the target method of this call site, as a volatile variable. The type of the new target must agree with the type of the old target.

The interactions with memory are the same as of a write to a volatile field. In particular, any threads is guaranteed to see the updated target the next time it calls getTarget.

new-target - the new target - java.lang.invoke.MethodHandle

throws: java.lang.NullPointerException - if the proposed new target is null

Updates the target method of this call site, as a volatile variable.
 The type of the new target must agree with the type of the old target.

 The interactions with memory are the same as of a write to a volatile field.
 In particular, any threads is guaranteed to see the updated target
 the next time it calls getTarget.

new-target - the new target - `java.lang.invoke.MethodHandle`

throws: java.lang.NullPointerException - if the proposed new target is null
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close