Suggested fix for #1241#1274
Merged
LAGIdiot merged 1 commit intoGregTechCE:masterfrom Oct 26, 2020
Merged
Conversation
6b21a67 to
442c718
Compare
Member
|
Please use proper template for creating PRs or I will decline this. |
Member
|
Thank you for updating PR description. Fix of error seems sound and concerns regarding performance are not in place for this. Did you test by provided steps from issue? |
Contributor
Author
|
Yes, i tested using the steps on the issue report. after the changes theres no concurrent exception and the items are properly consumed even if they are split between inventories and there`s no duping |
Member
|
Maybe I should extend PR template of section regarding testing... Anyway I have tested and it works as expected. Accepted. Thanks for your hard work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR solves the concurrent modification exception when using the crafting station with a recipe that has its ingredients split in adjacent inventories.
How solved: Changed use of hashMap to concurrentHashMap to avoid concurrent modification exception caused by iterating the hashMap.
consumeRecipeItemsmethod ingregtech/common/metatileentities/storage/CachedRecipeData.java
calls for the
extractItemmethod ingregtech/common/inventory/itemsource/NetworkItemInfo.java
that iterates the hashMap
inventoriesonextractItemandrecomputeItemAmountmethods.Outcome: Fixes: #1241
Possible compatibility issue: its said that concurrentHashMap is slower than hashMap, but the functions of the crafting station are all manual, so they shouldn't hurt much ?
Please fill in as much useful information as possible. Also please remove all unused sections.