Registers this object in our proxy cache and notifies the subscribers that were waiting for
subscription to this object.
181192
protected <T extends DObject> void registerObjectAndNotify (ObjectResponse<T> orsp)
    {
        // let the object know that we'll be managing it
        T obj = orsp.getObject();
        obj.setManager(this);

        // stick the object into the proxy object table
        _ocache.put(obj.getOid(), obj);

        // let the penders know that the object is available
        PendingRequest<?> req = _penders.remove(obj.getOid());
        if (req == null) {
            log.warning("Got object, but no one cares?!", "oid", obj.getOid(), "obj", obj);
            return;
        }

        for (int ii = 0; ii < req.targets.size(); ii++) {
            @SuppressWarnings("unchecked") Subscriber<T> target = (Subscriber<T>)req.targets.get(ii);
            // add them as a subscriber
            obj.addSubscriber(target);
            // and let them know that the object is in
            target.objectAvailable(obj);
        }
    }
1202346
def subscribe(caller = nil, &block)
      if block_given?
        notify_when = block.call(state)
        @listeners << { obj: block.binding.receiver, notify_when: notify_when }
      else
        @listeners << { obj: caller }
      end
    end
642873
static void registerIn(ConversionService conversionService) {

        LettuceAssert.notNull(conversionService, "ConversionService must not be null!");

        if (ReactiveTypes.isAvailable(ReactiveLibrary.PROJECT_REACTOR)) {

            if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA1)) {

                conversionService.addConverter(PublisherToRxJava1CompletableAdapter.INSTANCE);
                conversionService.addConverter(RxJava1CompletableToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava1CompletableToMonoAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava1SingleAdapter.INSTANCE);
                conversionService.addConverter(RxJava1SingleToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava1SingleToMonoAdapter.INSTANCE);
                conversionService.addConverter(RxJava1SingleToFluxAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava1ObservableAdapter.INSTANCE);
                conversionService.addConverter(RxJava1ObservableToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava1ObservableToMonoAdapter.INSTANCE);
                conversionService.addConverter(RxJava1ObservableToFluxAdapter.INSTANCE);
            }

            if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA2)) {

                conversionService.addConverter(PublisherToRxJava2CompletableAdapter.INSTANCE);
                conversionService.addConverter(RxJava2CompletableToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava2CompletableToMonoAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava2SingleAdapter.INSTANCE);
                conversionService.addConverter(RxJava2SingleToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava2SingleToMonoAdapter.INSTANCE);
                conversionService.addConverter(RxJava2SingleToFluxAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava2ObservableAdapter.INSTANCE);
                conversionService.addConverter(RxJava2ObservableToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava2ObservableToMonoAdapter.INSTANCE);
                conversionService.addConverter(RxJava2ObservableToFluxAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava2FlowableAdapter.INSTANCE);
                conversionService.addConverter(RxJava2FlowableToPublisherAdapter.INSTANCE);

                conversionService.addConverter(PublisherToRxJava2MaybeAdapter.INSTANCE);
                conversionService.addConverter(RxJava2MaybeToPublisherAdapter.INSTANCE);
                conversionService.addConverter(RxJava2MaybeToMonoAdapter.INSTANCE);
                conversionService.addConverter(RxJava2MaybeToFluxAdapter.INSTANCE);
            }

            conversionService.addConverter(PublisherToMonoAdapter.INSTANCE);
            conversionService.addConverter(PublisherToFluxAdapter.INSTANCE);

            if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA1)) {
                conversionService.addConverter(RxJava1SingleToObservableAdapter.INSTANCE);
                conversionService.addConverter(RxJava1ObservableToSingleAdapter.INSTANCE);
            }

            if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA2)) {
                conversionService.addConverter(RxJava2SingleToObservableAdapter.INSTANCE);
                conversionService.addConverter(RxJava2ObservableToSingleAdapter.INSTANCE);
                conversionService.addConverter(RxJava2ObservableToMaybeAdapter.INSTANCE);
            }
        }
    }
876805
def _dispatch_legacy_subscriber(self, obj, *args, **kwargs):
    """"""
    if obj in self._legacy_subscribers:
      self._legacy_subscribers[obj](obj)
201298
protected void registerSelf() {
        publishSelf();
        serviceRegistry.get().registerService(getServiceDescription());
        serviceRegistry.get().subscribe((pair, err) -> {
            serviceEvent(pair.car(), pair.cdr(), err);
        });
        heartBeat();
        Log.Info(this, "registered at serviceRegistry.");
    }
492579
function (host, done_cb, secure) {
    // Initializes the object that stores subscriptions
    this.subscriptions = {};
    // Initializes the object that holds the internal client
    this.client = {};
    // Functions backlog
    this.backlog = [];
    // Connect
    this.client = connectBrowser(this.subscriptions, this.backlog, host, done_cb, secure);
}
1110444
def post(self, request):
        """"""
        try:
            observer_id = request.query_params['observer']
            session_id = request.query_params['subscriber']
        except KeyError:
            return response.Response(status=400)

        observer.remove_subscriber(session_id, observer_id)
        return response.Response()
1136650
def event_subscriber(event):
    
    def wrapper(method):
        Registry.register_event(event.name, event, method)
    return wrapper
74318
static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
        if (it == null) {
            error(s, new NullPointerException("The iterator is null"));
            return;
        }

        boolean b;

        try {
            b = it.hasNext();
        } catch (Throwable e) {
            error(s, e);
            return;
        }

        if (!b) {
           complete(s);
            return;
        }

        s.onSubscribe(new IterableSubscription<T>(s, it));

    }
718899
public void register(final Object listener) {
		for (Class clazz = listener.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
			Method[] methods = clazz.getMethods();
			for (Method m : methods) {
				if (!m.isAnnotationPresent(Subscribe.class)) continue;
				Class[] params = m.getParameterTypes();

				if (params.length != 1)
					throw new IllegalArgumentException("Method " + m + " has @Subscribe annotation" +
							"and requires " + params.length +
							" arguments, but event-handling methods must require just one argument");
				Class event = params[0];
				EventHandler handler = new EventHandler(listener, m);
				this.handlersByEventType.put(event, handler);
			}
		}
	}
1067441
protected function fill_user_subscription_cache() {
        foreach ($this->forums as $forum) {
            $cm = get_fast_modinfo($this->courses[$forum->course])->instances['forum'][$forum->id];
            $modcontext = \context_module::instance($cm->id);

            $this->subscribedusers[$forum->id] = [];
            if ($users = \mod_forum\subscriptions::fetch_subscribed_users($forum, 0, $modcontext, 'u.id, u.maildigest', true)) {
                foreach ($users as $user) {
                    // This user is subscribed to this forum.
                    $this->subscribedusers[$forum->id][$user->id] = $user->id;
                    if (!isset($this->users[$user->id])) {
                        // Store minimal user info.
                        $this->users[$user->id] = $user;
                    }
                }
                // Release memory.
                unset($users);
            }
        }
    }
304062
public static void preRegister(Context context) {
        context.put(FSInfo.class, new Context.Factory<FSInfo>() {
            public FSInfo make(Context c) {
                FSInfo instance = new CacheFSInfo();
                c.put(FSInfo.class, instance);
                return instance;
            }
        });
    }
1089075
protected boolean register(IEventListener listener) {
        log.debug("register - listener: {}", listener);
        boolean registered = listeners.add(listener);
        if (registered) {
            listenerStats.increment();
            // prepare response for new client
            ownerMessage.addEvent(Type.CLIENT_INITIAL_DATA, null, null);
            if (!isPersistent()) {
                ownerMessage.addEvent(Type.CLIENT_CLEAR_DATA, null, null);
            }
            if (!attributes.isEmpty()) {
                ownerMessage.addEvent(new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, null, getAttributes()));
            }
            // we call notifyModified here to send response if we're not in a beginUpdate block
            notifyModified();
        }
        return registered;
    }
861833
private function doBeforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$dispatcher = $builder->getDefinition($this->prefix('dispatcher'));

		$subscribers = $builder->findByType(EventSubscriberInterface::class);
		foreach ($subscribers as $name => $subscriber) {
			$dispatcher->addSetup('addSubscriber', [$subscriber]);
		}
	}
61320
public synchronized void register(@NonNull EventHandlerWrapper eventHandler) {
        String type = eventHandler.type;
        List<EventHandlerWrapper> handlers = subscribers.get(eventHandler.type);
        if (handlers == null) {
            handlers = new ArrayList<>();
            subscribers.put(type, handlers);
        }
        handlers.add(eventHandler);
    }
744978
public void register(CacheEntryListenerConfiguration<K, V> configuration) {
    if (configuration.getCacheEntryListenerFactory() == null) {
      return;
    }
    EventTypeAwareListener<K, V> listener = new EventTypeAwareListener<>(
        configuration.getCacheEntryListenerFactory().create());

    CacheEntryEventFilter<K, V> filter = event -> true;
    if (configuration.getCacheEntryEventFilterFactory() != null) {
      filter = new EventTypeFilter<>(listener,
          configuration.getCacheEntryEventFilterFactory().create());
    }

    Registration<K, V> registration = new Registration<>(configuration, filter, listener);
    dispatchQueues.putIfAbsent(registration, CompletableFuture.completedFuture(null));
  }
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());
    }