I'm not sure if Java has the same thing, but in C++ another easy way to do something like this (without having to worry about yielding, since it does it for you automatically) in a different thread is via the Notifier class. It calls a function every N seconds (we specified 0.0025 seconds) on a different thread. Then you just have your state machine in a single function and have it do the right thing (ie, operate the right switches and such) every time the function gets called. And as the other poster said, you have a different function that gets called by the main thread that touches the state variables.
Of course, a key thing when dealing with multiple threads is to make sure you deal with potential synchronization problems, by using the appropriate locking mechanisms. In C++, you can use the Synchronized class to do that.
I've attached our Kicker code in C++. The full version of our 2010 code is at
http://www.virtualroadside.com/FRC/