/*
Service Lifecycle Methods
197386
@Override
    public void start(final StartContext context) throws StartException {
        AbstractKeyManagerService keyManagers = injectedKeyManagers.getOptionalValue();
        TrustManager[] trustManagers = injectedtrustManagers.getOptionalValue();

        try {
            SSLContext sslContext = SSLContext.getInstance(protocol);
            if(keyManagers != null && keyManagers.isLazy()) {
                sslContext = new LazyInitSSLContext(sslContext, injectedKeyManagers, injectedtrustManagers, enabledCipherSuites, enabledProtocols);
            } else {
                sslContext.init(keyManagers != null ? keyManagers.getKeyManagers() : null, trustManagers, null);
                sslContext = wrapSslContext(sslContext, enabledCipherSuites, enabledProtocols);
            }

            this.theSSLContext = sslContext;

        } catch (NoSuchAlgorithmException e) {
            throw DomainManagementLogger.ROOT_LOGGER.unableToStart(e);
        } catch (KeyManagementException e) {
            throw DomainManagementLogger.ROOT_LOGGER.unableToStart(e);
        }
    }
949094
public static void initEndpointDirectories(MuleContext muleContext, String[] serviceNames, String[] endpointNames) throws Exception {

		// Stop all named services (either Flows or services
		List<Lifecycle> services = new ArrayList<Lifecycle>();
		for (String serviceName : serviceNames) {
			try {
				Lifecycle service = muleContext.getRegistry().lookupObject(serviceName);
//				logServiceStatus(service);
//				service.stop();
//				logServiceStatus(service);
				services.add(service);
			} catch (Exception e) {
				logger.error("Error '" + e.getMessage()
						+ "' occured while stopping the service " + serviceName
						+ ". Perhaps the service did not exist in the config?");
				throw e;
			}
		}

		// Now init the directory for each named endpoint, one by one
		for (String endpointName : endpointNames) {
			initEndpointDirectory(muleContext, endpointName);
		}

		// We are done, startup the services again so that the test can begin...
		for (@SuppressWarnings("unused") Lifecycle service : services) {
//			logServiceStatus(service);
//			service.start();
//			logServiceStatus(service);
		}
	}
309617
function (jid, service) {
        var that = this._connection;
        if (service === undefined) {
            service = jid;
            jid = undefined;
        }
        this.jid = jid || that.jid;
        this.service = service || null;
        this._autoService = false;
    }
1150318
@Override
  public synchronized void start() {
    startTime = System.currentTimeMillis();
    ensureCurrentState(STATE.INITED);
    changeState(STATE.STARTED);
    LOG.info("Service:" + getName() + " is started.");
  }
1270808
@Override
	public void injectServices(ServiceRegistryImplementor serviceRegistry) {
		if ( gridDialect instanceof ServiceRegistryAwareService ) {
			( (ServiceRegistryAwareService) gridDialect ).injectServices( serviceRegistry );
		}
	}
424124
@SuppressWarnings("unchecked")
  private static <S> Iterable<S> constructAllServiceImplementations(Class<S> _service) {
    ClassLoader cl = CacheManagerImpl.class.getClassLoader();
    ArrayList<S> li = new ArrayList<S>();
    Iterator<S> it = ServiceLoader.load(_service, cl).iterator();
    while (it.hasNext()) {
      try {
        li.add(it.next());
      } catch (ServiceConfigurationError ex) {
        Log.getLog(CacheManager.class.getName()).debug("Error loading service '" + _service + "'", ex);
      }
    }
    final S[] a = (S[]) Array.newInstance(_service, li.size());
    li.toArray(a);
    return new Iterable<S>() {
      public Iterator<S> iterator() {
        return new Iterator<S>() {
          private int pos = 0;
          public boolean hasNext() {
            return pos < a.length;
          }
          public S next() {
            return a[pos++];
          }
          public void remove() {
            throw new UnsupportedOperationException();
          }
        };
      }
    };
  }
186347
private function initializeServiceContainer()
    {
        $this->containerManager = new ServiceContainerManager($this->dispatcher, $this->getLogger());
        $class = $this->getContainerClass();
        $container = $this->containerManager->initializeServiceContainer($class);
        $this->dispatcher->notify(new sfEvent($container, 'service_container.loaded'));

    }
322653
private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) {
        for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) {

            // Add a method to the multimap entry
            // TODO sort
            lifecycleMethod.add(annotationClass.getName(), method);
        }
    }
951379
private Element lifeCycle(HttpServletRequest request,
                              String id,
                              LifeCycle lc,
                              String name)
    {
        Composite comp=new Composite();
        comp.add(new Target(id));
        Font font = new Font();
        comp.add(font);
        font.color(lc.isStarted()?"green":"red");
        font.add(name);

        String action=lc.isStarted()?"Stop":"Start";
        
        comp.add("&nbsp;[");
        comp.add(new Link(URI.addPaths(request.getContextPath(),request.getServletPath())+
                          "?T="+Long.toString(System.currentTimeMillis(),36)+
                          "&A="+action+
                          "&ID="+UrlEncoded.encodeString(id),
                          action));
        comp.add("]");
        return comp;
    }
884962
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) {
        metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT);

        // service reference section
        metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT,
                SERVICE_COUNTER_LABELS_BUFFER_LENGTH);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT,
                SERVICE_COUNTER_VALUES_BUFFER_LENGTH);
    }
180303
@Autowired ( required = false )
  public void register(OAuthTokenLifecycleListener... lifecycleListeners) {
    if (lifecycleListeners != null) {
      this.lifecycleListeners.addAll(Arrays.asList(lifecycleListeners));
    }
  }
88061
@Override
  public void start()
  {
    if (_lifecycle.isActive()) {
      return;
    }
    
    synchronized (_lifecycle) {
      if (! _lifecycle.toInit()) {
        return;
      }
      
      init(_stubMain);
    }
    
    start(_stubMain);
  }
459042
function init(){
    if(!cacheServiceConfig) {
      cacheServiceConfig = {};
    }
    self.nameSpace = cacheServiceConfig.nameSpace || '';
    self.verbose = (typeof cacheServiceConfig.verbose === 'boolean') ? cacheServiceConfig.verbose : false;
    self.writeToVolatileCaches = (typeof cacheServiceConfig.writeToVolatileCaches === 'boolean') ? cacheServiceConfig.writeToVolatileCaches : true;
    self.caches = new CacheCollection({nameSpace: self.nameSpace, verbose: self.verbose}, cacheModules).caches;
    self.cachesLength = self.caches.length;
  }
692334
function process(services) {
            if (services == null || (typeof services === "undefined" ? "undefined" : _typeof(services)) !== "object") {
                throw new Error("Service definitions should be an object, a function returning an object (or a !!promise resolving to an object!!)");
            }
            var index = 0;
            var next = Object.keys(services)[index];
            return this.processKey(index, next, services).then(function () {
                return this;
            }.bind(this));
        }
1128405
@Override
    public Object startupService(BundleContext bundleContext)
    {
        service = this.createServiceTracker(context, getHttpContext(), this.getProperties());
        ((HttpServiceTracker)service).open();

        return service;
    }
574729
public void init(IPersistentSubscriptionStore storageService) {
        Log.debug("init invoked");

        m_storageService = storageService;

        //reload any subscriptions persisted
        if (Log.DEBUG) {
            Log.debug("Reloading all stored subscriptions...subscription tree before {}", dumpTree());
        }
        
        for (Subscription subscription : m_storageService.retrieveAllSubscriptions()) {
            Log.debug("Re-subscribing {} to topic {}", subscription.getClientId(), subscription.getTopic());
            addDirect(subscription);
        }
        if (Log.DEBUG) {
            Log.debug("Finished loading. Subscription tree after {}", dumpTree());
        }
    }
389224
protected function initializeServices()
    {
        // Initiate registry, route, params, and set base route based on finding.
        $this->services['route'] = $this->finding->getRoute();

        $this->params = $this->finding->getParameters();

        $this->services['request'] = $this->finding->getRequest();
    }