Is static volatile variable different with static variable in the closure?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is static volatile variable different with static variable in the closure?

Chang Chen
Static variable  will be initialized in worker node JVM, will not be serialized from master. But how about static volatile variable?

Recently I read the beam spark runner code, and i find that they use static volatile Broadcast variable. See https://github.com/apache/beam/blob/master/runners/spark/src/main/java/org/apache/beam/runners/spark/util/GlobalWatermarkHolder.java#L46

It confused me a lot, is static volatile variable different with static variable in the closure?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is static volatile variable different with static variable in the closure?

Sean Owen
static and volatile are unrelated. Being volatile doesn't change the properties of the variable with respect to being static.

On Wed, Jun 7, 2017 at 4:01 PM Chang Chen <[hidden email]> wrote:
Static variable  will be initialized in worker node JVM, will not be serialized from master. But how about static volatile variable?

Recently I read the beam spark runner code, and i find that they use static volatile Broadcast variable. See https://github.com/apache/beam/blob/master/runners/spark/src/main/java/org/apache/beam/runners/spark/util/GlobalWatermarkHolder.java#L46

It confused me a lot, is static volatile variable different with static variable in the closure?
Loading...