File tree 3 files changed +6
-26
lines changed
main/java/software/amazon/awssdk/core/internal/async
test/java/software/amazon/awssdk/core/internal/async
3 files changed +6
-26
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " feature" ,
3
+ "category" : " AWS SDK for Java v2" ,
4
+ "contributor" : " StephenFlavin" ,
5
+ "description" : " Enable zero-copy ByteBuffer publishing in AsyncRequestBody via \" unsafe\" constructors"
6
+ }
Original file line number Diff line number Diff line change 25
25
import software .amazon .awssdk .annotations .SdkInternalApi ;
26
26
import software .amazon .awssdk .core .async .AsyncRequestBody ;
27
27
import software .amazon .awssdk .core .internal .util .Mimetype ;
28
- import software .amazon .awssdk .utils .BinaryUtils ;
29
28
import software .amazon .awssdk .utils .Logger ;
30
29
31
30
/**
@@ -96,11 +95,6 @@ public void request(long n) {
96
95
do {
97
96
ByteBuffer buffer = buffers [i ];
98
97
99
- // Pending discussions on https://github.com/aws/aws-sdk-java-v2/issues/3928
100
- if (buffer .isDirect ()) {
101
- buffer = BinaryUtils .toNonDirectBuffer (buffer );
102
- }
103
-
104
98
s .onNext (buffer .asReadOnlyBuffer ());
105
99
remaining --;
106
100
} while (remaining > 0 && (i = index .getAndIncrement ()) < buffers .length );
Original file line number Diff line number Diff line change @@ -186,26 +186,6 @@ public void canceledSubscriberDoesNotReturnNewResults() {
186
186
assertTrue (subscriber .publishedResults .isEmpty ());
187
187
}
188
188
189
- // Pending discussions on https://github.com/aws/aws-sdk-java-v2/issues/3928
190
- @ Test
191
- public void directBuffersAreCoppiedToNonDirectBuffers () {
192
- byte [] bytes = "Hello World!" .getBytes (StandardCharsets .UTF_8 );
193
- ByteBuffer buffer = ByteBuffer .allocateDirect (bytes .length )
194
- .put (bytes );
195
- buffer .flip ();
196
- AsyncRequestBody requestBody = ByteBuffersAsyncRequestBody .of (buffer );
197
-
198
- TestSubscriber subscriber = new TestSubscriber ();
199
- requestBody .subscribe (subscriber );
200
- subscriber .request (1 );
201
-
202
- ByteBuffer publishedBuffer = subscriber .publishedResults .get (0 );
203
- assertFalse (publishedBuffer .isDirect ());
204
- byte [] publishedBytes = new byte [publishedBuffer .remaining ()];
205
- publishedBuffer .get (publishedBytes );
206
- assertArrayEquals (bytes , publishedBytes );
207
- }
208
-
209
189
@ Test
210
190
public void staticOfByteBufferConstructorSetsLengthBasedOnBufferRemaining () {
211
191
ByteBuffer bb1 = ByteBuffer .allocate (2 );
You can’t perform that action at this time.
0 commit comments