use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.
the class SrmHandler method toGetRequestSummaryResponse.
private SrmGetRequestSummaryResponse toGetRequestSummaryResponse(Map<String, ListenableFuture<TRequestSummary>> futureMap) throws InterruptedException, CacheException, NoRouteToCellException {
boolean hasFailure = false;
boolean hasSuccess = false;
List<TRequestSummary> summaries = new ArrayList<>();
for (Map.Entry<String, ListenableFuture<TRequestSummary>> entry : futureMap.entrySet()) {
try {
summaries.add(entry.getValue().get());
hasSuccess = true;
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof SRMException) {
summaries.add(createRequestSummaryFailure(entry.getKey(), ((SRMException) cause).getStatusCode(), cause.getMessage()));
hasFailure = true;
} else {
Throwables.throwIfInstanceOf(cause, CacheException.class);
Throwables.throwIfInstanceOf(cause, NoRouteToCellException.class);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
}
TReturnStatus status;
if (!hasFailure) {
status = new TReturnStatus(SRM_SUCCESS, "All request statuses have been retrieved.");
} else if (hasSuccess) {
status = new TReturnStatus(SRM_PARTIAL_SUCCESS, "Some request statuses have been retrieved.");
} else {
status = new TReturnStatus(SRM_FAILURE, "No request statuses have been retrieved.");
}
return new SrmGetRequestSummaryResponse(status, new ArrayOfTRequestSummary(summaries.toArray(TRequestSummary[]::new)));
}
use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.
the class NettyTransferService method executeMover.
@Override
public Cancellable executeMover(final NettyMover<P> mover, CompletionHandler<Void, Void> completionHandler) throws IOException, CacheException, NoRouteToCellException {
return new TryCatchTemplate<Void, Void>(completionHandler) {
@Override
public void execute() throws Exception {
UUID uuid = mover.getUuid();
NettyMoverChannel channel = autoclose(new NettyMoverChannel(uuid, mover.open(), connectTimeoutUnit.toMillis(connectTimeout), this, mover::addChecksumType, mover::addExpectedChecksum));
if (uuids.putIfAbsent(uuid, channel) != null) {
throw new IllegalStateException("UUID conflict");
}
conditionallyStartServer();
setCancellable(channel);
sendAddressToDoor(mover, getServerAddress().getPort());
}
@Override
public void onFailure(Throwable t, Void attachment) throws CacheException {
if (t instanceof NoRouteToCellException) {
throw new CacheException("Failed to send redirect message to door: " + t.getMessage(), t);
}
}
};
}
Aggregations