skip creation of local var in proxyhandler.storetocache

pull/1/head
reger 10 years ago
parent 8a4a2929ae
commit e4316e2d74

@ -112,32 +112,30 @@ public class ProxyHandler extends AbstractRemoteHandler implements Handler {
} }
} }
private void storeToCache(final Response response, final byte[] array) { private void storeToCache(final Response yacyResponse, final byte[] cacheArray) {
final Thread t = new Thread() { final Thread t = new Thread() {
final Response yacyResponse = response; @Override
final byte[] cacheArray = array;
@Override
public void run() { public void run() {
this.setName("ProxyHandler.storeToCache(" + yacyResponse.url() + ")"); if (yacyResponse == null) return;
if (yacyResponse == null) return; this.setName("ProxyHandler.storeToCache(" + yacyResponse.url() + ")");
// the cache does either not exist or is (supposed to be) stale // the cache does either not exist or is (supposed to be) stale
deleteFromCache(yacyResponse.url().hash()); deleteFromCache(yacyResponse.url().hash());
if (cacheArray == null || cacheArray.length <= 0) return; if (cacheArray == null || cacheArray.length <= 0) return;
yacyResponse.setContent(cacheArray); yacyResponse.setContent(cacheArray);
try { try {
Cache.store(yacyResponse.url(), yacyResponse.getResponseHeader(), cacheArray); Cache.store(yacyResponse.url(), yacyResponse.getResponseHeader(), cacheArray);
sb.toIndexer(yacyResponse); sb.toIndexer(yacyResponse);
} catch (IOException e) { } catch (IOException e) {
//log.logWarning("cannot write " + response.url() + " to Cache (1): " + e.getMessage(), e); //log.logWarning("cannot write " + response.url() + " to Cache (1): " + e.getMessage(), e);
}
} }
}; }
t.setPriority(Thread.MIN_PRIORITY); };
t.start(); t.setPriority(Thread.MIN_PRIORITY);
} t.start();
}
@Override @Override
public void handleRemote(String target, Request baseRequest, HttpServletRequest request, public void handleRemote(String target, Request baseRequest, HttpServletRequest request,

Loading…
Cancel
Save