From e4ec0fe1721403c47756b38a7a918d3cfd73f189 Mon Sep 17 00:00:00 2001 From: way zheng Date: Tue, 23 Sep 2025 19:34:47 -0700 Subject: [PATCH 1/7] deprecated methods --- .../shared/vertx/RotatingStoreVerticle.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java b/src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java index 23ce22f6..b71ad9f6 100644 --- a/src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java +++ b/src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java @@ -83,14 +83,10 @@ public void start(Promise startPromise) throws Exception { private void startRefresh(Promise promise) { LOGGER.info("Starting " + this.storeName + " loading"); final long startupRefreshStart = System.nanoTime(); - vertx.executeBlocking(p -> { - try { - this.refresh(); - p.complete(); - } catch (Exception e) { - p.fail(e); - } - }, ar -> { + vertx.executeBlocking(() -> { + this.refresh(); + return null; + }).onComplete(ar -> { final long startupRefreshEnd = System.nanoTime(); final long startupRefreshTimeMs = (startupRefreshEnd - startupRefreshStart) / 1000000; @@ -112,15 +108,10 @@ private void startBackgroundRefresh() { vertx.setPeriodic(this.refreshIntervalMs, (id) -> { final long start = System.nanoTime(); - vertx.executeBlocking(promise -> { - try { - this.refresh(); - promise.complete(); - } catch (Exception e) { - promise.fail(e); - } - }, - asyncResult -> { + vertx.executeBlocking(() -> { + this.refresh(); + return null; + }).onComplete(asyncResult -> { final long end = System.nanoTime(); final long elapsed = ((end - start) / 1000000); this.counterStoreRefreshTimeMs.increment(elapsed); From 64e34969a2416fd74d7e05c75da2dcde90793b36 Mon Sep 17 00:00:00 2001 From: way zheng Date: Wed, 24 Sep 2025 00:18:05 -0700 Subject: [PATCH 2/7] deprecated methods --- .../uid2/shared/vertx/CloudSyncVerticle.java | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java index 25815d00..4d09acc5 100644 --- a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java +++ b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java @@ -232,16 +232,17 @@ private Future cloudRefresh() { Promise refreshPromise = Promise.promise(); this.isRefreshing = true; - vertx.executeBlocking(blockBromise -> { + vertx.executeBlocking(() -> { this.cloudRefreshEnsureInSync(refreshPromise, 0); - blockBromise.complete(); - }, ar -> {}); + return null; + }); return refreshPromise.future() .onComplete(v -> { this.isRefreshing = false; emitRefreshedEvent(); }); + } // this is a blocking function @@ -320,12 +321,13 @@ private void handleUpload(Message msg) { this.pendingUpload.add(fileToUpload); } - this.uploadExecutor.executeBlocking( - promise -> this.cloudUploadBlocking(promise, msg.body()), - ar -> { - this.pendingUpload.remove(fileToUpload); - this.handleAsyncResult(ar); - msg.reply(ar.succeeded()); + this.uploadExecutor.executeBlocking(() -> { + this.cloudUploadBlocking(msg.body()); + return null; + }).onComplete(ar -> { + this.pendingUpload.remove(fileToUpload); + this.handleAsyncResult(ar); + msg.reply(ar.succeeded()); // increase counter if (ar.succeeded()) { @@ -338,16 +340,10 @@ private void handleUpload(Message msg) { }); } - private void cloudUploadBlocking(Promise promise, String fileToUpload) { - try { - String cloudPath = this.cloudSync.toCloudPath(fileToUpload); - try (InputStream localInput = this.localStorage.download(fileToUpload)) { - this.cloudStorage.upload(localInput, cloudPath); - } - promise.complete(); - } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); - promise.fail(new Throwable(ex)); + private void cloudUploadBlocking(String fileToUpload) throws Exception { + String cloudPath = this.cloudSync.toCloudPath(fileToUpload); + try (InputStream localInput = this.localStorage.download(fileToUpload)) { + this.cloudStorage.upload(localInput, cloudPath); } } @@ -364,9 +360,10 @@ private Future cloudDownloadFile(String s3Path) { } Promise promise = Promise.promise(); - this.downloadExecutor.executeBlocking( - blockingPromise -> this.cloudDownloadBlocking(blockingPromise, s3Path), - ar -> { + this.downloadExecutor.executeBlocking(() -> { + this.cloudDownloadBlocking(s3Path); + return null; + }).onComplete(ar -> { this.pendingDownload.remove(s3Path); this.handleAsyncResult(ar); promise.complete(); @@ -385,7 +382,7 @@ private Future cloudDownloadFile(String s3Path) { return promise.future(); } - private void cloudDownloadBlocking(Promise promise, String s3Path) { + private void cloudDownloadBlocking(String s3Path) throws Exception { final long cloudDownloadStart = System.nanoTime(); try { String localPath = this.cloudSync.toLocalPath(s3Path); @@ -398,7 +395,6 @@ private void cloudDownloadBlocking(Promise promise, String s3Path) { downloadSuccessTimer.record(java.time.Duration.ofMillis(cloudDownloadTimeMs)); LOGGER.info("S3 download completed: {} in {} ms", cloudStorage.mask(s3Path), cloudDownloadTimeMs); } - promise.complete(); } catch (Exception ex) { final long cloudDownloadEnd = System.nanoTime(); final long cloudDownloadTimeMs = (cloudDownloadEnd - cloudDownloadStart) / 1_000_000; @@ -406,7 +402,7 @@ private void cloudDownloadBlocking(Promise promise, String s3Path) { downloadFailureTimer.record(java.time.Duration.ofMillis(cloudDownloadTimeMs)); // Be careful as the s3Path may contain the pre-signed S3 token, so do not log the whole path LOGGER.error("download error: " + ex.getClass().getSimpleName()); - promise.fail(new Throwable(ex)); + throw ex; } } From cf89beba3d8e5e33704f7b42c5a5de8b2a6b9264 Mon Sep 17 00:00:00 2001 From: way zheng Date: Wed, 24 Sep 2025 00:36:17 -0700 Subject: [PATCH 3/7] deprecated methods --- src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java index 4d09acc5..aea5a669 100644 --- a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java +++ b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java @@ -242,7 +242,6 @@ private Future cloudRefresh() { this.isRefreshing = false; emitRefreshedEvent(); }); - } // this is a blocking function From cde38cb3613064022911baac9ceba9fc4afa7ae1 Mon Sep 17 00:00:00 2001 From: Release Workflow Date: Wed, 24 Sep 2025 16:58:58 +0000 Subject: [PATCH 4/7] [CI Pipeline] Released Snapshot version: 11.1.20-alpha-311-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8a0ddef4..a1d329ea 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.uid2 uid2-shared - 11.1.19-alpha-309-SNAPSHOT + 11.1.20-alpha-311-SNAPSHOT ${project.groupId}:${project.artifactId} Library for all the shared uid2 operations https://github.com/IABTechLab/uid2docs From 6f8fb490bcceb9e51549f8c8a32360572b1617d5 Mon Sep 17 00:00:00 2001 From: way zheng Date: Wed, 24 Sep 2025 13:17:02 -0700 Subject: [PATCH 5/7] turn download ordered = false --- src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java index aea5a669..6617573e 100644 --- a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java +++ b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java @@ -362,7 +362,7 @@ private Future cloudDownloadFile(String s3Path) { this.downloadExecutor.executeBlocking(() -> { this.cloudDownloadBlocking(s3Path); return null; - }).onComplete(ar -> { + }, false).onComplete(ar -> { this.pendingDownload.remove(s3Path); this.handleAsyncResult(ar); promise.complete(); From 4f3c709c441b6a2badb07b841a80564661b622dd Mon Sep 17 00:00:00 2001 From: Release Workflow Date: Wed, 24 Sep 2025 20:21:02 +0000 Subject: [PATCH 6/7] [CI Pipeline] Released Snapshot version: 11.1.21-alpha-312-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a1d329ea..fdc5d4e6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.uid2 uid2-shared - 11.1.20-alpha-311-SNAPSHOT + 11.1.21-alpha-312-SNAPSHOT ${project.groupId}:${project.artifactId} Library for all the shared uid2 operations https://github.com/IABTechLab/uid2docs From 926d59f78066989ae3b9420df2cbe37c057c436b Mon Sep 17 00:00:00 2001 From: way zheng Date: Thu, 25 Sep 2025 16:52:18 -0700 Subject: [PATCH 7/7] throw a masked exception --- src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java index 6617573e..a06f4213 100644 --- a/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java +++ b/src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java @@ -401,7 +401,7 @@ private void cloudDownloadBlocking(String s3Path) throws Exception { downloadFailureTimer.record(java.time.Duration.ofMillis(cloudDownloadTimeMs)); // Be careful as the s3Path may contain the pre-signed S3 token, so do not log the whole path LOGGER.error("download error: " + ex.getClass().getSimpleName()); - throw ex; + throw new CloudStorageException("Download failed"); } }