fix issue 517

Since when doing copyAndClear, it synchronized the Batch instance. 
To synchronize the method, to avoid the ConcurrentModifyException.