/** * @param bufferSize {@link io.protostuff.LinkedBuffer}'s buffer size. * @param maxCapacity {@link io.netty.util.Recycler}'s. */ public RecyclableLinkedBuffer(final int bufferSize, int maxCapacity) { this.recycler = new Recycler<RecyclableLinkedBuffer>(maxCapacity) { @Override protected RecyclableLinkedBuffer newObject(Handle handle) { RecyclableLinkedBuffer wrapper = new RecyclableLinkedBuffer(); wrapper.buffer = LinkedBuffer.allocate(bufferSize); wrapper.handle = handle; return wrapper; } }; }
/** * The netty {@link Recycler} has caused some problems for long running operations in some * versions of netty. As of this comment (10/21/2016), we are using netty 4.1.3.Final. The * Recycler uses a system property, "io.netty.recycler.maxCapacity" which needs to be set to "0" * to turn off potentially problematic behavior. The string gets transformed via the shading * process, and ends up being similar to the Recycler's package name. This method sets the value * to "0" if the value is not set. */ private static void turnOffNettyRecycler() { String packageName = Recycler.class.getName(); String prefix = packageName.substring(0, packageName.indexOf(".util.Recycler")); final String key = prefix + ".recycler.maxCapacity"; LOG.debug("Using prefix '{}' for io.netty.", prefix); if (System.getProperty(key) == null) { System.setProperty(key, "0"); } }
@SuppressWarnings("unchecked") private void recycle() { Recycler.Handle recyclerHandle = this.recyclerHandle; if (recyclerHandle != null) { ((Recycler<Object>) recycler()).recycle(this, recyclerHandle); } }
private Builder(Recycler.Handle handle) { this.recycleHandle = handle; this.values = new Object[16]; }
private TreeBuilder(Recycler.Handle handle) { this.recycleHandle = handle; }
public TotoroTransForm(Recycler.Handle<TransForm> handle) { this.handle = handle; }
public ElasticsearchMetadata(Recycler.Handle<ElasticsearchMetadata> handle) { this.handle = handle; }
public EsEntry(Recycler.Handle<EsEntry> handle) { this.handle = handle; }
public EsRowData(Recycler.Handle<EsRowData> handle) { this.handle = handle; }
public EsEntryArrayList(Recycler.Handle<EsEntryArrayList> handle) { this.handle = handle; }
public EsColumnHashMap(Recycler.Handle<EsColumnHashMap> handle) { this.handle = handle; }
public EsRowDataArrayList(Recycler.Handle<EsRowDataArrayList> handle) { this.handle = handle; }
private Segment(Recycler.Handle<Segment> recyclerHandle) { this.recyclerHandle = recyclerHandle; }
private UkcpPacket(Recycler.Handle<UkcpPacket> recyclerHandle) { this.recyclerHandle = recyclerHandle; }
private CodecOutputList(Recycler.Handle<CodecOutputList<T>> handle) { this.handle = handle; }
@Override protected RequestProtocol newObject(Recycler.Handle<RequestProtocol> handle) { return new RequestProtocol(handle); }
private RequestProtocol(Recycler.Handle<RequestProtocol> handle){ this.handle = handle; }
@Override protected ResponseProtocol newObject(Recycler.Handle<ResponseProtocol> handle) { return new ResponseProtocol(handle); }
public ResponseProtocol(Recycler.Handle<ResponseProtocol> handle) { this.handle = handle; }
private DefaultOutputImpl(Recycler.Handle<DefaultOutputImpl> handle) { this.handle = handle; }
@Override protected CallbackTask newObject(Recycler.Handle<CallbackTask> handle) { return new CallbackTask(handle); }
@Override protected CallbackCheckTask newObject(Recycler.Handle<CallbackCheckTask> handle) { return new CallbackCheckTask(handle); }
@Override protected Resource newObject(Recycler.Handle<Resource> handle) { return new Resource(handle); }
private Resource(Recycler.Handle<Resource> handle) { this.handle = handle; }
@Override protected Resource2 newObject(Recycler.Handle<Resource2> handle) { return new Resource2(handle); }
private Resource2(Recycler.Handle<Resource2> handle) { this.handle = handle; }
protected MessagePublishContext newObject(Recycler.Handle<MessagePublishContext> handle) { return new MessagePublishContext(handle); }
@Override protected ReplicationMetrics newObject(Recycler.Handle<ReplicationMetrics> handle) { return new ReplicationMetrics(handle); }
@Override protected DoubleByteBuf newObject(Recycler.Handle<DoubleByteBuf> handle) { return new DoubleByteBuf(handle); }
protected ByteBufCodedOutputStream newObject(Recycler.Handle<ByteBufCodedOutputStream> handle) { return new ByteBufCodedOutputStream(handle); }
protected ByteBufCodedInputStream newObject(Recycler.Handle<ByteBufCodedInputStream> handle) { return new ByteBufCodedInputStream(handle); }
protected OpReadEntry newObject(Recycler.Handle<OpReadEntry> recyclerHandle) { return new OpReadEntry(recyclerHandle); }
protected OpAddEntry newObject(Recycler.Handle<OpAddEntry> recyclerHandle) { return new OpAddEntry(recyclerHandle); }
private EntryImpl(Recycler.Handle<EntryImpl> recyclerHandle) { this.recyclerHandle = recyclerHandle; }
private PendingWrite(Recycler.Handle handle) { this.handle = handle; }
private AbstractWriteTask(Recycler.Handle handle) { super(handle); }
private WriteTask(Recycler.Handle handle) { super(handle); }
@Override protected void recycle(Recycler.Handle handle) { RECYCLER.recycle(this, handle); }
private WriteAndFlushTask(Recycler.Handle handle) { super(handle); }