Synchronize the internal set of subscriptions with the map that is passed in.

@param subs
Complete set of subscriptions for all groups. The keys for the map are the
group names.
@return
This instance for chaining of update operations.
350594
public Evaluator sync(Map<String, List<Subscription>> subs) {
    Set<String> removed = subscriptions.keySet();
    removed.removeAll(subs.keySet());
    removed.forEach(this::removeGroupSubscriptions);
    subs.forEach(this::addGroupSubscriptions);
    return this;
  }
262106
@Override
	public void registerConsumer(LocalMessageConsumer consumer)
    {
        super.registerConsumer(consumer);
        
        subscriptionsLock.writeLock().lock();
        try
		{
        	LocalTopicSubscription subscription = subscriptionMap.remove(consumer.getSubscriberId());
        	if (subscription == null)
        	{
        		// New subscription
        		storeNewSubscription(consumer);
        	}
        	else
        	{
        		// Remove old subscription
        		removeSubscription(subscription);
        		// Replace by new subscription
        		storeNewSubscription(consumer);
        	}
		}
        finally
        {
        	subscriptionsLock.writeLock().unlock();
        }
    }
1065214
@Override
    @CallerSideMethod public void subscribe(Subscriber subs) {
        // need callerside to transform to Callback
        Callback callback = (r, e) -> {
            if (Actors.isResult(e))
                subs.getReceiver().receive((ChangeMessage) r);
        };
        _subscribe(subs.getFilter(), callback, subs.getId());
    }
826423
public CollectionRequest<Task> subtasks(String task) {
    
        String path = String.format("/tasks/%s/subtasks", task);
        return new CollectionRequest<Task>(this, Task.class, path, "GET");
    }
67436
public function update($subscriptions)
    {
        $this->initCollection();

        /** @var SubscriptionInterface $subscription */
        foreach ($subscriptions as $subscription) {
            $this->changeSubscription(
                $subscription,
                (bool)$subscription->getSubscriberStatus() === true ?
                    Subscriber::STATUS_SUBSCRIBED :
                    Subscriber::STATUS_UNSUBSCRIBED
            );
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
990131
@Override
    public void updateGroupMembers(IEntityGroup group) throws GroupsException {
        throwExceptionIfNotInternallyManaged();
        getGroupStore().updateMembers(group);
        if (cacheInUse()) {
            cacheUpdate(group);
        }
        synchronizeGroupMembersOnUpdate(group);
    }
1126609
protected void synchronizeGroupMembersOnUpdate(IEntityGroup group) throws GroupsException {
        EntityGroupImpl egi = (EntityGroupImpl) group;
        GroupMemberImpl gmi = null;

        for (Iterator it = egi.getAddedMembers().values().iterator(); it.hasNext(); ) {
            gmi = (GroupMemberImpl) it.next();
            gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
            if (cacheInUse()) {
                cacheUpdate(gmi);
            }
        }

        for (Iterator it = egi.getRemovedMembers().values().iterator(); it.hasNext(); ) {
            gmi = (GroupMemberImpl) it.next();
            gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
            if (cacheInUse()) {
                cacheUpdate(gmi);
            }
        }
    }
1065980
@Override
    public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
    {
        Entry<K, V> from = entry(fromKey, null);
        Entry<K, V> to = entry(toKey, null);
        return new BinaryMap<>(entrySet.subSet(from, fromInclusive, to, toInclusive), comparator);
    }
884506
public Subscriptions getSubscriptions(final SubscriptionState state, final QueryParams params) {
        if (state != null) { params.put("state", state.getType()); }

        return doGET(Subscriptions.SUBSCRIPTIONS_RESOURCE,
                Subscriptions.class, params);
    }
1282238
public void setSubExpressions(java.util.Collection<SearchExpression> subExpressions) {
        if (subExpressions == null) {
            this.subExpressions = null;
            return;
        }

        this.subExpressions = new java.util.ArrayList<SearchExpression>(subExpressions);
    }
1279109
public void subscribe(Class<? extends Event> eventType, Class<? extends Subscriber> subscriberType) {
        if (!subscriptionMap.containsKey(eventType)) {
            subscriptionMap.put(eventType, new ArrayList<>());
        }
        final ArrayList<Class<? extends Subscriber>> subscribers = subscriptionMap.get(eventType);
        if (!subscribers.contains(subscriberType)) {
            subscribers.add(subscriberType);
        }
    }
844908
protected function mapFinalMember(
        IObjectMapper $mapper,
        array $subclassMappings,
        array $nestedRelations,
        IMemberExpression $lastPart
    ) : MemberMapping
    {
        switch (true) {
            case $lastPart instanceof SelfExpression:
                /** @var IEntityMapper $mapper */
                return $this->mapFinalSelfRelation($mapper);

            case $lastPart instanceof MemberPropertyExpression:
                return $this->mapFinalPropertyToMapping($subclassMappings, $nestedRelations, $lastPart->getProperty());

            case $lastPart instanceof LoadIdFromEntitySetMethodExpression:
                $relations    = $this->mapLoadExpressionToRelations($mapper, $lastPart);
                $lastRelation = array_pop($relations);

                return $this->mapFinalRelationToMapping($subclassMappings, array_merge($nestedRelations, $relations), $lastRelation);

            case $lastPart instanceof CollectionCountMethodExpression:
                $lastRelation = array_pop($nestedRelations);

                return new ToManyRelationCountMapping($this->rootEntityMapper, $subclassMappings, $nestedRelations, $lastRelation);

            case $lastPart instanceof ObjectSetAggregateMethodExpression:
                $lastRelation = array_pop($nestedRelations);

                return $this->mapFinalAggregateExpression($subclassMappings, $nestedRelations, $lastRelation, $lastPart);

            case $lastPart instanceof ObjectSetFlattenMethodExpression:
                $relations    = $this->mapMemberExpressionsToRelations($mapper, [$lastPart]);
                $lastRelation = array_pop($relations);

                return $this->mapFinalRelationToMapping($subclassMappings, array_merge($nestedRelations, $relations), $lastRelation);
        }

        throw InvalidArgumentException::format('unknown final member expression type %s', Debug::getType($lastPart));
    }
1090449
public Subscription addSubscriber(Function<? super E, Subscription> subscriber) {
        Objects.requireNonNull(subscriber);
        subscribers.add(subscriber);

        List<E> keys = new ArrayList<>(map.keySet());
        keys.forEach(key -> {
            List<Subscription> otherSubs = map.get(key);
            Subscription sub = subscriber.apply(key);
            otherSubs.add(sub);
            map.put(key, otherSubs);
        });

        return () -> removeSubscriber(subscriber);
    }
606534
public SubscriptionDefinition querySubscription(String subId) 
  throws SIDurableSubscriptionNotFoundException, SINotPossibleInCurrentConfigurationException, SIIncorrectCallException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "querySubscription", subId);

    checkStarted();
    
    if (subId == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "querySubscription", "Exception SubId null");

      throw new SIIncorrectCallException(
        nls.getFormattedMessage(
          "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
          new Object[] { null,
                         messageProcessor.getMessagingEngineName() },
          null));
    }

    ConsumerDispatcherState subState = null;
    HashMap durableSubs = destinationManager.getDurableSubscriptionsTable();

    synchronized (durableSubs)
    {
      //Look up the consumer dispatcher for this subId in the system durable subs list
      ConsumerDispatcher cd = (ConsumerDispatcher) durableSubs.get(subId);

      if (cd == null)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          SibTr.exit(tc, "querySubscription", "Subscription not found");

        throw new SIDurableSubscriptionNotFoundException(
          nls.getFormattedMessage(
            "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
            new Object[] { subId,
                           messageProcessor.getMessagingEngineName() },
            null));
      }

      // Obtain the subscription state from the consumer dispatcher
      subState = cd.getConsumerDispatcherState();
    }
    
    DestinationHandler dest = null;
    try
    {    
      dest = 
        destinationManager.getDestination(subState.getTopicSpaceUuid(), true);
    }
    catch (SITemporaryDestinationNotFoundException e)
    {
      // No FFDC code needed 
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "querySubscription", "SINotPossibleInCurrentConfigurationException");
      throw new SINotPossibleInCurrentConfigurationException(e.getMessage());
    }

    // Create subscription definition
    SubscriptionDefinition subDef =
      new SubscriptionDefinitionImpl(
        dest.getName(),
        subState.getSelectionCriteria().getDiscriminator(),
        subState.getSelectionCriteria().getSelectorString(),
        subState.getSelectionCriteria().getSelectorDomain().toInt(),
        subState.getUser(),
        subState.isNoLocal(),
        subState.getDurableHome());

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "querySubscription", subDef);

    return subDef;
  }
619507
public void setSubscribers(java.util.Collection<Subscriber> subscribers) {
        if (subscribers == null) {
            this.subscribers = null;
            return;
        }

        this.subscribers = new java.util.ArrayList<Subscriber>(subscribers);
    }
289053
public void setMatchspaceSub(ControllableProxySubscription sub)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "setMatchspaceSub", sub);
    
    _controllableProxySubscription = sub;
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "setMatchspaceSub");
  }
259635
private void update(Collection<InternalSubscriptionInfo> subscriptions) {
    for (InternalSubscriptionInfo subscription : subscriptions) {
      InternalTopic topic = topics.computeIfAbsent(subscription.topic, InternalTopic::new);
      InternalSubscriptionInfo matchingSubscription = topic.remoteSubscriptions().stream()
          .filter(s -> s.memberId().equals(subscription.memberId()) && s.logicalTimestamp().equals(subscription.logicalTimestamp()))
          .findFirst()
          .orElse(null);
      if (matchingSubscription == null) {
        topic.addRemoteSubscription(subscription);
      } else if (subscription.isTombstone()) {
        topic.removeRemoteSubscription(subscription);
      }
    }
  }