Search in sources :

Example 1 with TranscodingAsyncAtomicMap

use of io.atomix.core.map.impl.TranscodingAsyncAtomicMap in project atomix by atomix.

the class CorePrimitiveRegistry method start.

@Override
@SuppressWarnings("unchecked")
public CompletableFuture<PrimitiveRegistry> start() {
    ProxyProtocol protocol = partitionService.getSystemPartitionGroup().newProtocol();
    ProxyClient proxy = protocol.newProxy("primitives", AtomicMapType.instance(), AtomicMapService.class, new ServiceConfig(), partitionService);
    return proxy.connect().thenApply(v -> {
        AtomicMapProxy mapProxy = new AtomicMapProxy(proxy, this);
        primitives = new TranscodingAsyncAtomicMap<>(mapProxy, key -> key, key -> key, value -> value != null ? SERIALIZER.encode(value) : null, value -> value != null ? SERIALIZER.decode(value) : null);
        started.set(true);
        return this;
    });
}
Also used : DistributedPrimitive(io.atomix.primitive.DistributedPrimitive) TimeoutException(java.util.concurrent.TimeoutException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) PrimitiveTypeRegistry(io.atomix.primitive.PrimitiveTypeRegistry) CompletableFuture(java.util.concurrent.CompletableFuture) Namespaces(io.atomix.utils.serializer.Namespaces) ManagedPrimitiveRegistry(io.atomix.primitive.ManagedPrimitiveRegistry) PrimitiveInfo(io.atomix.primitive.PrimitiveInfo) TranscodingAsyncAtomicMap(io.atomix.core.map.impl.TranscodingAsyncAtomicMap) AtomicMapService(io.atomix.core.map.impl.AtomicMapService) AsyncAtomicMap(io.atomix.core.map.AsyncAtomicMap) AtomicMapProxy(io.atomix.core.map.impl.AtomicMapProxy) ProxyProtocol(io.atomix.primitive.protocol.ProxyProtocol) ProxyClient(io.atomix.primitive.proxy.ProxyClient) Collection(java.util.Collection) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Collectors(java.util.stream.Collectors) PrimitiveRegistry(io.atomix.primitive.PrimitiveRegistry) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) ServiceConfig(io.atomix.primitive.service.ServiceConfig) PrimitiveType(io.atomix.primitive.PrimitiveType) PartitionService(io.atomix.primitive.partition.PartitionService) AtomicMapType(io.atomix.core.map.AtomicMapType) PrimitiveException(io.atomix.primitive.PrimitiveException) Serializer(io.atomix.utils.serializer.Serializer) AtomicMapProxy(io.atomix.core.map.impl.AtomicMapProxy) ServiceConfig(io.atomix.primitive.service.ServiceConfig) ProxyClient(io.atomix.primitive.proxy.ProxyClient) ProxyProtocol(io.atomix.primitive.protocol.ProxyProtocol)

Aggregations

Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 AsyncAtomicMap (io.atomix.core.map.AsyncAtomicMap)1 AtomicMapType (io.atomix.core.map.AtomicMapType)1 AtomicMapProxy (io.atomix.core.map.impl.AtomicMapProxy)1 AtomicMapService (io.atomix.core.map.impl.AtomicMapService)1 TranscodingAsyncAtomicMap (io.atomix.core.map.impl.TranscodingAsyncAtomicMap)1 DistributedPrimitive (io.atomix.primitive.DistributedPrimitive)1 ManagedPrimitiveRegistry (io.atomix.primitive.ManagedPrimitiveRegistry)1 PrimitiveException (io.atomix.primitive.PrimitiveException)1 PrimitiveInfo (io.atomix.primitive.PrimitiveInfo)1 PrimitiveRegistry (io.atomix.primitive.PrimitiveRegistry)1 PrimitiveType (io.atomix.primitive.PrimitiveType)1 PrimitiveTypeRegistry (io.atomix.primitive.PrimitiveTypeRegistry)1 PartitionService (io.atomix.primitive.partition.PartitionService)1 ProxyProtocol (io.atomix.primitive.protocol.ProxyProtocol)1 ProxyClient (io.atomix.primitive.proxy.ProxyClient)1 ServiceConfig (io.atomix.primitive.service.ServiceConfig)1 Namespaces (io.atomix.utils.serializer.Namespaces)1 Serializer (io.atomix.utils.serializer.Serializer)1 Collection (java.util.Collection)1