Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
e83b53f
wip
aaron-congo Feb 3, 2025
29492e3
wip
aaron-congo Feb 3, 2025
14fc451
wip
aaron-congo Feb 3, 2025
6ec4c3d
First implementation of CacheService and MonitorService complete
aaron-congo Feb 5, 2025
7d596b7
wip
aaron-congo Feb 5, 2025
184b68a
wip
aaron-congo Feb 5, 2025
2ddebce
Merge branch 'refactoring-wip' into refactoring
aaron-congo Feb 5, 2025
9ebeb8a
wip
aaron-congo Feb 5, 2025
84760dc
Refactor interfaces based on feedback
aaron-congo Feb 6, 2025
44a530f
Add example event
aaron-congo Feb 7, 2025
cfa82ad
Add StorageService#exists method
aaron-congo Feb 7, 2025
ed1667b
Add Event interface
aaron-congo Feb 7, 2025
053dd75
Merge branch 'refactoring-wip' into refactoring
aaron-congo Feb 7, 2025
7e6fe25
Move StorageService into its own 'storage' package
aaron-congo Feb 7, 2025
4437581
Merge branch 'refactoring' into refactoring-wip
aaron-congo Feb 7, 2025
a12410f
wip
aaron-congo Feb 7, 2025
3e17520
PR comments
aaron-congo Feb 7, 2025
e35d740
Merge branch 'refactoring-wip' into refactoring
aaron-congo Feb 7, 2025
07b36fc
Implemented ExpirationCache and StorageServiceImpl
aaron-congo Feb 11, 2025
8bfbd4f
Replaced topologyCache with StorageService
aaron-congo Feb 12, 2025
f7ef88f
Error when passing Topology.class as the itemClass
aaron-congo Feb 12, 2025
53a1429
Added itemClass parameter to get() method
aaron-congo Feb 13, 2025
5d3f698
Failover integration test passing
aaron-congo Feb 13, 2025
833b384
Make MonitorStatus immutable, update StorageService API
aaron-congo Feb 13, 2025
23c0967
EventPublisher PR suggestions
aaron-congo Feb 13, 2025
8b3e30e
Remove MonitorGroup and MonitorServiceImpl
aaron-congo Feb 13, 2025
a9041ae
Instantiate StorageService in Driver class
aaron-congo Feb 14, 2025
afd7a56
cleanup
aaron-congo Feb 14, 2025
98d6dff
ExpiringCache fixes
aaron-congo Feb 14, 2025
bc83286
Merge branch 'refactoring-wip' into storage-service
aaron-congo Feb 14, 2025
e0af969
Fix build errors
aaron-congo Feb 15, 2025
472c793
cleanup
aaron-congo Feb 18, 2025
a516492
cleanup
aaron-congo Feb 18, 2025
2107add
PR comments
aaron-congo Feb 18, 2025
55e3eec
Cleanup, gradle check passing
aaron-congo Feb 19, 2025
b12c200
Lazily auto-register default caches
aaron-congo Feb 19, 2025
34aaadb
Move cleanup thread to StorageServiceImpl
aaron-congo Feb 21, 2025
5e03973
Minor fixes, cleanup
aaron-congo Feb 21, 2025
4cd7117
Add log to cleanup thread
aaron-congo Feb 21, 2025
da8e939
Adjust default cleanup time
aaron-congo Feb 21, 2025
a1794ec
Replace custom endpoint storage
aaron-congo Feb 24, 2025
dcad5c3
Implement ServiceContainer
aaron-congo Feb 26, 2025
bd92538
Cleanup
aaron-congo Feb 26, 2025
0c2b548
MonitorServiceImpl wip
aaron-congo Feb 27, 2025
e7f0ae2
Make CacheItem protected
aaron-congo Feb 28, 2025
1ece19d
Remove cleanupInterval from ExpirationCache
aaron-congo Feb 28, 2025
f4390ca
MonitorServiceImpl with MonitorItem
aaron-congo Feb 28, 2025
e06375a
MonitorServiceImpl wip
aaron-congo Mar 3, 2025
e8a8820
Implemented inactive timeout, AbstractMonitor
aaron-congo Mar 4, 2025
bef3657
Implement default registration
aaron-congo Mar 4, 2025
b05c6f4
replace commented out default suppliers with TODO
aaron-congo Mar 5, 2025
f647219
Auto-register default monitor types if missing
aaron-congo Mar 5, 2025
01014b4
PR comments, fix missing monitor error processing
aaron-congo Mar 5, 2025
2cd5869
Added CacheContainer
aaron-congo Mar 6, 2025
497b648
Implement ExternallyManagedCache
aaron-congo Mar 6, 2025
c99243d
Add removeIf() method
aaron-congo Mar 7, 2025
7d6b0f0
Cleanup MonitorServiceImpl and fix minor issues
aaron-congo Mar 7, 2025
eb8f45d
Remove monitor if expired
aaron-congo Mar 7, 2025
7261a6b
Add MonitorService to ServiceContainer, adapt CustomEndpointMonitor t…
aaron-congo Mar 10, 2025
bd04054
Use defaultSuppliers
aaron-congo Mar 11, 2025
381d9c6
MonitorService starts the monitor
aaron-congo Mar 11, 2025
a56acce
Implement data access messages
aaron-congo Mar 11, 2025
0d7e117
Remove ItemCategory argument in StorageService
aaron-congo Mar 12, 2025
1f36aec
Small fixes, cleanup, update docs
aaron-congo Mar 12, 2025
eb48888
Remove isRenewableExpiration option for ExternallyManagedCache, cleanup
aaron-congo Mar 14, 2025
77139f5
Adapt topology monitors to monitor service
aaron-congo Apr 15, 2025
d943913
Undo changes to integration test files
aaron-congo Apr 16, 2025
7edb822
Fix checkstyle error
aaron-congo Apr 16, 2025
cdd5c20
Merge branch 'main' into refactoring-wip
aaron-congo Apr 16, 2025
a984864
Merge branch 'refactoring-wip' into storage-service
aaron-congo Apr 16, 2025
cbe984d
ConnectionService wip
aaron-congo Apr 18, 2025
3b3d413
wip
aaron-congo Apr 21, 2025
f02112e
ConnectionService wip - tests passing
aaron-congo Apr 21, 2025
278b139
Remove non-auxiliary plugins for auxiliary connections
aaron-congo Apr 22, 2025
c576cb3
Fix bug where auxiliary connection was sharing a ServiceContainer wit…
aaron-congo Apr 22, 2025
d72cf7a
Merge branch 'main' into storage-service
aaron-congo Apr 22, 2025
8536154
Fix checkstyle
aaron-congo Apr 23, 2025
e4df970
Fix CustomEndpointTest
aaron-congo Apr 23, 2025
932adee
Fix bug where duplicate topology monitor was being submitted
aaron-congo Apr 24, 2025
d39aecf
fix: use default connection provider if the connection is auxiliary
aaron-congo Apr 24, 2025
a1851ec
Address some TODOs
aaron-congo Apr 24, 2025
838b574
Merge branch 'main' into storage-service
aaron-congo Apr 24, 2025
35832ce
cleanup
aaron-congo Apr 24, 2025
07a6add
PR cleanup
aaron-congo Apr 25, 2025
28bdffc
cleanup
aaron-congo Apr 25, 2025
89358aa
Merge branch 'main' into storage-service
aaron-congo Apr 25, 2025
834e44d
Move old cache classes into util.storage package
aaron-congo Apr 25, 2025
0deeeb6
cleanup
aaron-congo Apr 25, 2025
117bac5
Fix bug where the allowed hosts were fetched using the host instead o…
aaron-congo Apr 25, 2025
5782d7a
Fix checkstyle
aaron-congo Apr 25, 2025
10fab94
wip
aaron-congo Apr 28, 2025
2ac66d4
Move CacheMap, create CacheItem
aaron-congo Apr 30, 2025
db51f30
Create DisposableCacheItem
aaron-congo Apr 30, 2025
47f9f44
PR suggestions
aaron-congo Apr 30, 2025
fadcefc
Fix CacheItem, build errors
aaron-congo May 1, 2025
7a4ed0e
Merge branch 'main' into storage-service
aaron-congo May 1, 2025
dfc07d9
Remove IS_AUXILIARY_CONNECTION property
aaron-congo May 1, 2025
f3d6ee9
Remove deprecated annotation for forceConnect
aaron-congo May 1, 2025
820f695
wip
aaron-congo May 2, 2025
a12725d
wip
aaron-congo May 1, 2025
c1140c6
ConnectionServiceImpl changes wip
aaron-congo May 5, 2025
f1b3fce
wip
aaron-congo May 7, 2025
ab8d254
Fix build
aaron-congo May 7, 2025
c5d46a7
Failover2Test passing
aaron-congo May 7, 2025
0724281
Clear storage service after unit tests
aaron-congo May 8, 2025
ed03a02
Fix bug in CacheItem
aaron-congo May 8, 2025
357d047
Merge branch 'main' into storage-service
aaron-congo May 8, 2025
6e05563
Copy ConnectionServiceImpl props, remove AuxiliaryPluginFactory
aaron-congo May 8, 2025
47b3aff
Merge branch 'main' into storage-service
aaron-congo May 8, 2025
09ef363
Implement stop() in AbstractMonitor
aaron-congo May 9, 2025
639d005
Address PR comments
aaron-congo May 9, 2025
a255b1f
Undo integration test changes for local run
aaron-congo May 9, 2025
7f9374d
PR comments
aaron-congo May 9, 2025
5964f3b
Remove shadowing stop field in concrete monitor implementations
aaron-congo May 9, 2025
2de381a
Merge branch 'main' into storage-service
aaron-congo May 9, 2025
29c7438
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 12, 2025
18c06d7
wip
aaron-congo May 12, 2025
116e6f1
Cleanup PartialPluginService, MonitorService
aaron-congo May 12, 2025
4137f85
testMonitorRecreation wip
aaron-congo May 13, 2025
241aeb4
Test passing individually
aaron-congo May 14, 2025
4d3ebeb
Add unit tests for refactoring work
aaron-congo May 15, 2025
141208f
Fix checkstyle
aaron-congo May 15, 2025
d6644aa
stopAndRemove monitors instead of shutting down cleanup thread
aaron-congo May 15, 2025
1ab4f01
Merge branch 'main' into storage-service
aaron-congo May 15, 2025
0616f2c
Fix markdown links
aaron-congo May 15, 2025
8f16be5
Add ServiceContainerPluginFactory
aaron-congo May 16, 2025
2d509bf
Add CoreServicesContainer
aaron-congo May 16, 2025
441bce2
Merge branch 'main' into storage-service
aaron-congo May 16, 2025
7c534c4
Add TestStorageServiceImpl, make StorageServiceImpl cache and executo…
aaron-congo May 16, 2025
39fbff4
Add empty close method to AbstractMonitor
aaron-congo May 16, 2025
c0719f2
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 16, 2025
38bdb55
Rename monitoring.MonitorServiceImpl to DefaultMonitorService
aaron-congo May 16, 2025
fbf6abc
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 16, 2025
e98a122
Rename to CoreMonitorService to distinguish from efm/efm2 MonitorService
aaron-congo May 16, 2025
9795150
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 16, 2025
4d94ad6
wip
aaron-congo May 16, 2025
52c2fe6
Remove monitorService field from AbstractMonitor
aaron-congo May 16, 2025
e68845c
Only implement ServiceContainerPluginFactory where immediately required
aaron-congo May 16, 2025
1cec860
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 20, 2025
f795adc
Remove unnecessary CustomEndpointMonitorImpl constructor arg
aaron-congo May 20, 2025
6904ade
Rename EFM monitor classes to distinguish from new monitor classes
aaron-congo May 20, 2025
ba92785
PR suggestions
aaron-congo May 20, 2025
79bbb4f
Rename ServiceContainer to CompleteServicesContainer
aaron-congo May 20, 2025
757b049
Add javadocs, remove CoreServicesContainer#getEventPublisher
aaron-congo May 20, 2025
1b17600
Resolve storageService and monitorService on the fly from CompleteSer…
aaron-congo May 21, 2025
d63c1cd
Rename CoreMonitorService to MonitorService
aaron-congo May 21, 2025
76a9342
chore(deps): bump software.amazon.awssdk:auth from 2.31.36 to 2.31.45…
dependabot[bot] May 19, 2025
7e5c0fb
chore(deps): bump org.jetbrains.kotlin:kotlin-stdlib from 2.1.20 to 2…
dependabot[bot] May 19, 2025
4ad627c
chore(deps): bump software.amazon.awssdk:rds from 2.31.41 to 2.31.46 …
dependabot[bot] May 19, 2025
5349779
chore(deps): bump org.testcontainers:testcontainers from 1.20.6 to 1.…
dependabot[bot] May 20, 2025
eee05ff
chore(deps): bump software.amazon.awssdk:sts from 2.30.27 to 2.31.46 …
dependabot[bot] May 20, 2025
937611c
Fix checkstyle
aaron-congo May 21, 2025
4912f0b
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 21, 2025
018cfb3
Rename CompleteServicesContainer to FullServicesContainer, rename ser…
aaron-congo May 21, 2025
4b7c1d0
Fix checkstyle
aaron-congo May 21, 2025
64f5c42
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 21, 2025
c54881f
Merge branch 'main' into storage-service
aaron-congo May 22, 2025
9ab5be9
Merge branch 'main' into storage-service
aaron-congo May 27, 2025
eda8c6c
Fix build issues
aaron-congo May 27, 2025
cf9b924
Use ExecutorFactory
aaron-congo May 27, 2025
bac9629
Add ExecutorService constructor to AbstractMonitor
aaron-congo May 28, 2025
2efaaf1
Remove support for unnecessary PartialPluginService calls
aaron-congo May 28, 2025
1786c58
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 28, 2025
4b13728
wip
aaron-congo May 28, 2025
25c0f7d
Fix log message keys
aaron-congo May 28, 2025
877159d
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 28, 2025
d5110fa
wip
aaron-congo May 28, 2025
fc4b782
Make AbstractMonitor variables Atomic
aaron-congo May 28, 2025
7f6f037
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 28, 2025
16c86b6
wip
aaron-congo May 28, 2025
d56122d
Make monitorErrorResponses in MonitorSettings Nullable
aaron-congo May 28, 2025
9a17be6
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 28, 2025
6c8844f
wip
aaron-congo May 28, 2025
e340c61
Update docs for Monitor.monitor()
aaron-congo May 28, 2025
591e501
Update PartialPluginService UnsupportedOperation message
aaron-congo May 29, 2025
787ed0f
Adjust monitor stuck message
aaron-congo May 29, 2025
53436b0
EFM2 monitor working
aaron-congo May 29, 2025
028d075
Adapt limitless routers
aaron-congo May 29, 2025
aa6778a
Change default monitor expiration timeout, add Topology equals/hashcode
aaron-congo May 29, 2025
8c54475
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 29, 2025
51bc259
cleanup
aaron-congo May 29, 2025
22e9405
Adjust default monitor expiration settings
aaron-congo May 29, 2025
4a747cf
Fix checkstyle
aaron-congo May 29, 2025
a0c2652
Merge branch 'storage-service' into refactoring-adaptations
aaron-congo May 29, 2025
647fb79
Adapt NodeResponseTimeMonitors to use MonitorService
aaron-congo Jun 2, 2025
1b8be67
Merge branch 'main' into refactoring-adaptations
aaron-congo Jul 30, 2025
6240c2a
Fix build
aaron-congo Jul 30, 2025
d518c66
Cleanup
aaron-congo Jul 30, 2025
29ad95b
Merge branch 'main' into refactoring-adaptations
aaron-congo Aug 5, 2025
e917bcc
PR suggestion
aaron-congo Aug 5, 2025
3963ff3
Add EFM2 test
aaron-congo Aug 6, 2025
5c4200c
EFM test passing
aaron-congo Aug 6, 2025
c9b6e75
FastestResponseStrategyTest working
aaron-congo Aug 8, 2025
8d9350c
Remove old TODOs
aaron-congo Aug 8, 2025
46f5bf9
PR suggestions
aaron-congo Aug 11, 2025
ec7a4a1
Merge branch 'main' into refactoring-adaptations
aaron-congo Aug 11, 2025
73876f6
Disable FastestResponseStrategyTests for standard dockerized integrat…
aaron-congo Aug 11, 2025
b3dabc8
Fix test failure
aaron-congo Aug 12, 2025
c7c3437
Bump awssdk versions to 2.32.21
aaron-congo Aug 13, 2025
0b8fd2a
Merge branch 'main' into refactoring-adaptations
aaron-congo Aug 13, 2025
8b9030c
Disable efm test for multi-az-instance
aaron-congo Aug 13, 2025
894e086
Test working on multi-az instance, disable for mariadb
aaron-congo Aug 14, 2025
6c692d5
Disable FailoverTest, FastestResponseStrategyTest for RDS/MULTI_AZ_IN…
aaron-congo Aug 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws-advanced-jdbc-wrapper-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ repositories {

dependencies {
implementation("org.apache.httpcomponents:httpclient:4.5.14")
implementation("software.amazon.awssdk:rds:2.31.78")
implementation("software.amazon.awssdk:sts:2.31.78")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation("software.amazon.awssdk:sts:2.32.21")
implementation(project(":aws-advanced-jdbc-wrapper"))
}

Expand Down
6 changes: 3 additions & 3 deletions examples/AWSDriverExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc:2.7.13") // 2.7.13 is the last version compatible with Java 8
implementation("org.postgresql:postgresql:42.7.7")
implementation("com.mysql:mysql-connector-j:9.3.0")
implementation("software.amazon.awssdk:rds:2.31.78")
implementation("software.amazon.awssdk:secretsmanager:2.31.12")
implementation("software.amazon.awssdk:sts:2.31.78")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation("software.amazon.awssdk:secretsmanager:2.32.21")
implementation("software.amazon.awssdk:sts:2.32.21")
implementation("com.fasterxml.jackson.core:jackson-databind:2.19.0")
implementation(project(":aws-advanced-jdbc-wrapper"))
implementation("io.opentelemetry:opentelemetry-api:1.52.0")
Expand Down
2 changes: 1 addition & 1 deletion examples/DBCPExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dependencies {
implementation("com.mysql:mysql-connector-j:9.3.0")
implementation(project(":aws-advanced-jdbc-wrapper"))
implementation("org.apache.commons:commons-dbcp2:2.13.0")
implementation("software.amazon.awssdk:rds:2.31.50")
implementation("software.amazon.awssdk:rds:2.32.21")
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.retry:spring-retry")
implementation("org.postgresql:postgresql:42.7.7")
implementation("software.amazon.awssdk:rds:2.31.50")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation(project(":aws-advanced-jdbc-wrapper"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.retry:spring-retry")
implementation("org.postgresql:postgresql:42.7.7")
implementation("software.amazon.awssdk:rds:2.31.50")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation(project(":aws-advanced-jdbc-wrapper"))
}
2 changes: 1 addition & 1 deletion examples/SpringHibernateExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.postgresql:postgresql:42.7.7")
implementation("software.amazon.awssdk:rds:2.31.50")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation(project(":aws-advanced-jdbc-wrapper"))
}
2 changes: 1 addition & 1 deletion examples/SpringTxFailoverExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ dependencies {
implementation("org.springframework.retry:spring-retry:1.3.4")
implementation("org.springframework:spring-aspects:5.3.29")
implementation("org.postgresql:postgresql:42.5.4")
implementation("software.amazon.awssdk:rds:2.29.23")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation("software.amazon.jdbc:aws-advanced-jdbc-wrapper:latest")
}
```
Expand Down
2 changes: 1 addition & 1 deletion examples/SpringWildflyExample/spring/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
runtimeOnly("org.springframework.boot:spring-boot-devtools")
implementation("org.postgresql:postgresql:42.7.7")
implementation("software.amazon.awssdk:rds:2.31.50")
implementation("software.amazon.awssdk:rds:2.32.21")
implementation(project(":aws-advanced-jdbc-wrapper"))
}
22 changes: 11 additions & 11 deletions wrapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ if (useJacoco) {
dependencies {
implementation("org.checkerframework:checker-qual:3.49.5")
compileOnly("org.apache.httpcomponents:httpclient:4.5.14")
compileOnly("software.amazon.awssdk:rds:2.32.15")
compileOnly("software.amazon.awssdk:auth:2.31.45") // Required for IAM (light implementation)
compileOnly("software.amazon.awssdk:http-client-spi:2.32.11") // Required for IAM (light implementation)
compileOnly("software.amazon.awssdk:sts:2.32.15")
compileOnly("software.amazon.awssdk:rds:2.32.21")
compileOnly("software.amazon.awssdk:auth:2.32.21") // Required for IAM (light implementation)
compileOnly("software.amazon.awssdk:http-client-spi:2.32.21") // Required for IAM (light implementation)
compileOnly("software.amazon.awssdk:sts:2.32.21")
compileOnly("com.zaxxer:HikariCP:4.0.3") // Version 4.+ is compatible with Java 8
compileOnly("com.mchange:c3p0:0.11.0")
compileOnly("software.amazon.awssdk:secretsmanager:2.31.12")
compileOnly("software.amazon.awssdk:secretsmanager:2.32.21")
compileOnly("com.fasterxml.jackson.core:jackson-databind:2.19.0")
compileOnly("com.mysql:mysql-connector-j:9.3.0")
compileOnly("org.postgresql:postgresql:42.7.7")
Expand Down Expand Up @@ -70,12 +70,12 @@ dependencies {
testImplementation("com.mchange:c3p0:0.11.0")
testImplementation("org.springframework.boot:spring-boot-starter-jdbc:2.7.13") // 2.7.13 is the last version compatible with Java 8
testImplementation("org.mockito:mockito-inline:4.11.0") // 4.11.0 is the last version compatible with Java 8
testImplementation("software.amazon.awssdk:rds:2.32.15")
testImplementation("software.amazon.awssdk:auth:2.31.45") // Required for IAM (light implementation)
testImplementation("software.amazon.awssdk:http-client-spi:2.32.11") // Required for IAM (light implementation)
testImplementation("software.amazon.awssdk:ec2:2.32.15")
testImplementation("software.amazon.awssdk:secretsmanager:2.31.12")
testImplementation("software.amazon.awssdk:sts:2.32.15")
testImplementation("software.amazon.awssdk:rds:2.32.21")
testImplementation("software.amazon.awssdk:auth:2.32.21") // Required for IAM (light implementation)
testImplementation("software.amazon.awssdk:http-client-spi:2.32.21") // Required for IAM (light implementation)
testImplementation("software.amazon.awssdk:ec2:2.32.21")
testImplementation("software.amazon.awssdk:secretsmanager:2.32.21")
testImplementation("software.amazon.awssdk:sts:2.32.21")
// Note: all org.testcontainers dependencies should have the same version
testImplementation("org.testcontainers:testcontainers:1.21.2")
testImplementation("org.testcontainers:mysql:1.21.2")
Expand Down
4 changes: 0 additions & 4 deletions wrapper/src/main/java/software/amazon/jdbc/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@
import software.amazon.jdbc.plugin.OpenedConnectionTracker;
import software.amazon.jdbc.plugin.customendpoint.CustomEndpointMonitorImpl;
import software.amazon.jdbc.plugin.efm.HostMonitorThreadContainer;
import software.amazon.jdbc.plugin.efm2.HostMonitorServiceImpl;
import software.amazon.jdbc.plugin.federatedauth.FederatedAuthCacheHolder;
import software.amazon.jdbc.plugin.federatedauth.OktaAuthCacheHolder;
import software.amazon.jdbc.plugin.iam.IamAuthCacheHolder;
import software.amazon.jdbc.plugin.limitless.LimitlessRouterServiceImpl;
import software.amazon.jdbc.plugin.strategy.fastestresponse.FastestResponseStrategyPlugin;
import software.amazon.jdbc.plugin.strategy.fastestresponse.HostResponseTimeServiceImpl;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.profile.DriverConfigurationProfiles;
import software.amazon.jdbc.states.ResetSessionStateOnCloseCallable;
Expand Down Expand Up @@ -440,11 +438,9 @@ public static void clearCaches() {

public static void releaseResources() {
CoreServicesContainer.getInstance().getMonitorService().stopAndRemoveAll();
HostMonitorServiceImpl.closeAllMonitors();
HostMonitorThreadContainer.releaseInstance();
ConnectionProviderManager.releaseResources();
HikariPoolsHolder.closeAllPools();
HostResponseTimeServiceImpl.closeAllMonitors();
clearCaches();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import software.amazon.jdbc.HostListProviderService;
import software.amazon.jdbc.HostRole;
import software.amazon.jdbc.HostSpec;
import software.amazon.jdbc.hostavailability.HostAvailability;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class HostMonitorThreadContainer {

private static HostMonitorThreadContainer singleton = null;
private final Map<HostMonitor, Future<?>> tasksMap = new ConcurrentHashMap<>();
// TODO: remove monitorMap and threadPool and submit monitors to MonitorService instead
private final Map<String, HostMonitor> monitorMap = new ConcurrentHashMap<>();
private final ExecutorService threadPool;
private static final ReentrantLock LOCK_OBJECT = new ReentrantLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import software.amazon.jdbc.HostSpec;
import software.amazon.jdbc.PluginService;
import software.amazon.jdbc.util.ExecutorFactory;
import software.amazon.jdbc.util.Messages;
import software.amazon.jdbc.util.PropertyUtils;
import software.amazon.jdbc.util.connection.ConnectionService;
import software.amazon.jdbc.util.monitoring.AbstractMonitor;
import software.amazon.jdbc.util.telemetry.TelemetryContext;
import software.amazon.jdbc.util.telemetry.TelemetryCounter;
import software.amazon.jdbc.util.telemetry.TelemetryFactory;
Expand All @@ -47,10 +46,11 @@
* This class uses a background thread to monitor a particular server with one or more active {@link
* Connection}.
*/
public class HostMonitorImpl implements HostMonitor {
public class HostMonitorImpl extends AbstractMonitor implements HostMonitor {

private static final Logger LOGGER = Logger.getLogger(HostMonitorImpl.class.getName());
private static final long THREAD_SLEEP_NANO = TimeUnit.MILLISECONDS.toNanos(100);
private static final long TERMINATION_TIMEOUT_SEC = 30;
private static final String MONITORING_PROPERTY_PREFIX = "monitoring-";

protected static final Executor ABORT_EXECUTOR =
Expand All @@ -59,15 +59,11 @@ public class HostMonitorImpl implements HostMonitor {
private final Queue<WeakReference<HostMonitorConnectionContext>> activeContexts = new ConcurrentLinkedQueue<>();
private final Map<Long, Queue<WeakReference<HostMonitorConnectionContext>>> newContexts =
new ConcurrentHashMap<>();
private final PluginService pluginService;
private final ConnectionService connectionService;
private final TelemetryFactory telemetryFactory;
private final Properties properties;
private final HostSpec hostSpec;
private final AtomicBoolean stopped = new AtomicBoolean(false);
private Connection monitoringConn = null;
// TODO: remove and submit monitors to MonitorService instead
private final ExecutorService threadPool =
ExecutorFactory.newFixedThreadPool(2, "threadPool");

private final long failureDetectionTimeNano;
private final long failureDetectionIntervalNano;
Expand All @@ -82,7 +78,8 @@ public class HostMonitorImpl implements HostMonitor {
/**
* Store the monitoring configuration for a connection.
*
* @param pluginService A service for creating new connections.
* @param connectionService The service to use to create the monitoring connection.
* @param telemetryFactory The telemetry factory to use to create telemetry data.
* @param hostSpec The {@link HostSpec} of the server this {@link HostMonitorImpl}
* instance is monitoring.
* @param properties The {@link Properties} containing additional monitoring
Expand All @@ -93,26 +90,24 @@ public class HostMonitorImpl implements HostMonitor {
* @param abortedConnectionsCounter Aborted connection telemetry counter.
*/
public HostMonitorImpl(
final @NonNull PluginService pluginService,
final @NonNull ConnectionService connectionService,
final @NonNull TelemetryFactory telemetryFactory,
final @NonNull HostSpec hostSpec,
final @NonNull Properties properties,
final int failureDetectionTimeMillis,
final int failureDetectionIntervalMillis,
final int failureDetectionCount,
final TelemetryCounter abortedConnectionsCounter) {
super(TERMINATION_TIMEOUT_SEC, ExecutorFactory.newFixedThreadPool(2, "efm2-monitor"));

this.pluginService = pluginService;
this.telemetryFactory = pluginService.getTelemetryFactory();
this.connectionService = connectionService;
this.telemetryFactory = telemetryFactory;
this.hostSpec = hostSpec;
this.properties = properties;
this.failureDetectionTimeNano = TimeUnit.MILLISECONDS.toNanos(failureDetectionTimeMillis);
this.failureDetectionIntervalNano = TimeUnit.MILLISECONDS.toNanos(failureDetectionIntervalMillis);
this.failureDetectionCount = failureDetectionCount;
this.abortedConnectionsCounter = abortedConnectionsCounter;

this.threadPool.submit(this::newContextRun); // task to handle new contexts
this.threadPool.submit(this); // task to handle active monitoring contexts
this.threadPool.shutdown(); // No more tasks are accepted by pool.
}

@Override
Expand All @@ -121,21 +116,15 @@ public boolean canDispose() {
}

@Override
public void close() throws Exception {
this.stopped.set(true);

// Waiting for 30s gives a thread enough time to exit monitoring loop and close database connection.
if (!this.threadPool.awaitTermination(30, TimeUnit.SECONDS)) {
this.threadPool.shutdownNow();
}
LOGGER.finest(() -> Messages.get(
"HostMonitorImpl.stopped",
new Object[] {this.hostSpec.getHost()}));
public void start() {
this.monitorExecutor.submit(this::newContextRun); // task to handle new contexts
this.monitorExecutor.submit(this); // task to handle active monitoring contexts
this.monitorExecutor.shutdown(); // No more tasks are accepted by pool.
}

@Override
public void startMonitoring(final HostMonitorConnectionContext context) {
if (this.stopped.get()) {
if (this.stop.get()) {
LOGGER.warning(() -> Messages.get("HostMonitorImpl.monitorIsStopped", new Object[] {this.hostSpec.getHost()}));
}

Expand Down Expand Up @@ -166,9 +155,9 @@ public void newContextRun() {
new Object[] {this.hostSpec.getHost()}));

try {
while (!this.stopped.get()) {

while (!this.stop.get()) {
final long currentTimeNano = this.getCurrentTimeNano();
this.lastActivityTimestampNanos.set(currentTimeNano);

final ArrayList<Long> processedKeys = new ArrayList<>();
this.newContexts.entrySet().stream()
Expand Down Expand Up @@ -212,14 +201,14 @@ public void newContextRun() {
}

@Override
public void run() {
public void monitor() {

LOGGER.finest(() -> Messages.get(
"HostMonitorImpl.startMonitoringThread",
new Object[] {this.hostSpec.getHost()}));

try {
while (!this.stopped.get()) {
while (!this.stop.get()) {

if (this.activeContexts.isEmpty() && !this.nodeUnhealthy) {
TimeUnit.NANOSECONDS.sleep(THREAD_SLEEP_NANO);
Expand All @@ -236,7 +225,7 @@ public void run() {
WeakReference<HostMonitorConnectionContext> monitorContextWeakRef;

while ((monitorContextWeakRef = this.activeContexts.poll()) != null) {
if (this.stopped.get()) {
if (this.stop.get()) {
break;
}

Expand Down Expand Up @@ -284,7 +273,7 @@ public void run() {
ex); // We want to print full trace stack of the exception.
}
} finally {
this.stopped.set(true);
this.stop.set(true);
if (this.monitoringConn != null) {
try {
this.monitoringConn.close();
Expand Down Expand Up @@ -328,8 +317,7 @@ boolean checkConnectionStatus() {
});

LOGGER.finest(() -> "Opening a monitoring connection to " + this.hostSpec.getUrl());
// TODO: replace with ConnectionService#open
this.monitoringConn = this.pluginService.forceConnect(this.hostSpec, monitoringConnProperties);
this.monitoringConn = this.connectionService.open(this.hostSpec, monitoringConnProperties);
LOGGER.finest(() -> "Opened monitoring connection: " + this.monitoringConn);
return true;
}
Expand Down Expand Up @@ -402,4 +390,14 @@ private void abortConnection(final @NonNull Connection connectionToAbort) {
}
}

@Override
public void close() {
if (this.monitoringConn != null) {
try {
this.monitoringConn.close();
} catch (SQLException e) {
// ignore
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package software.amazon.jdbc.plugin.efm2;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import software.amazon.jdbc.HostSpec;

Expand All @@ -32,7 +33,7 @@ HostMonitorConnectionContext startMonitoring(
Properties properties,
int failureDetectionTimeMillis,
int failureDetectionIntervalMillis,
int failureDetectionCount);
int failureDetectionCount) throws SQLException;

/**
* Stop monitoring for a connection represented by the given {@link HostMonitorConnectionContext}.
Expand Down
Loading
Loading