Skip to content

Commit

Permalink
Revert "fix: use druid data source for better observability (#660)"
Browse files Browse the repository at this point in the history
This reverts commit 1877e8f.
  • Loading branch information
wangxye committed Nov 17, 2023
1 parent 657c3a3 commit a86eae0
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 93 deletions.
6 changes: 3 additions & 3 deletions metadata-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.20</version>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.1</version>
</dependency>

<dependency>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 com.automq.rocketmq.metadata;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.ibatis.datasource.pooled.PooledDataSourceFactory;

public class HikariCPDataSourceFactory extends PooledDataSourceFactory {
private static HikariDataSource dataSource;

@Override
public void setProperties(Properties properties) {
synchronized (HikariCPDataSourceFactory.class) {
if (null == dataSource) {
HikariConfig config = new HikariConfig(properties);
config.setMaximumPoolSize(20);
config.setAutoCommit(false);
dataSource = new HikariDataSource(config);
}
}
}

@Override
public DataSource getDataSource() {
return dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="com.automq.rocketmq.metadata.DruidDataSourceFactory">
<dataSource type="com.automq.rocketmq.metadata.HikariCPDataSourceFactory">
<property name="jdbcUrl" value="${jdbcUrl}"/>
<property name="username" value="${userName}"/>
<property name="password" value="${password}"/>
Expand Down

0 comments on commit a86eae0

Please sign in to comment.