Search in sources :

Example 1 with ThreadPoolContextFactory

use of io.atomix.utils.concurrent.ThreadPoolContextFactory in project atomix by atomix.

the class PrimaryBackupPartitionGroup method open.

@Override
public CompletableFuture<ManagedPartitionGroup> open(PartitionManagementService managementService) {
    threadFactory = new ThreadPoolContextFactory("atomix-" + name() + "-%d", Runtime.getRuntime().availableProcessors() * 2, LOGGER);
    List<CompletableFuture<Partition>> futures = partitions.values().stream().map(p -> p.open(managementService, threadFactory)).collect(Collectors.toList());
    return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenApply(v -> {
        LOGGER.info("Started");
        return this;
    });
}
Also used : Arrays(java.util.Arrays) LoggerFactory(org.slf4j.LoggerFactory) CompletableFuture(java.util.concurrent.CompletableFuture) MemberGroupStrategy(io.atomix.primitive.partition.MemberGroupStrategy) PartitionId(io.atomix.primitive.partition.PartitionId) ArrayList(java.util.ArrayList) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Lists(com.google.common.collect.Lists) Partition(io.atomix.primitive.partition.Partition) PrimitiveProtocol(io.atomix.primitive.PrimitiveProtocol) Map(java.util.Map) MemberGroupProvider(io.atomix.primitive.partition.MemberGroupProvider) ManagedPartitionGroup(io.atomix.primitive.partition.ManagedPartitionGroup) Logger(org.slf4j.Logger) Collection(java.util.Collection) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Recovery(io.atomix.primitive.Recovery) Maps(com.google.common.collect.Maps) PartitionGroup(io.atomix.primitive.partition.PartitionGroup) Collectors(java.util.stream.Collectors) ThreadContextFactory(io.atomix.utils.concurrent.ThreadContextFactory) ThreadPoolContextFactory(io.atomix.utils.concurrent.ThreadPoolContextFactory) List(java.util.List) MemberGroup(io.atomix.primitive.partition.MemberGroup) PartitionManagementService(io.atomix.primitive.partition.PartitionManagementService) Replication(io.atomix.primitive.Replication) Type(io.atomix.primitive.PrimitiveProtocol.Type) MultiPrimaryProtocol(io.atomix.protocols.backup.MultiPrimaryProtocol) Collections(java.util.Collections) MoreObjects.toStringHelper(com.google.common.base.MoreObjects.toStringHelper) CompletableFuture(java.util.concurrent.CompletableFuture) ThreadPoolContextFactory(io.atomix.utils.concurrent.ThreadPoolContextFactory)

Aggregations

MoreObjects.toStringHelper (com.google.common.base.MoreObjects.toStringHelper)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 PrimitiveProtocol (io.atomix.primitive.PrimitiveProtocol)1 Type (io.atomix.primitive.PrimitiveProtocol.Type)1 Recovery (io.atomix.primitive.Recovery)1 Replication (io.atomix.primitive.Replication)1 ManagedPartitionGroup (io.atomix.primitive.partition.ManagedPartitionGroup)1 MemberGroup (io.atomix.primitive.partition.MemberGroup)1 MemberGroupProvider (io.atomix.primitive.partition.MemberGroupProvider)1 MemberGroupStrategy (io.atomix.primitive.partition.MemberGroupStrategy)1 Partition (io.atomix.primitive.partition.Partition)1 PartitionGroup (io.atomix.primitive.partition.PartitionGroup)1 PartitionId (io.atomix.primitive.partition.PartitionId)1 PartitionManagementService (io.atomix.primitive.partition.PartitionManagementService)1 MultiPrimaryProtocol (io.atomix.protocols.backup.MultiPrimaryProtocol)1 ThreadContextFactory (io.atomix.utils.concurrent.ThreadContextFactory)1 ThreadPoolContextFactory (io.atomix.utils.concurrent.ThreadPoolContextFactory)1