Hi Wanda, What exactly is the use case for this? Nominally, you wouldn’t want to do that sort of access, as a single datum can’t be shared across machines when running distributed. Instead, you might want to use an accumulator to manage the aggregation of data in a distributed form.
Regards, Frank Austin Nothaft [email protected] [email protected] 202-340-0466 On Jul 15, 2014, at 12:23 PM, Wanda Hawk <[email protected]> wrote: > How can I declare in spark a shared object by all the threads that does not > block execution by locking the entire array (threads are supposed to access > different lines from a 2 dimensional array) ? > > For example, I would like to declare a 2 dimensional array. Each thread > should write on its corresponding line: Thread.currentThread.getId. > By doing this, is the entire 2d array locked by one thread, and therefore > other threads must wait to get the lock, or does this approach locks only the > corresponding line for each thread ? > > Is there another way to do this ? > > Thanks, > Wanda >
