MCPcopy Create free account
hub / github.com/e2wugui/zeze / initThreadPool

Method initThreadPool

ZezeJava/ZezeJava/src/main/java/Zeze/Util/Task.java:117–134  ·  view source on GitHub ↗
(@NotNull ExecutorService pool,
									  @NotNull ScheduledExecutorService scheduled)

Source from the content-addressed store, hash-verified

115 }
116
117 public static void initThreadPool(@NotNull ExecutorService pool,
118 @NotNull ScheduledExecutorService scheduled) {
119 taskLock.lock();
120 try {
121 //noinspection ConstantValue
122 if (pool == null || scheduled == null)
123 throw new IllegalArgumentException();
124
125 if (threadPoolDefault != null || threadPoolScheduled != null)
126 throw new IllegalStateException("ThreadPool Has Inited.");
127 threadPoolDefault = pool;
128 threadPoolScheduled = scheduled;
129 threadPoolCritical = newCriticalThreadPool("ZezeCriticalPool");
130 ThreadDiagnosable.startDiagnose(30_000);
131 } finally {
132 taskLock.unlock();
133 }
134 }
135
136 public static boolean tryInitThreadPool() {
137 return tryInitThreadPool(null);

Callers 7

mainMethod · 0.95
mainMethod · 0.95
_runMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95

Calls 4

newCriticalThreadPoolMethod · 0.95
startDiagnoseMethod · 0.95
lockMethod · 0.65
unlockMethod · 0.65

Tested by 4

mainMethod · 0.76
mainMethod · 0.76
_runMethod · 0.76
mainMethod · 0.76