Skip to content

Provide blocking peeks for MpscBlockingConsumerArrayQueue #337

@franz1981

Description

@franz1981

It should allow to implement batching draining strategies using a mix of blocking peek + drain

eg

// ...
do {
  while (q.blockingPeek(timeOut, unit) != null) {
      // same while using poll too
      if (q.drain(batch::offer, limit) > 0) {
          processBatch(batch);
      }
  }
  // perform timed check on something
} while (true); // or whatever other way to end this madness :P

Doing the same with the current API means using take or poll ie adding the just read e to the batch before using drain again, that's less "nice" (just a matter of taste, I know) and more verbose

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions