/** * Give it a number of tries to update the event/meeting object into DB storage if this still * satisfy the pre-condition regardless some changes in DB storage */ private void handleVersion(SignupMeeting meeting, SignupTimeslot timeslot, SignupAttendee waiter) throws Exception { boolean success = false; for (int i = 0; i < MAX_NUMBER_OF_RETRY; i++) { try { meeting = reloadMeeting(meeting.getId()); prepareRemoveFromWaitingList(meeting, timeslot, waiter); signupMeetingService.updateSignupMeeting(meeting, isOrganizer); success = true; break; // add attendee is successful } catch (OptimisticLockingFailureException oe) { // don't do any thing } } if (!success) throw new SignupUserActionException(Utilities.rb.getString("someone.already.updated.db")); }
private SignupMeeting reloadMeeting(Long meetingId) { SignupMeeting m = signupMeetingService.loadSignupMeeting(meetingId, currentUserId, currentSiteId); return m; }