log.debugf("Discard x-site state transfer start command in cache %s to remove", addressOf(cache(LON, testCaches.removeIndex)));
wrapComponent(cache(LON, testCaches.removeIndex), XSiteStateProvider.class,
new WrapFactory<XSiteStateProvider, XSiteStateProvider, Cache<?, ?>>() {
@Override
public XSiteStateProvider wrap(Cache<?, ?> wrapOn, XSiteStateProvider current) {
return new XSiteProviderDelegator(current) {
@Override
public void startStateTransfer(String siteName, Address requestor, int minTopologyId) {
log.debugf("Discard state transfer request to %s from %s", siteName, requestor);
//no-op, i.e. discard it!
}
};
}
}, true);
} else {
log.debugf("Block x-site state transfer start command in cache %s", addressOf(cache(LON, 1)));
wrapComponent(cache(LON, 1), XSiteStateProvider.class,
new WrapFactory<XSiteStateProvider, XSiteStateProvider, Cache<?, ?>>() {
@Override
public XSiteStateProvider wrap(Cache<?, ?> wrapOn, XSiteStateProvider current) {
return new XSiteProviderDelegator(current) {
@Override
public void startStateTransfer(String siteName, Address requestor, int minTopologyId) {
log.debugf("Blocking state transfer request to %s from %s", siteName, requestor);
pendingRequest.set(new StateTransferRequest(siteName, requestor, minTopologyId, xSiteStateProvider));
}