You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Vincent Devillers (JIRA)" <ji...@apache.org> on 2016/12/08 18:47:59 UTC

[jira] [Created] (KNOX-806) Implement Closeable for deallocable resources

Vincent Devillers created KNOX-806:
--------------------------------------

             Summary: Implement Closeable for deallocable resources
                 Key: KNOX-806
                 URL: https://issues.apache.org/jira/browse/KNOX-806
             Project: Apache Knox
          Issue Type: Improvement
          Components: ClientDSL
            Reporter: Vincent Devillers
            Priority: Minor


org.apache.hadoop.gateway.shell.BasicResponse and org.apache.hadoop.gateway.shell.Hadoop are not java.io.Closeable, which means that we have to do this:

{code:java}
BasicResponse response = null;
String jobId;
try {
    response = Workflow.submit(getHadoop()).text(xmlConfiguration).now();
    jobId = JsonPath.read(response.getString(), "$.id");
} finally {
    if(response != null) {
      response.close();
    }
}
{code}

instead of this:

{code:java}
String jobId;
try (BasicResponse response = Workflow.submit(getHadoop()).text(xmlConfiguration).now()){
    jobId = JsonPath.read(response.getString(), "$.id");
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)