accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo-examples] branch master updated: Removes try-block around client. Fixes #45 (#50)
Date Wed, 08 May 2019 19:59:49 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-examples.git


The following commit(s) were added to refs/heads/master by this push:
     new 66f5d1c  Removes try-block around client. Fixes #45 (#50)
66f5d1c is described below

commit 66f5d1c7bcfa2bdc93e9abb575ad483e95eb5870
Author: Jeffrey Manno <jeffreymanno15@gmail.com>
AuthorDate: Wed May 8 15:59:44 2019 -0400

    Removes try-block around client. Fixes #45 (#50)
---
 .../org/apache/accumulo/examples/reservations/ARS.java   | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
index e456c4c..572487b 100644
--- a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
+++ b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
@@ -301,13 +301,15 @@ public class ARS {
       } else if (tokens[0].equals("quit") && tokens.length == 1) {
         break;
       } else if (tokens[0].equals("connect") && tokens.length == 6 && ars
== null) {
-        try (AccumuloClient client = Accumulo.newClient().to(tokens[1], tokens[2])
-            .as(tokens[3], tokens[4]).build()) {
-          if (client.tableOperations().exists(tokens[5])) {
-            ars = new ARS(client, tokens[5]);
-            reader.println("  connected");
-          } else
-            reader.println("  No Such Table");
+
+        // the client can't be closed here, because it is passed to the new ARS object
+        AccumuloClient client = Accumulo.newClient().to(tokens[1], tokens[2])
+            .as(tokens[3], tokens[4]).build();
+        if (client.tableOperations().exists(tokens[5])) {
+          ars = new ARS(client, tokens[5]);
+          reader.println("  connected");
+        } else {
+          reader.println("  No Such Table");
         }
       } else {
         System.out.println("  Commands : ");


Mime
View raw message