Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
gpaulissen committed May 23, 2024
2 parents f414700 + 2c7267a commit 264c7c1
Show file tree
Hide file tree
Showing 17 changed files with 447 additions and 767 deletions.
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-Drevision=3.1.0
-Drevision=3.1.1
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Types of changes:

## [Unreleased]

## [3.1.1] - 2024-05-23

### Fixed

- [Wrong JDBC setup for Flyway in release 3.1.0.](https://github.com/paulissoft/oracle-tools/issues/159)

## [3.1.0] - 2024-05-14

### Added
Expand Down
9 changes: 0 additions & 9 deletions conf/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
<db.password>${env.DB_PASSWORD}</db.password>
</properties>

<!-- GJP 2024-05-14 Don't know why but seems necessary -->
<dependencies>
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${ojdbc.artifactId}</artifactId>
<version>${ojdbc.version}</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>test-connection</id>
Expand Down
19 changes: 2 additions & 17 deletions conf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,16 @@
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${ojdbc.artifactId}</artifactId>
<version>${ojdbc.version}</version>
<type>pom</type>
<type>${ojdbc.type}</type>
</dependency>
<!--dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${ojdbc.artifactId}</artifactId>
<version>${ojdbc.version}</version>
<exclusions>
<exclusion>
<groupId>com.oracle.database.ha</groupId>
<artifactId>simplefan</artifactId>
</exclusion>
<exclusion>
<groupId>com.oracle.database.ha</groupId>
<artifactId>ons</artifactId>
</exclusion>
</exclusions>
</dependency-->
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${ojdbc.artifactId}</artifactId>
<type>pom</type>
<type>${ojdbc.type}</type>
</dependency>
</dependencies>

Expand Down
35 changes: 4 additions & 31 deletions jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<HikariCP.version>3.4.2</HikariCP.version>
<lombok.version>1.18.30</lombok.version>
<oracle.ojdbc.artifactId>${ojdbc.artifactId}</oracle.ojdbc.artifactId>
<oracle.ucp.artifactId>ucp${ojdbc.java.version}</oracle.ucp.artifactId>
<oracle.jdbc.version>${ojdbc.version}</oracle.jdbc.version>
<spring.version>5.2.3.RELEASE</spring.version>
<spring.boot.version>2.2.3.RELEASE</spring.boot.version>
<commons-lang3.version>3.9</commons-lang3.version>
Expand Down Expand Up @@ -68,16 +65,6 @@
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${oracle.ojdbc.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
</dependency>
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${oracle.ucp.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -161,14 +148,12 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- A POM type artifact -->
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${oracle.ojdbc.artifactId}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${ojdbc.groupId}</groupId>
<artifactId>${oracle.ucp.artifactId}</artifactId>
<artifactId>${ojdbc.artifactId}</artifactId>
<version>${ojdbc.version}</version>
<type>${ojdbc.type}</type>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
Expand Down Expand Up @@ -270,18 +255,6 @@
<default.goal>versions:display-dependency-updates versions:display-parent-updates versions:display-plugin-updates versions:display-property-updates</default.goal>
</properties>
</profile>
<profile>
<id>java8</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<oracle.ojdbc.artifactId>ojdbc8</oracle.ojdbc.artifactId>
<oracle.ucp.artifactId>ucp</oracle.ucp.artifactId>
<oracle.jdbc.version>19.7.0.0</oracle.jdbc.version>
</properties>
</profile>
</profiles>

</project>
15 changes: 0 additions & 15 deletions jdbc/smart-pool-data-source-jmh-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
<spring.boot.version>2.2.3.RELEASE</spring.boot.version>
<HikariCP.version>3.4.2</HikariCP.version>
<lombok.version>1.18.30</lombok.version>
<oracle.ojdbc.artifactId>ojdbc11</oracle.ojdbc.artifactId>
<oracle.ucp.artifactId>ucp11</oracle.ucp.artifactId>
<oracle.jdbc.version>23.3.0.23.09</oracle.jdbc.version>

<default.goal />
<!--test>HikariTest</test-->
Expand Down Expand Up @@ -107,18 +104,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>${oracle.ojdbc.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>${oracle.ucp.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.paulissoft.pato.jdbc</groupId>
<artifactId>smart-pool-data-source</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions jdbc/smart-pool-data-source-jmh/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>${oracle.ojdbc.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>${oracle.ucp.artifactId}</artifactId>
<version>${oracle.jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.paulissoft.pato.jdbc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.zaxxer.hikari.HikariConfig;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.NonNull;
import lombok.experimental.Delegate;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -295,22 +297,29 @@ private void updatePoolDescription(@NonNull final PoolDataSourceConfigurationHik
poolDataSource.getPoolName(),
poolDataSource);

final String suffix = "-" + getPoolDataSourceConfiguration().getSchema();
final ArrayList<String> items = new ArrayList(Arrays.asList(poolDataSource.getPoolName().split("-")));
final String schema = getPoolDataSourceConfiguration().getSchema();

log.debug("items: {}; schema: {}", items, schema);

// set pool name
if (initializing) {
if (poolDataSource.getPoolName() == null ||
!poolDataSource.getPoolName().startsWith(getPoolNamePrefix() + "-")) {
poolDataSource.setPoolName(getPoolNamePrefix() + suffix);
} else if (!isParentPoolDataSource) {
poolDataSource.setPoolName(poolDataSource.getPoolName() + suffix);
if (isParentPoolDataSource) {
items.clear();
items.add(getPoolNamePrefix());
items.add(schema);
} else if (!isParentPoolDataSource && !items.contains(schema)) {
items.add(schema);
}
} else if (!isParentPoolDataSource) {
poolDataSource.setPoolName(poolDataSource.getPoolName().replace(suffix, ""));
} else if (!isParentPoolDataSource && items.contains(schema)) {
items.remove(schema);
}

if (items.size() >= 2) {
poolDataSource.setPoolName(String.join("-", items));
}

// keep poolDataSourceConfiguration in sync
poolDataSourceConfiguration.setPoolName(poolDataSource.getPoolName());
// keep poolDataSource.getPoolName() and poolDataSourceConfiguration.getPoolName() in sync
poolDataSourceConfiguration.setPoolName(getPoolNamePrefix() + "-" + schema); // own prefix
} finally {
log.debug("config pool data source; name: {}; address: {}",
poolDataSourceConfiguration.getPoolName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.NonNull;
import lombok.experimental.Delegate;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -179,11 +181,21 @@ public String getPoolNamePrefix() {
return this.getClass().getSimpleName();
}

// IMPORTANT
//
// Since the connection pool name can notchange once the pool has started,
// we change the description if we add/remove schemas.
public String getPoolDescription() {
final SimplePoolDataSourceOracle poolDataSource = getPoolDataSource();
final String description = poolDataSource.getDescription();
return getPoolDescription(getPoolDataSource());
}

return poolDataSource.getConnectionPoolName() + description != null ? description : "";
private static String getPoolDescription(@NonNull final SimplePoolDataSourceOracle poolDataSource) {
final String poolName = poolDataSource.getConnectionPoolName();
final String description = poolDataSource.getDescription();

return (poolName == null || poolName.isEmpty() ?
"" :
poolName + (description == null || description.isEmpty() ? "" : "-" + description));
}

@Override
Expand All @@ -200,23 +212,43 @@ protected void updatePoolDescription(@NonNull final PoolDataSourceConfigurationO
poolDataSource.getConnectionPoolName(),
poolDataSource);

// set pool name
final String suffix = "-" + getPoolDataSourceConfiguration().getSchema();
// IMPORTANT
//
// Since the connection pool name can notchange once the pool has started,
// we change the description if we add/remove schemas.

final String poolDescription = getPoolDescription(poolDataSource);
final ArrayList<String> items = new ArrayList(Arrays.asList(poolDescription.split("-"))); // use pool description not just name
// final String schema = getPoolDataSourceConfiguration().getSchema();
final String schema = poolDataSourceConfiguration.getSchema();

log.debug("items: {}; schema: {}", items, schema);

if (initializing) {
if (poolDataSource.getConnectionPoolName() == null ||
!poolDataSource.getConnectionPoolName().startsWith(getPoolNamePrefix() + "-")) {
poolDataSource.setConnectionPoolName(getPoolNamePrefix() + suffix);
if (isParentPoolDataSource) {
items.clear();
items.add(getPoolNamePrefix());
items.add(schema);
} else if (!isParentPoolDataSource && !items.contains(schema)) {
items.add(schema);
}
} else if (!isParentPoolDataSource && items.contains(schema)) {
items.remove(schema);
}

if (items.size() >= 2) {
poolDataSource.setConnectionPoolName(items.get(0) + "-" + items.get(1));
items.remove(0);
items.remove(0);
if (items.size() >= 1) {
poolDataSource.setDescription(String.join("-", items));
} else {
poolDataSource.setDescription("");
} else if (!isParentPoolDataSource) {
poolDataSource.setDescription(poolDataSource.getDescription() + suffix);
}
} else if (!isParentPoolDataSource) {
poolDataSource.setDescription(poolDataSource.getDescription().replace(suffix, ""));
}

// keep poolDataSource in sync with poolDataSourceConfiguration
poolDataSourceConfiguration.setConnectionPoolName(poolDataSource.getConnectionPoolName());
// keep poolDataSource.getPoolDescription() and poolDataSourceConfiguration.getConnectionPoolName() in sync
poolDataSourceConfiguration.setConnectionPoolName(getPoolNamePrefix() + "-" + schema); // own prefix
} catch (SQLException ex) {
throw new RuntimeException(SimplePoolDataSource.exceptionToString(ex));
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public interface PoolDataSourcePropertiesGettersOracle extends PoolDataSourcePro
String getServiceName();
int getSecondsToTrustIdleConnection();
void reconfigureDataSource(Properties paramProperties) throws SQLException;
int getMaxConnectionsPerService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ boolean isClosed() {
boolean result = true;

if (!isUpdateable.get()) {
result = false;
result = true;
} else if (isClosedSupplier != null) {
result = isClosedSupplier.get();
} else if (children != null) {
Expand All @@ -233,6 +233,8 @@ boolean isClosed() {
}
}

logger.debug("isClosed(): {}", result);

return result;
}

Expand Down Expand Up @@ -416,7 +418,7 @@ private boolean mustShowTotals() {
}

public void close() throws Exception {
logger.debug(">close()");
logger.info("{} - Close initiated...", getDescription());

try {
if (isUpdateable.get()) {
Expand All @@ -426,25 +428,28 @@ public void close() throws Exception {
isUpdateable.set(false);
}
} finally {
logger.debug("<close()");
assert isClosed() : "Statistics should be closed now.";
logger.info("{} - Close completed.", getDescription());
}
}

private void consolidate() {
/*
* Show the statistics when this item is closed AND
* Show the statistics when this item is not closed AND
* a) there are no children (level 4) OR
* b) there is more than 1 child OR
* c) the only child has different statistics than its parent (i.e. snapshots different)
*/
if (!this.isClosed()) {
if (this.isClosed()) {
return;
}

if (children == null ||
children.size() != 1 ||
!(new Snapshot(this)).equals(new Snapshot(children.iterator().next()))) {
showStatistics(true);
} else {
logger.info("Not showing statistics since the only child (level = {}) has the same characteristics as its parent.", level);
}

if (this.parent == null) {
Expand Down
Loading

0 comments on commit 264c7c1

Please sign in to comment.