-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Pinned.current() utility method * Fixed checkstyle formatting Upgraded detekt version * Simplified executors interface * Added snyk badge * Test fixes * Needle formatting fixes * Fixed detekt errors * Detekt fixes * Detekt fixes * Codecov reduction threshold addition * codecov.yml fixes * codecov.yml fixes * codecov.yml fixes
- Loading branch information
1 parent
2d8d53c
commit 5081f48
Showing
24 changed files
with
409 additions
and
570 deletions.
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
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
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
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 |
---|---|---|
@@ -1,6 +1,15 @@ | ||
coverage: | ||
precision: 2 | ||
round: up | ||
range: "75..95" | ||
range: 75..95 | ||
status: | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 2% | ||
project: | ||
default: | ||
target: auto | ||
threshold: 2% | ||
ignore: | ||
- "agent/**/*" |
72 changes: 72 additions & 0 deletions
72
concurrent/src/main/java/org/sheinbergon/needle/concurrent/PinnedExecutors.java
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.sheinbergon.needle.concurrent; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ForkJoinPool; | ||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
public final class PinnedExecutors { | ||
|
||
/** | ||
* Static factory methods for affinity aware single-thread {@code ExecutorService} inception. | ||
* | ||
* @param factory the {@code PinnedThreadFactory} used to create affinity aware {@code PinnedThread} instances | ||
* @return the affinity aware {@code ExecutorService} | ||
*/ | ||
public static ExecutorService newSinglePinnedThreadExecutor(final @Nonnull PinnedThreadFactory factory) { | ||
return Executors.newSingleThreadExecutor(factory); | ||
} | ||
|
||
/** | ||
* Static factory methods for affinity aware fixed-size {@code ExecutorService} inception. | ||
* | ||
* @param size number of {@code PinnedThread} instances to maintain in the pool | ||
* @param factory the {@code PinnedThreadFactory} used create affinity aware {@code PinnedThread} instances | ||
* @return the affinity aware {@code ExecutorService} | ||
*/ | ||
public static ExecutorService newFixedPinnedThreadPool(final int size, final @Nonnull PinnedThreadFactory factory) { | ||
return Executors.newFixedThreadPool(size, factory); | ||
} | ||
|
||
/** | ||
* Static factory methods for affinity aware single-thread {@code ScheduledExecutorService} inception. | ||
* | ||
* @param factory the {@code PinnedThreadFactory} used create affinity aware {@code PinnedThread} instances | ||
* @return the affinity aware {@code ScheduledExecutorService} | ||
*/ | ||
public static ScheduledExecutorService newSinglePinnedThreadScheduledExecutor( | ||
final @Nonnull PinnedThreadFactory factory) { | ||
return Executors.newSingleThreadScheduledExecutor(factory); | ||
} | ||
|
||
/** | ||
* Static factory methods for affinity aware fixed-size {@code ScheduledExecutorService} inception. | ||
* | ||
* @param size number of {@code PinnedThread} instances to maintain in the pool | ||
* @param factory the {@code PinnedThreadFactory} used create affinity aware {@code PinnedThread} instances | ||
* @return the affinity aware {@code ScheduledExecutorService} | ||
*/ | ||
public static ScheduledExecutorService newScheduledPinnedThreadPool( | ||
final int size, | ||
final @Nonnull PinnedThreadFactory factory) { | ||
return Executors.newScheduledThreadPool(size, factory); | ||
} | ||
|
||
/** | ||
* Creates a new affinity aware {@code ForkJoinPool} with the given parameters. | ||
* | ||
* @param parallelism the parallelism level (amount of worker threads to be spawned) | ||
* @param factory the {@code PinnedThread} factory to use when the executor | ||
* creates new fork-join worker threads | ||
* @return an affinity aware {@code ForkJoinPool} | ||
*/ | ||
public static ForkJoinPool newPinnedWorkStealingPool( | ||
final int parallelism, | ||
final @Nonnull PinnedThreadFactory factory) { | ||
return new ForkJoinPool(parallelism, factory, null, true); | ||
} | ||
|
||
private PinnedExecutors() { | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
concurrent/src/main/java/org/sheinbergon/needle/concurrent/PinnedForkJoinPool.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.