
org.onosproject.store.service.AtomicCounterBuilder Maven / Gradle / Ivy
package org.onosproject.store.service;
import java.util.concurrent.ScheduledExecutorService;
/**
* Builder for AtomicCounter.
*/
public interface AtomicCounterBuilder {
/**
* Sets the name for the atomic counter.
*
* Each atomic counter is identified by a unique name.
*
*
* Note: This is a mandatory parameter.
*
*
* @param name name of the atomic counter
* @return this AtomicCounterBuilder
*/
AtomicCounterBuilder withName(String name);
/**
* Creates this counter on the partition that spans the entire cluster.
*
* When partitioning is disabled, the counter state will be
* ephemeral and does not survive a full cluster restart.
*
*
* Note: By default partitions are enabled.
*
* @return this AtomicCounterBuilder
*/
AtomicCounterBuilder withPartitionsDisabled();
/**
* Enables retries when counter operations fail.
*
* Note: Use with caution. By default retries are disabled.
*
* @return this AtomicCounterBuilder
*/
AtomicCounterBuilder withRetryOnFailure();
/**
* Sets the executor service to use for retrying failed operations.
*
* Note: Must be set when retries are enabled
*
* @param executor executor service
* @return this AtomicCounterBuilder
*/
AtomicCounterBuilder withRetryExecutor(ScheduledExecutorService executor);
/**
* Builds a AtomicCounter based on the configuration options
* supplied to this builder.
*
* @return new AtomicCounter
* @throws java.lang.RuntimeException if a mandatory parameter is missing
*/
AtomicCounter build();
/**
* Builds a AsyncAtomicCounter based on the configuration options
* supplied to this builder.
*
* @return new AsyncAtomicCounter
* @throws java.lang.RuntimeException if a mandatory parameter is missing
*/
AsyncAtomicCounter buildAsyncCounter();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy