Scala: thread-safe circular iterator -


what correct way create thread-safe, infinite circular iterator in scala? seems following not thread safe (iterating simulataneously multiple threads on iterator throws exceptions):

val map = map(1->"one", 2->"two") val iterator = iterator.continually(map).flatten 

how correct make thread-safe?

i've ran same question think can safe implementation dependent discussed here.

iterator.synchronized(   iterator.next() ) 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -