@Override public void close() { if ( stopped.compareAndSet( false, true ) ) { //make sure we only stop once try ( Closer<RuntimeException> closer = new Closer<>() ) { closer.push( () -> { try { worker.close(); } catch (Exception e) { log.workerException( e ); } } ); closer.push( allIndexesManager::stop ); closer.push( timingSource::stop ); if ( workSerializer != null ) { closer.push( serviceManager::releaseService, LuceneWorkSerializer.class ); } // Execute this before closing the service manager to allow integrations to release services closer.pushAll( SearchIntegration::close, this.integrations.values() ); closer.push( serviceManager::releaseAllServices ); // unregister statistic mbean if ( statisticsMBeanName != null ) { closer.push( JMXRegistrar::unRegisterMBean, statisticsMBeanName ); } } } }
@Override public void close() { if ( stopped.compareAndSet( false, true ) ) { //make sure we only stop once try ( Closer<RuntimeException> closer = new Closer<>() ) { closer.push( () -> { try { worker.close(); } catch (Exception e) { log.workerException( e ); } } ); closer.push( allIndexesManager::stop ); closer.push( timingSource::stop ); if ( workSerializer != null ) { closer.push( serviceManager::releaseService, LuceneWorkSerializer.class ); } closer.push( serviceManager::releaseAllServices ); closer.pushAll( SearchIntegration::close, this.integrations.values() ); // unregister statistic mbean if ( statisticsMBeanName != null ) { closer.push( JMXRegistrar::unRegisterMBean, statisticsMBeanName ); } } } }