/** * Constructor to set maximum versions and use the specified configuration, * table factory and pool type. The HTablePool supports the * {@link PoolType#Reusable} and {@link PoolType#ThreadLocal}. If the pool * type is null or not one of those two values, then it will default to * {@link PoolType#Reusable}. * * @param config * configuration * @param maxSize * maximum number of references to keep for each table * @param tableFactory * table factory * @param poolType * pool type which is one of {@link PoolType#Reusable} or * {@link PoolType#ThreadLocal} */ public HTablePool(final Configuration config, final int maxSize, final HTableInterfaceFactory tableFactory, PoolType poolType) { // Make a new configuration instance so I can safely cleanup when // done with the pool. this.config = config == null ? HBaseConfiguration.create() : config; this.maxSize = maxSize; this.tableFactory = tableFactory == null ? new HTableFactory() : tableFactory; if (poolType == null) { this.poolType = PoolType.Reusable; } else { switch (poolType) { case Reusable: case ThreadLocal: this.poolType = poolType; break; default: this.poolType = PoolType.Reusable; break; } } this.tables = new PoolMap<String, HTableInterface>(this.poolType, this.maxSize); }
/** * Constructor to set maximum versions and use the specified configuration, * table factory and pool type. The HTablePool supports the * {@link PoolType#Reusable} and {@link PoolType#ThreadLocal}. If the pool * type is null or not one of those two values, then it will default to * {@link PoolType#Reusable}. * * @param config * configuration * @param maxSize * maximum number of references to keep for each table * @param tableFactory * table factory * @param poolType * pool type which is one of {@link PoolType#Reusable} or * {@link PoolType#ThreadLocal} */ public HTablePool(final Configuration config, final int maxSize, final HTableInterfaceFactory tableFactory, PoolType poolType) { // Make a new configuration instance so I can safely cleanup when // done with the pool. this.config = config == null ? new Configuration() : config; this.maxSize = maxSize; this.tableFactory = tableFactory == null ? new HTableFactory() : tableFactory; if (poolType == null) { this.poolType = PoolType.Reusable; } else { switch (poolType) { case Reusable: case ThreadLocal: this.poolType = poolType; break; default: this.poolType = PoolType.Reusable; break; } } this.tables = new PoolMap<String, HTableInterface>(this.poolType, this.maxSize); }
/** * Construct an IPC client whose values are of the given {@link Writable} * class. * @param valueClass value class * @param conf configuration * @param factory socket factory */ public HBaseClient(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getInt("hbase.client.pause", 1000); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", false); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); if (LOG.isDebugEnabled()) { LOG.debug("The ping interval is" + this.pingInterval + "ms."); } this.conf = conf; this.socketFactory = factory; this.clusterId = conf.get(HConstants.CLUSTER_ID, "default"); this.connections = new PoolMap<ConnectionId, Connection>( getPoolType(conf), getPoolSize(conf)); }
/** * Constructor to set maximum versions and use the specified configuration, * table factory and pool type. The HTablePool supports the * {@link PoolType#Reusable} and {@link PoolType#ThreadLocal}. If the pool * type is null or not one of those two values, then it will default to * {@link PoolType#Reusable}. * * @param config configuration * @param maxSize maximum number of references to keep for each table * @param tableFactory table factory * @param poolType pool type which is one of {@link PoolType#Reusable} or * {@link PoolType#ThreadLocal} */ public HaeinsaTablePool(final Configuration config, final int maxSize, final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) { // Make a new configuration instance so I can safely cleanup when // done with the pool. this.config = config == null ? new Configuration() : config; this.maxSize = maxSize; this.tableFactory = tableFactory == null ? new DefaultHaeinsaTableIfaceFactory(new HTableFactory()) : tableFactory; if (poolType == null) { this.poolType = PoolType.Reusable; } else { switch (poolType) { case Reusable: case ThreadLocal: { this.poolType = poolType; break; } default: { this.poolType = PoolType.Reusable; break; } } } this.tables = new PoolMap<String, HaeinsaTableIfaceInternal>(this.poolType, this.maxSize); }
/** * Construct an IPC client whose values are of the given {@link Writable} * class. * @param valueClass value class * @param conf configuration * @param factory socket factory */ public HBaseClient(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getInt("hbase.client.pause", 1000); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", false); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); if (LOG.isDebugEnabled()) { LOG.debug("The ping interval is" + this.pingInterval + "ms."); } this.conf = conf; this.socketFactory = factory; this.clusterId = conf.get(HConstants.CLUSTER_ID, "default"); this.connections = new PoolMap<ConnectionId, Connection>( getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); }
/** * Construct an IPC client whose values are of the {@link Message} * class. * @param conf configuration * @param factory socket factory */ public HBaseClient(Configuration conf, SocketFactory factory) { this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getInt("hbase.client.pause", 1000); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", true); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); if (LOG.isDebugEnabled()) { LOG.debug("The ping interval is" + this.pingInterval + "ms."); } this.conf = conf; this.socketFactory = factory; this.clusterId = conf.get(HConstants.CLUSTER_ID, "default"); this.connections = new PoolMap<ConnectionId, Connection>( getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); }
/** * Construct an IPC cluster client whose values are of the {@link Message} class. * @param conf configuration * @param clusterId the cluster id * @param factory socket factory * @param localAddr client socket bind address * @param metrics the connection metrics */ RpcClientImpl(Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr, MetricsConnection metrics) { super(conf, clusterId, localAddr, metrics); this.socketFactory = factory; this.connections = new PoolMap<ConnectionId, Connection>(getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); }
/** * Construct an IPC client whose values are of the given {@link Writable} * class. * @param valueClass value class * @param conf configuration * @param factory socket factory */ public HBaseClient(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getInt("hbase.client.pause", 1000); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", false); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); if (LOG.isDebugEnabled()) { LOG.debug("The ping interval is" + this.pingInterval + "ms."); } this.conf = conf; this.socketFactory = factory; this.clusterId = conf.get(HConstants.CLUSTER_ID, "default"); this.connections = new PoolMap<ConnectionId, Connection>( getPoolType(conf), getPoolSize(conf)); String hostName = this.conf.get("hbase.regionserver.rpc.client.socket.bind.address"); if (hostName != null) { this.bindAddress = new InetSocketAddress(hostName, 0); } else { this.bindAddress = null; } this.failedServers = new FailedServers(conf); }
/** * Construct an IPC cluster client whose values are of the {@link Message} class. * @param conf configuration * @param clusterId the cluster id * @param factory socket factory * @param localAddr client socket bind address */ RpcClientImpl(Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr) { super(conf, clusterId, localAddr); this.socketFactory = factory; this.connections = new PoolMap<ConnectionId, Connection>(getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); }
/** * Construct an IPC cluster client whose values are of the {@link Message} class. * @param conf configuration * @param clusterId * @param factory socket factory * @param localAddr client socket bind address */ RpcClient(Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr) { this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", true); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); this.ipcUtil = new IPCUtil(conf); this.conf = conf; this.codec = getCodec(); this.compressor = getCompressor(conf); this.socketFactory = factory; this.clusterId = clusterId != null ? clusterId : HConstants.CLUSTER_ID_DEFAULT; this.connections = new PoolMap<ConnectionId, Connection>(getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); this.fallbackAllowed = conf.getBoolean(IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.localAddr = localAddr; this.userProvider = UserProvider.instantiate(conf); // login the server principal (if using secure Hadoop) if (LOG.isDebugEnabled()) { LOG.debug("Codec=" + this.codec + ", compressor=" + this.compressor + ", tcpKeepAlive=" + this.tcpKeepAlive + ", tcpNoDelay=" + this.tcpNoDelay + ", maxIdleTime=" + this.maxIdleTime + ", maxRetries=" + this.maxRetries + ", fallbackAllowed=" + this.fallbackAllowed + ", ping interval=" + this.pingInterval + "ms" + ", bind address=" + (this.localAddr != null ? this.localAddr : "null")); } }
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration configuration = createConfiguration(); // htablePool = new HTablePool(configuration, 10, PoolMap.PoolType.ThreadLocal); }
/** * Construct an IPC cluster client whose values are of the {@link Message} class. * @param conf configuration * @param clusterId the cluster id * @param factory socket factory * @param localAddr client socket bind address */ RpcClient(Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr) { this.minIdleTimeBeforeClose = conf.getInt(IDLE_TIME, 120000); // 2 minutes this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", true); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.ipcUtil = new IPCUtil(conf); this.conf = conf; this.codec = getCodec(); this.compressor = getCompressor(conf); this.socketFactory = factory; this.clusterId = clusterId != null ? clusterId : HConstants.CLUSTER_ID_DEFAULT; this.connections = new PoolMap<ConnectionId, Connection>(getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); this.fallbackAllowed = conf.getBoolean(IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.localAddr = localAddr; this.userProvider = UserProvider.instantiate(conf); this.connectTO = conf.getInt(SOCKET_TIMEOUT_CONNECT, DEFAULT_SOCKET_TIMEOUT_CONNECT); this.readTO = conf.getInt(SOCKET_TIMEOUT_READ, DEFAULT_SOCKET_TIMEOUT_READ); this.writeTO = conf.getInt(SOCKET_TIMEOUT_WRITE, DEFAULT_SOCKET_TIMEOUT_WRITE); // login the server principal (if using secure Hadoop) if (LOG.isDebugEnabled()) { LOG.debug("Codec=" + this.codec + ", compressor=" + this.compressor + ", tcpKeepAlive=" + this.tcpKeepAlive + ", tcpNoDelay=" + this.tcpNoDelay + ", connectTO=" + this.connectTO + ", readTO=" + this.readTO + ", writeTO=" + this.writeTO + ", minIdleTimeBeforeClose=" + this.minIdleTimeBeforeClose + ", maxRetries=" + this.maxRetries + ", fallbackAllowed=" + this.fallbackAllowed + ", bind address=" + (this.localAddr != null ? this.localAddr : "null")); } }
/** * Construct an IPC cluster client whose values are of the {@link Message} class. * @param conf configuration * @param clusterId * @param factory socket factory * @param localAddr client socket bind address */ RpcClient(Configuration conf, String clusterId, SocketFactory factory, SocketAddress localAddr) { this.maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 10000); //10s this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.failureSleep = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", true); this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.pingInterval = getPingInterval(conf); this.ipcUtil = new IPCUtil(conf); this.conf = conf; this.codec = getCodec(); this.compressor = getCompressor(conf); this.socketFactory = factory; this.clusterId = clusterId != null ? clusterId : HConstants.CLUSTER_ID_DEFAULT; this.connections = new PoolMap<ConnectionId, Connection>(getPoolType(conf), getPoolSize(conf)); this.failedServers = new FailedServers(conf); this.fallbackAllowed = conf.getBoolean(IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.localAddr = localAddr; this.userProvider = UserProvider.instantiate(conf); if (LOG.isDebugEnabled()) { LOG.debug("Codec=" + this.codec + ", compressor=" + this.compressor + ", tcpKeepAlive=" + this.tcpKeepAlive + ", tcpNoDelay=" + this.tcpNoDelay + ", maxIdleTime=" + this.maxIdleTime + ", maxRetries=" + this.maxRetries + ", fallbackAllowed=" + this.fallbackAllowed + ", ping interval=" + this.pingInterval + "ms" + ", bind address=" + (this.localAddr != null ? this.localAddr : "null")); } }
@Override public void start() throws Exception { logger.info("Starting HBase Connection"); Configuration configuration = HBaseUtil.create(hbaseConfig); this.tablePool = new HTablePool(configuration, 10, PoolMap.PoolType.Reusable); this.hBaseAdmin = new HBaseAdmin(configuration); logger.info("Started HBase Connection"); }
/** * Constructor for tests * * @param configuration to HBase * @param clusterId for the cluster * @param localAddress local address to connect to * @param channelInitializer for custom channel handlers */ @VisibleForTesting AsyncRpcClient(Configuration configuration, String clusterId, SocketAddress localAddress, ChannelInitializer<SocketChannel> channelInitializer) { super(configuration, clusterId, localAddress); if (LOG.isDebugEnabled()) { LOG.debug("Starting async Hbase RPC client"); } // Max amount of threads to use. 0 lets Netty decide based on amount of cores int maxThreads = conf.getInt("hbase.rpc.client.threads.max", 0); this.eventLoopGroup = new NioEventLoopGroup(maxThreads, Threads.newDaemonThreadFactory("AsyncRpcChannel")); this.connections = new PoolMap<>(getPoolType(configuration), getPoolSize(configuration)); this.failedServers = new RpcClient.FailedServers(configuration); int operationTimeout = configuration.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT); // Configure the default bootstrap. this.bootstrap = new Bootstrap(); bootstrap.group(eventLoopGroup).channel(NioSocketChannel.class) .option(ChannelOption.TCP_NODELAY, tcpNoDelay) .option(ChannelOption.SO_KEEPALIVE, tcpKeepAlive) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, operationTimeout); if (channelInitializer == null) { channelInitializer = DEFAULT_CHANNEL_INITIALIZER; } bootstrap.handler(channelInitializer); if (localAddress != null) { bootstrap.localAddress(localAddress); } }
/** * Constructor for tests * * @param configuration to HBase * @param clusterId for the cluster * @param localAddress local address to connect to * @param metrics the connection metrics * @param channelInitializer for custom channel handlers */ protected AsyncRpcClient(Configuration configuration, String clusterId, SocketAddress localAddress, MetricsConnection metrics, ChannelInitializer<SocketChannel> channelInitializer) { super(configuration, clusterId, localAddress, metrics); if (LOG.isDebugEnabled()) { LOG.debug("Starting async Hbase RPC client"); } Pair<EventLoopGroup, Class<? extends Channel>> eventLoopGroupAndChannelClass; this.useGlobalEventLoopGroup = conf.getBoolean(USE_GLOBAL_EVENT_LOOP_GROUP, true); if (useGlobalEventLoopGroup) { eventLoopGroupAndChannelClass = getGlobalEventLoopGroup(configuration); } else { eventLoopGroupAndChannelClass = createEventLoopGroup(configuration); } if (LOG.isDebugEnabled()) { LOG.debug("Use " + (useGlobalEventLoopGroup ? "global" : "individual") + " event loop group " + eventLoopGroupAndChannelClass.getFirst().getClass().getSimpleName()); } this.connections = new PoolMap<>(getPoolType(configuration), getPoolSize(configuration)); this.failedServers = new FailedServers(configuration); int operationTimeout = configuration.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT); // Configure the default bootstrap. this.bootstrap = new Bootstrap(); bootstrap.group(eventLoopGroupAndChannelClass.getFirst()) .channel(eventLoopGroupAndChannelClass.getSecond()) .option(ChannelOption.TCP_NODELAY, tcpNoDelay) .option(ChannelOption.SO_KEEPALIVE, tcpKeepAlive) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, operationTimeout); if (channelInitializer == null) { channelInitializer = DEFAULT_CHANNEL_INITIALIZER; } bootstrap.handler(channelInitializer); if (localAddress != null) { bootstrap.localAddress(localAddress); } }
public static HTablePool createHTablePool(Configuration configuration, int maxSize, PoolMap.PoolType poolType) throws Exception { return new HTablePool(configuration, maxSize, poolType); }
/** * Construct an IPC client for the cluster <code>clusterId</code> * @param conf configuration * @param clusterId the cluster id * @param localAddr client socket bind address. * @param metrics the connection metrics */ public AbstractRpcClient(Configuration conf, String clusterId, SocketAddress localAddr, MetricsConnection metrics) { this.userProvider = UserProvider.instantiate(conf); this.localAddr = localAddr; this.tcpKeepAlive = conf.getBoolean("hbase.ipc.client.tcpkeepalive", true); this.clusterId = clusterId != null ? clusterId : HConstants.CLUSTER_ID_DEFAULT; this.failureSleep = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE); this.maxRetries = conf.getInt("hbase.ipc.client.connect.max.retries", 0); this.tcpNoDelay = conf.getBoolean("hbase.ipc.client.tcpnodelay", true); this.cellBlockBuilder = new CellBlockBuilder(conf); this.minIdleTimeBeforeClose = conf.getInt(IDLE_TIME, 120000); // 2 minutes this.conf = conf; this.codec = getCodec(); this.compressor = getCompressor(conf); this.fallbackAllowed = conf.getBoolean(IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.failedServers = new FailedServers(conf); this.connectTO = conf.getInt(SOCKET_TIMEOUT_CONNECT, DEFAULT_SOCKET_TIMEOUT_CONNECT); this.readTO = conf.getInt(SOCKET_TIMEOUT_READ, DEFAULT_SOCKET_TIMEOUT_READ); this.writeTO = conf.getInt(SOCKET_TIMEOUT_WRITE, DEFAULT_SOCKET_TIMEOUT_WRITE); this.metrics = metrics; this.maxConcurrentCallsPerServer = conf.getInt( HConstants.HBASE_CLIENT_PERSERVER_REQUESTS_THRESHOLD, HConstants.DEFAULT_HBASE_CLIENT_PERSERVER_REQUESTS_THRESHOLD); this.connections = new PoolMap<>(getPoolType(conf), getPoolSize(conf)); this.cleanupIdleConnectionTask = IDLE_CONN_SWEEPER.scheduleAtFixedRate(new Runnable() { @Override public void run() { cleanupIdleConnections(); } }, minIdleTimeBeforeClose, minIdleTimeBeforeClose, TimeUnit.MILLISECONDS); if (LOG.isDebugEnabled()) { LOG.debug("Codec=" + this.codec + ", compressor=" + this.compressor + ", tcpKeepAlive=" + this.tcpKeepAlive + ", tcpNoDelay=" + this.tcpNoDelay + ", connectTO=" + this.connectTO + ", readTO=" + this.readTO + ", writeTO=" + this.writeTO + ", minIdleTimeBeforeClose=" + this.minIdleTimeBeforeClose + ", maxRetries=" + this.maxRetries + ", fallbackAllowed=" + this.fallbackAllowed + ", bind address=" + (this.localAddr != null ? this.localAddr : "null")); } }
/** * Return the pool type specified in the configuration, which must be set to * either {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#RoundRobin} or * {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#ThreadLocal}, * otherwise default to the former. * * For applications with many user threads, use a small round-robin pool. For * applications with few user threads, you may want to try using a * thread-local pool. In any case, the number of {@link org.apache.hadoop.hbase.ipc.RpcClient} * instances should not exceed the operating system's hard limit on the number of * connections. * * @param config configuration * @return either a {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#RoundRobin} or * {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#ThreadLocal} */ protected static PoolMap.PoolType getPoolType(Configuration config) { return PoolMap.PoolType .valueOf(config.get(HConstants.HBASE_CLIENT_IPC_POOL_TYPE), PoolMap.PoolType.RoundRobin, PoolMap.PoolType.ThreadLocal); }
/** * Return the pool type specified in the configuration, which must be set to either * {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#RoundRobin} or * {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#ThreadLocal}, otherwise default to the * former. For applications with many user threads, use a small round-robin pool. For applications * with few user threads, you may want to try using a thread-local pool. In any case, the number * of {@link org.apache.hadoop.hbase.ipc.RpcClient} instances should not exceed the operating * system's hard limit on the number of connections. * @param config configuration * @return either a {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#RoundRobin} or * {@link org.apache.hadoop.hbase.util.PoolMap.PoolType#ThreadLocal} */ private static PoolMap.PoolType getPoolType(Configuration config) { return PoolMap.PoolType.valueOf(config.get(HConstants.HBASE_CLIENT_IPC_POOL_TYPE), PoolMap.PoolType.RoundRobin, PoolMap.PoolType.ThreadLocal); }