/** * Simply check whether the block exists, in such a way that we don't fetch the full content. If * it does exist then the USK tracker, and therefore any fetchers, will be updated. You can pass * either an SSK or a USK. */ public void hintCheck( FreenetURI uri, final Object token, ClientContext context, short priority, final HintCallback cb) throws MalformedURLException { final FreenetURI origURI = uri; if (uri.isUSK()) uri = uri.sskForUSK(); if (logMINOR) Logger.minor(this, "Doing hint fetch for " + uri); final ClientGetter get = new ClientGetter( new ClientGetCallback() { @Override public void onMajorProgress(ObjectContainer container) { // Ignore } @Override public void onSuccess( FetchResult result, ClientGetter state, ObjectContainer container) { cb.success(origURI, token); } @Override public void onFailure( FetchException e, ClientGetter state, ObjectContainer container) { if (e.isDataFound()) cb.success(origURI, token); else if (e.isDNF()) cb.dnf(origURI, token, e); else cb.failed(origURI, token, e); } }, uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK, false, null), priority, rcBulk, new NullBucket(), null, null); try { get.start(null, context); } catch (FetchException e) { if (logMINOR) Logger.minor(this, "Cannot start hint fetch for " + uri + " : " + e, e); if (e.isDataFound()) cb.success(origURI, token); else if (e.isDNF()) cb.dnf(origURI, token, e); else cb.failed(origURI, token, e); } }