Recycler.java — netty Source File
Architecture documentation for Recycler.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2013 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.util;
import io.netty.util.concurrent.FastThreadLocal;
import io.netty.util.concurrent.FastThreadLocalThread;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.UnstableApi;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.jctools.queues.MessagePassingQueue;
import org.jetbrains.annotations.VisibleForTesting;
import java.util.ArrayDeque;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import static io.netty.util.internal.PlatformDependent.newFixedMpmcQueue;
import static io.netty.util.internal.PlatformDependent.newMpscQueue;
import static java.lang.Math.max;
import static java.lang.Math.min;
/**
* Light-weight object pool based on a thread-local stack.
*
* @param <T> the type of the pooled object
*/
public abstract class Recycler<T> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(Recycler.class);
/**
* We created this handle to avoid having more than 2 concrete implementations of {@link EnhancedHandle}
* i.e. NOOP_HANDLE, {@link DefaultHandle} and the one used in the LocalPool.
*/
private static final class LocalPoolHandle<T> extends EnhancedHandle<T> {
private final UnguardedLocalPool<T> pool;
private LocalPoolHandle(UnguardedLocalPool<T> pool) {
this.pool = pool;
}
@Override
public void recycle(T object) {
UnguardedLocalPool<T> pool = this.pool;
// ... (670 more lines)
Domain
Subdomains
Classes
Types
Source
Frequently Asked Questions
What does Recycler.java do?
Recycler.java is a source file in the netty codebase, written in java. It belongs to the CommonUtil domain, Logging subdomain.
Where is Recycler.java in the architecture?
Recycler.java is located at common/src/main/java/io/netty/util/Recycler.java (domain: CommonUtil, subdomain: Logging, directory: common/src/main/java/io/netty/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free