Java言語のTimerクラスについて

このQ&Aのポイント
  • Java言語のTimerクラスについて解説します。
  • Timerクラスのscheduleメソッドの引数であるdelayとperiodの意味について説明します。
  • scheduleメソッドは、指定されたdelay時間の後にタスクを実行し、その後一定のperiod時間間隔でタスクを繰り返し実行します。
回答を見る
  • ベストアンサー

Timer schedule

Java言語のTimerクラスについて public void schedule (TimerTask task, long delay, long period) delayとperiodは何を意味するのでしょうか? よろしくお願いします public void schedule (TimerTask task, long delay, long period) Schedule a task for repeated fixed-delay execution after a specific delay. Parameters task the task to schedule. delay amount of time in milliseconds before first execution. period amount of time in milliseconds between subsequent executions.

  • Java
  • 回答数1
  • ありがとう数1

質問者が選んだベストアンサー

  • ベストアンサー
  • shikou238
  • ベストアンサー率100% (1/1)
回答No.1
参考URL:
http://java.sun.com/j2se/1.5.0/ja/docs/ja/api/java/util/Timer.html
left2012
質問者

お礼

詳細なご回答ありがとうございます。

関連するQ&A

  • Fatal error Maximum execution time

    Fatal error Maximum execution time of 0 seconds exceeded in ~ 「max_execution_time」をゼロ(無制限)にしても上記エラーが出る場合があります。 これはいかなるエラーなのでしょうか。 ご教示いただけると幸いです。

    • 締切済み
    • PHP
  • 日本語訳で困っています。

    次の英文の日本語訳がわかりません。誰か教えてください。お願いします。 (1)Performance is not likely to improve by the middle of the week even though people have time to "warm up." (2)Intelligence-test scores are likely to suffer more when people don't sleep at all for a long period of time. (3)After not having slept for a long period of time, people are still able to function properly. (4)Staying awake for three days has the same effect as sleeping less for five days. (5)People shouldn't take naps in the middle of the day or else performance will drop. (6)Taking several short naps is helpful if you can't get a normal amount of sleep at night.

  • 和訳~in a really long time

    友達が告白してくれましたが ~in a really long time がひっかかっています…。 That's not what i meant. I want to be friends, period. You are the best thing that happened to me in a really long time. ~for a really long time 実に長い間となると思うのですが⁈ よろしくお願いします‼︎

  • 英語について

    英語について The function of a thermostat is to maintain a constant temperature over a period of time.They are used in refrigerators,heating and cooling systems and many industrial processes. 訳をお願いします。 また、over a period of timeの訳し方を分りやすく教えてください。 あと、systemsとなっているのはheatingとcoolingがあるからなんでしょうか? 最後に、inはrefrigeratorsだけでなくin以降のすべてを修飾しているんでしょうか?

  • InterruptのCPUが跳ね上がり音飛びする

    windows7 64bit home Lenovoノート G570(サポートにあるドライバは全て最新) 内蔵 CPU i5 2.3G、MEM4G+8G(テスト済み)、SSD520 240G、LANカードAdvanced-N6250+Wimax abgn 外付け 3.5インチ4台ケースをUSB、E2220HDをDVI、M570マウスを使用。(全て外しても変化なし) セキュリティ AVIRA、COMODOFW、SuperAntiSpyware(全て検査済み) 症状 ブラウザで動画を再生中、5分おきぐらいに動作が重くなって音が飛ぶ。 ProcessExplorerによると「Interrupt」がCPUを瞬間的に30~40%消費している。 何故か普段でも1.2%前後で、スレッドには何も表示されず。 LatencyMonで確認するとDPCにおいて「ndis.sys NDIS6.20ドライバ」が原因とのこと。 ndis.sysはwinsxsとsystem32で見つかる。デバイスマネージャでAtheros AR8152/8158有線ドライバが該当していたので無効。 LatencyMonの結果変わらず。アンインストールして再起動。 LatencyMonの結果変わらず。Lenovoサポートから最新ドライバを落としインストール。 LatencyMonの結果変わらず。アンインストールして再起動で打つ手がなくなりました。 該当情報を検索しても海外の掲示板が引っかかるのみです。 以下にLMの結果をコピペしますので、足りない情報と解決策を教えてください。 REPORTED ISRs _________________________________________________________________________________________________________ Interrupt service routines are routines installed by the OS and device drivers that execute in response to a hardware interrupt signal. Highest ISR routine execution time (µs): 121.915867 Driver with highest ISR routine execution time: HDAudBus.sys - High Definition Audio Bus Driver, Microsoft Corporation Highest reported total ISR routine time (%): 0.056097 Driver with highest ISR total time: hal.dll - Hardware Abstraction Layer DLL, Microsoft Corporation Total time spent in ISRs (%) 0.080449 ISR count (execution time <250 µs): 261401 ISR count (execution time 250-500 µs): 0 ISR count (execution time 500-999 µs): 0 ISR count (execution time 1000-1999 µs): 0 ISR count (execution time 2000-3999 µs): 0 ISR count (execution time >=4000 µs): 0 _________________________________________________________________________________________________________ REPORTED DPCs _________________________________________________________________________________________________________ DPC routines are part of the interrupt servicing dispatch mechanism and disable the possibility for a process to utilize the CPU while it is interrupted until the DPC has finished execution. Highest DPC routine execution time (µs): 163516.577594 Driver with highest DPC routine execution time: ndis.sys - NDIS 6.20 ドライバー, Microsoft Corporation Highest reported total DPC routine time (%): 0.751335 Driver with highest DPC total execution time: ndis.sys - NDIS 6.20 ドライバー, Microsoft Corporation Total time spent in DPCs (%) 1.289586 DPC count (execution time <250 µs): 1548954 DPC count (execution time 250-500 µs): 0 DPC count (execution time 500-999 µs): 4822 DPC count (execution time 1000-1999 µs): 114 DPC count (execution time 2000-3999 µs): 25 DPC count (execution time >=4000 µs): 0 _________________________________________________________________________________________________________ REPORTED HARD PAGEFAULTS _________________________________________________________________________________________________________ Hard pagefaults are events that get triggered by making use of virtual memory that is not resident in RAM but backed by a memory mapped file on disk. The process of resolving the hard pagefault requires reading in the memory from disk while the process is interrupted and blocked from execution. Process with highest pagefault count: vpnclient_x64.exe Total number of hard pagefaults 57 Hard pagefault count of hardest hit process: 38 Highest hard pagefault resolution time (µs): 50.428509 Total time spent in hard pagefaults (%): 0.000109 Number of processes hit: 5

  • new Runnable() runメソッド

    以下ソースコードの@Override注釈を入れるとエラーになります。 Runnableインターフェースではrumメソッドをオーバーライドする必要があると思うのですが、 @Override注釈を入れるとエラーになります。 @Override注釈を入れないとエラーにならず実行できます。 環境はEclipseで、Androidのエミュレーターへ出力してテスト中です。 どなたか原因をご存じの方がおられましたら、アドバイスよろしくお願い致します。 public void startTimer(){ final Handler handler = new Handler(); TimerTask task = new TimerTask(){ @Override public void run() { handler.post(new Runnable(){ //@Override ←ここを記入するとエラーになる。 public void run() { board.doComp(); invalidate(); timer.cancel(); if (!board.isPlaying) return; if (board.isPass(board.you)){ board.addMessage("あなたは、パスです。"); showMsg("あなたは、パスです。"); startTimer(); } else { board.canMove = true; } } }); } }; timer = new Timer(); timer.schedule(task, 1000); }

    • ベストアンサー
    • Java
  • 英語の訳をお願いします!!

    For example as Table 1shows, the amount of magnesium in brown rice is seven time as much as that in white rice.Whole-wheat bread contain more than three time the amount of it than in white breads.There is also a large different in the amoun of potassium between refined grain foods and whole-grain foods.However,some minerals are contained in larger amounts in refined grain foods. For example, the same amount of sodium is contained in both white rice and brown rice, but white bread contains more of it than whole-wheat bread.

  • long periods

    とあるサイトでこのような文がありました。 Besides using bleach, i'm sure that the hotels don't use the same towels for long periods of time. Maybe a few months before they are thrown out. この文のlong periods of timeなのですが、periodのうしろにsをつけた理由はなんなのでしょうか??ふつうは、つけないでつかうんじゃなかったけ?と思ったのですが.. 回答おねがします。

  • with the sign reversed この意味は?

    Transactions in the assets include the accrual of interest, over a period of time but with the sign reversed.という文面で使用されているwith the sign reversedはどういう意味になりますか?

  • 解答をお願いします。

    自分でやってみたのですが、いまいち自信が持てないので 詳しい方教えて下さい。 clammy cramping dilated excruciating gradual intermittent intolerable pallor persistent radiate ↑の単語を当てはめる問題です。 1. ( gradual ) process occurring slowly over a period of time 2. ( excruciating ) extremely painful 3. ( intermittent ) happening occasionally 4.( persistent ) something that continues over a long period of time. 5. ( clammy ) unpleasantly damp or sticky 6. ( cramping ) feeling caused by a contraction of the muscles 7. ( pallor ) pale, unhealthy looking skin 8. ( intolerable ) unbearable 9. ( radiate ) spreads in all directions from a particular point 10. ( dilated ) open wide, opposite of contracted どうでしょうか><;

専門家に質問してみよう