List of usage examples for com.amazonaws.services.glue.model GetDatabasesResult getNextToken
public String getNextToken()
A continuation token for paginating the returned list of tokens, returned if the current segment of the list is not the last.
From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java
License:Apache License
@Override public List<String> getAllDatabases() { try {/*from w w w. j a va 2s.co m*/ List<String> databaseNames = new ArrayList<>(); String nextToken = null; do { GetDatabasesResult result = glueClient .getDatabases(new GetDatabasesRequest().withNextToken(nextToken)); nextToken = result.getNextToken(); result.getDatabaseList().forEach(database -> databaseNames.add(database.getName())); } while (nextToken != null); return databaseNames; } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }