从工作线程访问共享数据(Accessing shared data from a worker thread)
我有以下代码:
void COrganizerProgressDlg::LaunchWorkerThread() { CWorkerData data; data.m_pWndOrganizerProgressDlg = this; data.m_pWndImageOrganizerDlg = m_pWndImageOrganizerDlg; ::AfxBeginThread(RunBackgroundWorker, &data); }
这是我的
RunBackgroundWorker()
方法,它是一个static
方法。UINT COrganizerProgressDlg::RunBackgroundWorker(LPVOID pParam) { try { // Run organizer engine COrganizerEngine engine(m_nNotifyMessage, (CWorkerData*)pParam); engine.Run(); } catch (CException *e) { e->ReportError(); e->Delete(); } return 0; }
该数据用于初始化我的工人类中的设置。
问题是我的
data
变量在调用AfxBeginThread()
之前包含有效数据,但似乎在RunBackgroundWorker()
包含垃圾。我错过了什么? 如何从工作线程访问此数据?
I have the following code:
void COrganizerProgressDlg::LaunchWorkerThread() { CWorkerData data; data.m_pWndOrganizerProgressDlg = this; data.m_pWndImageOrganizerDlg = m_pWndImageOrganizerDlg; ::AfxBeginThread(RunBackgroundWorker, &data); }
And here is my
RunBackgroundWorker()
method, which is astatic
method.UINT COrganizerProgressDlg::RunBackgroundWorker(LPVOID pParam) { try { // Run organizer engine COrganizerEngine engine(m_nNotifyMessage, (CWorkerData*)pParam); engine.Run(); } catch (CException *e) { e->ReportError(); e->Delete(); } return 0; }
The data is being used to initialize settings in my worker class.
The problem is that my
data
variable contains valid data before callingAfxBeginThread()
, but seems to contain garbage withinRunBackgroundWorker()
.What am I missing? How can I access this data from my worker thread?
原文:https://stackoverflow.com/questions/42044580
最满意答案
1)通过输入检查运行的oozie服务
oozie admin -oozie http://OOZIE_IP:11000/oozie -status
如果它不显示
System mode: NORMAL
,则oozie无法正确启动2)在hadoop config的
core-site.xml
中设置,<property> <name>hadoop.proxyuser.oozie.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.oozie.groups</name> <value>*</value> </property>
希望这可以工作
1) check oozie service running by typing
oozie admin -oozie http://OOZIE_IP:11000/oozie -status
if it doesnt show
System mode: NORMAL
, oozie is not started correctly2) set in
core-site.xml
in hadoop config ,<property> <name>hadoop.proxyuser.oozie.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.oozie.groups</name> <value>*</value> </property>
Hope this works
相关问答
更多-
假设您可以通过某种方式知道要在大型语料库中处理哪些x文件,可以使用org.apache.hadoop.mapreduce.lib.input.FileInputFormat.setInputPathFilter(Job, Class extends PathFilter>)方法来配置你的工作。 你需要传递一个实现PathFilter的类。 Hadoop将创建这个类的一个新实例,并将通过boolean accept(Path path)方法呈现哪些文件在语料库中。 然后,您可以使用此选项将文件过滤为针对实 ...
-
远程运行Hadoop map-reduce作业导致EOFException?(Runnning Hadoop map-reduce job remotely causes EOFException?)[2023-07-11]
问题是客户端使用的是不同版本的Hadoop API(0.23.0),然后是Hadoop安装。 The problem was that client was using different version of Hadoop API (0.23.0) then the Hadoop instalation. -
oozie job -oozie http:// localhost:11000 / oozie -config /examples/apps/map-reduce/job.properties -run -config参数采用本地路径而不是HDFS路径。 workflow.xml需要存在于HDFS中,并且在job.properties文件中使用以下属性定义路径: oozie.wf.application.path=
oozie job -oozie h ... -
问题解决了......在使用新的mapreduce API时,我们需要在“$”符号前加上mapper和reducer类名:
mapreduce.map.class oozie.WordCount$Map mapreduce.reduce.class oozie.WordCount$Reduce -
将Spark添加到Oozie共享库(Add Spark to Oozie shared lib)[2022-07-24]
Spark行动计划与Oozie 4.2.0一起发布,即使该文档似乎有点落后。 在这里查看相关的JIRA: Oozie JIRA - 添加spark动作执行器 Cloudera的发行CDH 5.4已经有了它,请参阅官方文档: CDH 5.4 oozie doc - Oozie Spark Action Extension 使用旧版Oozie,可以通过各种方法共享罐子。 第一种方法可能效果最好。 完整列表无论如何: 以下是在工作流程中包含jar的各种方法: 将oozie.libpath = / path /设置 ... -
这篇文章解释了如何在mapreduce作业期间管理日志 https://discuss.zendesk.com/hc/en-us/articles/201925118 一旦作业完成,NodeManager将为${yarn.nodemanager.log.retain-seconds}保留每个容器的日志,默认情况下为10800秒(3小时),并在它们过期后删除它们。 但是如果${yarn.log-aggregation-enable} ,那么NodeManager会立即将所有容器日志连接成一个文件,然后将它们上 ...
-
1)通过输入检查运行的oozie服务 oozie admin -oozie http://OOZIE_IP:11000/oozie -status 如果它不显示System mode: NORMAL ,则oozie无法正确启动 2)在hadoop config的core-site.xml中设置,
hadoop.proxyuser.oozie.hosts * 在oozie工作中得到错误(getting error in oozie job)[2023-10-25]
问题似乎是在工作流xml中。 这里的属性名称应该是mapreduce.map.class和mapreduce.reduce.class而不是mapreduce.mapper.class和mapreduce.reducer.class 。 所以修改后的工作流程应具有这些属mapreduce.map.class Drivers.WordCount$WordMap oozie的工作没有提交(The oozie job is not submitting)[2022-09-01]
您正在使用-submit命令。 您需要使用-run来提交作业。 提交时,您应该获得工作流程ID。 这是您应该运行的命令: oozie/bin/oozie job -run -config /tmp/config.properties -oozie http://127.0.0.1:11000/oozie 您可以通过运行来检查作业的状态: oozie job -oozie http://localhost:11000/oozie -infoI have mentioned wrong y ... 我弄清楚出了什么问题! 执行Hive Action需要类org/apache/hadoop/hive/cli/CliDriver 。 从错误消息中可以明显看出这一点。 这个类在这个jar文件中: hive-cli-0.7.1-cdh3u5.jar 。 (就我的情况而言,我的cloudera版本中的cdh3u5)。 Oozie在ShareLib目录中检查此jar。 此目录的位置通常在hive-site.xml中hive-site.xml ,其属性名称为oozie.service.WorkflowAppServ ...相关文章
更多- Storm-源码分析-Topology Submit-Worker
- Storm【技术文档】-Worker Executor Task的关系
- Becoming a data scientist
- twitter storm 源码走读之5 -- worker进程内部消息传递处理和数据结构分析
- Spring Data: a new perspective of data operations
- (二)solr data import
- 《Big Data Glossary》笔记
- 关于Thread类中的start()方法和run()方法
- 线程报错 thread
- 解决Eclipse无法打开“Failed to load the JNI shared library”
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。