-
-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: alter clipboard thread to move all clipboard loading from main …
…thread (#2867)
- Loading branch information
Showing
8 changed files
with
181 additions
and
61 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
41 changes: 41 additions & 0 deletions
41
...-core/src/main/java/com/fastasyncworldedit/core/util/task/UUIDKeyQueuedThreadFactory.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,41 @@ | ||
package com.fastasyncworldedit.core.util.task; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import java.util.concurrent.ThreadFactory; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
@ApiStatus.Internal | ||
public class UUIDKeyQueuedThreadFactory implements ThreadFactory { | ||
|
||
private final ThreadGroup group; | ||
private final AtomicInteger threadNumber = new AtomicInteger(1); | ||
private final String namePrefix; | ||
|
||
public UUIDKeyQueuedThreadFactory() { | ||
group = new ThreadGroup("UUIDKeyQueuedThreadGroup"); | ||
namePrefix = "FAWE UUID-key-queued - "; | ||
} | ||
|
||
public Thread newThread(@Nonnull Runnable r) { | ||
Thread t = new UUIDKeyQueuedThread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); | ||
if (t.isDaemon()) { | ||
t.setDaemon(false); | ||
} | ||
if (t.getPriority() != Thread.NORM_PRIORITY) { | ||
t.setPriority(Thread.NORM_PRIORITY); | ||
} | ||
return t; | ||
} | ||
|
||
public static final class UUIDKeyQueuedThread extends Thread { | ||
|
||
public UUIDKeyQueuedThread(@Nullable ThreadGroup group, Runnable task, @Nonnull String name, long stackSize) { | ||
super(group, task, name, stackSize); | ||
} | ||
|
||
} | ||
|
||
} |
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