@Override public UpdatedRegistration updateRegistration(RegistrationUpdate update) { try { lock.writeLock().lock(); Registration registration = getRegistration(update.getRegistrationId()); if (registration == null) { return null; } else { Registration updatedRegistration = update.update(registration); regsByEp.put(updatedRegistration.getEndpoint(), updatedRegistration); // If registration is already associated to this address we don't care as we only want to keep the most // recent binding. regsByAddr.put(updatedRegistration.getSocketAddress(), updatedRegistration); if (!registration.getSocketAddress().equals(updatedRegistration.getSocketAddress())) { removeFromMap(regsByAddr, registration.getSocketAddress(), registration); } regsByRegId.put(updatedRegistration.getId(), updatedRegistration); return new UpdatedRegistration(registration, updatedRegistration); } } finally { lock.writeLock().unlock(); } }
Registration updatedRegistration = update.update(r);
Registration updatedRegistration = update.update(r);