TelemetryEventLog.java

net.minecraft.client.telemetry.TelemetryEventLog

信息

  • 全限定名:net.minecraft.client.telemetry.TelemetryEventLog
  • 类型:public class
  • 包:net.minecraft.client.telemetry
  • 源码路径:src/main/java/net/minecraft/client/telemetry/TelemetryEventLog.java
  • 起始行号:L15
  • 实现:AutoCloseable
  • 职责:

    TODO

字段/常量

  • LOGGER

    • 类型: Logger
    • 修饰符: private static final
    • 源码定位: L16
    • 说明:

      TODO

  • log

    • 类型: JsonEventLog<TelemetryEventInstance>
    • 修饰符: private final
    • 源码定位: L17
    • 说明:

      TODO

  • consecutiveExecutor

    • 类型: ConsecutiveExecutor
    • 修饰符: private final
    • 源码定位: L18
    • 说明:

      TODO

内部类/嵌套类型

构造器

public TelemetryEventLog(FileChannel channel, Executor executor) @ L20

  • 构造器名:TelemetryEventLog
  • 源码定位:L20
  • 修饰符:public

参数:

  • channel: FileChannel
  • executor: Executor

说明:

TODO

方法

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

public TelemetryEventLogger logger() @ L25

  • 方法名:logger
  • 源码定位:L25
  • 返回类型:TelemetryEventLogger
  • 修饰符:public

参数:

说明:

TODO

public void close() @ L35

  • 方法名:close
  • 源码定位:L35
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class TelemetryEventLog implements AutoCloseable {
    private static final Logger LOGGER = LogUtils.getLogger();
    private final JsonEventLog<TelemetryEventInstance> log;
    private final ConsecutiveExecutor consecutiveExecutor;
 
    public TelemetryEventLog(FileChannel channel, Executor executor) {
        this.log = new JsonEventLog<>(TelemetryEventInstance.CODEC, channel);
        this.consecutiveExecutor = new ConsecutiveExecutor(executor, "telemetry-event-log");
    }
 
    public TelemetryEventLogger logger() {
        return event -> this.consecutiveExecutor.schedule(() -> {
            try {
                this.log.write(event);
            } catch (IOException var3) {
                LOGGER.error("Failed to write telemetry event to log", (Throwable)var3);
            }
        });
    }
 
    @Override
    public void close() {
        this.consecutiveExecutor.schedule(() -> IOUtils.closeQuietly(this.log));
        this.consecutiveExecutor.close();
    }
}

引用的其他类