public java.lang.Object getFieldValue(_Fields field) { switch (field) { case WAIT_SECS: return get_wait_secs(); } throw new java.lang.IllegalStateException(); }
@Override public void killTopologyWithOpts(final String topoName, final KillOptions options) throws NotAliveException, AuthorizationException, TException { killTopologyWithOptsCalls.mark(); assertTopoActive(topoName, true); try { Map<String, Object> topoConf = tryReadTopoConfFromName(topoName); topoConf = Utils.merge(conf, topoConf); final String operation = "killTopology"; checkAuthorization(topoName, topoConf, operation); Integer waitAmount = null; if (options.is_set_wait_secs()) { waitAmount = options.get_wait_secs(); } transitionName(topoName, TopologyActions.KILL, waitAmount, true); notifyTopologyActionListener(topoName, operation); addTopoToHistoryLog((String) topoConf.get(Config.STORM_ID), topoConf); } catch (Exception e) { LOG.warn("Kill topology exception. (topology name='{}')", topoName, e); if (e instanceof TException) { throw (TException) e; } throw new RuntimeException(e); } }
public Object getFieldValue(_Fields field) { switch (field) { case WAIT_SECS: return get_wait_secs(); } throw new IllegalStateException(); }
public void killTopologyWithOpts(final String name, final KillOptions options) throws NotAliveException { final JobID jobId = this.getTopologyJobId(name); if (jobId == null) { throw new NotAliveException("Storm topology with name " + name + " not found."); } if (options != null) { try { Thread.sleep(1000 * options.get_wait_secs()); } catch (final InterruptedException e) { throw new RuntimeException(e); } } final Configuration configuration = GlobalConfiguration.loadConfiguration(); configuration.setString(JobManagerOptions.ADDRESS, this.jobManagerHost); configuration.setInteger(JobManagerOptions.PORT, this.jobManagerPort); final StandaloneClusterClient client; try { client = new StandaloneClusterClient(configuration); } catch (final Exception e) { throw new RuntimeException("Could not establish a connection to the job manager", e); } try { client.stop(jobId); } catch (final Exception e) { throw new RuntimeException("Cannot stop job.", e); } }