static int getCurrentCounterValue() { return COUNTER.intValue(); }
/** * @return Number of empty data pages in free list. */ public int emptyDataPages() { return bucketsSize[REUSE_BUCKET].intValue(); }
@Override public int writes() { return writeCounter.intValue(); }
/** * Get the total number of events that have been handled by this listener. * @return the total number of events */ public int total() { return counter.intValue(); }
private void requestN(long n) { // emitting with limit/offset long count = n; while (count > 0) { try (CloseableIterator<T> iterator = result.iterator(emitted.intValue(), (int) n)) { long i = 0; while (!canceled.get() && iterator.hasNext()) { if (i++ < count) { subscriber.onNext(iterator.next()); } else { break; } } emitted.addAndGet(i); // no more items if (!canceled.get() && i < count) { subscriber.onComplete(); break; } count = requested.addAndGet(-count); } } }
@Test public void multipleDelaysUsingDefaultScheduler() throws InterruptedException { AtomicLong counter = new AtomicLong(); Mono.delay(Duration.ofMillis(50)).subscribe(v -> counter.incrementAndGet()); Mono.delay(Duration.ofMillis(100)).subscribe(v -> counter.incrementAndGet()); Mono.delay(Duration.ofMillis(150)).subscribe(v -> counter.incrementAndGet()); Mono.delay(Duration.ofMillis(200)).subscribe(v -> counter.incrementAndGet()); assertThat(counter.intValue()).isEqualTo(0); Thread.sleep(110); assertThat(counter.intValue()).isEqualTo(2); Thread.sleep(110); assertThat(counter.intValue()).isEqualTo(4); }
&& workspaceConfiguration.getCyclesBeforeInitialization() == cyclesCount.intValue()) || (workspaceConfiguration.getPolicyLearning() == LearningPolicy.FIRST_LOOP && currentSize.get() == 0)) {
/** * Add a number of new Kafka broker to the cluster. The broker IDs will be generated. * * @param count the number of new brokers to add * @return this instance to allow chaining methods; never null * @throws IllegalStateException if the cluster is running */ public KafkaCluster addBrokers(int count) { if (running) throw new IllegalStateException("Unable to add a broker when the cluster is already running"); AtomicLong added = new AtomicLong(); while (added.intValue() < count) { kafkaServers.computeIfAbsent(Integer.valueOf(added.intValue() + 1), id -> { added.incrementAndGet(); KafkaServer server = new KafkaServer(zkServer::getConnection, id); if (dataDir != null) server.setStateDirectory(dataDir); if (kafkaConfig != null) server.setProperties(kafkaConfig); if (startingKafkaPort >= 0) server.setPort((int) this.nextKafkaPort.getAndIncrement()); return server; }); } return this; }
@Test public void testClassNullValue() throws Exception { Object key = new Object(); assertNull(this.ccs.nullValue(key)); int nr = this.ccs.nullInvocations().intValue(); assertNull(this.ccs.nullValue(key)); assertEquals(nr, this.ccs.nullInvocations().intValue()); assertNull(this.ccs.nullValue(new Object())); // the check method is also cached assertEquals(nr, this.ccs.nullInvocations().intValue()); assertEquals(nr + 1, AnnotatedClassCacheableService.nullInvocations.intValue()); }
@Override public int getNumRenewedTooLongConnections() { return counters.get(Counter.RENEWED_TOO_LONG_CONNECTIONS).intValue(); } }
@Override public int getNumRenewedIdleConnections() { return counters.get(Counter.RENEWED_IDLE_CONNECTIONS).intValue(); }
/** * @return Number of empty data pages in free list. */ public int emptyDataPages() { return bucketsSize[REUSE_BUCKET].intValue(); }
@Override public int getNumRenewedTooLongConnections() { return counters.get(Counter.RENEWED_TOO_LONG_CONNECTIONS).intValue(); } }
public int count(T arg0) { if (countMap.containsKey(arg0)) return countMap.get(arg0).intValue(); return 0; } }
@Override public Integer answer(InvocationOnMock invocation) throws Throwable { return parts.intValue(); } });
@Override public Integer answer(InvocationOnMock invocation) throws Throwable { return parts.intValue(); } });
@Override public Collection<PartDefinition> answer(InvocationOnMock invocation) throws Throwable { return new ArrayList<PartDefinition>(parts.intValue()); } });
double getAvg() { if (this.count.get() == 0) { return 0; } return this.value.doubleValue() / this.count.intValue(); }