Skip to content

Commit 4f59e71

Browse files
authored
[#3960]fix vertx close may block shutdown (#3965)
1 parent 863e887 commit 4f59e71

File tree

1 file changed

+4
-4
lines changed
  • foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx

1 file changed

+4
-4
lines changed

foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.concurrent.CountDownLatch;
2626
import java.util.concurrent.TimeUnit;
2727

28-
import io.vertx.core.file.impl.FileResolverImpl;
2928
import org.apache.commons.io.IOUtils;
3029
import org.apache.servicecomb.foundation.common.Holder;
3130
import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
@@ -44,6 +43,7 @@
4443
import io.vertx.core.Vertx;
4544
import io.vertx.core.VertxOptions;
4645
import io.vertx.core.buffer.Buffer;
46+
import io.vertx.core.file.impl.FileResolverImpl;
4747
import io.vertx.core.impl.VertxBuilder;
4848
import io.vertx.core.impl.VertxThread;
4949
import io.vertx.core.spi.VertxThreadFactory;
@@ -192,7 +192,7 @@ public static CompletableFuture<Void> closeVertxByName(String name) {
192192
public static void blockCloseVertxByName(String name) {
193193
CompletableFuture<Void> future = closeVertxByName(name);
194194
try {
195-
future.get();
195+
future.get(30, TimeUnit.SECONDS);
196196
} catch (Throwable e) {
197197
LOGGER.error("Failed to wait close vertx {}.", name, e);
198198
}
@@ -211,8 +211,8 @@ public static void blockCloseVertx(Vertx vertx) {
211211
});
212212

213213
try {
214-
latch.await();
215-
} catch (InterruptedException e) {
214+
latch.await(30, TimeUnit.SECONDS);
215+
} catch (Throwable e) {
216216
LOGGER.info("Failed to wait close vertx {}.", vertx);
217217
}
218218
}

0 commit comments

Comments
 (0)