protected Thread newThread(Runnable r, String name) { return new FastThreadLocalThread(threadGroup, r, name); } }
private static InternalThreadLocalMap fastGet(FastThreadLocalThread thread) { InternalThreadLocalMap threadLocalMap = thread.threadLocalMap(); if (threadLocalMap == null) { thread.setThreadLocalMap(threadLocalMap = new InternalThreadLocalMap()); } return threadLocalMap; }
/** * Returns {@code true} if {@link FastThreadLocal#removeAll()} will be called once {@link Thread#run()} completes. */ @UnstableApi public static boolean willCleanupFastThreadLocals(Thread thread) { return thread instanceof FastThreadLocalThread && ((FastThreadLocalThread) thread).willCleanupFastThreadLocals(); } }
public void start(Socket socket, int protocolVersion, boolean initiator) throws IOException { this.socket = socket; this.protocolVersion = protocolVersion; if (initiator) sendInitMessage(); new FastThreadLocalThread(this, name() + "-" + socket.getRemoteSocketAddress()).start(); }
private ChannelFuture doStart(ServerPort port) { final ServerBootstrap b = new ServerBootstrap(); serverBootstrap = b; config.channelOptions().forEach((k, v) -> { @SuppressWarnings("unchecked") final ChannelOption<Object> castOption = (ChannelOption<Object>) k; b.option(castOption, v); }); config.childChannelOptions().forEach((k, v) -> { @SuppressWarnings("unchecked") final ChannelOption<Object> castOption = (ChannelOption<Object>) k; b.childOption(castOption, v); }); b.group(EventLoopGroups.newEventLoopGroup(1, r -> { final FastThreadLocalThread thread = new FastThreadLocalThread(r, bossThreadName(port)); thread.setDaemon(false); return thread; }), config.workerGroup()); b.channel(TransportType.detectTransportType().serverChannelType()); b.handler(connectionLimitingHandler); b.childHandler(new HttpServerPipelineConfigurator(config, port, sslContexts, gracefulShutdownSupport)); return b.bind(port.localAddress()); }
public static InternalThreadLocalMap getIfSet() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { return ((FastThreadLocalThread) thread).threadLocalMap(); } return slowThreadLocalMap.get(); }
public static void remove() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { ((FastThreadLocalThread) thread).setThreadLocalMap(null); } else { slowThreadLocalMap.remove(); } }
public void start(Socket socket, int protocolVersion, boolean initiator) throws IOException { this.socket = socket; this.protocolVersion = protocolVersion; if (initiator) sendInitMessage(); new FastThreadLocalThread(this, name() + "-" + socket.getRemoteSocketAddress()).start(); }
public static InternalThreadLocalMap getIfSet() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { return ((FastThreadLocalThread) thread).threadLocalMap(); } return slowThreadLocalMap.get(); }
public static void remove() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { ((FastThreadLocalThread) thread).setThreadLocalMap(null); } else { slowThreadLocalMap.remove(); } }
public Thread newThread(final Runnable r) { final FastThreadLocalThread t = new FastThreadLocalThread(r, category + "-" + num++); return t; } }
/** * @param source Input source to read compressed data from * @param info Compression info */ public CompressedInputStream(InputStream source, CompressionInfo info, ChecksumType checksumType, Supplier<Double> crcCheckChanceSupplier) { this.info = info; this.buffer = new byte[info.parameters.chunkLength()]; // buffer is limited to store up to 1024 chunks this.dataBuffer = new ArrayBlockingQueue<>(Math.min(info.chunks.length, 1024)); this.crcCheckChanceSupplier = crcCheckChanceSupplier; this.checksumType = checksumType; new FastThreadLocalThread(new Reader(source, info, dataBuffer)).start(); }
private static InternalThreadLocalMap fastGet(FastThreadLocalThread thread) { InternalThreadLocalMap threadLocalMap = thread.threadLocalMap(); if (threadLocalMap == null) { thread.setThreadLocalMap(threadLocalMap = new InternalThreadLocalMap()); } return threadLocalMap; }
public static InternalThreadLocalMap getIfSet() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { return ((FastThreadLocalThread) thread).threadLocalMap(); } return slowThreadLocalMap.get(); }
/** * Returns {@code true} if {@link FastThreadLocal#removeAll()} will be called once {@link Thread#run()} completes. */ @UnstableApi public static boolean willCleanupFastThreadLocals(Thread thread) { return thread instanceof FastThreadLocalThread && ((FastThreadLocalThread) thread).willCleanupFastThreadLocals(); } }
public static void remove() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { ((FastThreadLocalThread) thread).setThreadLocalMap(null); } else { slowThreadLocalMap.remove(); } }
protected Thread newThread(Runnable r, String name) { return new FastThreadLocalThread(threadGroup, r, name); } }
/** * @param source Input source to read compressed data from * @param info Compression info */ public CompressedInputStream(InputStream source, CompressionInfo info, ChecksumType checksumType, Supplier<Double> crcCheckChanceSupplier) { this.info = info; this.buffer = new byte[info.parameters.chunkLength()]; // buffer is limited to store up to 1024 chunks this.dataBuffer = new ArrayBlockingQueue<>(Math.min(info.chunks.length, 1024)); this.crcCheckChanceSupplier = crcCheckChanceSupplier; this.checksumType = checksumType; new FastThreadLocalThread(new Reader(source, info, dataBuffer)).start(); }
private static InternalThreadLocalMap fastGet(FastThreadLocalThread thread) { InternalThreadLocalMap threadLocalMap = thread.threadLocalMap(); if (threadLocalMap == null) { thread.setThreadLocalMap(threadLocalMap = new InternalThreadLocalMap()); } return threadLocalMap; }
public static InternalThreadLocalMap getIfSet() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { return ((FastThreadLocalThread) thread).threadLocalMap(); } return slowThreadLocalMap.get(); }