diff options
| author | wangkuan <[email protected]> | 2020-10-12 16:46:52 +0800 |
|---|---|---|
| committer | wangkuan <[email protected]> | 2020-10-12 16:46:52 +0800 |
| commit | e82346e34bba902b9d50fda826ff1c1769a8339c (patch) | |
| tree | b5b70b5cd9940ad58f5013252fcb5e0d24164cf8 /src | |
| parent | 4cb6834024c049b0cbc8ea7be94b93e41227de25 (diff) | |
更改hbase连接池配置方式
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/com/mesa/reportservice/configuration/HbaseFactory.java | 5 | ||||
| -rw-r--r-- | src/main/java/com/mesa/reportservice/service/impl/HbaseServiceImpl.java | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/com/mesa/reportservice/configuration/HbaseFactory.java b/src/main/java/com/mesa/reportservice/configuration/HbaseFactory.java index ddbf5d3..9e4ef1c 100644 --- a/src/main/java/com/mesa/reportservice/configuration/HbaseFactory.java +++ b/src/main/java/com/mesa/reportservice/configuration/HbaseFactory.java @@ -40,6 +40,7 @@ public class HbaseFactory { conf.set("hbase.rpc.timeout", hbproperties.getRpc_timeout()); conf.set("hbase.client.keyvalue.maxsize", "1024000000"); conf.set("zookeeper.recovery.retry", "3"); + conf.set("hbase.client.ipc.pool.size", hbproperties.getConnect_pool().toString()); } @@ -49,11 +50,9 @@ public class HbaseFactory { @Bean(name = "hbaseConnection") public Connection getConnection(@Qualifier("hbaseConfiguration") org.apache.hadoop.conf.Configuration Conf) { - ExecutorService executor = null; Connection con = null; try { - executor = Executors.newFixedThreadPool(hbproperties.getConnect_pool()); - con = ConnectionFactory.createConnection(Conf,executor); + con = ConnectionFactory.createConnection(Conf); } catch (IOException e) { logger.error(e.toString()); diff --git a/src/main/java/com/mesa/reportservice/service/impl/HbaseServiceImpl.java b/src/main/java/com/mesa/reportservice/service/impl/HbaseServiceImpl.java index 01ffd6a..4509736 100644 --- a/src/main/java/com/mesa/reportservice/service/impl/HbaseServiceImpl.java +++ b/src/main/java/com/mesa/reportservice/service/impl/HbaseServiceImpl.java @@ -40,7 +40,7 @@ public class HbaseServiceImpl implements HbaseService { public Boolean put(JobEntity jobEntity) throws Exception { - Boolean status = true; + Boolean status = false; try(Table table =hbaseConnection.getTable(TableName.valueOf(hbproperties.getTable()))) { Put put = new Put(Bytes.toBytes(jobEntity.getQuery_id())); put.addColumn(Bytes.toBytes("response"), Bytes.toBytes("result"), Bytes.toBytes(jobEntity.getResult())); @@ -59,8 +59,8 @@ public class HbaseServiceImpl implements HbaseService { put.addColumn(Bytes.toBytes("detail"), Bytes.toBytes("memory_usage"), Bytes.toBytes(jobEntity.getMemory_usage())); } table.put(put); + status =true; }catch(Exception e) { - status =false; Logs.error(e.toString()); } return status; |
