Closed yangyangyyy closed 9 years ago
on the same server, it seems that the thrift server can be configured with multiple threads (" serverOpts.workerThreads = thriftServerThreads ")
but inside the worker, sequence is a local var. so theoretically it's possible to get duplicates. no??
Notice the synchronized block: https://github.com/twitter/snowflake/blob/snowflake-2010/src/main/scala/com/twitter/service/snowflake/IdWorker.scala#L71
synchronized
on the same server, it seems that the thrift server can be configured with multiple threads (" serverOpts.workerThreads = thriftServerThreads ")
but inside the worker, sequence is a local var. so theoretically it's possible to get duplicates. no??