2362N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable. 0N/A * An {@code invokedynamic} instruction linked to a {@code VolatileCallSite} sees updates 0N/A * to its call site target immediately, even if the update occurs in another thread. 0N/A * There may be a performance penalty for such tight coupling between threads. 0N/A * Unlike {@code MutableCallSite}, there is no 0N/A * {@linkplain MutableCallSite#syncAll syncAll operation} on volatile 0N/A * call sites, since every write to a volatile variable is implicitly 0N/A * synchronized with reader threads. 0N/A * In other respects, a {@code VolatileCallSite} is interchangeable 0N/A * with {@code MutableCallSite}. 0N/A * @see MutableCallSite 0N/A * @author John Rose, JSR 292 EG 0N/A * Creates a call site with a volatile binding to its target. 0N/A * The initial target is set to a method handle 0N/A * of the given type which will throw an {@code IllegalStateException} if called. 0N/A * @param type the method type that this call site will have 0N/A * @throws NullPointerException if the proposed type is null 0N/A * Creates a call site with a volatile binding to its target. 0N/A * The target is set to the given value. 0N/A * @param target the method handle that will be the initial target of the call site 0N/A * @throws NullPointerException if the proposed target is null 0N/A * Returns the target method of the call site, which behaves 0N/A * like a {@code volatile} field of the {@code VolatileCallSite}. 0N/A * The interactions of {@code getTarget} with memory are the same 0N/A * as of a read from a {@code volatile} field. 0N/A * In particular, the current thread is required to issue a fresh 0N/A * read of the target from memory, and must not fail to see 0N/A * a recent update to the target by another thread. 0N/A * @return the linkage state of this call site, a method handle which can change over time 0N/A * Updates the target method of this call site, as a volatile variable. 0N/A * The type of the new target must agree with the type of the old target. 0N/A * The interactions with memory are the same as of a write to a volatile field. 0N/A * In particular, any threads is guaranteed to see the updated target 0N/A * the next time it calls {@code getTarget}. 0N/A * @param newTarget the new target 0N/A * @throws NullPointerException if the proposed new target is null 0N/A * @throws WrongMethodTypeException if the proposed new target 0N/A * has a method type that differs from the previous target