下面列出了怎么用io.netty.util.Recycler.Handle的API类实例代码及写法,或者点击链接到github查看源代码。
private MessagePublishContext(Handle<MessagePublishContext> recyclerHandle) {
this.recyclerHandle = recyclerHandle;
}
private RecyclableArrayList(Handle handle) {
this(handle, DEFAULT_INITIAL_CAPACITY);
}
private MessageFetchContext(Handle<MessageFetchContext> recyclerHandle) {
this.recyclerHandle = recyclerHandle;
}
protected MessageFetchContext newObject(Handle<MessageFetchContext> handle) {
return new MessageFetchContext(handle);
}
@Override
protected RecyclableArrayDeque newObject(Handle<RecyclableArrayDeque> handle) {
return new RecyclableArrayDeque(DEFAULT_NUM_ELEMENTS, handle);
}
private RecyclableArrayDeque(int numElements, Handle<RecyclableArrayDeque> handle) {
super(numElements);
this.handle = handle;
}
@Override
protected Entry newObject(Handle<Entry> handle) {
return new Entry(handle);
}
private Entry(Handle<Entry> handle) {
this.handle = handle;
}
@Override
protected PooledSlicedByteBuf newObject(Handle<PooledSlicedByteBuf> handle) {
return new PooledSlicedByteBuf(handle);
}
private PooledSlicedByteBuf(Handle<PooledSlicedByteBuf> handle) {
super(handle);
}
@Override
protected PooledUnsafeHeapByteBuf newObject(Handle<PooledUnsafeHeapByteBuf> handle) {
return new PooledUnsafeHeapByteBuf(handle, 0);
}
private PooledUnsafeHeapByteBuf(Handle<PooledUnsafeHeapByteBuf> recyclerHandle, int maxCapacity) {
super(recyclerHandle, maxCapacity);
}
@SuppressWarnings("unchecked")
AbstractPooledDerivedByteBuf(Handle<? extends AbstractPooledDerivedByteBuf> recyclerHandle) {
super(0);
this.recyclerHandle = (Handle<AbstractPooledDerivedByteBuf>) recyclerHandle;
}
Entry(Handle<Entry<?>> recyclerHandle) {
this.recyclerHandle = recyclerHandle;
}
@SuppressWarnings("unchecked")
@Override
protected Entry newObject(Handle<Entry> handle) {
return new Entry(handle);
}
@Override
protected ThreadLocalUnsafeDirectByteBuf newObject(Handle<ThreadLocalUnsafeDirectByteBuf> handle) {
return new ThreadLocalUnsafeDirectByteBuf(handle);
}
private ThreadLocalUnsafeDirectByteBuf(Handle<ThreadLocalUnsafeDirectByteBuf> handle) {
super(UnpooledByteBufAllocator.DEFAULT, 256, Integer.MAX_VALUE);
this.handle = handle;
}
@Override
protected ThreadLocalDirectByteBuf newObject(Handle<ThreadLocalDirectByteBuf> handle) {
return new ThreadLocalDirectByteBuf(handle);
}
@Override
protected LPacketEvent newObject(Handle<LPacketEvent> handle) {
return new LPacketEvent(handle);
}
private ByteBufPayload(final Handle<ByteBufPayload> handle) {
this.handle = handle;
}
private PooledDuplicatedByteBuf(Handle<PooledDuplicatedByteBuf> handle) {
super(handle);
}
@SuppressWarnings("unchecked")
protected PooledByteBuf(Recycler.Handle<? extends PooledByteBuf<T>> recyclerHandle, int maxCapacity) {
super(maxCapacity);
this.recyclerHandle = (Handle<PooledByteBuf<T>>) recyclerHandle;
}
@Override
protected RecyclableArrayList newObject(Handle<RecyclableArrayList> handle) {
return new RecyclableArrayList(handle);
}
private RecyclableArrayList(Handle<RecyclableArrayList> handle) {
this(handle, DEFAULT_INITIAL_CAPACITY);
}
private RecyclableArrayList(Handle<RecyclableArrayList> handle, int initialCapacity) {
super(initialCapacity);
this.handle = handle;
}
protected RecycleResponse newObject(Recycler.Handle<RecycleResponse> handle) {
return new RecycleResponse(handle);
}
private RecycleResponse(Handle<RecycleResponse> handle) {
this.handle = handle;
}
private RecyclableArrayList(Handle handle, int initialCapacity) {
super(initialCapacity);
this.handle = handle;
}
private RecycleRequest(Handle<RecycleRequest> handle) {
this.handle = handle;
}
@Override
protected PendingCommand newObject(Handle<PendingCommand> handle) {
return new PendingCommand(handle);
}