public synchronized void stop() throws Exception{ MultiException exception = null; LOGGER.info("Attempting to stop..."); if (isRunning()) { LOGGER.info("Attempting to stop sentry thrift service..."); try { } catch (Exception e) { LOGGER.error("Error while stopping sentry thrift service", e); exception = addMultiException(exception,e); LOGGER.info("Sentry thrift service is already stopped..."); if (isWebServerRunning()) { try { LOGGER.info("Attempting to stop sentry web service..."); stopSentryWebServer(); } catch (Exception e) { LOGGER.error("Error while stopping sentry web service", e); exception = addMultiException(exception,e);
@Override public void run() { LOGGER.info("ShutdownHook shutting down server"); try { server.stop(); } catch (Throwable t) { LOGGER.error("Error stopping SentryService", t); } } });
public static SentryService create(Configuration conf) throws Exception { return new SentryService(conf); } }
/** * Add gauges for the SentryService class. * @param sentryservice */ public void addSentryServiceGauges(SentryService sentryservice) { if (!sentryServiceGaugesAdded) { addGauge(SentryService.class, "is_active", sentryservice.getIsActiveGauge()); addGauge(SentryService.class, "activated", sentryservice.getBecomeActiveCount()); sentryServiceGaugesAdded = true; } }
LOGGER.info("Attempting to stop..."); leaderMonitor.close(); if (isRunning()) { LOGGER.info("Attempting to stop sentry thrift service..."); try { } catch (Exception e) { LOGGER.error("Error while stopping sentry thrift service", e); exception = addMultiException(exception,e); LOGGER.info("Sentry thrift service is already stopped..."); if (isWebServerRunning()) { try { LOGGER.info("Attempting to stop sentry web service..."); stopSentryWebServer(); } catch (Exception e) { LOGGER.error("Error while stopping sentry web service", e); exception = addMultiException(exception,e); stopHMSFollower(conf); stopSentryStoreCleaner();
throw new IllegalArgumentException("Cannot read configuration file " + configFile); Configuration serverConf = loadConfig(configFileName); final SentryService server = new SentryService(serverConf); server.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override server.waitOnFuture(); } finally { server.serviceExecutor.shutdown();
throw new IllegalArgumentException("Cannot read configuration file " + configFile); Configuration serverConf = loadConfig(configFileName); final SentryService server = new SentryService(serverConf); server.start();
.getInt(ServerConfig.RPC_PORT, ServerConfig.RPC_PORT_DEFAULT); if (port == 0) { port = findFreePort(); conf.setInt(ServerConfig.RPC_PORT, port); .build(); serviceExecutor = Executors.newSingleThreadExecutor(sentryServiceThreadFactory); this.sentryStore = getSentryStore(conf); sentryStore.setPersistUpdateDeltas(SentryServiceUtil.isHDFSSyncEnabled(conf)); this.leaderMonitor = LeaderStatusMonitor.getLeaderStatusMonitor(conf);
conf.set(ServerConfig.SENTRY_STORE_JDBC_PASS, "dummy"); server = new SentryServiceFactory().create(conf); conf.set(ClientConfig.SERVER_RPC_ADDRESS, server.getAddress().getHostName()); conf.set(ClientConfig.SERVER_RPC_PORT, String.valueOf(server.getAddress().getPort())); conf.set(ServerConfig.SENTRY_STORE_GROUP_MAPPING, ServerConfig.SENTRY_STORE_LOCAL_GROUP_MAPPING);
.getInt(ServerConfig.RPC_PORT, ServerConfig.RPC_PORT_DEFAULT); if (port == 0) { port = findFreePort(); conf.setInt(ServerConfig.RPC_PORT, port);
SentryService.loadConfig(configFileName), dbType);
@Test public void testSentryServiceGauges() throws Throwable { //More Cases to be added once Sentry HA is implemented //Check for gauges with the server handle. Assert.assertEquals(Boolean.TRUE,server.getIsActiveGauge().getValue()); }
conf.set(ServerConfig.SENTRY_STORE_JDBC_PASS, "dummy"); server = SentryServiceFactory.create(conf); conf.set(ApiConstants.ClientConfig.SERVER_RPC_ADDRESS, server.getAddress().getHostName()); conf.set(ApiConstants.ClientConfig.SERVER_RPC_PORT, String.valueOf(server.getAddress().getPort())); conf.set(ServerConfig.SENTRY_STORE_GROUP_MAPPING, ServerConfig.SENTRY_STORE_LOCAL_GROUP_MAPPING);
@Override public void run() { LOGGER.info("ShutdownHook shutting down server"); try { server.stop(); } catch (Throwable t) { LOGGER.error("Error stopping SentryService", t); System.exit(1); } } }));
public SentryService create(Configuration conf) throws Exception { SentryService server = new SentryService(conf); return server; }
public void stopSentryService() throws Exception { server.stop(); Thread.sleep(30000); }
public void stopSentryService() throws Exception { server.stop(); Thread.sleep(30000); }
@AfterClass public static void tearDown() throws Exception { beforeTeardown(); if(server != null) { server.stop(); } if (dbDir != null) { FileUtils.deleteQuietly(dbDir); } SentryMiniKdcTestcase.stopMiniKdc(); afterTeardown(); }