public void setUnitOfWork(UnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; if (unitOfWork != null && onCompletions != null) { // now an unit of work has been assigned so add the on completions // we might have registered already for (Synchronization onCompletion : onCompletions) { unitOfWork.addSynchronization(onCompletion); } // cleanup the temporary on completion list as they now have been registered // on the unit of work onCompletions.clear(); onCompletions = null; } }