Changed the thread implementations to scheduled executors.