好好利用风暴?(Good use of storm?)
我认为我已经理解了这个概念,并且它适用于很多情况。 我有一个测试项目,我想要了解更多关于这个,但我想知道风暴是否真的适合这个。
我遇到的概念问题是'流'定义。 看起来风暴将作为订阅流并实时处理它的魅力起作用,但我没有真正的流,而是我想要处理的有限数据集。
我知道这里有一个hadoop,但我对Storm的实时功能以及Storm撰写的Nathan在谈话中提到的其他有趣点感兴趣。
所以我想知道,人们是否会写Spouts来调查非流式API,然后对结果进行比较以模拟流?
第二个重要的一点是,似乎风暴拓扑从未完成处理,直到中断,这再次不适用于我的情况。 我希望我的拓扑知道,一旦我有限的源数据列表完成,处理可以终止并且可以发出最终结果。
那么,这在风暴术语中是否有意义,还是我看错了东西? 如果是这样,那么您对这种实时并行计算需求有什么替代方案?
谢谢!
I've been reading about Storm and playing around with the examples from storm-starter.
I think I got the concept and it applies very well to many cases. I have a test project I want to do to learn more about this, but I'm wondering if Storm is really suited for this.
The conceptual problem I'm having is with the 'streaming' definition. It seems that Storms will work as a charm subscribing to a stream and processing it in real time, but I don't really have a stream, but rather a finite collection of data that I want to process.
I know there's hadoop for this, but I'm interested in the real time capabilities of Storm as well as other interesting points that Nathan, who wrote Storm, mentions in his talks.
So I was wondering, do people write Spouts that poll non streaming APIs and then diff the results maybe to emulate a stream?
The second important point is, it seems that Storm topologies never finish processing until interrupted, which again doesn't apply to my case. I would like my topology to know that once my finite list of source data is finished, the processing can terminate and a final result can be emitted.
So, does that all make sense in Storm terms or am I looking at the wrong thing? If so, what alternatives do you propose for this sort of real time parallel computing needs?
Thanks!
原文:https://stackoverflow.com/questions/9377600
最满意答案
您将以下变量传递给您的方法:
public static double compoundValueMethod(double savingAmount, double annualInterestRate, int NumberOfMonth)
请注意,但在方法中使用静态变量
numberOfMonth
而不是传递的NumberOfMonth
参数(Java中的变量名称区分大小写)。numberOfMonth
默认初始化为0
,因此不输入for循环,方法返回0。您应该消除静态变量并仅使用局部变量。 如果你首先这样做,你会得到一个编译错误,这将使你更容易找到你的错误。
You are passing the following variables to your method :
public static double compoundValueMethod(double savingAmount, double annualInterestRate, int NumberOfMonth)
Note but use the static variable
numberOfMonth
in your method instead of the passedNumberOfMonth
parameter (variable names in Java are case sensitive).numberOfMonth
is initialized to0
by default, so your for loop is not entered and the method returns 0.You should eliminate the static variables and only use local variables. Had you done that in the first place, you'd get a compilation error which would make it much easier to find your bug.
相关问答
更多-
您将以下变量传递给您的方法: public static double compoundValueMethod(double savingAmount, double annualInterestRate, int NumberOfMonth) 请注意,但在方法中使用静态变量numberOfMonth而不是传递的NumberOfMonth参数( ...
-
方法返回值的地址(Address of return value of method)[2023-07-31]
该标准禁止您使用右值的地址: https ://stackoverflow.com/a/28459180/2642059不符合标准的编译器可能会允许这种行为,但确实这不是跨平台的行为,也不是即使在编译器的更新之间,它也能保证成功,它可以更紧密地与C ++标准对齐。 既然你不是为特定的编译器编写程序,而是为C ++编写程序,那么在特定的编译器中找到一些工作不应该是你的目标。 在标准范围内寻找一种方法来完成这一点将是更可取的。 一个简单的选项可以做到这一点: 通过将其分配给一个临时值将其变为左值。 他们是免费的 ... -
如果您总是期望找到一个值,那么抛出异常,如果它丢失。 这个例外就意味着有一个问题。 如果值可能丢失或存在,并且两者都对应用程序逻辑有效,则返回null。 更重要的是:你在代码中做什么其他的地方? 一致性很重要。 If you are always expecting to find a value then throw the exception if it is missing. The exception would mean that there was a problem. If the value ...
-
当您有递归调用时,您需要返回递归调用的值。 public boolean isLargest(Node tmp, Node parent){ if(tmp.value > parent.value){ parent = parent.right; return tmp.isLargest(tmp, parent); } else if(parent.value == tmp.value){ System.out.println("test"); return true; } ...
-
使用该代码,你不会收到消息: public Tail getTail(long value1, String value2, int value3) { List
l = --> (I get list via Hibernate.) if (l.size() == 1) { return (Tail) l.get(0); } else if (l.size()>1){ for (Tail t: l) ... -
您似乎将CDI Extensions与生产者混合在一起。 首先,如果你想拥有一个生产者,那么工厂方法应该返回一个NewsListView ,而不是泛型类型。 使用@Producer和限定符注释将与带注释的类型绑定。 因此,无需使用NewsListView注释@FXMLManaged 。 然后你将NewsListView注入bean的某个地方。 制作视图: public class FXMLManagedProducer { @Produces @FXMLManaged public News ...
-
看起来你想要Func
。 Looks like you want Func . -
返回值异步方法(return value asynchronous method)[2022-10-19]
函数应该只返回一个值,如果它需要返回一个值。 编写一个不返回任何内容的函数绝对没有错。 回答你的另一个问题:不,没有解决方案,因为在异步方法执行之前, method函数本身就会返回。 你甚至会回来什么? 代码将在for循环中进行n次迭代,那么你怎么知道哪一个甚至返回? A function should only return a value if it needs to return a value. There is absolutely nothing wrong with writing a fun ... -
方法返回值(Method return values)[2024-01-06]
该行只是意味着这样写的方法默认会返回id : - init { ... } 要么 + array { ... } 与 - (id)init { ... } 此外,没有显式参数类型的方法将采用id对象。 - initWithObject:object { ... } 是相同的 - (id)initWithObject:(id)object { ... } That line simply means that a method written as such, would, by default, ... -
简短而过于简化的答案是它不会返回任何东西 。 代码在任何发生异常的地方都会“中断”,并且它会一直处于堆栈状态,直到出现异常。 即使您碰巧遇到异常,您尝试使用方法的返回值初始化的变量仍将保持调用方法之前的状态: var i = 5; try { i = MyMethodThatThrowsAnException(); } catch { // at this point, the i variable still equals 5. } 我应该提到,如果抛出异常,你真的不应该担心函数的返回 ...