All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.darkphoenixs.pool.hbase.HbaseConnectionPool Maven / Gradle / Ivy

Go to download

A simple multi-purpose connection pool client (Kafka & Hbase & Redis & RMDB & Socket & Http)

The newest version!
/*
 * Copyright 2015-2016 Dark Phoenixs (Open-Source Organization).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.darkphoenixs.pool.hbase;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.Connection;
import org.darkphoenixs.pool.ConnectionPool;
import org.darkphoenixs.pool.PoolBase;
import org.darkphoenixs.pool.PoolConfig;

import java.util.Properties;

/**
 * 

Title: HbaseConnectionPool

*

Description: Hbase连接池

* * @author Victor * @version 1.0 * @see PoolBase * @see ConnectionPool * @since 2015年9月19日 */ public class HbaseConnectionPool extends PoolBase implements ConnectionPool { /** * serialVersionUID */ private static final long serialVersionUID = -9126420905798370243L; /** *

Title: HbaseConnectionPool

*

Description: 默认构造方法

*/ public HbaseConnectionPool() { this(HbaseConfig.DEFAULT_HOST, HbaseConfig.DEFAULT_PORT); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param host 地址 * @param port 端口 */ public HbaseConnectionPool(final String host, final String port) { this(new PoolConfig(), host, port, HbaseConfig.DEFAULT_MASTER, HbaseConfig.DEFAULT_ROOTDIR); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param host 地址 * @param port 端口 * @param master hbase主机 * @param rootdir hdfs目录 */ public HbaseConnectionPool(final String host, final String port, final String master, final String rootdir) { this(new PoolConfig(), host, port, master, rootdir); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param hadoopConfiguration hbase配置 */ public HbaseConnectionPool(final Configuration hadoopConfiguration) { this(new PoolConfig(), hadoopConfiguration); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param poolConfig 池配置 * @param host 地址 * @param port 端口 */ public HbaseConnectionPool(final PoolConfig poolConfig, final String host, final String port) { this(poolConfig, host, port, HbaseConfig.DEFAULT_MASTER, HbaseConfig.DEFAULT_ROOTDIR); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param poolConfig 池配置 * @param hadoopConfiguration hbase配置 */ public HbaseConnectionPool(final PoolConfig poolConfig, final Configuration hadoopConfiguration) { super(poolConfig, new HbaseConnectionFactory(hadoopConfiguration)); } /** *

Title: HbaseConnectionPool

*

Description: 构造方法

* * @param poolConfig 池配置 * @param host 地址 * @param port 端口 * @param master hbase主机 * @param rootdir hdfs目录 */ public HbaseConnectionPool(final PoolConfig poolConfig, final String host, final String port, final String master, final String rootdir) { super(poolConfig, new HbaseConnectionFactory(host, port, master, rootdir)); } /** * @param poolConfig 池配置 * @param properties 参数配置 * @since 1.2.1 */ public HbaseConnectionPool(final PoolConfig poolConfig, final Properties properties) { super(poolConfig, new HbaseConnectionFactory(properties)); } @Override public Connection getConnection() { return super.getResource(); } @Override public void returnConnection(Connection conn) { super.returnResource(conn); } @Override public void invalidateConnection(Connection conn) { super.invalidateResource(conn); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy