/** * Stops the service collection and releases resources. * * @see AbstractLifecycle#onStop */ @Override protected void onStop() { if( m_serviceCollection != null ) { m_serviceCollection.stop(); m_serviceCollection = null; } setService( null ); }
/** * Resolves a new service by serching the services collection for first available service. */ private synchronized void resolveService() { T newService = null; final Iterator<T> it = m_serviceCollection.iterator(); while( newService == null && it.hasNext() ) { final T candidateService = it.next(); if( !candidateService.equals( getService() ) ) { newService = candidateService; } } setService( newService ); }