aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-10-10 09:37:06 +0200
committerjonmv <venstad@gmail.com>2022-10-10 09:37:06 +0200
commitbf4cac21aaf3776667cfcb117a4b2f931c875675 (patch)
treeab07766c239bb023fe3b3b1b8fba4c60bcf2bacb
parent240a62de8a9b3c93fb9f7031f5e204264d414817 (diff)
Start new mbus servers before stopping old ones
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java8
-rw-r--r--container-messagebus/src/main/java/com/yahoo/messagebus/jdisc/MbusServer.java5
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/service/ServerProvider.java8
3 files changed, 20 insertions, 1 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
index 7ea91726673..625bd87c2db 100644
--- a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
+++ b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
@@ -366,6 +366,12 @@ public final class ConfiguredApplication implements Application {
synchronized (monitor) {
Set<ServerProvider> serversToClose = createIdentityHashSet(startedServers);
serversToClose.removeAll(currentServers);
+ for (ServerProvider server : currentServers) {
+ if ( ! startedServers.contains(server) && server.isMultiplexed()) {
+ server.start();
+ startedServers.add(server);
+ }
+ }
if (serversToClose.size() > 0) {
log.info(String.format("Closing %d server instances", serversToClose.size()));
for (ServerProvider server : serversToClose) {
@@ -374,7 +380,7 @@ public final class ConfiguredApplication implements Application {
}
}
for (ServerProvider server : currentServers) {
- if (!startedServers.contains(server)) {
+ if ( ! startedServers.contains(server)) {
server.start();
startedServers.add(server);
}
diff --git a/container-messagebus/src/main/java/com/yahoo/messagebus/jdisc/MbusServer.java b/container-messagebus/src/main/java/com/yahoo/messagebus/jdisc/MbusServer.java
index 8f21cb227d8..3cf3b4bf8b0 100644
--- a/container-messagebus/src/main/java/com/yahoo/messagebus/jdisc/MbusServer.java
+++ b/container-messagebus/src/main/java/com/yahoo/messagebus/jdisc/MbusServer.java
@@ -60,6 +60,11 @@ public final class MbusServer extends AbstractResource implements ServerProvider
}
@Override
+ public boolean isMultiplexed() {
+ return true;
+ }
+
+ @Override
protected void destroy() {
log.log(Level.FINE, "Destroying message bus server.");
runState.set(State.STOPPED);
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/service/ServerProvider.java b/jdisc_core/src/main/java/com/yahoo/jdisc/service/ServerProvider.java
index ef72e643dae..ecdc30400f1 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/service/ServerProvider.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/service/ServerProvider.java
@@ -49,4 +49,12 @@ public interface ServerProvider extends SharedResource {
* Application} shutdown code.</p>
*/
void close();
+
+ /**
+ * Whether multiple instances of this can coexist, by means of a multiplexer on top of any exclusive resource.
+ * If this is true, new instances to replace old ones, during a graph generation switch, will be started before
+ * the obsolete ones are stopped; otherwise, the old will be stopped, and then the new ones started.
+ */
+ default boolean isMultiplexed() { return false; }
+
}