-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove synchronize in Virtual Threads Open up for external implementations
- Loading branch information
Showing
10 changed files
with
251 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package paxel.lintstone.api; | ||
|
||
import java.util.concurrent.locks.ReentrantLock; | ||
|
||
public class AutoClosableLock implements AutoCloseable { | ||
|
||
private final ReentrantLock lock; | ||
|
||
public AutoClosableLock(ReentrantLock lock) { | ||
this.lock = lock; | ||
lock.lock(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
lock.unlock(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package paxel.lintstone.api; | ||
|
||
import paxel.lintstone.impl.SequentialProcessorBuilder; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public interface ProcessorFactory { | ||
SequentialProcessorBuilder create(); | ||
|
||
void shutdown(); | ||
|
||
List<Runnable> shutdownNow(); | ||
|
||
boolean isShutdown(); | ||
|
||
boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException; | ||
} |
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,19 @@ | ||
package paxel.lintstone.api; | ||
|
||
import java.time.Duration; | ||
|
||
public interface Scheduler { | ||
|
||
/** | ||
* Run the runnable after the duration has passed. | ||
* | ||
* @param runnable The runnable to execute | ||
* @param duration The duration to wait | ||
*/ | ||
void runLater(Runnable runnable, Duration duration); | ||
|
||
/** | ||
* Stops the scheduler. Currently running runnables are finished, but no other Runnables will be executed. | ||
*/ | ||
void shutDown(); | ||
} |
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
Oops, something went wrong.