In the original implementation, id is an integer and increased with synchronized{} guard, just make it as an AtomicLong for convenience. Here the two lines are get the value and increment 

Ah, I think I know why you are confused here, the more straightforward way seems to be 

```
val id = Accumulator.nextAccumID.getAndIncrement
```

I tried that, but I found that the id field will be called for two times during the initilaization(?) of a task, so for every time, the id is increased...

I have to get the value when call id but increment in the constructor of Accumulable