Skip to content

Commit

Permalink
Inline baseline JDK methods from JDKSpecific
Browse files Browse the repository at this point in the history
Now that jboss-threads uses JDK-11+, these methods no longer use
a differnt implementation per jdk release.
  • Loading branch information
carterkozak committed Feb 14, 2024
1 parent 037e5e5 commit 233008a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/jboss/threads/EnhancedQueueExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public Builder setKeepAliveTime(final Duration keepAliveTime) {
@Deprecated
public Builder setKeepAliveTime(final long keepAliveTime, final TimeUnit keepAliveUnits) {
Assert.checkNotNullParam("keepAliveUnits", keepAliveUnits);
return setKeepAliveTime(Duration.of(keepAliveTime, JDKSpecific.timeToTemporal(keepAliveUnits)));
return setKeepAliveTime(Duration.of(keepAliveTime, keepAliveUnits.toChronoUnit()));
}

/**
Expand Down Expand Up @@ -2248,7 +2248,7 @@ void park(EnhancedQueueExecutor enhancedQueueExecutor) {
if (spins < YIELD_FACTOR) {
Thread.yield();
} else {
JDKSpecific.onSpinWait();
Thread.onSpinWait();
}
spins--;
if (parked == STATE_UNPARKED && unsafe.compareAndSwapInt(this, parkedOffset, STATE_UNPARKED, STATE_NORMAL)) {
Expand Down Expand Up @@ -2281,7 +2281,7 @@ void park(EnhancedQueueExecutor enhancedQueueExecutor, long nanos) {
if (spins < YIELD_FACTOR) {
Thread.yield();
} else {
JDKSpecific.onSpinWait();
Thread.onSpinWait();
}
if (parked == STATE_UNPARKED && unsafe.compareAndSwapInt(this, parkedOffset, STATE_UNPARKED, STATE_NORMAL)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jboss/threads/EnhancedViewExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private EnhancedViewExecutorRunnable blockingTake() {
// try again
if (spins < MAX_QUEUE_SPINS) {
spins++;
JDKSpecific.onSpinWait();
Thread.onSpinWait();
} else {
Thread.yield();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jboss/threads/JBossThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void interrupt() {
} else if (oldVal == STATE_INTERRUPT_IN_PROGRESS) {
// wait for interruption on other thread to be completed
if (spins < MAX_INTERRUPT_SPINS) {
JDKSpecific.onSpinWait();
onSpinWait();
spins++;
} else {
Thread.yield();
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/jboss/threads/JDKSpecific.java

This file was deleted.

0 comments on commit 233008a

Please sign in to comment.