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

    https://github.com/apache/storm/pull/1446#discussion_r64617209
  
    --- Diff: storm-core/src/jvm/org/apache/storm/StormSubmitter.java ---
    @@ -223,48 +227,65 @@ public static void submitTopologyAs(String name, Map 
stormConf, StormTopology to
                         // this is for backwards compatibility
                         localNimbus.submitTopology(name, stormConf, topology);
                     }
    +                LOG.info("Finished submitting topology: " +  name);
                 } else {
                     String serConf = JSONValue.toJSONString(stormConf);
    -                NimbusClient client = 
NimbusClient.getConfiguredClientAs(conf, asUser);
                     if(topologyNameExists(conf, name, asUser)) {
                         throw new RuntimeException("Topology with name `" + 
name + "` already exists on cluster");
                     }
                     String jar = submitJarAs(conf, 
System.getProperty("storm.jar"), progressListener, asUser);
    -                try {
    -                    LOG.info("Submitting topology " +  name + " in 
distributed mode with conf " + serConf);
    -                    if(opts!=null) {
    +                try (NimbusClient client = 
NimbusClient.getConfiguredClientAs(conf, asUser)) {
    +                    LOG.info("Submitting topology " + name + " in 
distributed mode with conf " + serConf);
    +                    if (opts != null) {
                             client.getClient().submitTopologyWithOpts(name, 
jar, serConf, topology, opts);
                         } else {
                             // this is for backwards compatibility
                             client.getClient().submitTopology(name, jar, 
serConf, topology);
                         }
    -                } catch(InvalidTopologyException e) {
    -                    LOG.warn("Topology submission exception: 
"+e.get_msg());
    +                    LOG.info("Finished submitting topology: " + name);
    +                } catch (InvalidTopologyException e) {
    +                    LOG.warn("Topology submission exception: " + 
e.get_msg());
                         throw e;
    -                } catch(AlreadyAliveException e) {
    +                } catch (AlreadyAliveException e) {
                         LOG.warn("Topology already alive exception", e);
                         throw e;
    -                } finally {
    -                    client.close();
    --- End diff --
    
    It is created inside try-with-resource statement  and will be closed 
automatically.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to