[ 
https://issues.apache.org/jira/browse/KNOX-806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vincent Devillers updated KNOX-806:
-----------------------------------
    Attachment: KNOX-806.patch

> 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
>            Assignee: Vincent Devillers
>            Priority: Minor
>              Labels: KIP-4
>             Fix For: 0.12.0
>
>         Attachments: KNOX-806.patch
>
>
> 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}
> [Source|https://blog.layer4.fr/2016/12/06/knox-production-pitfalls-and-common-mistakes/]



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

Reply via email to