org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge Java Examples
The following examples show how to use
org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThriftHiveMetaStoreCore.java From beeju with Apache License 2.0 | 5 votes |
public void initialise() throws Exception { thriftPort = -1; final Lock startLock = new ReentrantLock(); final Condition startCondition = startLock.newCondition(); final AtomicBoolean startedServing = new AtomicBoolean(); try (ServerSocket socket = new ServerSocket(0)) { thriftPort = socket.getLocalPort(); } beejuCore.setHiveVar(HiveConf.ConfVars.METASTOREURIS, getThriftConnectionUri()); final HiveConf hiveConf = new HiveConf(beejuCore.conf(), HiveMetaStoreClient.class); thriftServer.execute(new Runnable() { @Override public void run() { try { HadoopThriftAuthBridge bridge = new HadoopThriftAuthBridge23(); HiveMetaStore.startMetaStore(thriftPort, bridge, hiveConf, startLock, startCondition, startedServing); } catch (Throwable e) { LOG.error("Unable to start a Thrift server for Hive Metastore", e); } } }); int i = 0; while (i++ < 3) { startLock.lock(); try { if (startCondition.await(1, TimeUnit.MINUTES)) { break; } } finally { startLock.unlock(); } if (i == 3) { throw new RuntimeException("Maximum number of tries reached whilst waiting for Thrift server to be ready"); } } }
Example #2
Source File: ShimLoader.java From dremio-oss with Apache License 2.0 | 5 votes |
public static synchronized HadoopThriftAuthBridge getHadoopThriftAuthBridge() { if (hadoopThriftAuthBridge == null) { hadoopThriftAuthBridge = loadShims(HADOOP_THRIFT_AUTH_BRIDGE_CLASSES, HadoopThriftAuthBridge.class); } return hadoopThriftAuthBridge; }
Example #3
Source File: HiveLocalMetaStore.java From hadoop-mini-clusters with Apache License 2.0 | 5 votes |
@Override public void run() { try { HiveMetaStore.startMetaStore(hiveMetastorePort, new HadoopThriftAuthBridge(), hiveConf); } catch (Throwable t) { t.printStackTrace(); } }
Example #4
Source File: MetaStoreProxyServer.java From waggle-dance with Apache License 2.0 | 4 votes |
/** * Start Metastore based on a passed {@link HadoopThriftAuthBridge} * * @param bridge * @param startLock * @param startCondition * @param startedServing * @throws Throwable */ private void startWaggleDance( HadoopThriftAuthBridge bridge, Lock startLock, Condition startCondition, AtomicBoolean startedServing) throws Throwable { try { // Server will create new threads up to max as necessary. After an idle // period, it will destory threads to keep the number of threads in the // pool to min. int minWorkerThreads = hiveConf.getIntVar(ConfVars.METASTORESERVERMINTHREADS); int maxWorkerThreads = hiveConf.getIntVar(ConfVars.METASTORESERVERMAXTHREADS); boolean tcpKeepAlive = hiveConf.getBoolVar(ConfVars.METASTORE_TCP_KEEP_ALIVE); boolean useFramedTransport = hiveConf.getBoolVar(ConfVars.METASTORE_USE_THRIFT_FRAMED_TRANSPORT); boolean useSSL = hiveConf.getBoolVar(ConfVars.HIVE_METASTORE_USE_SSL); TServerSocket serverSocket = createServerSocket(useSSL, waggleDanceConfiguration.getPort()); if (tcpKeepAlive) { serverSocket = new TServerSocketKeepAlive(serverSocket); } TTransportFactory transFactory = useFramedTransport ? new TFramedTransport.Factory() : new TTransportFactory(); LOG.info("Starting WaggleDance Server"); TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverSocket) .processorFactory(tSetIpAddressProcessorFactory) .transportFactory(transFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads) .stopTimeoutVal(waggleDanceConfiguration.getThriftServerStopTimeoutValInSeconds()) .requestTimeout(waggleDanceConfiguration.getThriftServerRequestTimeout()) .requestTimeoutUnit(waggleDanceConfiguration.getThriftServerRequestTimeoutUnit()); tServer = new TThreadPoolServer(args); LOG.info("Started the new WaggleDance on port [" + waggleDanceConfiguration.getPort() + "]..."); LOG.info("Options.minWorkerThreads = " + minWorkerThreads); LOG.info("Options.maxWorkerThreads = " + maxWorkerThreads); LOG.info("TCP keepalive = " + tcpKeepAlive); if (startLock != null) { signalOtherThreadsToStart(tServer, startLock, startCondition, startedServing); } tServer.serve(); } catch (Throwable x) { LOG.error(StringUtils.stringifyException(x)); throw x; } LOG.info("Waggle Dance has stopped"); }