That's not safe ... there could be something added between pool and clear and so you would loose the task. The above code is safe.