/** * Connects to the log partition. */ CompletableFuture<Partition> connect( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); client = new LogPartitionClient(this, managementService, threadFactory); return client.start().thenApply(v -> this); }
/** * Connects to the primary-backup partition. */ CompletableFuture<Partition> connect( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); client = new PrimaryBackupPartitionClient(this, managementService, threadFactory); return client.start().thenApply(v -> this); }
/** * Joins the primary-backup partition. */ CompletableFuture<Partition> join( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); server = new PrimaryBackupPartitionServer( this, managementService, memberGroupProvider, threadFactory); client = new PrimaryBackupPartitionClient(this, managementService, threadFactory); return server.start().thenCompose(v -> client.start()).thenApply(v -> this); }
/** * Joins the log partition. */ CompletableFuture<Partition> join( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); server = new LogPartitionServer( this, managementService, config, threadFactory); client = new LogPartitionClient(this, managementService, threadFactory); return server.start().thenCompose(v -> client.start()).thenApply(v -> this); }
private PrimaryBackupServer buildServer() { return PrimaryBackupServer.builder() .withServerName(partition.name()) .withMembershipService(managementService.getMembershipService()) .withMemberGroupProvider(memberGroupProvider) .withProtocol(new PrimaryBackupServerCommunicator( partition.name(), Serializer.using(PrimaryBackupNamespaces.PROTOCOL), managementService.getMessagingService())) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withPrimitiveTypes(managementService.getPrimitiveTypes()) .withThreadContextFactory(threadFactory) .build(); }
private PrimaryBackupClient newClient() { return PrimaryBackupClient.builder() .withClientName(partition.name()) .withPartitionId(partition.id()) .withMembershipService(managementService.getMembershipService()) .withProtocol(new PrimaryBackupClientCommunicator( partition.name(), Serializer.using(PrimaryBackupNamespaces.PROTOCOL), managementService.getMessagingService())) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withSessionIdProvider(managementService.getSessionIdService()) .withThreadContextFactory(threadFactory) .build(); }
private DistributedLogSessionClient newClient() { return DistributedLogSessionClient.builder() .withClientName(partition.name()) .withPartitionId(partition.id()) .withMembershipService(managementService.getMembershipService()) .withProtocol(new LogClientCommunicator( partition.name(), Serializer.using(LogNamespaces.PROTOCOL), managementService.getMessagingService())) .withSessionIdProvider(() -> managementService.getSessionIdService().nextSessionId()) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withThreadContextFactory(threadFactory) .build(); }
private DistributedLogServer buildServer() { return DistributedLogServer.builder() .withServerName(partition.name()) .withMembershipService(managementService.getMembershipService()) .withMemberGroupProvider(config.getMemberGroupProvider()) .withProtocol(new LogServerCommunicator( partition.name(), Serializer.using(LogNamespaces.PROTOCOL), managementService.getMessagingService())) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withStorageLevel(config.getStorageConfig().getLevel()) .withDirectory(config.getStorageConfig().getDirectory(partition.name())) .withMaxSegmentSize((int) config.getStorageConfig().getSegmentSize().bytes()) .withMaxEntrySize((int) config.getStorageConfig().getMaxEntrySize().bytes()) .withFlushOnCommit(config.getStorageConfig().isFlushOnCommit()) .withMaxLogSize(config.getCompactionConfig().getSize().bytes()) .withMaxLogAge(config.getCompactionConfig().getAge()) .withThreadContextFactory(threadFactory) .build(); }
/** * Connects to the log partition. */ CompletableFuture<Partition> connect( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); client = new LogPartitionClient(this, managementService, threadFactory); return client.start().thenApply(v -> this); }
/** * Joins the log partition. */ CompletableFuture<Partition> join( PartitionManagementService managementService, ThreadContextFactory threadFactory) { election = managementService.getElectionService().getElectionFor(partitionId); server = new LogPartitionServer( this, managementService, config, threadFactory); client = new LogPartitionClient(this, managementService, threadFactory); return server.start().thenCompose(v -> client.start()).thenApply(v -> this); }
private DistributedLogSessionClient newClient() { return DistributedLogSessionClient.builder() .withClientName(partition.name()) .withPartitionId(partition.id()) .withMembershipService(managementService.getMembershipService()) .withProtocol(new LogClientCommunicator( partition.name(), Serializer.using(LogNamespaces.PROTOCOL), managementService.getMessagingService())) .withSessionIdProvider(() -> managementService.getSessionIdService().nextSessionId()) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withThreadContextFactory(threadFactory) .build(); }
private DistributedLogServer buildServer() { return DistributedLogServer.builder() .withServerName(partition.name()) .withMembershipService(managementService.getMembershipService()) .withMemberGroupProvider(config.getMemberGroupProvider()) .withProtocol(new LogServerCommunicator( partition.name(), Serializer.using(LogNamespaces.PROTOCOL), managementService.getMessagingService())) .withPrimaryElection(managementService.getElectionService().getElectionFor(partition.id())) .withStorageLevel(config.getStorageConfig().getLevel()) .withDirectory(config.getStorageConfig().getDirectory(partition.name())) .withMaxSegmentSize((int) config.getStorageConfig().getSegmentSize().bytes()) .withMaxEntrySize((int) config.getStorageConfig().getMaxEntrySize().bytes()) .withFlushOnCommit(config.getStorageConfig().isFlushOnCommit()) .withMaxLogSize(config.getCompactionConfig().getSize().bytes()) .withMaxLogAge(config.getCompactionConfig().getAge()) .withThreadContextFactory(threadFactory) .build(); }