use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.
the class ConsistentReplicaStore method get.
/**
* Retrieves a CacheRepositoryEntry from the wrapped meta data store. If the entry is missing or
* fails consistency checks, the entry is reconstructed with information from PNFS.
*/
@Override
public ReplicaRecord get(PnfsId id) throws IllegalArgumentException, CacheException {
ReplicaRecord entry = _replicaStore.get(id);
if (entry != null && isBroken(entry)) {
LOGGER.warn("Recovering {}...", id);
try {
/* It is safe to remove FROM_STORE/FROM_POOL replicas: We have
* another copy anyway. Files in REMOVED or DESTROYED
* were about to be deleted, so we can finish the job.
*/
switch(entry.getState()) {
case FROM_POOL:
case FROM_STORE:
case REMOVED:
case DESTROYED:
_replicaStore.remove(id);
_pnfsHandler.clearCacheLocation(id);
LOGGER.info("Recovering: Removed {} because it was not fully staged.", id);
return null;
}
entry = rebuildEntry(entry);
} catch (IOException e) {
throw new DiskErrorCacheException("I/O error in healer: " + messageOrClassName(e), e);
} catch (FileNotFoundCacheException e) {
_replicaStore.remove(id);
LOGGER.warn("Recovering: Removed {} because name space entry was deleted.", id);
return null;
} catch (FileIsNewCacheException e) {
_replicaStore.remove(id);
LOGGER.warn("Recovering: Removed {}: {}", id, e.getMessage());
return null;
} catch (TimeoutCacheException e) {
throw e;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CacheException("Pool is shutting down", e);
} catch (CacheException | NoSuchAlgorithmException e) {
entry.update("Failed to recover replica: " + e.getMessage(), r -> r.setState(ReplicaState.BROKEN));
LOGGER.error(AlarmMarkerFactory.getMarker(PredefinedAlarm.BROKEN_FILE, id.toString(), _poolName), "Marked {} bad: {}.", id, e.getMessage());
}
}
return entry;
}
use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.
the class XrootdRedirectHandler method doOnStatx.
@Override
protected XrootdResponse<StatxRequest> doOnStatx(ChannelHandlerContext ctx, StatxRequest req) throws XrootdException {
if (req.getPaths().length == 0) {
throw new XrootdException(kXR_ArgMissing, "no paths specified");
}
try {
FsPath[] paths = new FsPath[req.getPaths().length];
for (int i = 0; i < paths.length; i++) {
paths[i] = createFullPath(req.getPaths()[i]);
}
LoginSessionInfo loginSessionInfo = sessionInfo();
Subject subject = loginSessionInfo.getSubject();
Restriction restriction = loginSessionInfo.getRestriction();
return new StatxResponse(req, _door.getMultipleFileStatuses(paths, subject, restriction));
} catch (TimeoutCacheException e) {
throw xrootdException(e.getRc(), "Internal timeout");
} catch (PermissionDeniedCacheException e) {
throw xrootdException(e);
} catch (CacheException e) {
throw xrootdException(e.getRc(), String.format("Failed to open file (%s [%d])", e.getMessage(), e.getRc()));
}
}
use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.
the class UserAdminShell method checkPermission.
/**
* Checks that the current effective user has the given acl.
*
* @throws AclException if the current user does not have the given {@code aclName}
*/
public void checkPermission(String aclName) throws AclException {
Object[] request = new Object[5];
request[0] = "request";
request[1] = "<nobody>";
request[2] = "check-permission";
request[3] = getUser();
request[4] = aclName;
Object[] r;
try {
r = _acmStub.sendAndWait(request, Object[].class);
} catch (TimeoutCacheException | NoRouteToCellException e) {
throw new AclException(e.getMessage());
} catch (CacheException | InterruptedException e) {
throw new AclException("Problem: " + e.getMessage());
}
if (r.length < 6 || !(r[5] instanceof Boolean)) {
throw new AclException("Protocol violation 4456");
}
if (!((Boolean) r[5])) {
throw new AclException(getUser(), aclName);
}
}
use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.
the class HttpBillingEngine method printMainStatisticsPage.
private void printMainStatisticsPage(OutputStream out) throws HttpException {
HTMLWriter html = new HTMLWriter(out, _context);
try {
Object[][] x = _billing.sendAndWait("get billing info", Object[][].class);
html.addHeader("/styles/billing.css", "dCache Billing");
printTotalStatistics(html, x);
try {
Map<String, long[]> map = _billing.sendAndWait("get pool statistics", Map.class);
printPoolStatistics(html, map, null);
} catch (InterruptedException | TimeoutCacheException e) {
throw e;
} catch (CacheException e) {
html.print("<p class=\"error\">This 'billingCell' doesn't support: 'get pool statistics':");
html.print("<blockquote><pre>" + e + "</pre></blockquote>");
}
} catch (NoRouteToCellException e) {
throw new HttpException(500, "No connection to billing");
} catch (TimeoutCacheException e) {
throw new HttpException(500, "Request Timed Out");
} catch (InterruptedException | CacheException e) {
throw new HttpException(500, "Problem : " + e.getMessage());
} finally {
html.addFooter(getClass().getName());
}
}
use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.
the class HttpPoolMgrEngineV3 method showMatch.
private void showMatch(PrintWriter pw, HttpRequest request) throws NoRouteToCellException, InterruptedException {
String type = request.getParameter(PARAMETER_TYPE);
String store = request.getParameter(PARAMETER_STORE);
String dcache = request.getParameter(PARAMETER_DCACHE);
String net = request.getParameter(PARAMETER_NET);
String prot = request.getParameter(PARAMETER_PROTOCOL);
String linkGroup = request.getParameter(PARAMETER_LINKGROUP);
linkGroup = (linkGroup == null) || (linkGroup.isEmpty()) ? "none" : linkGroup;
store = (store == null) || (store.isEmpty()) ? "*" : store;
dcache = (dcache == null) || (dcache.isEmpty()) ? "*" : dcache;
net = (net == null) || (net.isEmpty()) ? "*" : net;
prot = (prot == null) || (prot.isEmpty()) ? "*" : prot;
pw.println("<center>");
if (type == null) {
showQueryForm(pw, "none", "read", "*", "*", "*", "DCap/3");
} else {
showQueryForm(pw, linkGroup, type, store, dcache, net, prot);
pw.println("<p><hr><p>");
try {
PoolPreferenceLevel[] result = _poolManager.sendAndWait("psux match " + type + " " + store + " " + dcache + " " + net + " " + prot + (linkGroup.equals("none") ? "" : " -linkGroup=" + linkGroup), PoolPreferenceLevel[].class);
for (int i = 0; i < result.length; i++) {
pw.print("<p><h2>Selected Pools with attraction " + i);
String tag = result[i].getTag();
if (tag != null) {
pw.print(" (dCache subsection=" + tag + ")");
}
pw.println("</h2>");
showList(pw, result[i].getPoolList().toArray(), 8, "/poolInfo/pools/");
}
} catch (TimeoutCacheException e) {
showTimeout(pw);
} catch (CacheException e) {
showProblem(pw, e.getMessage());
}
}
pw.println("</center>");
}
Aggregations