Tabnine Logo
ThriftServer
Code IndexAdd Tabnine to your IDE (free)

How to use
ThriftServer
in
org.apache.hadoop.hbase.thrift2

Best Java code snippets using org.apache.hadoop.hbase.thrift2.ThriftServer (Showing top 20 results out of 315)

origin: apache/hbase

@Test
public void testFilterRegistration() 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"));
}
origin: apache/hbase

private static ThriftServer startThriftServer(int port, boolean useHttp) {
 Configuration thriftServerConf = HBaseConfiguration.create(TEST_UTIL.getConfiguration());
 thriftServerConf.setInt(Constants.PORT_CONF_KEY, port);
 if (useHttp) {
  thriftServerConf.setBoolean(Constants.USE_HTTP_CONF_KEY, true);
 }
 ThriftServer server = new ThriftServer(thriftServerConf);
 Thread thriftServerThread = new Thread(() -> {
  try{
   server.run();
  } catch (Exception t) {
   LOG.error("Thrift Server failed", t);
  }
 });
 thriftServerThread.setDaemon(true);
 thriftServerThread.start();
 if (useHttp) {
  TEST_UTIL.waitFor(10000, () -> server.getHttpServer() != null);
 } else {
  TEST_UTIL.waitFor(10000, () -> server.getTserver() != null);
 }
 return server;
}
origin: org.apache.hbase/hbase-thrift

@Override
public int run(String[] args) throws Exception {
 final Configuration conf = getConf();
 TServer server = null;
 Options options = getOptions();
 CommandLine cmd = parseArguments(conf, options, args);
 int workerThreads = 0;
 int selectorThreads = 0;
  printUsage();
  return 1;
 registerFilters(conf);
 TProtocolFactory protocolFactory = getTProtocolFactory(compact);
 final ThriftHBaseServiceHandler hbaseHandler =
  new ThriftHBaseServiceHandler(conf, userProvider);
 TTransportFactory transportFactory = getTTransportFactory(qop, name, host, framed,
   conf.getInt("hbase.regionserver.thrift.framed.max_frame_size_in_mb", 2) * 1024 * 1024);
 InetSocketAddress inetSocketAddress = bindToPort(bindAddress, listenPort);
 conf.setBoolean("hbase.regionserver.thrift.framed", framed);
 if (qop != null) {
  printUsage();
  System.exit(1);
  server = getTNonBlockingServer(protocolFactory,
    processor,
    transportFactory,
origin: co.cask.hbase/hbase

Options options = getOptions();
try {
 CommandLine cmd = parseArguments(options, args);
  printUsage();
  System.exit(1);
 TProtocolFactory protocolFactory = getTProtocolFactory(compact);
 THBaseService.Iface handler =
   ThriftHBaseServiceHandler.newInstance(conf, metrics);
 TTransportFactory transportFactory = getTTransportFactory(framed);
 conf.setBoolean("hbase.regionserver.thrift.framed", framed);
  log.error("The Nonblocking and HsHaServer servers don't support IP address binding at the moment." +
    " See https://issues.apache.org/jira/browse/HBASE-2155 for details.");
  printUsage();
  System.exit(1);
  printUsage();
  System.exit(1);
 InetSocketAddress inetSocketAddress = bindToPort(cmd.getOptionValue("bind"), listenPort);
  server = getTNonBlockingServer(protocolFactory, processor, transportFactory, inetSocketAddress);
 } else if (hsha) {
  server = getTHsHaServer(protocolFactory, processor, transportFactory, inetSocketAddress, metrics);
 } else {
  server = getTThreadPoolServer(protocolFactory, processor, transportFactory, inetSocketAddress);
origin: apache/hbase

/**
 * Start up the Thrift2 server.
 */
public static void main(String[] args) throws Exception {
 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);
 System.exit(status);
}
origin: co.cask.hbase/hbase

private static TServer getTHsHaServer(TProtocolFactory protocolFactory,
  THBaseService.Processor processor, TTransportFactory transportFactory,
  InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
  throws TTransportException {
 TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
 log.info("starting HBase HsHA Thrift server on " + inetSocketAddress.toString());
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 ExecutorService executorService = createExecutor(
   serverArgs.getWorkerThreads(), metrics);
 serverArgs.executorService(executorService);
 serverArgs.processor(processor);
 serverArgs.transportFactory(transportFactory);
 serverArgs.protocolFactory(protocolFactory);
 return new THsHaServer(serverArgs);
}
origin: co.cask.hbase/hbase

private static void printUsage() {
 HelpFormatter formatter = new HelpFormatter();
 formatter.printHelp("Thrift", null, getOptions(),
   "To start the Thrift server run 'bin/hbase-daemon.sh start thrift2'\n" +
     "To shutdown the thrift server run 'bin/hbase-daemon.sh stop thrift2' or" +
     " send a kill signal to the thrift server pid",
   true);
}
origin: com.aliyun.hbase/alihbase-thrift

@Override
public int run(String[] args) throws Exception {
 final Configuration conf = getConf();
 TServer server = null;
 Options options = getOptions();
 CommandLine cmd = parseArguments(conf, options, args);
 int workerThreads = 0;
 int selectorThreads = 0;
  printUsage();
  return 1;
 registerFilters(conf);
 TProtocolFactory protocolFactory = getTProtocolFactory(compact);
 final ThriftHBaseServiceHandler hbaseHandler =
  new ThriftHBaseServiceHandler(conf, userProvider);
 TTransportFactory transportFactory = getTTransportFactory(qop, name, host, framed,
   conf.getInt("hbase.regionserver.thrift.framed.max_frame_size_in_mb", 2) * 1024 * 1024);
 InetSocketAddress inetSocketAddress = bindToPort(bindAddress, listenPort);
 conf.setBoolean("hbase.regionserver.thrift.framed", framed);
 if (qop != null) {
  printUsage();
  System.exit(1);
  server = getTNonBlockingServer(protocolFactory,
    processor,
    transportFactory,
origin: apache/hbase

@Override
protected ThriftServer createThriftServer() {
 return new ThriftServer(TEST_UTIL.getConfiguration());
}
origin: org.apache.hbase/hbase-thrift

private static TServer getTHsHaServer(TProtocolFactory protocolFactory,
  TProcessor processor, TTransportFactory transportFactory,
  int workerThreads, int maxCallQueueSize,
  InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
  throws TTransportException {
 TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
 log.info("starting HBase HsHA Thrift server on " + inetSocketAddress.toString());
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 if (workerThreads > 0) {
  // Could support the min & max threads, avoiding to preserve existing functionality.
  serverArgs.minWorkerThreads(workerThreads).maxWorkerThreads(workerThreads);
 }
 ExecutorService executorService = createExecutor(
   workerThreads, maxCallQueueSize, metrics);
 serverArgs.executorService(executorService);
 serverArgs.processor(processor);
 serverArgs.transportFactory(transportFactory);
 serverArgs.protocolFactory(protocolFactory);
 return new THsHaServer(serverArgs);
}
origin: org.apache.hbase/hbase-thrift

private static void printUsage() {
 HelpFormatter formatter = new HelpFormatter();
 formatter.printHelp("Thrift", null, getOptions(),
   "To start the Thrift server run 'hbase-daemon.sh start thrift2' or " +
   "'hbase thrift2'\n" +
   "To shutdown the thrift server run 'hbase-daemon.sh stop thrift2' or" +
   " send a kill signal to the thrift server pid",
   true);
}
origin: org.apache.hbase/hbase-thrift

@Test
public void testFilterRegistration() 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"));
}
origin: apache/hbase

@Override
protected ThriftServer createThriftServer() {
 return new ThriftServer(TEST_UTIL.getConfiguration());
}
origin: com.aliyun.hbase/alihbase-thrift

private static TServer getTHsHaServer(TProtocolFactory protocolFactory,
  TProcessor processor, TTransportFactory transportFactory,
  int workerThreads, int maxCallQueueSize,
  InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
  throws TTransportException {
 TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
 log.info("starting HBase HsHA Thrift server on " + inetSocketAddress.toString());
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 if (workerThreads > 0) {
  // Could support the min & max threads, avoiding to preserve existing functionality.
  serverArgs.minWorkerThreads(workerThreads).maxWorkerThreads(workerThreads);
 }
 ExecutorService executorService = createExecutor(
   workerThreads, maxCallQueueSize, metrics);
 serverArgs.executorService(executorService);
 serverArgs.processor(processor);
 serverArgs.transportFactory(transportFactory);
 serverArgs.protocolFactory(protocolFactory);
 return new THsHaServer(serverArgs);
}
origin: com.aliyun.hbase/alihbase-thrift

private static void printUsage() {
 HelpFormatter formatter = new HelpFormatter();
 formatter.printHelp("Thrift", null, getOptions(),
   "To start the Thrift server run 'hbase-daemon.sh start thrift2' or " +
   "'hbase thrift2'\n" +
   "To shutdown the thrift server run 'hbase-daemon.sh stop thrift2' or" +
   " send a kill signal to the thrift server pid",
   true);
}
origin: com.aliyun.hbase/alihbase-thrift

@Test
public void testFilterRegistration() 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"));
}
origin: org.apache.hbase/hbase-thrift

/**
 * Start up the Thrift2 server.
 */
public static void main(String[] args) throws Exception {
 final Configuration conf = HBaseConfiguration.create();
 // for now, only time we return is on an argument error.
 final int status = ToolRunner.run(conf, new ThriftServer(), args);
 System.exit(status);
}
origin: org.apache.hbase/hbase-thrift

private static TServer getTThreadedSelectorServer(TProtocolFactory protocolFactory,
  TProcessor processor, TTransportFactory transportFactory,
  int workerThreads, int selectorThreads, int maxCallQueueSize,
  InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
  throws TTransportException {
 TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
 log.info("starting HBase ThreadedSelector Thrift server on " + inetSocketAddress.toString());
 TThreadedSelectorServer.Args serverArgs = new TThreadedSelectorServer.Args(serverTransport);
 if (workerThreads > 0) {
   serverArgs.workerThreads(workerThreads);
 }
 if (selectorThreads > 0) {
   serverArgs.selectorThreads(selectorThreads);
 }
 ExecutorService executorService = createExecutor(
   workerThreads, maxCallQueueSize, metrics);
 serverArgs.executorService(executorService);
 serverArgs.processor(processor);
 serverArgs.transportFactory(transportFactory);
 serverArgs.protocolFactory(protocolFactory);
 return new TThreadedSelectorServer(serverArgs);
}
origin: com.aliyun.hbase/alihbase-thrift

/**
 * Start up the Thrift2 server.
 */
public static void main(String[] args) throws Exception {
 final Configuration conf = HBaseConfiguration.create();
 // for now, only time we return is on an argument error.
 final int status = ToolRunner.run(conf, new ThriftServer(), args);
 System.exit(status);
}
origin: com.aliyun.hbase/alihbase-thrift

private static TServer getTThreadedSelectorServer(TProtocolFactory protocolFactory,
  TProcessor processor, TTransportFactory transportFactory,
  int workerThreads, int selectorThreads, int maxCallQueueSize,
  InetSocketAddress inetSocketAddress, ThriftMetrics metrics)
  throws TTransportException {
 TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
 log.info("starting HBase ThreadedSelector Thrift server on " + inetSocketAddress.toString());
 TThreadedSelectorServer.Args serverArgs = new TThreadedSelectorServer.Args(serverTransport);
 if (workerThreads > 0) {
   serverArgs.workerThreads(workerThreads);
 }
 if (selectorThreads > 0) {
   serverArgs.selectorThreads(selectorThreads);
 }
 ExecutorService executorService = createExecutor(
   workerThreads, maxCallQueueSize, metrics);
 serverArgs.executorService(executorService);
 serverArgs.processor(processor);
 serverArgs.transportFactory(transportFactory);
 serverArgs.protocolFactory(protocolFactory);
 return new TThreadedSelectorServer(serverArgs);
}
org.apache.hadoop.hbase.thrift2ThriftServer

Javadoc

ThriftServer - this class starts up a Thrift server which implements the HBase API specified in the HbaseClient.thrift IDL file.

Most used methods

  • registerFilters
    Adds the option to pre-load filters at startup.
  • <init>
  • bindToPort
  • createExecutor
  • getOptions
  • getTHsHaServer
  • getTNonBlockingServer
  • getTProtocolFactory
  • getTThreadPoolServer
  • getTTransportFactory
  • parseArguments
  • printUsage
  • parseArguments,
  • printUsage,
  • getConf,
  • getTThreadedSelectorServer,
  • getHttpServer,
  • getTserver,
  • run,
  • stop

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • getContentResolver (Context)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now