我在写我的mapper时候,比如我new 了一个成员变量会出现多线程吗?就像 java的serlet一样
public static class CoreMapper extends Mapper<Object, Text, Text, IntWritable> { private IntWritable a= new IntWritable(1);
@Override
protected void map(Object key, IntWritable value, Mapper<Object, IntWritable, Text, IntWritable>.Context context) throws IOException, InterruptedException {
a=value;
context.write("a", a);
}
会不会出现这种情况?当一个线程执行 context.write("a", a); 时候,此事刚好另一个线程执行 a=value; 这样就会输出错误的值?
请问会出现这种情况吗?
|