# Timer

[原文](https://docs.oracle.com/javase/8/docs/api/java/util/Timer.html)

## 0x01、 概述

运行在后台线程中，为即将执行的动作进行调度的设施。 即将执行的动作可以被调度只执行一次或者按照既定规则重复执行。

每一个 Timer 对象都对应一个后台线程，该线程用于按顺序执行所有 timer 的任务。 被执行的任务应该是能够快速完成的任务。 如果一个 timer 任务需要花费过多的时间才能完成，它将占用 timer 线程的执行。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tom.gitbook.io/project/java_dev-14/doc-api/java.util/classes/timer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
