File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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 2525import software .amazon .awssdk .annotations .SdkInternalApi ;
2626import software .amazon .awssdk .core .async .AsyncRequestBody ;
2727import software .amazon .awssdk .core .internal .util .Mimetype ;
28- import software .amazon .awssdk .utils .BinaryUtils ;
2928import software .amazon .awssdk .utils .Logger ;
3029
3130/**
@@ -96,11 +95,6 @@ public void request(long n) {
9695 do {
9796 ByteBuffer buffer = buffers [i ];
9897
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-
10498 s .onNext (buffer .asReadOnlyBuffer ());
10599 remaining --;
106100 } 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() {
186186 assertTrue (subscriber .publishedResults .isEmpty ());
187187 }
188188
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-
209189 @ Test
210190 public void staticOfByteBufferConstructorSetsLengthBasedOnBufferRemaining () {
211191 ByteBuffer bb1 = ByteBuffer .allocate (2 );
You can’t perform that action at this time.
0 commit comments