Skip to content

Commit

Permalink
feat: update AllayChunkService.loadChunk()
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jun 18, 2024
1 parent 62f4d01 commit 59de5b2
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ public CompletableFuture<Chunk> loadChunk(int x, int z) {
if (presentValue != null) {
return presentValue;
}
if (AllayComputeThread.isAllayComputeThread(Thread.currentThread())) {
// 若当前线程已经为计算线程,则直接在此线程上加载区块
// 否则会出现一个计算线程等待另外一个计算线程的情况,造成线程资源的浪费
// If the current thread is already a computing thread, load the block directly on this thread
// Otherwise, one computing thread will wait for another computing thread, resulting in a waste of thread resources
loadChunkSynchronously(x, z, future);
return future;
}
// if (AllayComputeThread.isAllayComputeThread(Thread.currentThread())) {
// // 若当前线程已经为计算线程,则直接在此线程上加载区块
// // 否则会出现一个计算线程等待另外一个计算线程的情况,造成线程资源的浪费
// // If the current thread is already a computing thread, load the block directly on this thread
// // Otherwise, one computing thread will wait for another computing thread, resulting in a waste of thread resources
// loadChunkSynchronously(x, z, future);
// return future;
// }
worldStorage.readChunk(x, z, dimension.getDimensionInfo())
.exceptionally(t -> {
log.error("Error while reading chunk ({},{}) !", x, z, t);
Expand Down

0 comments on commit 59de5b2

Please sign in to comment.