use of org.infinispan.remoting.inboundhandler.DeliverOrder in project infinispan by infinispan.
the class JGroupsTransport method backupRemotely.
@Override
public BackupResponse backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand command) {
if (log.isTraceEnabled())
log.tracef("About to send to backups %s, command %s", backups, command);
Map<XSiteBackup, CompletableFuture<ValidResponse>> backupCalls = new HashMap<>(backups.size());
for (XSiteBackup xsb : backups) {
assert !localSite.equals(xsb.getSiteName()) : "sending to local site";
Address recipient = JGroupsAddressCache.fromJGroupsAddress(new SiteMaster(xsb.getSiteName()));
long requestId = requests.newRequestId();
logRequest(requestId, command, recipient, "backup");
SingleSiteRequest<ValidResponse> request = new SingleSiteRequest<>(SingleResponseCollector.validOnly(), requestId, requests, xsb.getSiteName());
addRequest(request);
backupCalls.put(xsb, request);
DeliverOrder order = xsb.isSync() ? DeliverOrder.NONE : DeliverOrder.PER_SENDER;
long timeout = xsb.getTimeout();
try {
sendCommand(recipient, command, request.getRequestId(), order, false, false);
if (timeout > 0) {
request.setTimeout(timeoutExecutor, timeout, TimeUnit.MILLISECONDS);
}
} catch (Throwable t) {
request.cancel(true);
throw t;
}
}
return new JGroupsBackupResponse(backupCalls, timeService);
}
use of org.infinispan.remoting.inboundhandler.DeliverOrder in project infinispan by infinispan.
the class TopologyManagementHelper method executeOnClusterAsync.
public void executeOnClusterAsync(Transport transport, ReplicableCommand command) {
// invoke remotely
try {
DeliverOrder deliverOrder = DeliverOrder.NONE;
transport.sendToAll(command, deliverOrder);
} catch (Exception e) {
throw Util.rewrapAsCacheException(e);
}
// invoke the command on the local node
try {
if (log.isTraceEnabled())
log.tracef("Attempting to execute command on self: %s", command);
bcr.wireDependencies(command, true);
invokeAsync(command);
} catch (Throwable throwable) {
// The command already logs any exception in invoke()
}
}
use of org.infinispan.remoting.inboundhandler.DeliverOrder in project infinispan by infinispan.
the class ScatteredStreamIteratorTest method blockStateTransfer.
@Override
protected <K> void blockStateTransfer(Cache<?, ?> cache, CheckPoint checkPoint) {
// TODO Replace with Mocks.blockInboundCacheRpcCommand() once ISPN-10864 is fixed
Executor executor = extractGlobalComponent(cache.getCacheManager(), ExecutorService.class, KnownComponentNames.NON_BLOCKING_EXECUTOR);
TestingUtil.wrapInboundInvocationHandler(cache, handler -> new AbstractDelegatingHandler(handler) {
@Override
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) {
if (!(command instanceof ScatteredStateGetKeysCommand)) {
delegate.handle(command, reply, order);
return;
}
checkPoint.trigger(Mocks.BEFORE_INVOCATION);
// Scattered cache iteration blocks and waits for state transfer to fetch the values
// if a segment is owned in the pending CH, so we can't block forever
// Instead we just block for 2 seconds to verify ISPN-10984
checkPoint.future(Mocks.BEFORE_RELEASE, 2, TimeUnit.SECONDS, executor).whenComplete((ignored1, ignored2) -> delegate.handle(command, reply, order)).thenCompose(ignored -> {
checkPoint.trigger(Mocks.AFTER_INVOCATION);
return checkPoint.future(Mocks.AFTER_RELEASE, 20, TimeUnit.SECONDS, executor);
});
}
});
}
Aggregations