/**
     * Retrieves the packet content. May be recomputed if the packet is invalidated or
     * if there is memory demand (handled by a soft reference).
     * <p>
     * {@link FramedPacket#body()} will contain a buffer allocated by this method.
     */
public @NotNull FramedPacket retrieve() {
        if (!PacketUtils.CACHED_PACKET) {
            // TODO: Using a local buffer may be possible
            return PacketUtils.allocateTrimmedPacket(packet());
        }
        SoftReference<FramedPacket> ref;
        FramedPacket cache;
        if (updated == 0 ||
                ((ref = packet) == null ||
                        (cache = ref.get()) == null)) {
            cache = PacketUtils.allocateTrimmedPacket(packet());
            this.packet = new SoftReference<>(cache);
            UPDATER.compareAndSet(this, 0, 1);
        }
        return cache;
    }
public @NotNull FramedPacket retrieve() {
if (!PacketUtils.CACHED_PACKET) {
// TODO: Using a local buffer may be possible
return PacketUtils.allocateTrimmedPacket(packet());
}
SoftReference<FramedPacket> ref;
FramedPacket cache;
if (updated == 0 ||
((ref = packet) == null ||
(cache = ref.get()) == null)) {
cache = PacketUtils.allocateTrimmedPacket(packet());
this.packet = new SoftReference<>(cache);
UPDATER.compareAndSet(this, 0, 1);
}
return cache;
}
public @NotNull FramedPacket retrieve() {
if (!PacketUtils.CACHED_PACKET) {
// TODO: Using a local buffer may be possible
return PacketUtils.allocateTrimmedPacket(packet());
}
SoftReference<FramedPacket> ref;
FramedPacket cache;
if (updated == 0 ||
((ref = packet) == null ||
(cache = ref.get()) == null)) {
cache = PacketUtils.allocateTrimmedPacket(packet());
this.packet = new SoftReference<>(cache);
UPDATER.compareAndSet(this, 0, 1);
}
return cache;
}
public @NotNull FramedPacket retrieve() {
if (!PacketUtils.CACHED_PACKET) {
// TODO: Using a local buffer may be possible
return PacketUtils.allocateTrimmedPacket(packet());
}
SoftReference<FramedPacket> ref;
FramedPacket cache;
if (updated == 0 ||
((ref = packet) == null ||
(cache = ref.get()) == null)) {
cache = PacketUtils.allocateTrimmedPacket(packet());
this.packet = new SoftReference<>(cache);
UPDATER.compareAndSet(this, 0, 1);
}
return cache;
}