JAL-1115 change implementation to avoid possibility of deadlock