SENTRY-792: Throw underlying exception if SentryService start fails (Sravya Tirukkovalur, Reviewed by: Colin Ma)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/fe8e7d99 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/fe8e7d99 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/fe8e7d99 Branch: refs/heads/hive_plugin_v2 Commit: fe8e7d99ba5da781048304df859a70e1162e8859 Parents: c9276fa Author: Sravya Tirukkovalur <[email protected]> Authored: Mon Jul 13 12:19:46 2015 -0700 Committer: Sravya Tirukkovalur <[email protected]> Committed: Mon Jul 13 12:19:46 2015 -0700 ---------------------------------------------------------------------- .../org/apache/sentry/service/thrift/SentryService.java | 10 +++------- .../sentry/tests/e2e/minisentry/InternalSentrySrv.java | 3 --- 2 files changed, 3 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/fe8e7d99/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java index 9dda1fb..3a8653b 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.EventListener; import java.util.List; import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; @@ -54,7 +55,6 @@ import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties; import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig; import org.apache.thrift.TMultiplexedProcessor; import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TCompactProtocol; import org.apache.thrift.server.TServer; import org.apache.thrift.server.TServerEventHandler; import org.apache.thrift.server.TThreadPoolServer; @@ -298,13 +298,9 @@ public class SentryService implements Callable { } // wait for the service thread to finish execution - public synchronized void waitForShutDown() { + public synchronized void waitOnFuture() throws ExecutionException, InterruptedException { LOGGER.info("Waiting on future.get()"); - try { serviceStatus.get(); - } catch (Exception e) { - LOGGER.debug("Error during the shutdown", e); - } } private MultiException addMultiException(MultiException exception, Exception e) { @@ -390,7 +386,7 @@ public class SentryService implements Callable { // Let's wait on the service to stop try { - server.waitForShutDown(); + server.waitOnFuture(); } finally { server.serviceExecutor.shutdown(); } http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/fe8e7d99/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java index 603aa38..054b193 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java @@ -24,7 +24,6 @@ import java.util.concurrent.atomic.AtomicLong; import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.sentry.provider.db.service.thrift.SentryProcessorWrapper; import org.apache.sentry.service.thrift.SentryService; import org.apache.sentry.service.thrift.SentryServiceFactory; import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig; @@ -32,7 +31,6 @@ import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.server.ServerContext; import org.apache.thrift.server.TServerEventHandler; -import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -193,7 +191,6 @@ public class InternalSentrySrv implements SentrySrv { } SentryService sentryServer = sentryServers.get(serverNum); sentryServer.stop(); - sentryServer.waitForShutDown(); } @Override
