void transformAndQueue ( T event , long systemCurrentTimeMillis ) { // if you're super unlucky, this blows up the stack if ( rand . nextDouble ( ) < 0.05 ) { // duplicate this message (note recursion means maybe more than duped) transformAndQueue ( event , systemCurrentTimeMillis ) ; } long delayms = nextZipfDelay ( ) ; delayed . add ( systemCurrentTimeMillis + delayms , event ) ; }
Possibly duplicate and delay by some random amount .