@Override public void startStateTransfer(String sendingSite) { if (debug) { log.debugf("Starting state transfer. Receiving from %s", sendingSite); } if (this.sendingSite.compareAndSet(null, sendingSite)) { commitManager.startTrack(Flag.PUT_FOR_X_SITE_STATE_TRANSFER); } else { throw new CacheException("Already receiving state from " + this.sendingSite.get()); } }
@Override public void endStateTransfer(String sendingSite) { if (debug) { log.debugf("Ending state transfer from %s", sendingSite); } String currentSendingSite = this.sendingSite.get(); if (sendingSite == null || sendingSite.equals(currentSendingSite)) { this.sendingSite.set(null); commitManager.stopTrack(PUT_FOR_X_SITE_STATE_TRANSFER); } else { if (log.isDebugEnabled()) { log.debugf( "Received an end request from a non-sender site. Expects %s but got %s", currentSendingSite, sendingSite); } } }