Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Concepts: Timers

Joe Hegarty edited this pageApr 26, 2016 ·1 revision

Overview

Timers in Orbit allow a programmer to run a task at set intervals. They are intended to be used for events which fire frequently (milliseconds, seconds).

Timers do not keep an actor activated and will disappear on deactivation.

Timers are usually registered during actor activation, although this is not a requirement.

Using Timers

Registrationtimer;@OverridepublicTaskactivateAsync(){timer =registerTimer(() ->printMessage(),5,5,TimeUnit.SECONDS);returnsuper.activateAsync();}publicTaskprintMessage(){System.out.println("Timer Fired");timer.dispose();timer =null;returnTask.done();}
  • Registering a timer simply requires calling registerTimer
  • You can store the timer in a Registration object if required
  • Calling dispose on a timer will stop the timer from ticking.

Developed byElectronic Arts.Licensed under theBSD 3-Clause License.

Clone this wiki locally


[8]ページ先頭

©2009-2026 Movatter.jp