Skip to content
Open
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion src/main/java/io/vertx/core/impl/DeploymentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;

/**
Expand All @@ -38,6 +39,8 @@ public class DeploymentManager {

private static final Logger log = LoggerFactory.getLogger(DeploymentManager.class);

private static final AtomicLong nextId = new AtomicLong();

private final VertxImpl vertx;
private final Map<String, Deployment> deployments = new ConcurrentHashMap<>();

Expand All @@ -46,7 +49,11 @@ public DeploymentManager(VertxImpl vertx) {
}

private String generateDeploymentID() {
return UUID.randomUUID().toString();
if (vertx.isClustered() && vertx.haManager()!=null) {
// in this case we need a globally unique id
return UUID.randomUUID().toString();
}
return Long.valueOf(nextId.incrementAndGet()).toString();
}

public Future<String> deployVerticle(Callable<Verticle> verticleSupplier, DeploymentOptions options) {
Expand Down
Loading