You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/01/11 20:23:16 UTC

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

    [ https://issues.apache.org/jira/browse/KNOX-806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15819052#comment-15819052 ] 

ASF subversion and git services commented on KNOX-806:
------------------------------------------------------

Commit 869ced5de8b948965b58d2c4415bc1e383a89ba0 in knox's branch refs/heads/master from [~sumit.gupta]
[ https://git-wip-us.apache.org/repos/asf?p=knox.git;h=869ced5 ]

KNOX-806 Implement Closeable for deallocable resources (Vincent Devillers via Sumit Gupta)


> 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)