This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0466025  ARROW-5063: [FlightRPC][Java] Test that Flight client 
connections are independent
0466025 is described below

commit 04660250b5b8255dcda40865606798a0737b759c
Author: David Li <li.david...@gmail.com>
AuthorDate: Wed Jun 26 14:17:53 2019 -0500

    ARROW-5063: [FlightRPC][Java] Test that Flight client connections are 
independent
    
    This adds a test that creates two Flight clients to the same server, then 
closes one Flight client while the other still has an operation in progress, in 
order to ensure that gRPC doesn't share connections between the clients.
    
    Author: David Li <li.david...@gmail.com>
    
    Closes #4648 from lihalite/arrow-5063 and squashes the following commits:
    
    7002bc3a1 <David Li> Add test for independent Flight client shutdown in Java
---
 .../org/apache/arrow/flight/TestFlightClient.java  | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git 
a/java/flight/src/test/java/org/apache/arrow/flight/TestFlightClient.java 
b/java/flight/src/test/java/org/apache/arrow/flight/TestFlightClient.java
new file mode 100644
index 0000000..273f11f
--- /dev/null
+++ b/java/flight/src/test/java/org/apache/arrow/flight/TestFlightClient.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.flight;
+
+import java.util.Collections;
+
+import org.apache.arrow.flight.FlightClient.ClientStreamListener;
+import org.apache.arrow.flight.TestBasicOperation.Producer;
+import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.memory.RootAllocator;
+
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.types.pojo.ArrowType;
+import org.apache.arrow.vector.types.pojo.Field;
+import org.apache.arrow.vector.types.pojo.Schema;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestFlightClient {
+  /**
+   * ARROW-5063: make sure two clients to the same location can be closed 
independently.
+   */
+  @Test
+  public void independentShutdown() throws Exception {
+    try (final BufferAllocator allocator = new 
RootAllocator(Integer.MAX_VALUE);
+        final FlightServer server = FlightTestUtil.getStartedServer(
+            port -> FlightServer.builder(allocator, 
Location.forGrpcInsecure(FlightTestUtil.LOCALHOST, port),
+                new Producer(allocator)).build())) {
+      final Location location = 
Location.forGrpcInsecure(FlightTestUtil.LOCALHOST, server.getPort());
+      final Schema schema = new 
Schema(Collections.singletonList(Field.nullable("a", new ArrowType.Int(32, 
true))));
+      try (final FlightClient client1 = FlightClient.builder(allocator, 
location).build();
+          final VectorSchemaRoot root = VectorSchemaRoot.create(schema, 
allocator)) {
+        // Use startPut as this ensures the RPC won't finish until we want it 
to
+        final ClientStreamListener listener = 
client1.startPut(FlightDescriptor.path("test"), root);
+        try (final FlightClient client2 = FlightClient.builder(allocator, 
location).build()) {
+          client2.listActions().forEach(actionType -> 
Assert.assertNotNull(actionType.getType()));
+        }
+        listener.completed();
+        listener.getResult();
+      }
+    }
+  }
+}

Reply via email to