package org.glassfish.grizzly.http;
import org.glassfish.grizzly.Buffer;
import org.glassfish.grizzly.Cacheable;
import org.glassfish.grizzly.ThreadCache;
public final class ParsingResult implements Cacheable {
private static final ThreadCache.CachedTypeIndex<ParsingResult> CACHE_IDX = ThreadCache.obtainIndex(ParsingResult.class, 1);
private HttpContent httpContent;
private Buffer remainderBuffer;
private boolean = true;
public static ParsingResult create(final HttpContent httpContent, final Buffer remainderBuffer) {
ParsingResult resultObject = ThreadCache.takeFromCache(CACHE_IDX);
if (resultObject == null) {
resultObject = new ParsingResult();
}
resultObject.httpContent = httpContent;
resultObject.remainderBuffer = remainderBuffer;
return resultObject;
}
public static ParsingResult create(final HttpContent httpContent, final Buffer remainderBuffer, final boolean sendHeaderUpstream) {
ParsingResult resultObject = create(httpContent, remainderBuffer);
resultObject.sendHeaderUpstream = sendHeaderUpstream;
return resultObject;
}
private ParsingResult() {
}
public Buffer getRemainderBuffer() {
return remainderBuffer;
}
public HttpContent getHttpContent() {
return httpContent;
}
public boolean () {
return sendHeaderUpstream;
}
@Override
public void recycle() {
remainderBuffer = null;
httpContent = null;
sendHeaderUpstream = true;
ThreadCache.putToCache(CACHE_IDX, this);
}
}