From 8fd99cd9bfb143bf5deb9aa74b83a032a0eed5b9 Mon Sep 17 00:00:00 2001 From: David Li
This method assumes ownership of the {@link ArrowBuf}. + */ public static PutResult metadata(ArrowBuf metadata) { if (metadata == null) { return empty(); @@ -50,7 +55,12 @@ public static PutResult empty() { return new PutResult(null); } - /** Get the metadata in this message. May be null. */ + /** + * Get the metadata in this message. May be null. + * + *
Ownership of the {@link ArrowBuf} is retained by this object. Call {@link ReferenceManager#retain()} to preserve + * a reference. + */ public ArrowBuf getApplicationMetadata() { return applicationMetadata; } diff --git a/java/flight/src/test/java/org/apache/arrow/flight/TestLargeMessage.java b/java/flight/src/test/java/org/apache/arrow/flight/TestLargeMessage.java index 70ba9a4100e1a..c00b9ecbf477d 100644 --- a/java/flight/src/test/java/org/apache/arrow/flight/TestLargeMessage.java +++ b/java/flight/src/test/java/org/apache/arrow/flight/TestLargeMessage.java @@ -44,8 +44,8 @@ public void getLargeMessage() throws Exception { FlightTestUtil.getStartedServer((location) -> FlightServer.builder(a, location, producer).build())) { try (FlightClient client = FlightClient.builder(a, s.getLocation()).build()) { - FlightStream stream = client.getStream(new Ticket(new byte[]{})); - try (VectorSchemaRoot root = stream.getRoot()) { + try (FlightStream stream = client.getStream(new Ticket(new byte[]{})); + VectorSchemaRoot root = stream.getRoot()) { while (stream.next()) { for (final Field field : root.getSchema().getFields()) { int value = 0; @@ -57,7 +57,6 @@ public void getLargeMessage() throws Exception { } } } - stream.close(); } } }