/*
Called by Declarative Services to activate service
965091
@SuppressWarnings({ "unchecked", "rawtypes" })
    protected void activate(ComponentContext cc) {
        BundleContext bundleContext = cc.getBundleContext();
        monitorServiceTracker = new ServiceTracker(bundleContext, "com.ibm.websphere.monitor.MonitorManager", new ServiceTrackerCustomizer() {

            @Override
            public Object addingService(ServiceReference serviceReference) {
                init();
                return this;
            }

            @Override
            public void modifiedService(ServiceReference arg0, Object serviceReference) {}

            @Override
            public void removedService(ServiceReference arg0, Object serviceReference) {
                preDestroy();
            }
        });;
        monitorServiceTracker.open();
    }
586461
function onActivate(event) {
  // Delete old caches to save space.
  const dropOldCaches = async () => {
    const cacheNames = await caches.keys();

    // Return true on all the caches we want to clean up.
    // Note that caches are shared across the origin, so only remove
    // caches we are sure we created.
    const cleanTheseUp = cacheNames.filter((cacheName) =>
        cacheName.startsWith(CACHE_NAME_PREFIX) && cacheName != CACHE_NAME);

    const cleanUpPromises =
        cleanTheseUp.map((cacheName) => caches.delete(cacheName));

    await Promise.all(cleanUpPromises);
  };

  event.waitUntil(dropOldCaches());
}
846166
private synchronized static void activating(String classname, int fn)
	{
		m.put(classname, StaticOperationsCounters.act[fn]++);
		m.put(classname, StaticOperationsCounters.active[fn]++);
		stateChanged();
	}
5606
function onServices() {
  //debug('onServices');
  var numServices = Object.keys(this.services).length;
  if (!this.properties.tethering && numServices > 0) {
    //debug('update servicesCache');
    _servicesCache = this.services;
  }
}
712242
public function activate()
    {
        $db = Loader::db();
        self::deactivateAll();
        $db->Execute('update SystemAntispamLibraries set saslIsActive = 1 where saslHandle = ?', array($this->saslHandle));
    }
1185528
public synchronized void enable() {
        ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE);
        StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER));
        connection().addStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR, filter);
    }
1182913
public static void invokeServiceAdded(ServiceConfig cfg, Service<?, ?> service) {
        requireNonNull(cfg, "cfg");
        requireNonNull(service, "service");

        try {
            service.serviceAdded(cfg);
        } catch (Exception e) {
            throw new IllegalStateException(
                    "failed to invoke serviceAdded() on: " + service, e);
        }
    }
901930
def _activate(self):
        """"""
        if six.callable(self.streamer):
            # If it's a function, create the stream.
            self.stream_ = self.streamer(*(self.args), **(self.kwargs))

        else:
            # If it's iterable, use it directly.
            self.stream_ = iter(self.streamer)
21920
@Override
    public void activate(final Object maintainer) throws InterruptedException, CouldNotPerformException {
        if (!isLocked() || this.maintainer.equals(maintainer)) {
            synchronized (maintainerLock) {
                unlock(maintainer);
                activate();
                lock(maintainer);
            }
        } else {
            throw new VerificationFailedException("[" + maintainer + "] is not the current maintainer of this remote");
        }
    }
949151
@Reference(name = REFERENCE_ENDPOINT_ACTIVATION_SERVICES,
               service = EndpointActivationService.class,
               policy = ReferencePolicy.DYNAMIC,
               cardinality = ReferenceCardinality.MULTIPLE)
    protected synchronized void addEndPointActivationService(ServiceReference<EndpointActivationService> reference) {
        String activationSvcId = (String) reference.getProperty(ACT_SPEC_CFG_ID);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "activationSvcId : " + activationSvcId);
        }

        EndpointActivationServiceInfo easInfo = createEndpointActivationServiceInfo(activationSvcId);

        // Deactivate any endpoints that were using the old service.
        if (easInfo.service != null) {
            deactivateEndpoints(easInfo.endpointFactories);
        }

        // Activate any endpoints with the new service.
        easInfo.setReference(reference);
        activateDeferredEndpoints(easInfo.endpointFactories);
    }
883747
public function activate()
    {
        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/activate/');
        $this->deserialize($data);
    }
872658
@SuppressWarnings("rawtypes")
    protected <S> ServiceRegistration registerService(Class<S> clazz, S service,
            Map<String, ?> props) {
        if (service instanceof IBundleAwareService) {
            ((IBundleAwareService) service).setBundle(bundle);
        }

        Dictionary<String, Object> _p = new Hashtable<String, Object>();
        if (props != null) {
            for (Entry<String, ?> entry : props.entrySet()) {
                _p.put(entry.getKey(), entry.getValue());
            }
        }
        ServiceRegistration sr = bundleContext.registerService(clazz, service, _p);
        registeredServices.add(sr);
        return sr;
    }
584697
protected synchronized void activate(ComponentContext cc) {
        pipelineRef.activate(cc);
        securityServiceRef.activate(cc);

        insertJMXSecurityFilter();
    }
1355893
def activate(self):
        

        raise NotImplementedError("{0} | '{1}' must be implemented by '{2}' subclasses!".format(
            self.__class__.__name__, self.activate.__name__, self.__class__.__name__))
579036
function selectService (service){

    if(typeof(uServices[service]) !== 'undefined'){

        if (uServices[service].length !== 0 ) {
            var uService = uServices[service], //array
                activeuService = uService[0];
            // the first service should be active but if is not, should look for an active one
            if (activeuService.status == 0) {
                var foundOne = false;
                for ( var i = 0 ; i < uService.length ; i++ ){
                    if ( foundOne == false && uService[i].status == 1 ) {
                        activeuService = uService[i];
                        foundOne = true;
                    }
                }
                //if there is not active service just stay whith the first one
            }

            activeuService.status = 0;     //change state to busy

            uService.shift();              //take the service out of the list
            uService.push(activeuService); // pushing the service at the end of the list
            uService[0].status = 1;        //activate other service

            //save the new uServices
            uServices[service] = uService;

            // changing the variable on redis
            client.set('uServices', JSON.stringify(uServices));
            // Publish that it did an update
            client.publish('uServicesChannel', 'UPDATE');
            return activeuService;

        } else {
            //not services availables
            console.log('Not services %s available', service);
            //return error to broker
            return 'Not services '+service+' available'
        }

    } else {
        return "not services with name "+service;
        // return an error cause there are no services with that name
    }
}
308941
function()
    {
        var _this = this;

        _(api.services).each(function(service, key) {
            _this._addService(service);
        });
    }
1227931
@Override
    public void activate(final T instance, final Object key) throws DempsyException {
        wrap(() -> activationMethod.invoke(instance, key));
    }