/** * Run without any command line arguments * @return exit code * @throws Exception exception */ public int run() throws Exception { return run(null); }
@Override public void run() { try { thriftServer.run(args); } catch (Exception e) { LOG.error("Error when start thrift server", e); cmdLineException = e; } } });
private void startHttpServerThread(final String[] args) { LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" ").join(args)); httpServerException = null; httpServerThread = new Thread(() -> { try { thriftServer.run(args); } catch (Exception e) { httpServerException = e; } }); httpServerThread.setName(ThriftServer.class.getSimpleName() + "-httpServer"); httpServerThread.start(); }
@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) { } }