static boolean weakCompareAndSet(AtomicInteger ai, int i, int j) { if (ai instanceof BTraceAtomicInteger) { return ai.weakCompareAndSet(i, j); } else { throw new IllegalArgumentException(); } }
return bits.weakCompareAndSet(floatToIntBits(expect), floatToIntBits(update));
/** * Atomically sets the value to the given updated value * if the current value {@code ==} the expected value. * * <p>May <a href="package-summary.html#Spurious">fail spuriously</a> * and does not provide ordering guarantees, so is only rarely an * appropriate alternative to {@code compareAndSet}. * * @param ai AtomicInteger whose value is weakly compared and set. * @param expect the expected value * @param update the new value * @return true if successful. */ public static boolean weakCompareAndSet(AtomicInteger ai, int expect, int update) { return ai.weakCompareAndSet(expect, update); }
public final boolean weakCompareAndSet(int expect, int update) { if (update < 0) { throw new IllegalArgumentException("update value " + update + " < 0"); } return i.weakCompareAndSet(expect, update); }
public final boolean weakCompareAndSet(int expect, int update) { if (update < 0) { throw new IllegalArgumentException("update value " + update + " < 0"); } return i.weakCompareAndSet(expect, update); }
public final boolean weakCompareAndSet(int expect, int update) { if (update < 0) { throw new IllegalArgumentException("update value " + update + " < 0"); } return i.weakCompareAndSet(expect, update); }
public final boolean weakCompareAndSet(int expect, int update) { if (update < 0) { throw new IllegalArgumentException("update value " + update + " < 0"); } return i.weakCompareAndSet(expect, update); }
public final boolean weakCompareAndSet(int expect, int update) { if (update < 0) { throw new IllegalArgumentException("update value " + update + " < 0"); } return i.weakCompareAndSet(expect, update); }
public void reset() { if (!calledCount.weakCompareAndSet(1, 0)) { throw new IllegalStateException(String.format("Expected <%d> upgrade calls for %s, but was called <%d> times", 1, this.getClass().getName(), calledCount.get())); } }
public static Address loadbalanceUniformity(String serviceName) { ServiceParams serviceParams = ServiceParams.getService(serviceName); int total = serviceParams.getAddresses().size(); count.weakCompareAndSet(Integer.MAX_VALUE,0); return serviceParams.getAddresses().get(count.getAndIncrement()%total); }
/** * Atomically sets this float to the specified updated value * if the current value equals the specified expected value. * <p> * My fail spuriously, and does not provide ordering guarantees, so * is only rarely useful. * @param expect the expected value. * @param update the updated value. * @return true, if successfully set; false, if the current * value was not equal to the expected value. */ public final boolean weakCompareAndSet(float expect, float update) { return _ai.weakCompareAndSet(i(expect),i(update)); }