简体   繁体   English

Apache 风暴 static 来自螺栓的变量引用

[英]Apache storm static variable reference from bolt

A bolt in my storm topology has reference to a static variable in a utility class and will this static variable stays same for each tuple processed on a worker process.我的风暴拓扑中的螺栓引用了实用程序 class 中的 static 变量,这个 static 变量对于在工作进程上处理的每个元组是否保持不变。

Task is not created for each tuple.不会为每个元组创建任务。 Once the task is initiated on an executor thread, tuples will flow to this task.一旦任务在执行程序线程上启动,元组将流向该任务。 So, the static variable will shared across tuples.因此,static 变量将在元组之间共享。

The task thread will stay there until there is some issues with the thread and new thread gets allocated for a task.任务线程将留在那里,直到线程出现问题并且为任务分配了新线程。 So, the static variable in my scenario is not to be used.因此,我的方案中的 static 变量不会被使用。 So, changed the logic to not have static variable.因此,将逻辑更改为没有 static 变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM