Register work manager
@param wm The work manager
971670
public void registerWorkManager(WorkManager wm)
   {
      if (wm != null)
      {
         if (wm.getName() == null || wm.getName().trim().equals(""))
            throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm);

         if (trace)
            log.tracef("Registering WorkManager: %s", wm);

         if (!workmanagers.keySet().contains(wm.getName()))
         {
            workmanagers.put(wm.getName(), wm);

            // Replay events for distributed work managers
            if (wm instanceof DistributedWorkManager)
            {
               WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance();
               List<WorkManagerEvent> events = wmeq.getEvents(wm.getName());

               if (!events.isEmpty())
               {
                  if (trace)
                     log.tracef("%s: Events=%s", wm.getName(), events);

                  for (WorkManagerEvent event : events)
                  {
                     if (event.getType() == WorkManagerEvent.TYPE_JOIN)
                     {
                        DistributedWorkManager dwm = resolveDistributedWorkManager(event.getAddress());

                        if (dwm != null)
                        {
                           Collection<NotificationListener> copy =
                              new ArrayList<>(dwm.getNotificationListeners());
                           for (NotificationListener nl : copy)
                           {
                              nl.join(event.getAddress());
                           }
                        }
                     }
                     else if (event.getType() == WorkManagerEvent.TYPE_LEAVE)
                     {
                        DistributedWorkManager dwm = 
                           (DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());

                        if (dwm != null)
                        {
                           Collection<NotificationListener> copy =
                              new ArrayList<NotificationListener>(dwm.getNotificationListeners());
                           for (NotificationListener nl : copy)
                           {
                              nl.leave(event.getAddress());
                           }
                        }

                        removeWorkManager(event.getAddress().getWorkManagerId());
                     }
                     else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_SHORT_RUNNING)
                     {
                        DistributedWorkManager dwm = 
                           (DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());

                        if (dwm != null)
                        {
                           Collection<NotificationListener> copy =
                              new ArrayList<NotificationListener>(dwm.getNotificationListeners());
                           for (NotificationListener nl : copy)
                           {
                              nl.updateShortRunningFree(event.getAddress(), event.getValue());
                           }
                        }
                     }
                     else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING)
                     {
                        DistributedWorkManager dwm = 
                           (DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());

                        if (dwm != null)
                        {
                           Collection<NotificationListener> copy =
                              new ArrayList<NotificationListener>(dwm.getNotificationListeners());
                           for (NotificationListener nl : copy)
                           {
                              nl.updateLongRunningFree(event.getAddress(), event.getValue());
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
317754
public synchronized WorkManager createWorkManager(String id, String name)
   {
      if (id == null || id.trim().equals(""))
         throw new IllegalArgumentException("The id of WorkManager is invalid: " + id);

      // Check for an active work manager
      if (activeWorkmanagers.keySet().contains(id))
      {
         if (trace)
            log.tracef("RefCounting WorkManager: %s", id);

         Integer i = refCountWorkmanagers.get(id);
         refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1));

         WorkManager wm = activeWorkmanagers.get(id);
         if (wm instanceof DistributedWorkManager)
         {
            DistributedWorkManager dwm = (DistributedWorkManager)wm;
            if (dwm.getTransport() != null)
               dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
         }

         return wm;
      }

      try
      {
         // Create a new instance
         WorkManager template = null;
         if (name != null)
         {
            template = workmanagers.get(name);
         }
         else
         {
            template = defaultWorkManager;
         }

         if (template == null)
            throw new IllegalArgumentException("The WorkManager wasn't found: " + name);

         WorkManager wm = template.clone();
         wm.setId(id);

         if (wm instanceof DistributedWorkManager)
         {
            DistributedWorkManager dwm = (DistributedWorkManager)wm;
            dwm.initialize();

            if (dwm.getTransport() != null)
            {
               dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
               try
               {
                  ((DistributedWorkManager) wm).getTransport().startup();
               }
               catch (Throwable t)
               {
                  throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" +
                        ((DistributedWorkManager) wm).getTransport().getId(), t);
               }
            }
            else
            {
               throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() +
                     " doesn't have a transport associated");
            }
         }

         activeWorkmanagers.put(id, wm);
         refCountWorkmanagers.put(id, Integer.valueOf(1));

         if (trace)
            log.tracef("Created WorkManager: %s", wm);

         return wm;
      }
      catch (Throwable t)
      {
         throw new IllegalStateException("The WorkManager couldn't be created: " + name, t);
      }
   }
932465
private void addWindowManager(WindowManager wm) {
        if (subManagers == null) {
            subManagers = new ArrayList();
        }
        if (!subManagers.contains(wm)) {
            subManagers.add(wm);
            wm.parentManager = this;
        }
    }
203019
public function register(string $name, ServiceManager $service_manager)
    {
        $this->service_managers[$name] = $service_manager;
        if (Core::i()->log) {
            Core::i()->log->debug('Registered service manager: ' . $name);
        }
    }
1115956
protected function registerWorkCommand()
    {
        $this->app->extend('command.queue.work', function () {
            if ($this->eye->laravelVersionIs('>=', '5.3.0')) {
                return new WorkCommand($this->app['queue.worker']);
            } else {
                return new LegacyWorkCommand($this->app['queue.worker']);
            }
        });
    }
484991
void addWorkWrapper(WorkWrapper ww)
   {
      synchronized (activeWorkWrappers)
      {
         activeWorkWrappers.add(ww);

         if (statisticsEnabled)
            statistics.setWorkActive(activeWorkWrappers.size());
      }
   }
820004
protected function registerBindings()
    {
        // bind the manager class.
        $this->app->bind(Contracts\Token\Manager::class, Manager::class);

        // bind the guard class.
        $this->app->bind(Contracts\Auth\Guard::class, Guard::class);
    }
862511
function (manager) {
  this.config = {};
  this.manager = manager;
  this.debug = manager.debug;
  this.binder = new ProxyBinder(this.manager);
  this.api = this.manager.api;
  this.manifests = {};
  this.providers = {};

  this.id = 'ModuleInternal';
  this.pendingPorts = 0;
  this.requests = {};
  this.unboundPorts = {};

  util.handleEvents(this);
}
83015
public function register(ShortcodeInterface $shortcode, ?string $name = null): ManagerInterface
    {
        $name = $name ?: $shortcode->getName();

        if (!$name) {
            throw RegisterException::blank();
        } elseif ($this->isRegistered($name)) {
            throw RegisterException::duplicate($name);
        }

        if ($shortcode instanceof ContainerAwareInterface) {
            $shortcode->bind($this);
        }

        $this->shortcodes[$name] = $shortcode;

        return $this;
    }
699202
protected function registerEntityManager()
    {
        // Bind the default Entity Manager
        $this->app->singleton('em', function ($app) {
            return $app->make(ManagerRegistry::class)->getManager();
        });

        $this->app->alias('em', EntityManager::class);
        $this->app->alias('em', EntityManagerInterface::class);
    }
1358380
public void localWorkManagerAdd(Address address, T physicalAddress)
   {
      if (trace)
         log.tracef("LOCAL_WORKMANAGER_ADD(%s, %s)", address, physicalAddress);

      join(address, physicalAddress);
   }
1237405
public static void registerMbean(Object mbean, ObjectName name) {
        registerMbean(ManagementFactory.getPlatformMBeanServer(),
                      JmxUtils.createModelMBean(mbean),
                      name);
    }
1017998
public static AsmMeter registerWorkerMeter(String topologyId, String name, AsmMeter meter) {
        return (AsmMeter) registerWorkerMetric(
                MetricUtils.workerMetricName(topologyId, host, 0, name, MetricType.METER), meter);
    }
70191
protected function registerWorkerStartCallback()
    {
        $this->swooleServer->on('WorkerStart', function ($server, $workerId) {
            $this->setProcessName(sprintf(
                '%s : Worker %d%s', $this->app->name(), $workerId, $server->taskworker ? ' Task' : ''
            ));

            $this->events->dispatch(new Events\WorkerStarted($this, $workerId));

            $this->dispatchEvent('WorkerStart', $this, $workerId);
        });
    }
876968
protected void setupRegistration() {
        if (isServiceWorkerSupported()) {
            Navigator.serviceWorker.register(getResource()).then(object -> {
                logger.info("Service worker has been successfully registered");
                registration = (ServiceWorkerRegistration) object;

                onRegistered(new ServiceEvent(), registration);

                // Observe service worker lifecycle
                observeLifecycle(registration);

                // Setup Service Worker events events
                setupOnControllerChangeEvent();
                setupOnMessageEvent();
                setupOnErrorEvent();
                return null;
            }, error -> {
                logger.info("ServiceWorker registration failed: " + error);
                return null;
            });
        } else {
            logger.info("Service worker is not supported by this browser.");
        }
    }
1132
def register_actions(self, shortcut_manager):
        
        shortcut_manager.add_callback_for_action("undo", self.undo)
        shortcut_manager.add_callback_for_action("redo", self.redo)
1287236
def register(self, observer):
        
        self.observer_manager.append(observer)
        observer.manager = self