Class SimpleLinkRequest

java.lang.Object
jdk.dynalink.linker.support.SimpleLinkRequest
All Implemented Interfaces:
LinkRequest

public class SimpleLinkRequest extends Object implements LinkRequest
Default simple implementation of LinkRequest.
Since:
9
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleLinkRequest(CallSiteDescriptor callSiteDescriptor, boolean callSiteUnstable, Object... arguments)
    Creates a new link request.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 in DynamicLinkerFactory.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 Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • 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 either callSiteDescriptor or arguments is null.
  • Method Details

    • getArguments

      public Object[] 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 interface LinkRequest
      Returns:
      the arguments for the invocation being linked.
    • getReceiver

      public Object 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 for getArguments()[0] that also avoids the cloning of the arguments array.
      Specified by:
      getReceiver in interface LinkRequest
      Returns:
      the receiver object.
    • getCallSiteDescriptor

      public CallSiteDescriptor getCallSiteDescriptor()
      Description copied from interface: LinkRequest
      Returns the call site descriptor for the call site being linked.
      Specified by:
      getCallSiteDescriptor in interface LinkRequest
      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 in DynamicLinkerFactory.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 interface LinkRequest
      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 interface LinkRequest
      Parameters:
      newCallSiteDescriptor - the new call site descriptor
      newArguments - the new arguments
      Returns:
      a new request identical to this one, except with the call site descriptor and arguments replaced with the specified ones.