io.atomix.core.PrimitivesService Maven / Gradle / Ivy
/*
* Copyright 2017-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.atomix.core;
import io.atomix.core.barrier.DistributedCyclicBarrier;
import io.atomix.core.barrier.DistributedCyclicBarrierBuilder;
import io.atomix.core.barrier.DistributedCyclicBarrierType;
import io.atomix.core.counter.AtomicCounter;
import io.atomix.core.counter.AtomicCounterBuilder;
import io.atomix.core.counter.AtomicCounterType;
import io.atomix.core.counter.DistributedCounter;
import io.atomix.core.counter.DistributedCounterBuilder;
import io.atomix.core.counter.DistributedCounterType;
import io.atomix.core.election.LeaderElection;
import io.atomix.core.election.LeaderElectionBuilder;
import io.atomix.core.election.LeaderElectionType;
import io.atomix.core.election.LeaderElector;
import io.atomix.core.election.LeaderElectorBuilder;
import io.atomix.core.election.LeaderElectorType;
import io.atomix.core.idgenerator.AtomicIdGenerator;
import io.atomix.core.idgenerator.AtomicIdGeneratorBuilder;
import io.atomix.core.idgenerator.AtomicIdGeneratorType;
import io.atomix.core.list.DistributedList;
import io.atomix.core.list.DistributedListBuilder;
import io.atomix.core.list.DistributedListType;
import io.atomix.core.lock.AtomicLock;
import io.atomix.core.lock.AtomicLockBuilder;
import io.atomix.core.lock.AtomicLockType;
import io.atomix.core.lock.DistributedLock;
import io.atomix.core.lock.DistributedLockBuilder;
import io.atomix.core.lock.DistributedLockType;
import io.atomix.core.log.DistributedLogBuilder;
import io.atomix.core.log.DistributedLogType;
import io.atomix.core.map.AtomicCounterMap;
import io.atomix.core.map.AtomicCounterMapBuilder;
import io.atomix.core.map.AtomicCounterMapType;
import io.atomix.core.map.AtomicMap;
import io.atomix.core.map.AtomicMapBuilder;
import io.atomix.core.map.AtomicMapType;
import io.atomix.core.map.AtomicNavigableMap;
import io.atomix.core.map.AtomicNavigableMapBuilder;
import io.atomix.core.map.AtomicNavigableMapType;
import io.atomix.core.map.AtomicSortedMap;
import io.atomix.core.map.AtomicSortedMapBuilder;
import io.atomix.core.map.AtomicSortedMapType;
import io.atomix.core.map.DistributedMap;
import io.atomix.core.map.DistributedMapBuilder;
import io.atomix.core.map.DistributedMapType;
import io.atomix.core.map.DistributedNavigableMap;
import io.atomix.core.map.DistributedNavigableMapBuilder;
import io.atomix.core.map.DistributedNavigableMapType;
import io.atomix.core.map.DistributedSortedMap;
import io.atomix.core.map.DistributedSortedMapBuilder;
import io.atomix.core.map.DistributedSortedMapType;
import io.atomix.core.multimap.AtomicMultimap;
import io.atomix.core.multimap.AtomicMultimapBuilder;
import io.atomix.core.multimap.AtomicMultimapType;
import io.atomix.core.multimap.DistributedMultimap;
import io.atomix.core.multimap.DistributedMultimapBuilder;
import io.atomix.core.multimap.DistributedMultimapType;
import io.atomix.core.multiset.DistributedMultiset;
import io.atomix.core.multiset.DistributedMultisetBuilder;
import io.atomix.core.multiset.DistributedMultisetType;
import io.atomix.core.queue.DistributedQueue;
import io.atomix.core.queue.DistributedQueueBuilder;
import io.atomix.core.queue.DistributedQueueType;
import io.atomix.core.semaphore.AtomicSemaphore;
import io.atomix.core.semaphore.AtomicSemaphoreBuilder;
import io.atomix.core.semaphore.AtomicSemaphoreType;
import io.atomix.core.semaphore.DistributedSemaphore;
import io.atomix.core.semaphore.DistributedSemaphoreBuilder;
import io.atomix.core.semaphore.DistributedSemaphoreType;
import io.atomix.core.set.DistributedNavigableSet;
import io.atomix.core.set.DistributedNavigableSetBuilder;
import io.atomix.core.set.DistributedNavigableSetType;
import io.atomix.core.set.DistributedSet;
import io.atomix.core.set.DistributedSetBuilder;
import io.atomix.core.set.DistributedSetType;
import io.atomix.core.set.DistributedSortedSet;
import io.atomix.core.set.DistributedSortedSetBuilder;
import io.atomix.core.set.DistributedSortedSetType;
import io.atomix.core.transaction.TransactionBuilder;
import io.atomix.core.tree.AtomicDocumentTree;
import io.atomix.core.tree.AtomicDocumentTreeBuilder;
import io.atomix.core.tree.AtomicDocumentTreeType;
import io.atomix.core.value.AtomicValue;
import io.atomix.core.value.AtomicValueBuilder;
import io.atomix.core.value.AtomicValueType;
import io.atomix.core.value.DistributedValue;
import io.atomix.core.value.DistributedValueBuilder;
import io.atomix.core.value.DistributedValueType;
import io.atomix.core.workqueue.WorkQueue;
import io.atomix.core.workqueue.WorkQueueBuilder;
import io.atomix.core.workqueue.WorkQueueType;
import io.atomix.primitive.PrimitiveBuilder;
import io.atomix.primitive.PrimitiveFactory;
import io.atomix.primitive.PrimitiveType;
import io.atomix.primitive.SyncPrimitive;
/**
* Manages the creation of distributed primitive instances.
*
* The primitives service provides various methods for constructing core and custom distributed primitives.
* The service provides various methods for creating and operating on distributed primitives. Generally, the primitive
* methods are separated into two types. Primitive getters return multiton instances of a primitive. Primitives created
* via getters must be pre-configured in the Atomix instance configuration. Alternatively, primitive builders can be
* used to create and configure primitives in code:
*
* {@code
* AtomicMap map = atomix.mapBuilder("my-map")
* .withProtocol(MultiRaftProtocol.builder("raft")
* .withReadConsistency(ReadConsistency.SEQUENTIAL)
* .build())
* .build();
* }
*
* Custom primitives can be constructed by providing a custom {@link PrimitiveType} and using the
* {@link #primitiveBuilder(String, PrimitiveType)} method:
*
* {@code
* MyPrimitive myPrimitive = atomix.primitiveBuilder("my-primitive, MyPrimitiveType.instance())
* .withProtocol(MultiRaftProtocol.builder("raft")
* .withReadConsistency(ReadConsistency.SEQUENTIAL)
* .build())
* .build();
* }
*
*/
public interface PrimitivesService extends PrimitiveFactory {
/**
* Creates a new log primitive builder.
*
* @param the log entry type
* @return the log builder
*/
default DistributedLogBuilder logBuilder() {
return primitiveBuilder("log", DistributedLogType.instance());
}
/**
* Creates a new named {@link DistributedMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMap map = atomix.mapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a distributed map
*/
default DistributedMapBuilder mapBuilder(String name) {
return primitiveBuilder(name, DistributedMapType.instance());
}
/**
* Creates a new named {@link DistributedSortedMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSortedMap map = atomix.sortedMapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a tree map
*/
default , V> DistributedSortedMapBuilder sortedMapBuilder(String name) {
return primitiveBuilder(name, DistributedSortedMapType.instance());
}
/**
* Creates a new named {@link DistributedNavigableMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedNavigableMap map = atomix.navigableMapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a tree map
*/
default , V> DistributedNavigableMapBuilder navigableMapBuilder(String name) {
return primitiveBuilder(name, DistributedNavigableMapType.instance());
}
/**
* Creates a new named {@link DistributedMultimap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the multimap, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMultimap multimap = atomix.multimapBuilder("my-multimap").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a multimap
*/
default DistributedMultimapBuilder multimapBuilder(String name) {
return primitiveBuilder(name, DistributedMultimapType.instance());
}
/**
* Creates a new named {@link AtomicMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicMap map = atomix.atomicMapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a atomic map
*/
default AtomicMapBuilder atomicMapBuilder(String name) {
return primitiveBuilder(name, AtomicMapType.instance());
}
/**
* Creates a new named {@link AtomicDocumentTree} builder.
*
* The tree name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the document tree, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicDocumentTree tree = atomix.atomicDocumentTreeBuilder("my-tree").build().async();
* }
*
*
* @param name the primitive name
* @param value type
* @return builder for a atomic document tree
*/
default AtomicDocumentTreeBuilder atomicDocumentTreeBuilder(String name) {
return primitiveBuilder(name, AtomicDocumentTreeType.instance());
}
/**
* Creates a new {@link AtomicSortedMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicSortedMap map = atomix.atomicSortedMapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a async atomic tree map
*/
default , V> AtomicSortedMapBuilder atomicSortedMapBuilder(String name) {
return primitiveBuilder(name, AtomicSortedMapType.instance());
}
/**
* Creates a new named {@link AtomicNavigableMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicNavigableMap map = atomix.atomicNavigableMapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a async atomic tree map
*/
default , V> AtomicNavigableMapBuilder atomicNavigableMapBuilder(String name) {
return primitiveBuilder(name, AtomicNavigableMapType.instance());
}
/**
* Creates a new named {@link AtomicMultimap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the multimap, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicMultimap multimap = atomix.atomicMultimapBuilder("my-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return builder for a set based async atomic multimap
*/
default AtomicMultimapBuilder atomicMultimapBuilder(String name) {
return primitiveBuilder(name, AtomicMultimapType.instance());
}
/**
* Creates a new named {@link AtomicCounterMap} builder.
*
* The map name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicCounterMap map = atomix.atomicCounterMapBuilder("my-counter-map").build().async();
* }
*
*
* @param name the primitive name
* @param key type
* @return builder for an atomic counter map
*/
default AtomicCounterMapBuilder atomicCounterMapBuilder(String name) {
return primitiveBuilder(name, AtomicCounterMapType.instance());
}
/**
* Creates a new named {@link DistributedSet} builder.
*
* The set name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSet set = atomix.setBuilder("my-set").build().async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return builder for an distributed set
*/
default DistributedSetBuilder setBuilder(String name) {
return primitiveBuilder(name, DistributedSetType.instance());
}
/**
* Creates a new named {@link DistributedSortedSet} builder.
*
* The set name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSortedSet set = atomix.sortedSetBuilder("my-set").build().async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return builder for a distributed set
*/
default > DistributedSortedSetBuilder sortedSetBuilder(String name) {
return primitiveBuilder(name, DistributedSortedSetType.instance());
}
/**
* Creates a new named {@link DistributedNavigableSet} builder.
*
* The set name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedNavigableSet set = atomix.navigableSetBuilder("my-set").build().async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return builder for a distributed set
*/
default > DistributedNavigableSetBuilder navigableSetBuilder(String name) {
return primitiveBuilder(name, DistributedNavigableSetType.instance());
}
/**
* Creates a new named {@link DistributedQueue} builder.
*
* The queue name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the queue, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedQueue queue = atomix.queueBuilder("my-queue").build().async();
* }
*
*
* @param name the primitive name
* @param queue element type
* @return builder for a distributed queue
*/
default DistributedQueueBuilder queueBuilder(String name) {
return primitiveBuilder(name, DistributedQueueType.instance());
}
/**
* Creates a new named {@link DistributedList} builder.
*
* The list name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the list, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedList list = atomix.queueBuilder("my-list").build().async();
* }
*
*
* @param name the primitive name
* @param list element type
* @return builder for a distributed list
*/
default DistributedListBuilder listBuilder(String name) {
return primitiveBuilder(name, DistributedListType.instance());
}
/**
* Creates a new named {@link DistributedMultiset} builder.
*
* The multiset name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the multiset, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMultiset multiset = atomix.multisetBuilder("my-multiset").build().async();
* }
*
*
* @param name the primitive name
* @param multiset element type
* @return builder for a distributed multiset
*/
default DistributedMultisetBuilder multisetBuilder(String name) {
return primitiveBuilder(name, DistributedMultisetType.instance());
}
/**
* Creates a new named {@link DistributedCounter} builder.
*
* The counter name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the counter, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedCounter counter = atomix.counterBuilder("my-counter").build().async();
* }
*
*
* @param name the primitive name
* @return distributed counter builder
*/
default DistributedCounterBuilder counterBuilder(String name) {
return primitiveBuilder(name, DistributedCounterType.instance());
}
/**
* Creates a new named {@link AtomicCounter} builder.
*
* The counter name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the counter, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicCounter counter = atomix.atomicCounterBuilder("my-counter").build().async();
* }
*
*
* @param name the primitive name
* @return atomic counter builder
*/
default AtomicCounterBuilder atomicCounterBuilder(String name) {
return primitiveBuilder(name, AtomicCounterType.instance());
}
/**
* Creates a new named {@link AtomicIdGenerator} builder.
*
* The ID generator name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the ID generator, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicIdGenerator idGenerator = atomix.atomicIdGeneratorBuilder("my-id-generator").build().async();
* }
*
*
* @param name the primitive name
* @return atomic ID generator builder
*/
default AtomicIdGeneratorBuilder atomicIdGeneratorBuilder(String name) {
return primitiveBuilder(name, AtomicIdGeneratorType.instance());
}
/**
* Creates a new named {@link DistributedValue} builder.
*
* The value name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the value, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedValue value = atomix.valueBuilder("my-value").build().async();
* }
*
*
* @param name the primitive name
* @param atomic value type
* @return atomic value builder
*/
default DistributedValueBuilder valueBuilder(String name) {
return primitiveBuilder(name, DistributedValueType.instance());
}
/**
* Creates a new named {@link AtomicValue} builder.
*
* The value name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the value, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicValue value = atomix.atomicValueBuilder("my-value").build().async();
* }
*
*
* @param name the primitive name
* @param atomic value type
* @return atomic value builder
*/
default AtomicValueBuilder atomicValueBuilder(String name) {
return primitiveBuilder(name, AtomicValueType.instance());
}
/**
* Creates a new named {@link LeaderElection} builder.
*
* The election name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the election, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncLeaderElection election = atomix.leaderElectionBuilder("my-election").build().async();
* }
*
*
* @param name the primitive name
* @return leader election builder
*/
default LeaderElectionBuilder leaderElectionBuilder(String name) {
return primitiveBuilder(name, LeaderElectionType.instance());
}
/**
* Creates a new named {@link LeaderElector} builder.
*
* The elector name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the elector, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncLeaderElector elector = atomix.leaderElectorBuilder("my-elector").build().async();
* }
*
*
* @param name the primitive name
* @return leader elector builder
*/
default LeaderElectorBuilder leaderElectorBuilder(String name) {
return primitiveBuilder(name, LeaderElectorType.instance());
}
/**
* Creates a new named {@link DistributedLock} builder.
*
* The lock name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the lock, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedLock lock = atomix.lockBuilder("my-lock").build().async();
* }
*
*
* @param name the primitive name
* @return distributed lock builder
*/
default DistributedLockBuilder lockBuilder(String name) {
return primitiveBuilder(name, DistributedLockType.instance());
}
/**
* Creates a new named {@link AtomicLock} builder.
*
* The lock name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the lock, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicLock lock = atomix.atomicLockBuilder("my-lock").build().async();
* }
*
*
* @param name the primitive name
* @return distributed lock builder
*/
default AtomicLockBuilder atomicLockBuilder(String name) {
return primitiveBuilder(name, AtomicLockType.instance());
}
/**
* Creates a new named {@link DistributedCyclicBarrier} builder.
*
* The barrier name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the barrier, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedCyclicBarrier barrier = atomix.cyclicBarrierBuilder("my-barrier").build().async();
* }
*
*
* @param name the primitive name
* @return distributed cyclic barrier builder
*/
default DistributedCyclicBarrierBuilder cyclicBarrierBuilder(String name) {
return primitiveBuilder(name, DistributedCyclicBarrierType.instance());
}
/**
* Creates a new named {@link DistributedSemaphore} builder.
*
* The semaphore name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the semaphore, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSemaphore semaphore = atomix.semaphoreBuilder("my-semaphore").build().async();
* }
*
*
* @param name the primitive name
* @return distributed semaphore builder
*/
default DistributedSemaphoreBuilder semaphoreBuilder(String name) {
return primitiveBuilder(name, DistributedSemaphoreType.instance());
}
/**
* Creates a new named {@link AtomicSemaphore} builder.
*
* The semaphore name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the semaphore, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicSemaphore semaphore = atomix.atomicSemaphoreBuilder("my-semaphore").build().async();
* }
*
*
* @param name the primitive name
* @return distributed semaphore builder
*/
default AtomicSemaphoreBuilder atomicSemaphoreBuilder(String name) {
return primitiveBuilder(name, AtomicSemaphoreType.instance());
}
/**
* Creates a new named {@link WorkQueue} builder.
*
* The work queue name must be provided when constructing the builder. The name is used to reference a distinct instance of
* the primitive within the cluster. Multiple instances of the primitive with the same name will share the same state.
* However, the instance of the primitive constructed by the returned builder will be distinct and will not share
* local memory (e.g. cache) with any other instance on this node.
*
* To get an asynchronous instance of the work queue, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncWorkQueue workQueue = atomix.workQueueBuilder("my-work-queue").build().async();
* }
*
*
* @param name the primitive name
* @param work queue element type
* @return work queue builder
*/
default WorkQueueBuilder workQueueBuilder(String name) {
return primitiveBuilder(name, WorkQueueType.instance());
}
/**
* Creates a new transaction builder.
*
* To get an asynchronous instance of the transaction, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncTransaction transaction = atomix.transactionBuilder().build().async();
* }
*
*
* @return transaction builder
*/
default TransactionBuilder transactionBuilder() {
return transactionBuilder("transaction");
}
/**
* Creates a new transaction builder.
*
* To get an asynchronous instance of the transaction, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncTransaction transaction = atomix.transactionBuilder().build().async();
* }
*
*
* @param name the transaction name
* @return the transaction builder
*/
TransactionBuilder transactionBuilder(String name);
/**
* Gets or creates a {@link DistributedMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMap map = atomix.getMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new distributed map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedMap getMap(String name);
/**
* Gets or creates a {@link DistributedSortedMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSortedMap map = atomix.getSortedMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new distributed map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
, V> DistributedSortedMap getSortedMap(String name);
/**
* Gets or creates a {@link DistributedNavigableMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedNavigableMap map = atomix.getNavigableMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new distributed map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
, V> DistributedNavigableMap getNavigableMap(String name);
/**
* Gets or creates a {@link DistributedMultimap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the multimap, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMultimap multimap = atomix.getMultimap("my-multimap").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new distributed multimap
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedMultimap getMultimap(String name);
/**
* Gets or creates a {@link AtomicMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicMap map = atomix.getAtomicMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new atomic map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicMap getAtomicMap(String name);
/**
* Gets or creates a {@link AtomicDocumentTree}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the tree, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicDocumentTree map = atomix.getDocumentTree("my-tree").async();
* }
*
*
* @param name the primitive name
* @param value type
* @return a new atomic map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicDocumentTree getAtomicDocumentTree(String name);
/**
* Gets or creates a {@link AtomicSortedMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicSortedMap map = atomix.getAtomicSortedMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new atomic tree map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
, V> AtomicSortedMap getAtomicSortedMap(String name);
/**
* Gets or creates a {@link AtomicNavigableMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicNavigableMap map = atomix.getAtomicNavigableMap("my-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new atomic tree map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
, V> AtomicNavigableMap getAtomicNavigableMap(String name);
/**
* Gets or creates a {@link AtomicMultimap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the multimap, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicMultimap multimap = atomix.getAtomicMultimap("my-multimap").async();
* }
*
*
* @param name the primitive name
* @param key type
* @param value type
* @return a new atomic tree map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicMultimap getAtomicMultimap(String name);
/**
* Gets or creates a {@link AtomicCounterMap}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the map, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicCounterMap map = atomix.getAtomicCounterMap("my-counter-map").async();
* }
*
*
* @param name the primitive name
* @param key type
* @return a new atomic counter map
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicCounterMap getAtomicCounterMap(String name);
/**
* Gets or creates a {@link DistributedSet}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSet set = atomix.getSet("my-set").async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return a multiton instance of a distributed set
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedSet getSet(String name);
/**
* Gets or creates a {@link DistributedSortedSet}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSortedSet set = atomix.getSortedSet("my-set").async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return a multiton instance of a distributed sorted set
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
> DistributedSortedSet getSortedSet(String name);
/**
* Gets or creates a {@link DistributedNavigableSet}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the set, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedNavigableSet set = atomix.getNavigableSet("my-set").async();
* }
*
*
* @param name the primitive name
* @param set element type
* @return a multiton instance of a distributed navigable set
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
> DistributedNavigableSet getNavigableSet(String name);
/**
* Gets or creates a {@link DistributedQueue}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the queue, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedQueue queue = atomix.getQueue("my-queue").async();
* }
*
*
* @param name the primitive name
* @param queue element type
* @return a multiton instance of a distributed queue
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedQueue getQueue(String name);
/**
* Gets or creates a {@link DistributedList}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the list, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedList list = atomix.getList("my-list").async();
* }
*
*
* @param name the primitive name
* @param list element type
* @return a multiton instance of a distributed list
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedList getList(String name);
/**
* Gets or creates a {@link DistributedMultiset}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the multiset, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedMultiset multiset = atomix.getMultiset("my-multiset").async();
* }
*
*
* @param name the primitive name
* @param multiset element type
* @return a multiton instance of a distributed multiset
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedMultiset getMultiset(String name);
/**
* Gets or creates a {@link DistributedCounter}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the counter, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedCounter counter = atomix.getCounter("my-counter").async();
* }
*
*
* @param name the primitive name
* @return distributed counter
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedCounter getCounter(String name);
/**
* Gets or creates a {@link AtomicCounter}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the counter, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicCounter counter = atomix.getAtomicCounter("my-counter").async();
* }
*
*
* @param name the primitive name
* @return atomic counter builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicCounter getAtomicCounter(String name);
/**
* Gets or creates a {@link AtomicIdGenerator}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the ID generator, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicIdGenerator idGenerator = atomix.getAtomicIdGenerator("my-id-generator").async();
* }
*
*
* @param name the primitive name
* @return atomic ID generator builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicIdGenerator getAtomicIdGenerator(String name);
/**
* Gets or creates a {@link DistributedValue}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the value, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedValue value = atomix.getValue("my-value").async();
* }
*
*
* @param name the primitive name
* @param value type
* @return distributed value
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedValue getValue(String name);
/**
* Gets or creates a {@link AtomicValue}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the value, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicValue value = atomix.getAtomicValue("my-value").async();
* }
*
*
* @param name the primitive name
* @param atomic value type
* @return atomic value builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicValue getAtomicValue(String name);
/**
* Gets or creates a {@link LeaderElection}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the election, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncLeaderElection election = atomix.getLeaderElection("my-election").async();
* }
*
*
* @param name the primitive name
* @return leader election builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
LeaderElection getLeaderElection(String name);
/**
* Gets or creates a {@link LeaderElector}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the elector, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncLeaderElector elector = atomix.getLeaderElector("my-elector").async();
* }
*
*
* @param name the primitive name
* @return leader elector builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
LeaderElector getLeaderElector(String name);
/**
* Gets or creates a {@link DistributedLock}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the lock, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedLock lock = atomix.getLock("my-lock").async();
* }
*
*
* @param name the primitive name
* @return atomic lock builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedLock getLock(String name);
/**
* Gets or creates a {@link AtomicLock}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the lock, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicLock lock = atomix.getAtomicLock("my-lock").async();
* }
*
*
* @param name the primitive name
* @return atomic lock builder
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicLock getAtomicLock(String name);
/**
* Gets or creates a {@link DistributedCyclicBarrier}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the barrier, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedCyclicBarrier barrier = atomix.getCyclicBarrier("my-barrier").async();
* }
*
*
* @param name the primitive name
* @return the cyclic barrier
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedCyclicBarrier getCyclicBarrier(String name);
/**
* Gets or creates a {@link DistributedSemaphore}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the semaphore, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncDistributedSemaphore semaphore = atomix.getSemaphore("my-semaphore").async();
* }
*
*
* @param name the primitive name
* @return DistributedSemaphore
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
DistributedSemaphore getSemaphore(String name);
/**
* Gets or creates a {@link AtomicSemaphore}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the semaphore, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncAtomicSemaphore semaphore = atomix.getAtomicSemaphore("my-semaphore").async();
* }
*
*
* @param name the primitive name
* @return DistributedSemaphore
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
AtomicSemaphore getAtomicSemaphore(String name);
/**
* Gets or creates a {@link WorkQueue}.
*
* A new primitive will be created if no primitive instance with the given {@code name} exists on this node, otherwise
* the existing instance will be returned. The name is used to reference a distinct instance of the primitive within
* the cluster. The returned primitive will share the same state with primitives of the same name on other nodes.
*
* When the instance is initially constructed, it will be configured with any pre-existing primitive configuration
* defined in {@code atomix.conf}.
*
* To get an asynchronous instance of the work queue, use the {@link SyncPrimitive#async()} method:
*
* {@code
* AsyncWorkQueue workQueue = atomix.getWorkQueue("my-work-queue").async();
* }
*
*
* @param name the primitive name
* @param work queue element type
* @return work queue
* @deprecated since 3.1; use {@link PrimitiveBuilder#get()}
*/
@Deprecated
WorkQueue getWorkQueue(String name);
}