Skip to content

Commit

Permalink
log more verbosely for Pool create and close resource
Browse files Browse the repository at this point in the history
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
  • Loading branch information
neowu committed Mar 20, 2024
1 parent 0833965 commit f943a5e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Change log

### 9.0.9 (3/20/2024 - )

* mysql: updated and patched to 8.3.0, fixed CJException should be wrapped as SQLException
> make sure use "core.framework.mysql:mysql-connector-j:8.3.0-r2"
### 9.0.8 (1/29/2024 - 3/7/2024)

* kafka: update to 3.7.0
Expand Down Expand Up @@ -78,7 +83,7 @@ triggered VirtualThreads.park, make all other virtual threads which share same h
* json: update jackson to 2.16.1
> refer to https://cowtowncoder.medium.com/jackson-2-16-rc1-overview-55dbb90c22d9
* mysql: updated and patched to 8.3.0
> use "core.framework.mysql:mysql-connector-j:8.3.0-r1"
> use "core.framework.mysql:mysql-connector-j:8.3.0-r2"
* db: support azure IAM auth
> azure mysql flexible server supports IAM service account auth, to use access token instead of user/password
> set db user to "iam/azure" to use azure iam auth
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply(plugin = "project")

subprojects {
group = "core.framework"
version = "9.0.8"
version = "9.0.9"

repositories {
maven {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private boolean validate(PoolItem<T> item) {
valid = false;
}
if (!valid) {
LOGGER.warn(errorCode("BROKEN_POOL_CONNECTION"), "connection is broken, try to reconnect immediately, pool=" + name);
LOGGER.warn(errorCode("BROKEN_POOL_CONNECTION"), "connection is broken, try to reconnect immediately, pool={}", name);
closeItem(item);
}
return valid;
Expand Down Expand Up @@ -128,13 +128,15 @@ private PoolItem<T> waitNextAvailableItem() {
private PoolItem<T> createNewItem() {
var watch = new StopWatch();
size.incrementAndGet();
PoolItem<T> item = null;
try {
return new PoolItem<>(factory.get());
item = new PoolItem<>(factory.get());
return item;
} catch (Throwable e) {
size.getAndDecrement();
throw e;
} finally {
LOGGER.debug("create new resource, pool={}, elapsed={}", name, watch.elapsed());
LOGGER.debug("create new resource, pool={}, item={}, elapsed={}", name, item == null ? null : item.resource, watch.elapsed());
}
}

Expand Down Expand Up @@ -181,6 +183,7 @@ private void closeItem(PoolItem<T> item) {
}

private void closeResource(PoolItem<T> item) {
LOGGER.debug("close resource, pool={}, item={}", name, item.resource);
try {
item.resource.close();
} catch (Exception e) {
Expand Down

0 comments on commit f943a5e

Please sign in to comment.