-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: use FlowSched for task scheduling (#256)
- Loading branch information
Showing
29 changed files
with
287 additions
and
761 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "FlowSched"] | ||
path = FlowSched | ||
url = https://github.com/RelativityMC/FlowSched.git |
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,24 @@ | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
|
||
configurations { | ||
shadowInclude | ||
} | ||
|
||
dependencies { | ||
shadowInclude("com.ishland.flowsched:flowsched") { | ||
transitive false | ||
} | ||
} | ||
|
||
shadowJar { | ||
archiveClassifier = "all-dev" | ||
configurations = [ project.configurations.shadowInclude ] | ||
} | ||
|
||
remapJar { | ||
input = shadowJar.archiveFile | ||
archiveFileName = shadowJar.archiveFileName.get().replaceAll("-dev\\.jar\$", ".jar") | ||
addNestedDependencies = true | ||
dependsOn shadowJar | ||
} | ||
|
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
36 changes: 36 additions & 0 deletions
36
...src/main/java/com/ishland/c2me/base/common/scheduler/AbstractPosAwarePrioritizedTask.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,36 @@ | ||
package com.ishland.c2me.base.common.scheduler; | ||
|
||
import com.ishland.flowsched.executor.Task; | ||
import it.unimi.dsi.fastutil.objects.ReferenceArrayList; | ||
|
||
import java.util.Objects; | ||
|
||
public abstract class AbstractPosAwarePrioritizedTask implements Task { | ||
|
||
protected final ReferenceArrayList<Runnable> postExec = new ReferenceArrayList<>(4); | ||
private final long pos; | ||
private int priority = Integer.MAX_VALUE; | ||
|
||
public AbstractPosAwarePrioritizedTask(long pos) { | ||
this.pos = pos; | ||
} | ||
|
||
@Override | ||
public int priority() { | ||
return this.priority; | ||
} | ||
|
||
public void setPriority(int priority) { | ||
this.priority = priority; | ||
} | ||
|
||
public long getPos() { | ||
return this.pos; | ||
} | ||
|
||
public void addPostExec(Runnable runnable) { | ||
synchronized (this.postExec) { | ||
postExec.add(Objects.requireNonNull(runnable)); | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
c2me-base/src/main/java/com/ishland/c2me/base/common/scheduler/LockTokenImpl.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,6 @@ | ||
package com.ishland.c2me.base.common.scheduler; | ||
|
||
import com.ishland.flowsched.executor.LockToken; | ||
|
||
public record LockTokenImpl(int ownerTag, long pos) implements LockToken { | ||
} |
53 changes: 0 additions & 53 deletions
53
c2me-base/src/main/java/com/ishland/c2me/base/common/scheduler/NeighborLockingManager.java
This file was deleted.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
c2me-base/src/main/java/com/ishland/c2me/base/common/scheduler/NeighborLockingTask.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
c2me-base/src/main/java/com/ishland/c2me/base/common/scheduler/PriorityUtils.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.