test_class.file: server/src/test/java/io/spine/server/delivery/DeliveryTest.java
test_class.identifier: DeliveryTest
test_class.superclass: extends AbstractDeliveryTest
test_case.body: @Test
      @DisplayName("single shard and return stats when picked up the shard " +
              "and `Optional.empty()` if shard was already picked")
      public void returnOptionalEmptyIfPicked() {
          int shardCount = 11;
          ShardedWorkRegistry registry = new InMemoryShardedWorkRegistry();
          FixedShardStrategy strategy = new FixedShardStrategy(shardCount);
          Delivery delivery = Delivery.newBuilder()
                                      .setStrategy(strategy)
                                      .setWorkRegistry(registry)
                                      .build();
          ServerEnvironment env = ServerEnvironment.instance();
          env.use(delivery, Tests.class);
  
          ShardIndex index = strategy.nonEmptyShard();
          TenantId tenantId = GivenTenantId.generate();
          TenantAwareRunner.with(tenantId)
                           .run(() -> assertStatsMatch(delivery, index));
  
          Optional<ShardProcessingSession> session = registry.pickUp(index, env.nodeId());
          assertThat(session).isPresent();
  
          TenantAwareRunner.with(tenantId)
                           .run(() -> assertStatsEmpty(delivery, index));
      }
test_case.class_method_signature: DeliveryTest.returnOptionalEmptyIfPicked()
test_case.full_signature: @Test @DisplayName("single shard and return stats when picked up the shard " + "and `Optional.empty()` if shard was already picked") public void returnOptionalEmptyIfPicked()
test_case.identifier: returnOptionalEmptyIfPicked
test_case.invocations: build setWorkRegistry setStrategy newBuilder instance use nonEmptyShard generate run with assertStatsMatch pickUp nodeId isPresent assertThat run with assertStatsEmpty
test_case.modifiers: @Test @DisplayName("single shard and return stats when picked up the shard " + "and `Optional.empty()` if shard was already picked") public
test_case.parameters: ()
test_case.return: void
test_case.signature: void returnOptionalEmptyIfPicked()
focal_class.declarator: LOCAL_DEDUPLICATION_WINDOW = Durations.fromSeconds(30)
focal_class.modifier: private static final
focal_class.original_string: private static final Duration LOCAL_DEDUPLICATION_WINDOW = Durations.fromSeconds(30);
focal_class.type: Duration
focal_class.var_name: LOCAL_DEDUPLICATION_WINDOW
focal_class.declarator: strategy
focal_class.modifier: private final
focal_class.original_string: private final DeliveryStrategy strategy;
focal_class.type: DeliveryStrategy
focal_class.var_name: strategy
focal_class.declarator: deduplicationWindow
focal_class.modifier: private final
focal_class.original_string: private final Duration deduplicationWindow;
focal_class.type: Duration
focal_class.var_name: deduplicationWindow
focal_class.declarator: deliveries
focal_class.modifier: private final
focal_class.original_string: private final InboxDeliveries deliveries;
focal_class.type: InboxDeliveries
focal_class.var_name: deliveries
focal_class.declarator: shardObservers
focal_class.modifier: private final
focal_class.original_string: private final List<ShardObserver> shardObservers;
focal_class.type: List<ShardObserver>
focal_class.var_name: shardObservers
focal_class.declarator: workRegistry
focal_class.modifier: private final
focal_class.original_string: private final ShardedWorkRegistry workRegistry;
focal_class.type: ShardedWorkRegistry
focal_class.var_name: workRegistry
focal_class.declarator: inboxStorage
focal_class.modifier: private final
focal_class.original_string: private final InboxStorage inboxStorage;
focal_class.type: InboxStorage
focal_class.var_name: inboxStorage
focal_class.declarator: catchUpStorage
focal_class.modifier: private final
focal_class.original_string: private final CatchUpStorage catchUpStorage;
focal_class.type: CatchUpStorage
focal_class.var_name: catchUpStorage
focal_class.declarator: catchUpPageSize
focal_class.modifier: private final
focal_class.original_string: private final int catchUpPageSize;
focal_class.type: int
focal_class.var_name: catchUpPageSize
focal_class.declarator: monitor
focal_class.modifier: private final
focal_class.original_string: private final DeliveryMonitor monitor;
focal_class.type: DeliveryMonitor
focal_class.var_name: monitor
focal_class.declarator: deliveredMessages
focal_class.modifier: private final
focal_class.original_string: private final DeliveredMessages deliveredMessages;
focal_class.type: DeliveredMessages
focal_class.var_name: deliveredMessages
focal_class.declarator: pageSize
focal_class.modifier: private final
focal_class.original_string: private final int pageSize;
focal_class.type: int
focal_class.var_name: pageSize
focal_class.declarator: dispatchListener =
              new DeliveryDispatchListener(this::onNewMessage)
focal_class.modifier: private final
focal_class.original_string: private final DeliveryDispatchListener dispatchListener =
              new DeliveryDispatchListener(this::onNewMessage);
focal_class.type: DeliveryDispatchListener
focal_class.var_name: dispatchListener
focal_class.file: server/src/main/java/io/spine/server/delivery/Delivery.java
focal_class.identifier: Delivery
focal_class.interfaces: implements Logging
focal_class.class_method_signature: Delivery.Delivery(DeliveryBuilder builder)
focal_class.full_signature:   Delivery(DeliveryBuilder builder)
focal_class.identifier: Delivery
focal_class.parameters: (DeliveryBuilder builder)
focal_class.signature:  Delivery(DeliveryBuilder builder)
focal_class.class_method_signature: Delivery.newBuilder()
focal_class.full_signature: public static DeliveryBuilder newBuilder()
focal_class.identifier: newBuilder
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: DeliveryBuilder
focal_class.signature: DeliveryBuilder newBuilder()
focal_class.class_method_signature: Delivery.local()
focal_class.full_signature: public static Delivery local()
focal_class.identifier: local
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Delivery
focal_class.signature: Delivery local()
focal_class.class_method_signature: Delivery.localAsync()
focal_class.full_signature: public static Delivery localAsync()
focal_class.identifier: localAsync
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Delivery
focal_class.signature: Delivery localAsync()
focal_class.class_method_signature: Delivery.localWithShardsAndWindow(int shardCount, Duration deduplicationWindow)
focal_class.full_signature: @VisibleForTesting static Delivery localWithShardsAndWindow(int shardCount, Duration deduplicationWindow)
focal_class.identifier: localWithShardsAndWindow
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (int shardCount, Duration deduplicationWindow)
focal_class.return: Delivery
focal_class.signature: Delivery localWithShardsAndWindow(int shardCount, Duration deduplicationWindow)
focal_class.class_method_signature: Delivery.localWithStrategyAndWindow(DeliveryStrategy strategy,
                                                 Duration deduplicationWindow)
focal_class.full_signature: @VisibleForTesting static Delivery localWithStrategyAndWindow(DeliveryStrategy strategy,
                                                 Duration deduplicationWindow)
focal_class.identifier: localWithStrategyAndWindow
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (DeliveryStrategy strategy,
                                                 Duration deduplicationWindow)
focal_class.return: Delivery
focal_class.signature: Delivery localWithStrategyAndWindow(DeliveryStrategy strategy,
                                                 Duration deduplicationWindow)
focal_class.class_method_signature: Delivery.deliverMessagesFrom(ShardIndex index)
focal_class.full_signature: public Optional<DeliveryStats> deliverMessagesFrom(ShardIndex index)
focal_class.identifier: deliverMessagesFrom
focal_class.modifiers: public
focal_class.parameters: (ShardIndex index)
focal_class.return: Optional<DeliveryStats>
focal_class.signature: Optional<DeliveryStats> deliverMessagesFrom(ShardIndex index)
focal_class.class_method_signature: Delivery.runDelivery(ShardProcessingSession session)
focal_class.full_signature: private RunResult runDelivery(ShardProcessingSession session)
focal_class.identifier: runDelivery
focal_class.modifiers: private
focal_class.parameters: (ShardProcessingSession session)
focal_class.return: RunResult
focal_class.signature: RunResult runDelivery(ShardProcessingSession session)
focal_class.class_method_signature: Delivery.launch(Conveyor conveyor, Iterable<Station> stations, ShardIndex index)
focal_class.full_signature: private DeliveryStage launch(Conveyor conveyor, Iterable<Station> stations, ShardIndex index)
focal_class.identifier: launch
focal_class.modifiers: private
focal_class.parameters: (Conveyor conveyor, Iterable<Station> stations, ShardIndex index)
focal_class.return: DeliveryStage
focal_class.signature: DeliveryStage launch(Conveyor conveyor, Iterable<Station> stations, ShardIndex index)
focal_class.class_method_signature: Delivery.conveyorStationsFor(Iterable<CatchUp> catchUpJobs,
                                                         DeliveryAction action)
focal_class.full_signature: private ImmutableList<Station> conveyorStationsFor(Iterable<CatchUp> catchUpJobs,
                                                         DeliveryAction action)
focal_class.identifier: conveyorStationsFor
focal_class.modifiers: private
focal_class.parameters: (Iterable<CatchUp> catchUpJobs,
                                                         DeliveryAction action)
focal_class.return: ImmutableList<Station>
focal_class.signature: ImmutableList<Station> conveyorStationsFor(Iterable<CatchUp> catchUpJobs,
                                                         DeliveryAction action)
focal_class.class_method_signature: Delivery.notifyOfDuplicatesIn(Conveyor conveyor)
focal_class.full_signature: private void notifyOfDuplicatesIn(Conveyor conveyor)
focal_class.identifier: notifyOfDuplicatesIn
focal_class.modifiers: private
focal_class.parameters: (Conveyor conveyor)
focal_class.return: void
focal_class.signature: void notifyOfDuplicatesIn(Conveyor conveyor)
focal_class.class_method_signature: Delivery.newStage(ShardIndex index, int deliveredInBatch)
focal_class.full_signature: private static DeliveryStage newStage(ShardIndex index, int deliveredInBatch)
focal_class.identifier: newStage
focal_class.modifiers: private static
focal_class.parameters: (ShardIndex index, int deliveredInBatch)
focal_class.return: DeliveryStage
focal_class.signature: DeliveryStage newStage(ShardIndex index, int deliveredInBatch)
focal_class.class_method_signature: Delivery.monitorTellsToContinue(DeliveryStage stage)
focal_class.full_signature: private boolean monitorTellsToContinue(DeliveryStage stage)
focal_class.identifier: monitorTellsToContinue
focal_class.modifiers: private
focal_class.parameters: (DeliveryStage stage)
focal_class.return: boolean
focal_class.signature: boolean monitorTellsToContinue(DeliveryStage stage)
focal_class.class_method_signature: Delivery.onNewMessage(InboxMessage message)
focal_class.full_signature: @SuppressWarnings("OverlyBroadCatchBlock") private void onNewMessage(InboxMessage message)
focal_class.identifier: onNewMessage
focal_class.modifiers: @SuppressWarnings("OverlyBroadCatchBlock") private
focal_class.parameters: (InboxMessage message)
focal_class.return: void
focal_class.signature: void onNewMessage(InboxMessage message)
focal_class.class_method_signature: Delivery.newInbox(TypeUrl entityType)
focal_class.full_signature: public Inbox.Builder<I> newInbox(TypeUrl entityType)
focal_class.identifier: newInbox
focal_class.modifiers: public
focal_class.parameters: (TypeUrl entityType)
focal_class.return: Inbox.Builder<I>
focal_class.signature: Inbox.Builder<I> newInbox(TypeUrl entityType)
focal_class.class_method_signature: Delivery.newCatchUpProcess(ProjectionRepository<I, ?, ?> repo)
focal_class.full_signature: public CatchUpProcessBuilder<I> newCatchUpProcess(ProjectionRepository<I, ?, ?> repo)
focal_class.identifier: newCatchUpProcess
focal_class.modifiers: public
focal_class.parameters: (ProjectionRepository<I, ?, ?> repo)
focal_class.return: CatchUpProcessBuilder<I>
focal_class.signature: CatchUpProcessBuilder<I> newCatchUpProcess(ProjectionRepository<I, ?, ?> repo)
focal_class.class_method_signature: Delivery.registerDispatchersIn(BoundedContext context)
focal_class.full_signature: @Internal public void registerDispatchersIn(BoundedContext context)
focal_class.identifier: registerDispatchersIn
focal_class.modifiers: @Internal public
focal_class.parameters: (BoundedContext context)
focal_class.return: void
focal_class.signature: void registerDispatchersIn(BoundedContext context)
focal_class.class_method_signature: Delivery.dispatchListener()
focal_class.full_signature: @Internal public MulticastDispatchListener dispatchListener()
focal_class.identifier: dispatchListener
focal_class.modifiers: @Internal public
focal_class.parameters: ()
focal_class.return: MulticastDispatchListener
focal_class.signature: MulticastDispatchListener dispatchListener()
focal_class.class_method_signature: Delivery.subscribe(ShardObserver observer)
focal_class.full_signature: public void subscribe(ShardObserver observer)
focal_class.identifier: subscribe
focal_class.modifiers: public
focal_class.parameters: (ShardObserver observer)
focal_class.return: void
focal_class.signature: void subscribe(ShardObserver observer)
focal_class.class_method_signature: Delivery.register(Inbox<?> inbox)
focal_class.full_signature:  void register(Inbox<?> inbox)
focal_class.identifier: register
focal_class.parameters: (Inbox<?> inbox)
focal_class.return: void
focal_class.signature: void register(Inbox<?> inbox)
focal_class.class_method_signature: Delivery.whichShardFor(Object entityId, TypeUrl entityStateType)
focal_class.full_signature:  ShardIndex whichShardFor(Object entityId, TypeUrl entityStateType)
focal_class.identifier: whichShardFor
focal_class.parameters: (Object entityId, TypeUrl entityStateType)
focal_class.return: ShardIndex
focal_class.signature: ShardIndex whichShardFor(Object entityId, TypeUrl entityStateType)
focal_class.class_method_signature: Delivery.unregister(Inbox<?> inbox)
focal_class.full_signature:  void unregister(Inbox<?> inbox)
focal_class.identifier: unregister
focal_class.parameters: (Inbox<?> inbox)
focal_class.return: void
focal_class.signature: void unregister(Inbox<?> inbox)
focal_class.class_method_signature: Delivery.inboxStorage()
focal_class.full_signature: @VisibleForTesting InboxStorage inboxStorage()
focal_class.identifier: inboxStorage
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: ()
focal_class.return: InboxStorage
focal_class.signature: InboxStorage inboxStorage()
focal_class.class_method_signature: Delivery.shardCount()
focal_class.full_signature:  int shardCount()
focal_class.identifier: shardCount
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int shardCount()
focal_class.class_method_signature: Delivery.shardObservers()
focal_class.full_signature: @VisibleForTesting ImmutableList<ShardObserver> shardObservers()
focal_class.identifier: shardObservers
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: ()
focal_class.return: ImmutableList<ShardObserver>
focal_class.signature: ImmutableList<ShardObserver> shardObservers()
focal_class.class_method_signature: Delivery.inboxWriter()
focal_class.full_signature: private InboxWriter inboxWriter()
focal_class.identifier: inboxWriter
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: InboxWriter
focal_class.signature: InboxWriter inboxWriter()
focal_method.body: public static DeliveryBuilder newBuilder() {
          return new DeliveryBuilder();
      }
focal_method.class_method_signature: Delivery.newBuilder()
focal_method.full_signature: public static DeliveryBuilder newBuilder()
focal_method.identifier: newBuilder
focal_method.modifiers: public static
focal_method.parameters: ()
focal_method.return: DeliveryBuilder
focal_method.signature: DeliveryBuilder newBuilder()