This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 370
Change: Count subtypes for pipeline threads #1681
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4609543
Add reflections for thread count
DyrellC ab21c14
Remove dependency, use ignore list as replacement
DyrellC 330362c
HASHING -> MULTIPLE
DyrellC 436ad5f
Condense logic to one line
DyrellC c26e476
List -> immutable list
DyrellC 95b3661
Merge branch 'dev' of https://github.com/iotaledger/iri into reflecti…
DyrellC 74f6c36
Make thread number static
DyrellC 8e06427
Remove unused import
DyrellC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,14 @@ | |
import com.iota.iri.utils.Converter; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.concurrent.ArrayBlockingQueue; | ||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
|
||
import com.iota.iri.utils.IotaUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
@@ -52,7 +54,12 @@ | |
public class TransactionProcessingPipelineImpl implements TransactionProcessingPipeline { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(TransactionProcessingPipelineImpl.class); | ||
private ExecutorService stagesThreadPool = Executors.newFixedThreadPool(6); | ||
private ExecutorService stagesThreadPool = Executors.newFixedThreadPool(getNumberOfThreads()); | ||
|
||
/** | ||
* List of stages that will be ignored when determining thread count | ||
*/ | ||
private static final List IGNORED_STAGES = IotaUtils.createImmutableList(Stage.MULTIPLE, Stage.ABORT, Stage.FINISH); | ||
|
||
// stages of the protocol protocol | ||
private PreProcessStage preProcessStage; | ||
|
@@ -69,6 +76,10 @@ public class TransactionProcessingPipelineImpl implements TransactionProcessingP | |
private BlockingQueue<ProcessingContext> broadcastStageQueue = new ArrayBlockingQueue<>(100); | ||
private BlockingQueue<ProcessingContext> replyStageQueue = new ArrayBlockingQueue<>(100); | ||
|
||
private int getNumberOfThreads() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One last thing, usually when a method doesn't use the fields of the class I like to attach However, I see advantages to it because:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed this to a static final int now. |
||
return Stage.values().length - IGNORED_STAGES.size(); | ||
} | ||
|
||
/** | ||
* Creates a {@link TransactionProcessingPipeline}. | ||
* | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't understand why this changed, but I'll ignore it this time
just be careful next time
On bigger PRs all those little changes are annoying
It also messes up hisotry