Class AbstractRelinkableCallSite
java.lang.Object
java.lang.invoke.CallSite
java.lang.invoke.MutableCallSite
jdk.dynalink.support.AbstractRelinkableCallSite
- All Implemented Interfaces:
RelinkableCallSite
- Direct Known Subclasses:
ChainedCallSite, SimpleRelinkableCallSite
public abstract class AbstractRelinkableCallSite
extends MutableCallSite
implements RelinkableCallSite
A basic implementation of the
RelinkableCallSite as a
MutableCallSite. It carries a CallSiteDescriptor passed in
the constructor and provides the correct implementation of the
initialize(MethodHandle) method. Subclasses must provide
RelinkableCallSite.relink(GuardedInvocation, MethodHandle) and
RelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
methods.- Since:
- 9
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRelinkableCallSite(CallSiteDescriptor descriptor) Creates a new abstract relinkable call site. -
Method Summary
Modifier and TypeMethodDescriptionReturns the descriptor for this call site.voidinitialize(MethodHandle relinkAndInvoke) Invoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle.Methods declared in class MutableCallSite
dynamicInvoker, getTarget, setTarget, syncAllModifier and TypeMethodDescriptionfinal MethodHandleProduces a method handle equivalent to an invokedynamic instruction which has been linked to this call site.final MethodHandleReturns the target method of the call site, which behaves like a normal field of theMutableCallSite.voidsetTarget(MethodHandle newTarget) Updates the target method of this call site, as a normal variable.static voidsyncAll(MutableCallSite[] sites) Performs a synchronization operation on each call site in the given array, forcing all other threads to throw away any cached values previously loaded from the target of any of the call sites.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.Methods declared in interface RelinkableCallSite
relink, resetAndRelinkModifier and TypeMethodDescriptionvoidrelink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke) This method will be called by the dynamic linker every time the call site is relinked (but seeRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)for an exception).voidresetAndRelink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke) This method will be called by the dynamic linker every time the call site is relinked and the linker wishes the call site to throw away any prior linkage state (that is how it differs fromRelinkableCallSite.relink(GuardedInvocation, MethodHandle)).
-
Constructor Details
-
AbstractRelinkableCallSite
Creates a new abstract relinkable call site.- Parameters:
descriptor- the descriptor for this call site that will be returned fromgetDescriptor(). The call site'sCallSite.type()will be equal to descriptor'sCallSiteDescriptor.getMethodType().- Throws:
NullPointerException- ifdescriptoris null.
-
-
Method Details
-
getDescriptor
Description copied from interface:RelinkableCallSiteReturns the descriptor for this call site.- Specified by:
getDescriptorin interfaceRelinkableCallSite- Returns:
- the descriptor for this call site.
-
initialize
Description copied from interface:RelinkableCallSiteInvoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle. The call site implementation is supposed to set this method handle as its target usingCallSite.setTarget(MethodHandle). Relink-and-invoke is the initial method handle set byDynamicLinker.link(RelinkableCallSite)that will cause the call site to be relinked to an appropriate target on its first invocation based on its arguments, and that linked target will then be invoked (hence the name). This linking protocol effectively delays linking until the call site is invoked with actual arguments and thus ensures that linkers can make nuanced linking decisions based on those arguments and not just on the static method type of the call site.- Specified by:
initializein interfaceRelinkableCallSite- Parameters:
relinkAndInvoke- a relink-and-invoke method handle supplied by Dynalink.
-