Source:
private MarshallableEntry<K, V> load(Object key, boolean fetchValue, boolean fetchMetadata) { try { DefaultHttpHeaders headers = new DefaultHttpHeaders(); DefaultHttpRequest get = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, keyToUri(key), headers); HttpResponseHandler handler = new HttpResponseHandler(true); Channel ch = bootstrap.connect(configuration.host(), configuration.port()).awaitUninterruptibly().channel().pipeline().addLast(new HttpObjectAggregator(maxContentLength), handler).channel(); ch.writeAndFlush(get).sync().channel().closeFuture().sync(); FullHttpResponse response = handler.getResponse(); try { if (HttpResponseStatus.OK.equals(response.status())) { String contentType = response.headers().get(HttpHeaderNames.CONTENT_TYPE); long created = -1; long lastUsed = -1; Metadata metadata; if (fetchMetadata) { long ttl = timeHeaderToSeconds(response.headers().get(TIME_TO_LIVE_SECONDS)); long maxidle = timeHeaderToSeconds(response.headers().get(MAX_IDLE_TIME_SECONDS)); metadata = metadataHelper.buildMetadata(contentType, ttl, TimeUnit.SECONDS, maxidle, TimeUnit.SECONDS); if (metadata.maxIdle() > -1 || metadata.lifespan() > -1) { created = ctx.getTimeService().wallClockTime(); lastUsed = created; } } else { metadata = null; } Object value; if (fetchValue) { ByteBuf content = response.content(); byte[] bytes = new byte[content.readableBytes()]; content.readBytes(bytes); value = unmarshall(contentType, bytes); } else { value = null; } return entryFactory.create(key, value, metadata, created, lastUsed); } else if (HttpResponseStatus.NOT_FOUND.equals(response.status())) { return null; } else { throw log.httpError(response.status().toString()); } } finally { response.release(); } } catch (IOException e) { throw log.httpError(e); } catch (Exception e) { throw new PersistenceException(e); } }

Target:
private MarshallableEntry<K, V> load(Object key, boolean fetchValue, boolean fetchMetadata) { try { DefaultHttpHeaders headers = new DefaultHttpHeaders(); DefaultHttpRequest get = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, keyToUri(key), headers); HttpResponseHandler handler = new HttpResponseHandler(true); Channel ch = bootstrap.connect(configuration.host(), configuration.port()).awaitUninterruptibly().channel().pipeline().addLast(new HttpObjectAggregator(maxContentLength), handler).channel(); ch.writeAndFlush(get).sync().channel().closeFuture().sync(); FullHttpResponse response = handler.getResponse(); try { if (HttpResponseStatus.OK.equals(response.status())) { String contentType = response.headers().get(HttpHeaderNames.CONTENT_TYPE); Metadata metadata; long created, lastUsed; if (fetchMetadata) { long ttl = timeHeaderToLong(response.headers().get(TIME_TO_LIVE_SECONDS)); long maxidle = timeHeaderToLong(response.headers().get(MAX_IDLE_TIME_SECONDS)); metadata = metadataHelper.buildMetadata(contentType, ttl, TimeUnit.SECONDS, maxidle, TimeUnit.SECONDS); created = timeHeaderToLong(response.headers().get(CREATED)); lastUsed = timeHeaderToLong(response.headers().get(LAST_USED)); } else { metadata = null; created = -1; lastUsed = -1; } Object value; if (fetchValue) { ByteBuf content = response.content(); byte[] bytes = new byte[content.readableBytes()]; content.readBytes(bytes); value = unmarshall(contentType, bytes); } else { value = null; } return entryFactory.create(key, value, metadata, created, lastUsed); } else if (HttpResponseStatus.NOT_FOUND.equals(response.status())) { return null; } else { throw log.httpError(response.status().toString()); } } finally { response.release(); } } catch (IOException e) { throw log.httpError(e); } catch (Exception e) { throw new PersistenceException(e); } }