diff options
author | Nick Hudson <nick.hudson@isode.com> | 2012-01-16 15:43:40 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-01-16 15:54:31 (GMT) |
commit | 3adee817bfcbd54fd13c4d946bedadeca661e9b1 (patch) | |
tree | 57787bd6a45c1a207f776f883f6192f04c00d832 /test/com/isode | |
parent | 1c107332343c7ce4dadb02d69148d4232cebf965 (diff) | |
download | stroke-3adee817bfcbd54fd13c4d946bedadeca661e9b1.zip stroke-3adee817bfcbd54fd13c4d946bedadeca661e9b1.tar.bz2 |
Update JavaTimer class to guard against premature timer expiration
The JavaTimer class uses Thead.sleep() to wait a specified number of
milliseconds. Thread.sleep() requires the caller catch
InterruptedException, but in the original implementation, such an
exception would result in the code assuming that the specified time
had been reached.
So as things stood, if you e.g. set a timer for 60 seconds, then the
timer might generate its "onTick" signal before that 60 seconds had
elapsed.
This patch changes the code so that the method will wait until the
specified time has been reached.
The "milliseconds" parameters are also changed to "long", which is the
type used by the rest of the java library for millisecond values.
Added a bit of javadoc and a toString() method as well.
Note there is still a "FIXME" in the code which I've not addressed.
Test-information:
Tested in debugging setup; things seem to be working as expected.
Diffstat (limited to 'test/com/isode')
0 files changed, 0 insertions, 0 deletions