Buggy code:
public class LensServices extends CompositeService implements ServiceProvider { public static final Log LOG = LogFactory . getLog ( LensServices . class ) ; public static final String LENS_SERVICES_NAME = "lens_services" ; private static final String FS_AUTOMATIC_CLOSE = "fs.automatic.close" ; private static LensServices INSTANCE = new LensServices ( LensServices . LENS_SERVICES_NAME ) ; private HiveConf conf ; private CLIService cliService ; private final Map < String , Service > services = new LinkedHashMap < String , Service > ( ) ; private final List < LensService > lensServices = new ArrayList < LensService > ( ) ; private Path persistDir ; private FileSystem persistenceFS ; private boolean stopping = false ; private long snapShotInterval ; @ Getter @ Setter private LensServices . SERVICE_MODE serviceMode ; private Timer timer ; public enum SERVICE_MODE { READ_ONLY , METASTORE_READONLY , METASTORE_NODROP , OPEN ; } public LensServices ( String name ) { } static void setInstance ( LensServices newInstance ) { } @ SuppressWarnings ( "unchecked" ) @ Override public synchronized void init ( HiveConf hiveConf ) { if ( ( getServiceState ( ) ) == ( STATE . NOTINITED ) ) { conf = hiveConf ; conf . addResource ( "lensserver-default.xml" ) ; conf . addResource ( "lens-site.xml" ) ; conf . setVar ( HIVE_SESSION_IMPL_CLASSNAME , LensSessionImpl . class . getCanonicalName ( ) ) ; serviceMode = conf . getEnum ( SERVER_MODE , LensServices . SERVICE_MODE . valueOf ( DEFAULT_SERVER_MODE ) ) ; cliService = new CLIService ( ) ; addService ( cliService ) ; addService ( new EventServiceImpl ( LensEventService . NAME ) ) ; addService ( new MetricsServiceImpl ( MetricsService . NAME ) ) ; addService ( new StatisticsService ( StatisticsService . STATS_SVC_NAME ) ) ; String [ ] serviceNames = conf . getStrings ( SERVICE_NAMES ) ; for ( String sName : serviceNames ) { try { String serviceClassName = conf . get ( LensConfConstants . getServiceImplConfKey ( sName ) ) ; if ( StringUtils . isBlank ( serviceClassName ) ) { LensServices . LOG . warn ( ( ( ( "Invalid<seq2seq4repair_space>class<seq2seq4repair_space>for<seq2seq4repair_space>service<seq2seq4repair_space>" + sName ) + "<seq2seq4repair_space>class=" ) + serviceClassName ) ) ; continue ; } Class < ? > cls = Class . forName ( serviceClassName ) ; if ( LensService . class . isAssignableFrom ( cls ) ) { Class < ? extends LensService > serviceClass = ( ( Class < ? extends LensService > ) ( cls ) ) ; LensServices . LOG . info ( ( ( ( "Adding<seq2seq4repair_space>" + sName ) + "<seq2seq4repair_space>service<seq2seq4repair_space>with<seq2seq4repair_space>" ) + serviceClass ) ) ; Constructor < ? > constructor = serviceClass . getConstructor ( CLIService . class ) ; LensService service = ( ( LensService ) ( constructor . newInstance ( new Object [ ] { cliService } ) ) ) ; addService ( service ) ; lensServices . add ( service ) ; } else if ( Service . class . isAssignableFrom ( cls ) ) { Class < ? extends Service > serviceClass = ( ( Class < ? extends Service > ) ( cls ) ) ; Service svc = serviceClass . newInstance ( ) ; addService ( svc ) ; } else { LensServices . LOG . warn ( ( ( ( "Unsupported<seq2seq4repair_space>service<seq2seq4repair_space>class<seq2seq4repair_space>" + serviceClassName ) + "<seq2seq4repair_space>for<seq2seq4repair_space>service<seq2seq4repair_space>" ) + sName ) ) ; } } catch ( Exception e ) { LensServices . LOG . warn ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>add<seq2seq4repair_space>service:" + sName ) , e ) ; throw new RuntimeException ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>add<seq2seq4repair_space>service:" + sName ) , e ) ; } } for ( Service svc : getServices ( ) ) { services . put ( svc . getName ( ) , svc ) ; } super . init ( conf ) ; String persistPathStr = conf . get ( SERVER_STATE_PERSIST_LOCATION , DEFAULT_SERVER_STATE_PERSIST_LOCATION ) ; persistDir = new Path ( persistPathStr ) ; try { Configuration configuration = new Configuration ( conf ) ; configuration . setBoolean ( LensServices . FS_AUTOMATIC_CLOSE , false ) ; <START_BUG> persistenceFS = FileSystem . newInstance ( persistDir . toUri ( ) , conf ) ; <END_BUG> setupPersistedState ( ) ; } catch ( Exception e ) { LensServices . LOG . error ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>recover<seq2seq4repair_space>from<seq2seq4repair_space>persisted<seq2seq4repair_space>state" , e ) ; throw new RuntimeException ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>recover<seq2seq4repair_space>from<seq2seq4repair_space>persisted<seq2seq4repair_space>state" , e ) ; } snapShotInterval = conf . getLong ( SERVER_SNAPSHOT_INTERVAL , DEFAULT_SERVER_SNAPSHOT_INTERVAL ) ; LensServices . LOG . info ( ( "Initialized<seq2seq4repair_space>services:<seq2seq4repair_space>" + ( services . keySet ( ) . toString ( ) ) ) ) ; UserConfigLoaderFactory . init ( conf ) ; timer = new Timer ( "lens-server-snapshotter" , true ) ; } } public synchronized void start ( ) { } private void setupPersistedState ( ) throws IOException , ClassNotFoundException { } private synchronized void persistLensServiceState ( ) throws IOException { } private Path getServicePersistPath ( LensService service ) { } public synchronized void stop ( ) { } public STATE getServiceState ( ) { } public boolean isStopping ( ) { } public static LensServices get ( ) { } @ Override @ SuppressWarnings ( "unchecked" ) public < T extends Service > T getService ( String sName ) { } public List < LensService > getLensServices ( ) { } }

Fix:
persistenceFS = FileSystem . newInstance ( persistDir . toUri ( ) , configuration ) ;