Module java.base

Class MutableCallSite

    • Constructor Detail

      • MutableCallSite

        public MutableCallSite​(MethodHandle mutableTarget)
                        throws NullPointerException
        Create a MutableCallSite permanently set to the same type as the mutableTarget and using the mutableTarget as the initial target value.
        Parameters:
        mutableTarget - - the initial target of the CallSite
        Throws:
        NullPointerException - - if the mutableTarget is null.
      • MutableCallSite

        public MutableCallSite​(MethodType type)
                        throws NullPointerException
        Create a MutableCallSite with the MethodType type and an initial target that throws IllegalStateException.
        Parameters:
        type - - the permanent type of this CallSite.
        Throws:
        NullPointerException - - if the type is null.
    • Method Detail

      • syncAll

        public static void syncAll​(MutableCallSite[] sites)
                            throws NullPointerException
        Forces the current target MethodHandle of each of the MutableCallSites in the sites array to be seen by all threads. Loads of the target from any of the CallSites that has already begun will continue to use the old value.

        If any of the elements in the sites array is null, a NullPointerException will be raised. It is undefined whether any of the sites may have been synchronized.

        Note: it is valid for an implementation to use a volatile variable for the target value of MutableCallSite. In that case, the syncAll(MutableCallSite[]) call becomes a no-op.

        Parameters:
        sites - - the array of MutableCallSites to force to be synchronized.
        Throws:
        NullPointerException - - if sites or any of its elements are null.