Skip to content

Commit

Permalink
Issue eclipse-ditto#878: review: renamed methid PublisherIndex.allot.…
Browse files Browse the repository at this point in the history
….. to assign...

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Nov 25, 2020
1 parent 05d3591 commit 0792e18
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private List<Pair<ActorRef, PublishSignal>> doPublish(final Collection<String> t
topicCounter.increment(topics.size());
final List<Long> hashes = topics.stream().map(ddataReader::approximate).collect(Collectors.toList());
final ActorRef sender = getSender();
final List<Pair<ActorRef, PublishSignal>> subscribers = publisherIndex.allotGroupsToSubscribers(signal, hashes);
final List<Pair<ActorRef, PublishSignal>> subscribers =
publisherIndex.assignGroupsToSubscribers(signal, hashes);
subscribers.forEach(pair -> pair.first().tell(pair.second(), sender));
return subscribers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ static PublisherIndex<String> fromSubscriptionsReader(final SubscriptionsReader
return new PublisherIndex<>(index, filterMap);
}

List<Pair<ActorRef, PublishSignal>> allotGroupsToSubscribers(final Signal<?> signal, final Collection<T> topics) {
return allotGroupsToSubscribers(signal, topics, null);
List<Pair<ActorRef, PublishSignal>> assignGroupsToSubscribers(final Signal<?> signal, final Collection<T> topics) {
return assignGroupsToSubscribers(signal, topics, null);
}

List<Pair<ActorRef, PublishSignal>> allotGroupsToSubscribers(final Signal<?> signal, final Collection<T> topics,
List<Pair<ActorRef, PublishSignal>> assignGroupsToSubscribers(final Signal<?> signal, final Collection<T> topics,
@Nullable final Map<String, Integer> chosenGroups) {
final Map<String, List<ActorRef>> groupToSubscribers = new HashMap<>();
final Map<ActorRef, Map<String, Integer>> subscriberToChosenGroups = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void broadcastToLocalSubscribers(final PublishSignal command) {
final T message = messageClass.cast(command.getSignal());
final Collection<String> topics = topicExtractor.getTopics(message);
final Set<ActorRef> localSubscribers =
publisherIndex.allotGroupsToSubscribers(message, topics, command.getGroups())
publisherIndex.assignGroupsToSubscribers(message, topics, command.getGroups())
.stream()
.map(Pair::first)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private T fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders,
try {
return jsonObjectParsable.parse(jsonObject, dittoHeaders, inner);
} catch (final JsonRuntimeException jre) {
final JsonExceptionBuilder builder = JsonRuntimeException.newBuilder(jre.getErrorCode())
final JsonExceptionBuilder<?> builder = JsonRuntimeException.newBuilder(jre.getErrorCode())
.message("Error when parsing Json type '" + type + "': " + jre.getMessage())
.cause(jre.getCause());
jre.getDescription().ifPresent(builder::description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ interface ParseInnerJson {
* @return the deserialized Jsonifiable object.
* @throws NotSerializableException if inner JSON cannot be deserialized.
*/
Jsonifiable<?> parseInnerJson(final JsonObject jsonObject) throws NotSerializableException;
Jsonifiable<?> parseInnerJson(JsonObject jsonObject) throws NotSerializableException;
}
}

0 comments on commit 0792e18

Please sign in to comment.