Introduce support for Netty 5 Buffer
This commit introduces support for Netty 5's Buffer, in the form of Netty5DataBuffer. Because of the new API offered by Buffer, several changes have been made to the DataBuffer API: - CloseableDataBuffer is a simpler alternative to PooledDataBuffer, and implemented by Netty5DataBuffer. DataBufferUtils::release can now handle CloseableDataBuffer as well as PooledDataBuffer. - PooledDataBuffer::touch has been moved into a separate interface: TouchableDataBuffer, which is implemented by Netty5DataBuffer. - The capacity of DataBuffers can no longer be reduced, they can only grow larger. As a consequence, DataBuffer::capacity(int) has been deprecated, but ensureWritable (formally ensureCapacity) still exists. - DataBuffer::slice and retainedSlice have been deprecated in favor of split, a new method that ensures that memory regions do not overlap. - DataBuffer::asByteBuffer has been deprecated in favor of toByteBuffer, a new method that returns a copy, instead of shared data. - DataBufferFactory::allocateBuffer has been deprecated in favor of allocateBuffer(int). Closes gh-28874
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -136,7 +136,7 @@ class WiretapConnector implements ClientHttpConnector {
|
||||
@Nullable
|
||||
private final Flux<? extends Publisher<? extends DataBuffer>> publisherNested;
|
||||
|
||||
private final DataBuffer buffer = DefaultDataBufferFactory.sharedInstance.allocateBuffer();
|
||||
private final DataBuffer buffer = DefaultDataBufferFactory.sharedInstance.allocateBuffer(256);
|
||||
|
||||
// unsafe(): we're intercepting, already serialized Publisher signals
|
||||
private final Sinks.One<byte[]> content = Sinks.unsafe().one();
|
||||
|
||||
Reference in New Issue
Block a user