Class SimpleLinkRequest
java.lang.Object
jdk.dynalink.linker.support.SimpleLinkRequest
- All Implemented Interfaces:
LinkRequest
Default simple implementation of
LinkRequest
.- Since:
- 9
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleLinkRequest
(CallSiteDescriptor callSiteDescriptor, boolean callSiteUnstable, Object... arguments) Creates a new link request. -
Method Summary
Modifier and TypeMethodDescriptionObject[]
Returns the arguments for the invocation being linked.Returns the call site descriptor for the call site being linked.Returns the first argument for the invocation being linked; this is typically the receiver object.boolean
Returns true if the call site is considered unstable, that is, it has been relinked more times than was specified inDynamicLinkerFactory.setUnstableRelinkThreshold(int)
.replaceArguments
(CallSiteDescriptor newCallSiteDescriptor, Object... newArguments) Returns a request identical to this one with call site descriptor and arguments replaced with the ones specified.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
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
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(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 void
wait
(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.
-
Constructor Details
-
SimpleLinkRequest
public SimpleLinkRequest(CallSiteDescriptor callSiteDescriptor, boolean callSiteUnstable, Object... arguments) Creates a new link request.- Parameters:
callSiteDescriptor
- the descriptor for the call site being linked. Must not be null.callSiteUnstable
- true if the call site being linked is considered unstable.arguments
- the arguments for the invocation. Must not be null.- Throws:
NullPointerException
- if eithercallSiteDescriptor
orarguments
is null.
-
-
Method Details
-
getArguments
Description copied from interface:LinkRequest
Returns the arguments for the invocation being linked. The returned array must be a clone; modifications to it must not affect the arguments in this request.- Specified by:
getArguments
in interfaceLinkRequest
- Returns:
- the arguments for the invocation being linked.
-
getReceiver
Description copied from interface:LinkRequest
Returns the first argument for the invocation being linked; this is typically the receiver object. This is a shorthand forgetArguments()[0]
that also avoids the cloning of the arguments array.- Specified by:
getReceiver
in interfaceLinkRequest
- Returns:
- the receiver object.
-
getCallSiteDescriptor
Description copied from interface:LinkRequest
Returns the call site descriptor for the call site being linked.- Specified by:
getCallSiteDescriptor
in interfaceLinkRequest
- Returns:
- the call site descriptor for the call site being linked.
-
isCallSiteUnstable
public boolean isCallSiteUnstable()Description copied from interface:LinkRequest
Returns true if the call site is considered unstable, that is, it has been relinked more times than was specified inDynamicLinkerFactory.setUnstableRelinkThreshold(int)
. Linkers should use this as a hint to prefer producing linkage that is more stable (its guard fails less frequently), even if that assumption causes a less effective version of an operation to be linked. This is just a hint, though, and linkers are allowed to ignore this property.- Specified by:
isCallSiteUnstable
in interfaceLinkRequest
- Returns:
- true if the call site is considered unstable.
-
replaceArguments
public LinkRequest replaceArguments(CallSiteDescriptor newCallSiteDescriptor, Object... newArguments) Description copied from interface:LinkRequest
Returns a request identical to this one with call site descriptor and arguments replaced with the ones specified.- Specified by:
replaceArguments
in interfaceLinkRequest
- Parameters:
newCallSiteDescriptor
- the new call site descriptornewArguments
- the new arguments- Returns:
- a new request identical to this one, except with the call site descriptor and arguments replaced with the specified ones.
-