Github user sudheeshkatkam commented on a diff in the pull request:

    https://github.com/apache/drill/pull/374#discussion_r52960439
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
 ---
    @@ -146,38 +154,37 @@ public QProfiles(List<ProfileInfo> runningQueries, 
List<ProfileInfo> finishedQue
       @Path("/profiles.json")
       @Produces(MediaType.APPLICATION_JSON)
       public QProfiles getProfilesJSON() {
    -    PStore<QueryProfile> completed = null;
    -    PStore<QueryInfo> running = null;
    -    try {
    -      completed = provider().getStore(QueryManager.QUERY_PROFILE);
    -      running = provider().getStore(QueryManager.RUNNING_QUERY_INFO);
    -    } catch (IOException e) {
    -      logger.debug("Failed to get profiles from persistent or ephemeral 
store.");
    -      return new QProfiles(new ArrayList<ProfileInfo>(), new 
ArrayList<ProfileInfo>());
    -    }
    -
    -    List<ProfileInfo> runningQueries = Lists.newArrayList();
    -
    -    for (Map.Entry<String, QueryInfo> entry : running) {
    -      QueryInfo profile = entry.getValue();
    -      if (principal.canManageProfileOf(profile.getUser())) {
    -        runningQueries.add(new ProfileInfo(entry.getKey(), 
profile.getStart(), profile.getForeman().getAddress(),
    -            profile.getQuery(), profile.getState().name(), 
profile.getUser()));
    +    try (
    +        final PersistentStore<QueryProfile> completed = 
getProvider().getOrCreateStore(QueryManager.QUERY_PROFILE);
    --- End diff --
    
    This should not use try-with-resources statement, which will close the 
resources at the end of the block.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to