Long poll ( int pollerIndex ) { final long now = clock . now ( ) ; final long step = ServoPollers . POLLING_INTERVALS [ pollerIndex ] ; rollCount ( pollerIndex , now ) ; final int prevPos = 2 * pollerIndex + PREVIOUS ; final long value = data [ prevPos ] . get ( ) ; final long last = lastPollTime [ pollerIndex ] . getAndSet ( now ) ; final long missed = ( now - last ) / step - 1 ; if ( last / step == now / step ) { return value ; } else if ( last > 0L && missed > 0L ) { return null ; } else { return value ; } }
Get the value for the last completed interval .