< prev index next >
src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java
Print this page
8197531: Miscellaneous changes imported from jsr166 CVS 2018-04
Reviewed-by: martin, psandoz
@@ -1094,11 +1094,11 @@
int stat = 0, cap = ((a = array) == null) ? 0 : a.length;
int t = tail, i = t & (cap - 1), n = t + 1 - head;
if (cap > 0) {
boolean added;
if (n >= cap && cap < maxCapacity) // resize
- added = growAndoffer(item, a, t);
+ added = growAndOffer(item, a, t);
else if (n >= cap || unowned) // need volatile CAS
added = QA.compareAndSet(a, i, null, item);
else { // can use release mode
QA.setRelease(a, i, item);
added = true;
@@ -1113,11 +1113,11 @@
/**
* Tries to expand buffer and add item, returning true on
* success. Currently fails only if out of memory.
*/
- final boolean growAndoffer(T item, Object[] a, int t) {
+ final boolean growAndOffer(T item, Object[] a, int t) {
int cap = 0, newCap = 0;
Object[] newArray = null;
if (a != null && (cap = a.length) > 0 && (newCap = cap << 1) > 0) {
try {
newArray = new Object[newCap];
@@ -1464,11 +1464,11 @@
int.class);
DEMAND = l.findVarHandle(BufferedSubscription.class, "demand",
long.class);
QA = MethodHandles.arrayElementVarHandle(Object[].class);
} catch (ReflectiveOperationException e) {
- throw new Error(e);
+ throw new ExceptionInInitializerError(e);
}
// Reduce the risk of rare disastrous classloading in first call to
// LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
Class<?> ensureLoaded = LockSupport.class;
< prev index next >