private void checkClosed() throws DoNotRetryIOException { if (this.closed) { throw new DoNotRetryIOException(toString() + " closed"); } }
private ExecutorService getThreadPool(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) { // shared HTable thread executor not yet initialized if (maxThreads == 0) { maxThreads = Runtime.getRuntime().availableProcessors() * 8; } if (coreThreads == 0) { coreThreads = Runtime.getRuntime().availableProcessors() * 8; } long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime", 60); BlockingQueue<Runnable> workQueue = passedWorkQueue; if (workQueue == null) { workQueue = new LinkedBlockingQueue<>(maxThreads * conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS, HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS)); coreThreads = maxThreads; } ThreadPoolExecutor tpe = new ThreadPoolExecutor( coreThreads, maxThreads, keepAliveTime, TimeUnit.SECONDS, workQueue, Threads.newDaemonThreadFactory(toString() + nameHint)); tpe.allowCoreThreadTimeOut(true); return tpe; }
@BeforeClass public static void beforeClass() { ConnectionImplementation mocked = Mockito.mock(ConnectionImplementation.class); Mockito.when(mocked.toString()).thenReturn("mocked-connection"); Mockito.when(mocked.getCurrentBatchPool()).thenReturn(BATCH_POOL); METRICS = new MetricsConnection(mocked); }
MetricsConnection(final ConnectionImplementation conn) { this.scope = conn.toString(); this.registry = new MetricRegistry();
RpcClient rpcClient = conn.getRpcClient(); LOG.info("Going to cancel connections. connection=" + conn.toString() + ", sn=" + sn); for (int i = 0; i < 5000; i++) { rpcClient.cancelConnections(sn);
private void checkClosed() throws DoNotRetryIOException { if (this.closed) { throw new DoNotRetryIOException(toString() + " closed"); } }
private ExecutorService getThreadPool(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) { // shared HTable thread executor not yet initialized if (maxThreads == 0) { maxThreads = Runtime.getRuntime().availableProcessors() * 8; } if (coreThreads == 0) { coreThreads = Runtime.getRuntime().availableProcessors() * 8; } long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime", 60); BlockingQueue<Runnable> workQueue = passedWorkQueue; if (workQueue == null) { workQueue = new LinkedBlockingQueue<>(maxThreads * conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS, HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS)); coreThreads = maxThreads; } ThreadPoolExecutor tpe = new ThreadPoolExecutor( coreThreads, maxThreads, keepAliveTime, TimeUnit.SECONDS, workQueue, Threads.newDaemonThreadFactory(toString() + nameHint)); tpe.allowCoreThreadTimeOut(true); return tpe; }
MetricsConnection(final ConnectionImplementation conn) { this.scope = conn.toString(); this.registry = new MetricRegistry();
@BeforeClass public static void beforeClass() { ConnectionImplementation mocked = Mockito.mock(ConnectionImplementation.class); Mockito.when(mocked.toString()).thenReturn("mocked-connection"); Mockito.when(mocked.getCurrentBatchPool()).thenReturn(BATCH_POOL); METRICS = new MetricsConnection(mocked); }
private void checkClosed() throws DoNotRetryIOException { if (this.closed) { throw new DoNotRetryIOException(toString() + " closed"); } }
private ExecutorService getThreadPool(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) { // shared HTable thread executor not yet initialized if (maxThreads == 0) { maxThreads = Runtime.getRuntime().availableProcessors() * 8; } if (coreThreads == 0) { coreThreads = Runtime.getRuntime().availableProcessors() * 8; } long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime", 60); BlockingQueue<Runnable> workQueue = passedWorkQueue; if (workQueue == null) { workQueue = new LinkedBlockingQueue<>(maxThreads * conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS, HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS)); coreThreads = maxThreads; } ThreadPoolExecutor tpe = new ThreadPoolExecutor( coreThreads, maxThreads, keepAliveTime, TimeUnit.SECONDS, workQueue, Threads.newDaemonThreadFactory(toString() + nameHint)); tpe.allowCoreThreadTimeOut(true); return tpe; }
MetricsConnection(final ConnectionImplementation conn) { this.scope = conn.toString(); this.registry = new MetricRegistry();
RpcClient rpcClient = conn.getRpcClient(); LOG.info("Going to cancel connections. connection=" + conn.toString() + ", sn=" + sn); for (int i = 0; i < 5000; i++) { rpcClient.cancelConnections(sn);