fix to make flux compatible with Storm versions earlier than 0.9.3
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/c3cffa08 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/c3cffa08 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/c3cffa08 Branch: refs/heads/master Commit: c3cffa08bbdb3b4748202f94ec802858df45e1fd Parents: b931d1b Author: P. Taylor Goetz <[email protected]> Authored: Wed Apr 1 12:04:55 2015 -0400 Committer: P. Taylor Goetz <[email protected]> Committed: Wed Apr 1 12:04:55 2015 -0400 ---------------------------------------------------------------------- flux-core/src/main/java/org/apache/storm/flux/Flux.java | 12 +++++++++--- .../main/java/org/apache/storm/flux/FluxBuilder.java | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/c3cffa08/flux-core/src/main/java/org/apache/storm/flux/Flux.java ---------------------------------------------------------------------- diff --git a/flux-core/src/main/java/org/apache/storm/flux/Flux.java b/flux-core/src/main/java/org/apache/storm/flux/Flux.java index 2c2105c..6300631 100644 --- a/flux-core/src/main/java/org/apache/storm/flux/Flux.java +++ b/flux-core/src/main/java/org/apache/storm/flux/Flux.java @@ -79,7 +79,7 @@ public class Flux { options.addOption(option(0, "i", OPTION_INACTIVE, "Deploy the topology, but do not activate it.")); options.addOption(option(1, "z", OPTION_ZOOKEEPER, "host:port", "When running in local mode, use the ZooKeeper at the " + - "specified <host>:<port> instead of the in-process ZooKeeper.")); + "specified <host>:<port> instead of the in-process ZooKeeper. (requires Storm 0.9.3 or later)")); options.addOption(option(1, "f", OPTION_FILTER, "file", "Perform property substitution. Use the specified file " + "as a source of properties, and replace keys identified with {$[property name]} with the value defined " + @@ -169,7 +169,7 @@ public class Flux { LOG.info("Deploying topology in an ACTIVE state..."); submitOptions = new SubmitOptions(TopologyInitialStatus.ACTIVE); } - StormSubmitter.submitTopology(topologyName, conf, topology, submitOptions); + StormSubmitter.submitTopology(topologyName, conf, topology, submitOptions, null); } catch (Exception e) { LOG.warn("Unable to deploy topology to remote cluster.", e); } @@ -198,7 +198,13 @@ public class Flux { } else { zkHost = zkStr; } - cluster = new LocalCluster(zkHost, zkPort); + // the following constructor is only available in 0.9.3 and later + try { + cluster = new LocalCluster(zkHost, zkPort); + } catch (NoSuchMethodError e){ + LOG.error("The --zookeeper option can only be used with Apache Storm 0.9.3 and later."); + System.exit(1); + } } else { cluster = new LocalCluster(); } http://git-wip-us.apache.org/repos/asf/storm/blob/c3cffa08/flux-core/src/main/java/org/apache/storm/flux/FluxBuilder.java ---------------------------------------------------------------------- diff --git a/flux-core/src/main/java/org/apache/storm/flux/FluxBuilder.java b/flux-core/src/main/java/org/apache/storm/flux/FluxBuilder.java index c576855..31b6e64 100644 --- a/flux-core/src/main/java/org/apache/storm/flux/FluxBuilder.java +++ b/flux-core/src/main/java/org/apache/storm/flux/FluxBuilder.java @@ -419,7 +419,8 @@ public class FluxBuilder { Object[] methodArgs = getArgsWithListCoercian(args, method.getParameterTypes()); method.invoke(instance, methodArgs); } else { - LOG.warn("Unable to find method '{}' in class '{}' with arguments {}.", methodName, clazz.getName(), args); + LOG.warn("Unable to find method '{}' in class '{}' with arguments {}.", + new Object[]{methodName, clazz.getName(), args}); throw new IllegalArgumentException("Configuration method not found."); } } @@ -447,8 +448,9 @@ public class FluxBuilder { } } if (eligibleCount > 1) { - LOG.warn("Found multiple invokable methods for class {}, method {}, given arguments {}. Using the last one found.", - target, methodName, args); + LOG.warn("Found multiple invokable methods for class {}, method {}, given arguments {}. " + + "Using the last one found.", + new Object[]{target, methodName, args}); } return retval; }
