Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.
java.lang.invoke

Class VolatileCallSite


  • public class VolatileCallSite
    extends CallSite
    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.

    See Also:
    MutableCallSite
    • Constructor Detail

      • VolatileCallSite

        public VolatileCallSite(MethodType type)
        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.
        Parameters:
        type - the method type that this call site will have
        Throws:
        NullPointerException - if the proposed type is null
      • VolatileCallSite

        public VolatileCallSite(MethodHandle target)
        Creates a call site with a volatile binding to its target. The target is set to the given value.
        Parameters:
        target - the method handle that will be the initial target of the call site
        Throws:
        NullPointerException - if the proposed target is null
    • Method Detail

      • getTarget

        public final MethodHandle getTarget()
        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.

        Specified by:
        getTarget in class CallSite
        Returns:
        the linkage state of this call site, a method handle which can change over time
        See Also:
        setTarget(java.lang.invoke.MethodHandle)
      • setTarget

        public void setTarget(MethodHandle newTarget)
        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.

        Specified by:
        setTarget in class CallSite
        Parameters:
        newTarget - the new target
        Throws:
        NullPointerException - if the proposed new target is null
        WrongMethodTypeException - if the proposed new target has a method type that differs from the previous target
        See Also:
        getTarget()
      • dynamicInvoker

        public final MethodHandle dynamicInvoker()
        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)
         
        Specified by:
        dynamicInvoker in class CallSite
        Returns:
        a method handle which always invokes this call site's current target

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/lang/invoke/volatilecallsite.html/

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut