Quote:
Originally Posted by SamCarlberg
Hey Ben!
Solenoid methods are thread-safe. I'd be more worried about scheduling a close, doing some stuff, then opening the solenoid (and expecting it to stay open) before the scheduled close happens. In this case, the methods for opening/closing the solenoid should have checks to see if it's been claimed by a different call.
But I don't think it's a problem for something this simple.
|
It can be solved by limiting the exposure of the solenoid to a class that governs the entire mechanism, then by calling TimerTask.cancel() to eliminate the auto-close when the mechanism is told to do something different.