public static void main(String [] args) throws Exception { LOG.info("***** STARTING service '" + ThriftServer.class.getSimpleName() + "' *****"); VersionInfo.logVersion(); final Configuration conf = HBaseConfiguration.create(); // for now, only time we return is on an argument error. final int status = ToolRunner.run(conf, new ThriftServer(conf), args); LOG.info("***** STOPPING service '" + ThriftServer.class.getSimpleName() + "' *****"); System.exit(status); } }
printUsageAndExit(options, -1); LOG.error("Could not parse the value provided for the " + INFOPORT_OPTION + " option", e); printUsageAndExit(options, -1); optionToConf(cmd, MIN_WORKERS_OPTION, conf, TBoundedThreadPoolServer.MIN_WORKER_THREADS_CONF_KEY); optionToConf(cmd, MAX_WORKERS_OPTION, conf, TBoundedThreadPoolServer.MAX_WORKER_THREADS_CONF_KEY); optionToConf(cmd, MAX_QUEUE_SIZE_OPTION, conf, TBoundedThreadPoolServer.MAX_QUEUED_REQUESTS_CONF_KEY); optionToConf(cmd, KEEP_ALIVE_SEC_OPTION, conf, TBoundedThreadPoolServer.THREAD_KEEP_ALIVE_TIME_SEC_CONF_KEY); optionToConf(cmd, READ_TIMEOUT_OPTION, conf, THRIFT_SERVER_SOCKET_READ_TIMEOUT_KEY); optionToConf(cmd, SELECTOR_NUM_OPTION, conf, THRIFT_SELECTOR_NUM); conf.setBoolean(FRAMED_CONF_KEY, framed); optionToConf(cmd, BIND_OPTION, conf, BIND_CONF_KEY);
@Override public int run(String[] strings) throws Exception { processOptions(strings); setupParamters(); startInfoServer(); if (httpEnabled) { setupHTTPServer(); httpServer.start(); httpServer.join(); } else { setupServer(); tserver.serve(); } return 0; }
/** * Parse the command line options to set parameters the conf. */ protected void processOptions(final String[] args) throws Exception { if (args == null || args.length == 0) { return; } Options options = new Options(); addOptions(options); CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { printUsageAndExit(options, 1); } parseCommandLine(cmd, options); }
/** * @param args * @throws Exception */ public static void main(String [] args) throws Exception { VersionInfo.logVersion(); try { new ThriftServer(HBaseConfiguration.create()).doMain(args); } catch (ExitCodeException ex) { System.exit(ex.getExitCode()); } } }
@Override public void run() { try { thriftServer.doMain(args); } catch (Exception e) { cmdLineException = e; } } });
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServer server = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); server = new ThriftServer(conf); server.run(); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } }
this.metrics = createThriftMetrics(conf); this.pauseMonitor = new JvmPauseMonitor(conf, this.metrics.getSource()); this.hbaseServiceHandler = createHandler(conf, userProvider); this.hbaseServiceHandler.initMetrics(metrics); this.processor = createProcessor(); SaslUtil.QualityOfProtection.PRIVACY.name())); checkHttpSecurity(qop, conf); if (!securityEnabled) { throw new IOException("Thrift server must run in secure mode to support authentication"); registerFilters(conf); pauseMonitor.start();
/** * Start up or shuts down the Thrift server, depending on the arguments. * @param args */ void doMain(final String[] args) throws Exception { processOptions(args); serverRunner = new ThriftServerRunner(conf); // Put up info server. int port = conf.getInt("hbase.thrift.info.port", 9095); if (port >= 0) { conf.setLong("startcode", System.currentTimeMillis()); String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); infoServer.start(); } serverRunner.run(); }
private void stopHttpServerThread() throws Exception { LOG.debug("Stopping " + " Thrift HTTP server"); thriftServer.stop(); httpServerThread.join(); if (httpServerException != null) { LOG.error("Command-line invocation of HBase Thrift server threw an " + "exception", httpServerException); throw new Exception(httpServerException); } } }
/** * Run without any command line arguments * @return exit code * @throws Exception exception */ public int run() throws Exception { return run(null); }
public void doTestFilterRegistration() throws Exception { Configuration conf = UTIL.getConfiguration(); conf.set("hbase.thrift.filters", "MyFilter:filterclass"); ThriftServer.registerFilters(conf); Map<String, String> registeredFilters = ParseFilter.getAllFilters(); assertEquals("filterclass", registeredFilters.get("MyFilter")); }
/** * @param args * @throws Exception */ public static void main(String [] args) throws Exception { LOG.info("***** STARTING service '" + ThriftServer.class.getSimpleName() + "' *****"); VersionInfo.logVersion(); int exitCode = 0; try { new ThriftServer(HBaseConfiguration.create()).doMain(args); } catch (ExitCodeException ex) { exitCode = ex.getExitCode(); } LOG.info("***** STOPPING service '" + ThriftServer.class.getSimpleName() + "' *****"); System.exit(exitCode); } }
@Override public void run() { try { thriftServer.doMain(args); } catch (Exception e) { cmdLineException = e; } } });
/** * Start up or shuts down the Thrift server, depending on the arguments. * @param args */ void doMain(final String[] args) throws Exception { processOptions(args); serverRunner = new ThriftServerRunner(conf); // Put up info server. int port = conf.getInt("hbase.thrift.info.port", 9095); if (port >= 0) { conf.setLong("startcode", System.currentTimeMillis()); String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); infoServer.start(); } serverRunner.run(); }
private void stopCmdLineThread() throws Exception { LOG.debug("Stopping " + implType.simpleClassName() + " Thrift server"); thriftServer.stop(); cmdLineThread.join(); if (cmdLineException != null) { LOG.error("Command-line invocation of HBase Thrift server threw an " + "exception", cmdLineException); throw new Exception(cmdLineException); } } }
@Override public void run() { try { thriftServer.run(args); } catch (Exception e) { LOG.error("Error when start thrift server", e); cmdLineException = e; } } });
/** * @param args * @throws Exception */ public static void main(String [] args) throws Exception { LOG.info("***** STARTING service '" + ThriftServer.class.getSimpleName() + "' *****"); VersionInfo.logVersion(); int exitCode = 0; try { new ThriftServer(HBaseConfiguration.create()).doMain(args); } catch (ExitCodeException ex) { exitCode = ex.getExitCode(); } LOG.info("***** STOPPING service '" + ThriftServer.class.getSimpleName() + "' *****"); System.exit(exitCode); } }
protected ThriftServer createThriftServer() { return new ThriftServer(TEST_UTIL.getConfiguration()); }
LOG.error("Exactly one of 'start' and 'stop' has to be specified"); printUsageAndExit(options, 1); } catch (NumberFormatException e) { LOG.error("Could not parse the value provided for the port option", e); printUsageAndExit(options, -1); printUsageAndExit(options, -1); optionToConf(cmd, MIN_WORKERS_OPTION, conf, TBoundedThreadPoolServer.MIN_WORKER_THREADS_CONF_KEY); optionToConf(cmd, MAX_WORKERS_OPTION, conf, TBoundedThreadPoolServer.MAX_WORKER_THREADS_CONF_KEY); optionToConf(cmd, MAX_QUEUE_SIZE_OPTION, conf, TBoundedThreadPoolServer.MAX_QUEUED_REQUESTS_CONF_KEY); optionToConf(cmd, KEEP_ALIVE_SEC_OPTION, conf, TBoundedThreadPoolServer.THREAD_KEEP_ALIVE_TIME_SEC_CONF_KEY);