[concurrency-interest] Simple ScheduledFuture problem

Joe Bowbeer joe.bowbeer at gmail.com
Wed Aug 16 20:41:55 EDT 2006

At a glance, I notice a few things that could be cleaned up, though
they may have no impact on the problem.

1. setFlag is synchronized but there is no synchronized getFlag method.

Either added synchronized getFlag, or declare flag to be "volatile".

2. doConnect(url) code may fail without closing input stream.

Add try-catch after opening input stream.

3. Also, I would consider switching to fixed delay to avoid the
possibility of multiple outstanding pings.

More information about the Concurrency-interest mailing list