congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CallQueue.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.hadoop.hbase.thrift.CallQueue
constructor

Best Java code snippets using org.apache.hadoop.hbase.thrift.CallQueue.<init> (Showing top 18 results out of 315)

origin: apache/hbase

public TBoundedThreadPoolServer(Args options, ThriftMetrics metrics) {
 super(options);
 int minWorkerThreads = options.minWorkerThreads;
 int maxWorkerThreads = options.maxWorkerThreads;
 if (options.maxQueuedRequests > 0) {
  this.callQueue = new CallQueue(
    new LinkedBlockingQueue<>(options.maxQueuedRequests), metrics);
  minWorkerThreads = maxWorkerThreads;
 } else {
  this.callQueue = new CallQueue(new SynchronousQueue<>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift-worker-%d");
 executorService =
   new THBaseThreadPoolExecutor(minWorkerThreads,
     maxWorkerThreads, options.threadKeepAliveTimeSec,
     TimeUnit.SECONDS, this.callQueue, tfb.build(), metrics);
 executorService.allowCoreThreadTimeOut(true);
 serverOptions = options;
}
origin: apache/hbase

protected TServer getTHsHaServer(TNonblockingServerTransport serverTransport,
  TProtocolFactory protocolFactory, TProcessor processor, TTransportFactory transportFactory,
  InetSocketAddress inetSocketAddress) {
 LOG.info("starting HBase HsHA Thrift server on " + inetSocketAddress.toString());
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 int queueSize = conf.getInt(TBoundedThreadPoolServer.MAX_QUEUED_REQUESTS_CONF_KEY,
   TBoundedThreadPoolServer.DEFAULT_MAX_QUEUED_REQUESTS);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(queueSize), metrics);
 int workerThread = conf.getInt(TBoundedThreadPoolServer.MAX_WORKER_THREADS_CONF_KEY,
   serverArgs.getMaxWorkerThreads());
 ExecutorService executorService = createExecutor(
   callQueue, workerThread, workerThread);
 serverArgs.executorService(executorService).processor(processor)
   .transportFactory(transportFactory).protocolFactory(protocolFactory);
 return new THsHaServer(serverArgs);
}
origin: apache/hbase

protected TServer getTThreadedSelectorServer(TNonblockingServerTransport serverTransport,
  TProtocolFactory protocolFactory, TProcessor processor, TTransportFactory transportFactory,
  InetSocketAddress inetSocketAddress) {
 LOG.info("starting HBase ThreadedSelector Thrift server on " + inetSocketAddress.toString());
 TThreadedSelectorServer.Args serverArgs =
   new HThreadedSelectorServerArgs(serverTransport, conf);
 int queueSize = conf.getInt(TBoundedThreadPoolServer.MAX_QUEUED_REQUESTS_CONF_KEY,
   TBoundedThreadPoolServer.DEFAULT_MAX_QUEUED_REQUESTS);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(queueSize), metrics);
 int workerThreads = conf.getInt(TBoundedThreadPoolServer.MAX_WORKER_THREADS_CONF_KEY,
   serverArgs.getWorkerThreads());
 int selectorThreads = conf.getInt(THRIFT_SELECTOR_NUM, serverArgs.getSelectorThreads());
 serverArgs.selectorThreads(selectorThreads);
 ExecutorService executorService = createExecutor(
   callQueue, workerThreads, workerThreads);
 serverArgs.executorService(executorService).processor(processor)
   .transportFactory(transportFactory).protocolFactory(protocolFactory);
 return new TThreadedSelectorServer(serverArgs);
}
origin: apache/hbase

@Test
public void testOfferPoll() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.offer(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.poll();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: apache/hbase

@Test
public void testPutTake() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.put(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.take();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: co.cask.hbase/hbase

private static ExecutorService createExecutor(
  int workerThreads, ThriftMetrics metrics) {
 CallQueue callQueue = new CallQueue(
   new LinkedBlockingQueue<Call>(), metrics);
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift2-worker-%d");
 return new ThreadPoolExecutor(workerThreads, workerThreads,
     Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build());
}
origin: co.cask.hbase/hbase

public TBoundedThreadPoolServer(Args options, ThriftMetrics metrics) {
 super(options);
 if (options.maxQueuedRequests > 0) {
  this.callQueue = new CallQueue(
    new LinkedBlockingQueue<Call>(options.maxQueuedRequests), metrics);
 } else {
  this.callQueue = new CallQueue(new SynchronousQueue<Call>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift-worker-%d");
 executorService =
   new ThreadPoolExecutor(options.minWorkerThreads,
     options.maxWorkerThreads, options.threadKeepAliveTimeSec,
     TimeUnit.SECONDS, this.callQueue, tfb.build());
 serverOptions = options;
}
origin: org.apache.hbase/hbase-thrift

public TBoundedThreadPoolServer(Args options, ThriftMetrics metrics) {
 super(options);
 int minWorkerThreads = options.minWorkerThreads;
 int maxWorkerThreads = options.maxWorkerThreads;
 if (options.maxQueuedRequests > 0) {
  this.callQueue = new CallQueue(
    new LinkedBlockingQueue<>(options.maxQueuedRequests), metrics);
  minWorkerThreads = maxWorkerThreads;
 } else {
  this.callQueue = new CallQueue(new SynchronousQueue<>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift-worker-%d");
 executorService =
   new THBaseThreadPoolExecutor(minWorkerThreads,
     maxWorkerThreads, options.threadKeepAliveTimeSec,
     TimeUnit.SECONDS, this.callQueue, tfb.build(), metrics);
 executorService.allowCoreThreadTimeOut(true);
 serverOptions = options;
}
origin: com.aliyun.hbase/alihbase-thrift

public TBoundedThreadPoolServer(Args options, ThriftMetrics metrics) {
 super(options);
 int minWorkerThreads = options.minWorkerThreads;
 int maxWorkerThreads = options.maxWorkerThreads;
 if (options.maxQueuedRequests > 0) {
  this.callQueue = new CallQueue(
    new LinkedBlockingQueue<>(options.maxQueuedRequests), metrics);
  minWorkerThreads = maxWorkerThreads;
 } else {
  this.callQueue = new CallQueue(new SynchronousQueue<>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift-worker-%d");
 executorService =
   new THBaseThreadPoolExecutor(minWorkerThreads,
     maxWorkerThreads, options.threadKeepAliveTimeSec,
     TimeUnit.SECONDS, this.callQueue, tfb.build(), metrics);
 executorService.allowCoreThreadTimeOut(true);
 serverOptions = options;
}
origin: org.apache.hbase/hbase-thrift

private static ExecutorService createExecutor(
  int workerThreads, int maxCallQueueSize, ThriftMetrics metrics) {
 CallQueue callQueue;
 if (maxCallQueueSize > 0) {
  callQueue = new CallQueue(new LinkedBlockingQueue<>(maxCallQueueSize), metrics);
 } else {
  callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift2-worker-%d");
 ThreadPoolExecutor pool = new THBaseThreadPoolExecutor(workerThreads, workerThreads,
     Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build(), metrics);
 pool.prestartAllCoreThreads();
 return pool;
}
origin: com.aliyun.hbase/alihbase-thrift

private static ExecutorService createExecutor(
  int workerThreads, int maxCallQueueSize, ThriftMetrics metrics) {
 CallQueue callQueue;
 if (maxCallQueueSize > 0) {
  callQueue = new CallQueue(new LinkedBlockingQueue<>(maxCallQueueSize), metrics);
 } else {
  callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 }
 ThreadFactoryBuilder tfb = new ThreadFactoryBuilder();
 tfb.setDaemon(true);
 tfb.setNameFormat("thrift2-worker-%d");
 ThreadPoolExecutor pool = new THBaseThreadPoolExecutor(workerThreads, workerThreads,
     Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build(), metrics);
 pool.prestartAllCoreThreads();
 return pool;
}
origin: co.cask.hbase/hbase

THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
CallQueue callQueue =
  new CallQueue(new LinkedBlockingQueue<Call>(), metrics);
ExecutorService executorService = createExecutor(
  callQueue, serverArgs.getWorkerThreads());
  new HThreadedSelectorServerArgs(serverTransport, conf);
CallQueue callQueue =
  new CallQueue(new LinkedBlockingQueue<Call>(), metrics);
ExecutorService executorService = createExecutor(
  callQueue, serverArgs.getWorkerThreads());
origin: com.aliyun.hbase/alihbase-thrift

@Test
public void testOfferPoll() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.offer(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.poll();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: org.apache.hbase/hbase-thrift

@Test
public void testOfferPoll() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.offer(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.poll();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: com.aliyun.hbase/alihbase-thrift

@Test
public void testPutTake() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.put(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.take();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: org.apache.hbase/hbase-thrift

@Test
public void testPutTake() throws Exception {
 ThriftMetrics metrics = createMetrics();
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 for (int i = 0; i < elementsAdded; ++i) {
  callQueue.put(createDummyRunnable());
 }
 for (int i = 0; i < elementsRemoved; ++i) {
  callQueue.take();
 }
 verifyMetrics(metrics, "timeInQueue_num_ops", elementsRemoved);
}
origin: com.aliyun.hbase/alihbase-thrift

} else if (implType == ImplType.HS_HA) {
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 ExecutorService executorService = createExecutor(
   callQueue, serverArgs.getMaxWorkerThreads(), serverArgs.getMaxWorkerThreads());
 TThreadedSelectorServer.Args serverArgs =
   new HThreadedSelectorServerArgs(serverTransport, conf);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 ExecutorService executorService = createExecutor(
   callQueue, serverArgs.getWorkerThreads(), serverArgs.getWorkerThreads());
origin: org.apache.hbase/hbase-thrift

} else if (implType == ImplType.HS_HA) {
 THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 ExecutorService executorService = createExecutor(
   callQueue, serverArgs.getMaxWorkerThreads(), serverArgs.getMaxWorkerThreads());
 TThreadedSelectorServer.Args serverArgs =
   new HThreadedSelectorServerArgs(serverTransport, conf);
 CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics);
 ExecutorService executorService = createExecutor(
   callQueue, serverArgs.getWorkerThreads(), serverArgs.getWorkerThreads());
org.apache.hadoop.hbase.thriftCallQueue<init>

Popular methods of CallQueue

  • drainTo
  • size
  • updateMetrics
  • offer
  • poll
  • put
  • take

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JOptionPane (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • 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