Skip to content

Conversation

@theigl
Copy link
Collaborator

@theigl theigl commented Jul 31, 2020

This PR resolves #746.

Limiting a pools maximum capacity is currently broken for two cases:

  1. threadSafe=true softReferences=true
  2. threadSafe=false softReferences=false

In the first case, LinkedBlockingQueue.add isn't overridden, so an IllegalStateException is thrown when reaching maximum capacity.

In the second case, the wrong method was overridden. ArrayDeck is not wrapped in a SoftReferenceQueue so ArrayDeck.offer is called directly. Internally, it uses addLast instead of add so the overridden method is never called.

I also made a slight change to the code formatting settings that preserves explicit linebreaks. It greatly improves the readability of the test-cases.

@theigl
Copy link
Collaborator Author

theigl commented Jul 31, 2020

@magro: Please review.

@magro
Copy link
Collaborator

magro commented Aug 2, 2020

Cool, thanks for the PR!

@magro magro merged commit 1de2ad5 into EsotericSoftware:master Aug 2, 2020
@theigl theigl deleted the 746-pool-max-capacity branch August 3, 2020 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

IllegalStateException on calling free for pooled item to synchronized pool using soft references and being full

2 participants