ReentrantBlockableEventLoop.java

net.minecraft.util.thread.ReentrantBlockableEventLoop

信息

  • 全限定名:net.minecraft.util.thread.ReentrantBlockableEventLoop
  • 类型:public abstract class
  • 包:net.minecraft.util.thread
  • 源码路径:src/main/java/net/minecraft/util/thread/ReentrantBlockableEventLoop.java
  • 起始行号:L3
  • 继承:BlockableEventLoop
  • 职责:

    TODO

字段/常量

  • reentrantCount
    • 类型: int
    • 修饰符: private
    • 源码定位: L4
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ReentrantBlockableEventLoop(String name, boolean propagatesCrashes) @ L6

  • 构造器名:ReentrantBlockableEventLoop
  • 源码定位:L6
  • 修饰符:public

参数:

  • name: String
  • propagatesCrashes: boolean

说明:

TODO

方法

下面的方法块按源码顺序生成。

protected boolean scheduleExecutables() @ L10

  • 方法名:scheduleExecutables
  • 源码定位:L10
  • 返回类型:boolean
  • 修饰符:protected

参数:

说明:

TODO

protected boolean runningTask() @ L15

  • 方法名:runningTask
  • 源码定位:L15
  • 返回类型:boolean
  • 修饰符:protected

参数:

说明:

TODO

protected void doRunTask(R task) @ L19

  • 方法名:doRunTask
  • 源码定位:L19
  • 返回类型:void
  • 修饰符:protected

参数:

  • task: R

说明:

TODO

代码

public abstract class ReentrantBlockableEventLoop<R extends Runnable> extends BlockableEventLoop<R> {
    private int reentrantCount;
 
    public ReentrantBlockableEventLoop(String name, boolean propagatesCrashes) {
        super(name, propagatesCrashes);
    }
 
    @Override
    protected boolean scheduleExecutables() {
        return this.runningTask() || super.scheduleExecutables();
    }
 
    protected boolean runningTask() {
        return this.reentrantCount != 0;
    }
 
    @Override
    protected void doRunTask(R task) {
        this.reentrantCount++;
 
        try {
            super.doRunTask(task);
        } finally {
            this.reentrantCount--;
        }
    }
}

引用的其他类