used scheduled executor service instead of busy loop.