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

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -