private Optional<List<String>> loadAllViews(String databaseName) throws Exception { try { return retry() .stopOn(UnknownDBException.class) .stopOnIllegalExceptions() .run( "getAllViews", stats .getAllViews() .wrap( () -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { String filter = HIVE_FILTER_FIELD_PARAMS + PRESTO_VIEW_FLAG + " = \"true\""; return Optional.of(client.getTableNamesByFilter(databaseName, filter)); } })); } catch (UnknownDBException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }