Skip to content

MpscBlockingConsumerArrayQueue.offerIfBelowThreshold()#314

Merged
nitsanw merged 3 commits into
JCTools:masterfrom
diffusiondata:master
Aug 6, 2020
Merged

MpscBlockingConsumerArrayQueue.offerIfBelowThreshold()#314
nitsanw merged 3 commits into
JCTools:masterfrom
diffusiondata:master

Conversation

@philipa

@philipa philipa commented Jul 10, 2020

Copy link
Copy Markdown
Contributor

Add offerIfBelowThreshold() to MpscBlockingConsumerArrayQueue, with the same semantics as MpscArrayQueue.offerIfBelowThreshold().

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 693

  • 21 of 26 (80.77%) changed or added relevant lines in 1 file are covered.
  • 7 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.2%) to 86.369%

Changes Missing Coverage Covered Lines Changed/Added Lines %
jctools-core/src/main/java/org/jctools/queues/MpscBlockingConsumerArrayQueue.java 21 26 80.77%
Files with Coverage Reduction New Missed Lines %
jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java 1 79.91%
jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMapLong.java 1 82.91%
jctools-core/src/main/java/org/jctools/maps/NonBlockingIdentityHashMap.java 1 77.56%
jctools-core/src/main/java/org/jctools/maps/NonBlockingSetInt.java 4 77.09%
Totals Coverage Status
Change from base Build 681: 0.2%
Covered Lines: 4809
Relevant Lines: 5568

💛 - Coveralls

@nitsanw

nitsanw commented Jul 30, 2020

Copy link
Copy Markdown
Contributor

Testing needs to be extended, see the method used for the same method on MpscArrayQueue. We also need to cover the scenarios around unparking the consumer here, which will require some refactoring to the extended cases I expect.

@nitsanw

nitsanw commented Aug 5, 2020

Copy link
Copy Markdown
Contributor

See suggested changes here: 9e2d882


final long available = (producerLimit - pIndex) >> 1;
// sizeEstimate <= size
final long sizeEstimate = capacity - available;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug as capacity is actually 2xcapacity

@nitsanw nitsanw merged commit 5dc705b into JCTools:master Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants