Top Fields Constructors Methods
io.netty5.buffer.internal

public final Class MemoryManagerLoader

extends Object
Class Inheritance
Imports
io.netty5.buffer.MemoryManager, java.util.List, .ServiceLoader, .ServiceLoader.Provider, java.util.concurrent.atomic.AtomicReference, java.util.concurrent.locks.ReentrantLock, java.util.stream.Collectors, .Stream

Field Summary

Modifier and TypeField and Description
private static final AtomicReference<List<ServiceLoader.Provider<MemoryManager>>>
CACHE

Cache the service loader result to reduce cost of repeated calls.

private static final ReentrantLock

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Stream<ServiceLoader.Provider<MemoryManager>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACHEback to summary
private static final AtomicReference<List<ServiceLoader.Provider<MemoryManager>>> CACHE

Cache the service loader result to reduce cost of repeated calls. However, also place the cached loader field in a dedicated class, so the service loading is performed lazily, on class initialisation, when (and if) needed. ServiceLoader objects are not actually thread-safe, so instead of caching the loader itself, we cache its result. This becomes a bit more complicated by the fact that the service-loader stream is lazy.

CACHE_POP_LOCKback to summary
private static final ReentrantLock CACHE_POP_LOCK

Constructor Detail

MemoryManagerLoaderback to summary
private MemoryManagerLoader()

Method Detail

streamback to summary
public static Stream<ServiceLoader.Provider<MemoryManager>> stream()
See Also
MemoryManager#availableManagers()