001// 002// NAME 003// TimerNotifier.java 004// 005// COPYRIGHT 006// Copyright 2007-2014 Cloud Software Group, Inc. ALL RIGHTS RESERVED. 007// Cloud Software Group, Inc. Confidential Information 008// 009// HISTORY 010// $Revision: 1.1.2.84 $ $Date: 2014/02/06 20:35:16 $ 011// 012// WARNINGS 013// THIS FILE IS GENERATED, DO NOT EDIT 014// 015 016package com.kabira.platform.swtimer; 017 018import java.util.*; 019import com.kabira.platform.annotation.*; 020 021 022/** 023<p> 024 Timer Notifier 025<p> 026 The TimerNotifier provides timer control and a 027 user provided notification operation, 028 timerNotify(). 029<p> 030 Multiple timers may be started against a 031 single instance of a TimerNotifier. 032<p> 033 The life cycle of the notifier is controlled 034 by the user. If a timer fires on a notifier 035 that has been deleted by the user, 036 the timer will be automatically canceled. 037 038 039*/ 040 041@Managed 042public class TimerNotifier 043{ 044 private static final String _RuntimeType = "swtimer::TimerNotifier"; 045 046/** 047Create a new TimerNotifier 048 049*/ 050 public TimerNotifier() 051 { 052 super(); 053 } 054 055 056 /** 057 <p> 058 Start a timer that fires once 059@param seconds The number of seconds before 060 this timer should fire. 061 062@param object Object handle to be passed 063 to the timer notifier 064 when the timer fires. 065 066@return TimerId ID for this timer. 067<p> 068 Starts a timer that will fire once, 069 at least "seconds" seconds from now. 070 The TimerId result and the object 071 parameter will be passed to 072 the timerNotify operation when the 073 timer fires. 074 075 076 */ 077 078 public final native String startOneShot( 079 final int seconds, 080 final java.lang.Object object); 081 082 083 /** 084 <p> 085 Start a timer that fires multiple times 086@param seconds The number of seconds before 087 this timer should fire. 088 089@param object Object handle to be passed 090 to the timer notifier 091 when the timer fires. 092 093@return TimerId ID for this timer. 094<p> 095 Starts a timer that will fire every 096 "seconds" seconds, starting 097 "seconds" seconds from now. 098 The TimerId result and the object 099 parameter will be passed to 100 the timerNotify operation when the 101 timer fires. 102 103 104 */ 105 106 public final native String startRecurring( 107 final int seconds, 108 final java.lang.Object object); 109 110 111 /** 112 <p> 113 Reset the timer expiration time 114@param timerId The ID of the timer to reset 115@param seconds The number of seconds to 116 rest the timer to. 117 118@return Result 119<p> 120 Resets the expiration time on an 121 existing timer to "seconds" seconds 122 from now. 123<p> 124 Ok is returned if the timer was found 125 and reset. Otherwise Fail is 126 returned. 127 128 129 */ 130 131 public final native com.kabira.platform.swtimer.Result reset( 132 final String timerId, 133 final int seconds); 134 135 136 /** 137 <p> 138 Start a timer that fires once 139@param milliseconds The number of milliseconds before 140 this timer should fire. 141 142@param object Object handle to be passed 143 to the timer notifier 144 when the timer fires. 145 146@return TimerId ID for this timer. 147<p> 148 Starts a timer that will fire once, 149 at least "milliseconds" milliseconds 150 from now. 151 The TimerId result and the object 152 parameter will be passed to 153 the timerNotify operation when the 154 timer fires. 155 156<p> 157<b>Warnings: </b> The timer resolution is dependent 158 upon the current setting of the 159 timerResolutionMilliseconds 160 161 162 */ 163 164 public final native String highResolutionStartOneShot( 165 final int milliseconds, 166 final java.lang.Object object); 167 168 169 /** 170 <p> 171 Start a timer that fires multiple times 172@param milliseconds The number of milliseconds 173 before this timer should fire. 174 175@param object Object handle to be passed 176 to the timer notifier 177 when the timer fires. 178 179@return TimerId ID for this timer. 180<p> 181 Starts a timer that will fire every 182 "milliseconds" milliseconds, starting 183 "milliseconds" milliseconds from now. 184 The TimerId result and the object 185 parameter will be passed to 186 the timerNotify operation when the 187 timer fires. 188 189<p> 190<b>Warnings: </b> The timer resolution is dependent 191 upon the current setting of the 192 timerResolutionMilliseconds 193 configuration value. 194 195 196 */ 197 198 public final native String highResolutionStartRecurring( 199 final int milliseconds, 200 final java.lang.Object object); 201 202 203 /** 204 <p> 205 Reset the timer expiration time 206@param timerId The ID of the timer to reset 207@param milliseconds The number of milliseconds to 208 reset the timer to. 209 210@return Result 211<p> 212 Resets the expiration time on an 213 existing timer to "seconds" seconds 214 from now. 215<p> 216 Ok is returned if the timer was found 217 and reset. Otherwise Fail is 218 returned. 219 220<p> 221<b>Warnings: </b> The timer resolution is dependent 222 upon the current setting of the 223 timerResolutionMilliseconds 224 225 226 */ 227 228 public final native com.kabira.platform.swtimer.Result highResolutionReset( 229 final String timerId, 230 final int milliseconds); 231 232 233 /** 234 <p> 235 Cancel the timer 236@param timerId ID of the timer to cancel. 237<p> 238 Cancels an existing timer. 239<p> 240 This operation returns void 241 because there are inherent race 242 conditions when canceling timers 243 in multi-threaded systems. 244 It is possible for one 245 (or even more in very busy systems) 246 timer notifications to arrive after 247 the cancel has completed. 248<p> 249 The application calling cancel (on 250 one thread/CPU) may be occurring 251 simultaneously with the timer service 252 thread (on another thread/CPU) 253 executing the timer notification. 254 Another possibility is that the 255 timer service has queued one or 256 more notifications that haven't yet 257 been serviced due to CPU starvation. 258 259 260 */ 261 262 public final native void cancel( 263 final String timerId); 264 265 266 /** 267 <p> 268 Called when a timer fires 269@param object The object handle that was 270 passed to the timer start 271 operation. 272 273@param timerId The ID that was returned from 274 the timer start operation. 275 276<p> 277 This operation must be implemented 278 by in the callers interface, derived 279 from swtimer::TimerNotifier. 280<p> 281 It is invoked by the timer service 282 when a timer fires. 283 284 285 */ 286 287 public native void timerNotify( 288 final String timerId, 289 final java.lang.Object object); 290 291 292 /** 293 <p> 294 Called when a timer fires 295@param object The object handle that was 296 passed to the timer start 297 operation. 298 299@param timerId The ID that was returned from 300 the timer start operation. 301 302<p> 303 This operation must be implemented 304 by in the callers interface, derived 305 from swtimer::TimerNotifier. 306<p> 307 It is invoked by the timer service 308 when a timer fires. 309 310 311 */ 312 313 private native void timerNotify_super( 314 final String timerId, 315 final java.lang.Object object); 316 317}