public long getClobOpenCountAndReset() { return clobOpenCount.getAndSet(0); }
public long getSkipSqlCountAndReset() { return skipSqlCount.getAndSet(0); }
public long getKeepAliveCheckCountAndReset() { return keepAliveCheckCount.getAndSet(0); }
public long getBlobOpenCountAndReset() { return blobOpenCount.getAndSet(0); }
public static long get(AtomicLong counter, boolean reset) { if (reset) { return counter.getAndSet(0); } else { return counter.get(); } }
@Override public void cancel() { if (requested.getAndSet(Long.MIN_VALUE) != Long.MIN_VALUE) { parent.remove(this); } } }
/** * Atomically sets the new Subscription on the field and requests any accumulated amount * from the requested field. * @param field the target field for the new Subscription * @param requested the current requested amount * @param s the new Subscription, not null (verified) * @return true if the Subscription was set the first time */ public static boolean deferredSetOnce(AtomicReference<Subscription> field, AtomicLong requested, Subscription s) { if (SubscriptionHelper.setOnce(field, s)) { long r = requested.getAndSet(0L); if (r != 0L) { s.request(r); } return true; } return false; }
@Override public final void onSubscribe(Subscription s) { if (EndConsumerHelper.setOnce(this.upstream, s, getClass())) { long r = missedRequested.getAndSet(0L); if (r != 0L) { s.request(r); } onStart(); } }
protected void maybeRecordEndOfDrySpell() { if (oomTimeSensor != null) { long startOfDrySpell = startOfNoMemPeriod.getAndSet(0); if (startOfDrySpell != 0) { //how long were we refusing allocation requests for oomTimeSensor.record((System.nanoTime() - startOfDrySpell) / 1000000.0); //fractional (double) millis } } } }
@Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this.upstream, s)) { long r = requested.getAndSet(0L); if (r != 0L) { requestUpstream(r, s); } } }
@Override public void onComplete() { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onComplete(); task.dispose(); } }
@Override public void onComplete() { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onComplete(); worker.dispose(); } }
@Override public void onComplete() { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onComplete(); task.dispose(); } }
@Override public void onComplete() { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onComplete(); worker.dispose(); } }
@Override public void request(final long n) { if (SubscriptionHelper.validate(n)) { Subscription s = this.upstream.get(); if (s != null) { requestUpstream(n, s); } else { BackpressureHelper.add(requested, n); s = this.upstream.get(); if (s != null) { long r = requested.getAndSet(0L); if (r != 0L) { requestUpstream(r, s); } } } } }
@Override public void onError(Throwable t) { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onError(t); task.dispose(); } else { RxJavaPlugins.onError(t); } }
@Override public void onError(Throwable t) { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onError(t); worker.dispose(); } else { RxJavaPlugins.onError(t); } }
@Override public void onError(Throwable t) { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onError(t); task.dispose(); } else { RxJavaPlugins.onError(t); } }
@Override public void onError(Throwable t) { if (index.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) { task.dispose(); downstream.onError(t); worker.dispose(); } else { RxJavaPlugins.onError(t); } }
public void setCurrentTimeMs(long newMs) { long oldMs = timeMs.getAndSet(newMs); // does not allow to set to an older timestamp if (oldMs > newMs) throw new IllegalArgumentException("Setting the time to " + newMs + " while current time " + oldMs + " is newer; this is not allowed"); highResTimeNs.set(TimeUnit.MILLISECONDS.toNanos(newMs)); tick(); }