Search in sources :

Example 1 with Long2BytesZbMapEntry

use of io.zeebe.map.iterator.Long2BytesZbMapEntry in project zeebe by zeebe-io.

the class TaskExpireLockStreamProcessor method timeOutTasks.

private void timeOutTasks() {
    final Iterator<Long2BytesZbMapEntry> iterator = expirationMap.iterator();
    while (iterator.hasNext()) {
        final Long2BytesZbMapEntry entry = iterator.next();
        final DirectBuffer value = entry.getValue();
        final long eventPosition = value.getLong(0);
        final long lockExpirationTime = value.getLong(SIZE_OF_LONG);
        if (lockExpired(lockExpirationTime)) {
            // TODO: would be nicer to have a consumable channel for timed-out timers
            // that we can stop consuming/yield on backpressure
            final boolean success = streamWriter.tryWriteTaskEvent(eventPosition, TaskState.EXPIRE_LOCK);
            if (!success) {
                return;
            }
        }
    }
}
Also used : DirectBuffer(org.agrona.DirectBuffer) Long2BytesZbMapEntry(io.zeebe.map.iterator.Long2BytesZbMapEntry)

Aggregations

Long2BytesZbMapEntry (io.zeebe.map.iterator.Long2BytesZbMapEntry)1 DirectBuffer (org.agrona.DirectBuffer)1