日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java.util.timertask_java.util.TimerTask翻译

發布時間:2024/9/27 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java.util.timertask_java.util.TimerTask翻译 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

java.util

Class TimerTask

java.lang.Object

java.util.TimerTask

All Implemented Interfaces:

public abstract class TimerTask

extends

Object

implements

Runnable

A task that can be scheduled for one-time or repeated execution by a Timer. 由Timer安排執行一次或重復執行的任務。

Since:

1.3

See Also:

Constructor Summary

protected

Creates a new timer task. 創建一個新的計時任務。

Method Summary

boolean

Cancels this timer task. 取消該計時任務。

abstract ?void

The action to be performed by this timer task. 由計時任務執行的動作。

long

Returns the scheduled execution time of the most recent actual execution of this task. 返回該任務安排的最近實際執行的執行時間。

Constructor Detail

TimerTask

protected TimerTask()

Creates a new timer task. 創建一個新的計時任務。

Method Detail

run

public abstract void run()

The action to be performed by this timer task. 由計時任務執行的動作。

Specified by:

in interface

cancel

public boolean cancel()

Cancels this timer task. If the task has been scheduled for one-time execution and has not yet run, or has not yet been scheduled, it will never run. If the task has been scheduled for repeated execution, it will never run again. (If the task is running when this call occurs, the task will run to completion, but will never run again.) 取消該計時任務。如果任務已被安排為一次執行并且還沒有運行或者還沒有被安排,它將不會運行。如果任務被安排為重復執行,它將不會再次運行。(如果調用時任務正在運行,任務將運行至結束,但不會再次運行。)

Note that calling this method from within the run method of a repeating timer task absolutely guarantees that the timer task will not run again. 注意在一個重復計時任務的run方法調用此方法可以絕對擔保計時任務不會再次運行。

This method may be called repeatedly; the second and subsequent calls have no effect. 該方法可以重復調用,但第二次及其后的調用不起作用。

Returns:

true if this task is scheduled for one-time execution and has not yet run, or this task is scheduled for repeated execution. Returns false if the task was scheduled for one-time execution and has already run, or if the task was never scheduled, or if the task was already cancelled. (Loosely speaking, this method returns true if it prevents one or more scheduled executions from taking place.) 如果任務被安排為一次執行而沒有運行,或者被安排為重復執行,返回true。 如果任務被安排為一次執行而已經運行,或者任務還沒有被安排,或者任務已經被取消,返回false。 (粗略地講,如果方法阻止一次或多次被安排執行的發生,返回true。)

scheduledExecutionTime

public long scheduledExecutionTime()

Returns the scheduled execution time of the most recent actual execution of this task. (If this method is invoked while task execution is in progress, the return value is the scheduled execution time of the ongoing task execution.) 返回該任務最近實際執行所安排的執行時間。(如果方法調用時任務執行正在進行,那么返回正在進行任務執行的安排執行時間值。)

This method is typically invoked from within a task's run method, to determine whether the current execution of the task is sufficiently timely to warrant performing the scheduled activity: 該方法通常在任務的run方法中調用,用來確定是否當前執行的任務是否足夠及時保證執行安排的動作:

public void run() {

if (System.currentTimeMillis() - scheduledExecutionTime() >=

MAX_TARDINESS)

return; // Too late; skip this execution.

// Perform the task

}

This method is typically not used in conjunction with fixed-delay execution repeating tasks, as their scheduled execution times are allowed to drift over time, and so are not terribly significant. 該方法通常不在固定延遲的執行重復任務的連接中使用,因為 它們的執行時間允許超時,所以意義不明顯。

Returns:

the time at which the most recent execution of this task was scheduled to occur, in the format returned by Date.getTime(). The return value is undefined if the task has yet to commence its first execution. 任務的最近執行被安排的時間,以格式Date.getTime()返回。如果任務還未開始它的第一次執行, 返回值不確定。

See Also:

Submit a bug or feature

For further API reference and developer documentation, see

Java 2 SDK SE Developer Documentation

. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject tolicense terms. Also see thedocumentation redistribution policy.

總結

以上是生活随笔為你收集整理的java.util.timertask_java.util.TimerTask翻译的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。