> On June 28, 2016, 11:03 a.m., Rajat Khandelwal wrote: > > I don't think this issue still exists in master. LENS-1010 had fixed it. > > Can you check again? > > Raju Bairishetti wrote: > I am using LENS-1010 for auto closing the lens clients using > try-with-resources. LensClient won't be closed automatically if we do not > initializes in try-with-resources. > > > https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html > > Rajat Khandelwal wrote: > All right, but I'm saying that the original issue for which this jira was > created no more exists. Now cli doesn't print the "unable to close" error > message. And that's because there was one more change in LENS-1010: > protection from multiple close. That is solving LENS-991. You might want to > modify your current code and remove some of those. > > 1. +1 for checkstyle change > 2. conversion to static shouldn't be required in BaseLensCommand. In fact > -- no changes should be required. > 3. All the other changes are in test classes. And they are mostly > addition of try-with-resources block. So maybe those changes should go in a > separate jira, a follow-up of LENS-1010.
This is basically reverting LENS-853 and putting single shutdown hook for CLI to close - which looks correct to me, instead of adding separate shutdown hook for each command. - Amareshwari ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/45099/#review139758 ----------------------------------------------------------- On June 28, 2016, 10:59 a.m., Raju Bairishetti wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/45099/ > ----------------------------------------------------------- > > (Updated June 28, 2016, 10:59 a.m.) > > > Review request for lens, Amareshwari Sriramadasu and Rajat Khandelwal. > > > Bugs: lens-991 > https://issues.apache.org/jira/browse/lens-991 > > > Repository: lens > > > Description > ------- > > Shutdown hook was getting called for each lens **command bean** whenver we do > ctrl+c on cli. > > > Diffs > ----- > > checkstyle/src/main/resources/checkstyle.xml 0a37d01 > lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java > 9eb73b3 > > lens-cli/src/test/java/org/apache/lens/cli/TestLensConnectionCliCommands.java > d1ec94e > lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java > f53ed6b > lens-cli/src/test/java/org/apache/lens/cli/TestLensDatabaseCommands.java > 705aace > lens-cli/src/test/java/org/apache/lens/cli/TestLensNativeTableCommands.java > 80dd0d1 > lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java > 4d8341a > lens-client/src/test/java/org/apache/lens/client/TestLensClient.java > ea464d5 > > Diff: https://reviews.apache.org/r/45099/diff/ > > > Testing > ------- > > **Before applying patch:** > > lens-shell>show cubes > No cube found > lens-shell>show params > ... > lens-shell>Exception in thread "Thread-3" java.lang.IllegalStateException: > Unable to close lens connection with params > LensConnectionParams{dbName='default', baseUrl='http://0.0.0.0:9999/lensapi', > user=anonymous, lensConfs={}, lensVars={}, sessionVars={}} > at org.apache.lens.client.LensConnection.close(LensConnection.java:206) > at > org.apache.lens.client.LensClient.closeConnection(LensClient.java:326) > at > org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92) > at > org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81) > LZDLocalAdmins-MacBook-Pro-2:client rajubairishetti$ > > > > **After aplying patch:** > > lens-shell>show cubes > No cube found > lens-shell>show params > ... > lens-shell>LZDLocalAdmins-MacBook-Pro-2:client rajubairishetti$ > > > All tests are passing except TestUnionQueries from lens-cube. Jira is already > present for that. > > [INFO] Reactor Summary: > [INFO] > [INFO] Lens Checkstyle Rules ............................. SUCCESS [3.835s] > [INFO] Lens .............................................. SUCCESS [4.721s] > [INFO] Lens API .......................................... SUCCESS [26.082s] > [INFO] Lens API for server and extensions ................ SUCCESS [22.151s] > [INFO] Lens Cube ......................................... SUCCESS [9:31.256s] > [INFO] Lens DB storage ................................... SUCCESS [15.318s] > [INFO] Lens Query Library ................................ SUCCESS [13.582s] > [INFO] Lens Hive Driver .................................. SUCCESS [1:21.532s] > [INFO] Lens Driver for JDBC .............................. SUCCESS [30.481s] > [INFO] Lens Elastic Search Driver ........................ SUCCESS [18.666s] > [INFO] Lens Server ....................................... SUCCESS > [13:40.026s] > [INFO] Lens client ....................................... SUCCESS [1:31.229s] > [INFO] Lens CLI .......................................... SUCCESS [1:17.334s] > [INFO] Lens Examples ..................................... SUCCESS [8.929s] > [INFO] Lens Ship Jars to Distributed Cache ............... SUCCESS [0.888s] > [INFO] Lens Distribution ................................. SUCCESS [11.928s] > [INFO] Lens ML Lib ....................................... SUCCESS [1:08.603s] > [INFO] Lens ML Ext Distribution .......................... SUCCESS [2.754s] > [INFO] Lens Regression ................................... SUCCESS [15.555s] > [INFO] Lens UI ........................................... SUCCESS [0.997s] > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 31:26.443s > [INFO] Finished at: Tue Jun 28 10:53:01 SGT 2016 > [INFO] Final Memory: 214M/1170M > [INFO] > ------------------------------------------------------------------------ > > > Thanks, > > Raju Bairishetti > >
