I think you'll need two threads here, one to do the work and one to keep track of time. Timer runs on another
thread alright but I'm not sure what we'd want to do when it expires. How about putting the work onto the other thread and having the thread we rode in on check the time. I've done this before:
If you're in JDK 5 look into Future, too. It has a method to get the results from a Runnable with a timeout.
BTW: I might move throwing the exception into the runnable ... then it would more like Future ...
Does that ring your chimes at all?