Skip to content

Commit

Permalink
Don't add channels until fully initialized.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Jan 28, 2025
1 parent 85be5b9 commit 5cd4edc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public ChannelManager() {
this(k -> null);
}

/**
* Return all keys.
*
* @return the keys.
*/
@Override
public Set<K> keys() {
return entries.keySet();
Expand Down Expand Up @@ -113,6 +118,18 @@ public ChannelManager<K, C, A> put(K key, C channel) {
return this;
}

/**
* Creates a new channel without adding it to the channel manager.
* After fully initializing the channel, it should be added to the
* manager using {@link #put(K, C)}.
*
* @param key the key
* @return the c
*/
public C createChannel(K key) {
return supplier.apply(key);
}

/**
* Returns the {@link Channel} for the given name, creating it using
* the supplier passed to the constructor if it doesn't exist yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ protected void doUpdateConletState(NotifyConletModel event,
case "stop":
fire(new ModifyVm(vmName, "state", "Stopped", vmChannel));
break;
case "openConsole":
break;
case "cpus":
fire(new ModifyVm(vmName, "currentCpus",
new BigDecimal(event.param(1).toString()).toBigInteger(),
Expand Down

0 comments on commit 5cd4edc

Please sign in to comment.