Don't add channels until fully initialized.
This commit is contained in:
parent
85be5b9cbf
commit
5cd4edcec1
2 changed files with 19 additions and 0 deletions
|
|
@ -62,6 +62,11 @@ public class ChannelManager<K, C extends Channel, A>
|
||||||
this(k -> null);
|
this(k -> null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all keys.
|
||||||
|
*
|
||||||
|
* @return the keys.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<K> keys() {
|
public Set<K> keys() {
|
||||||
return entries.keySet();
|
return entries.keySet();
|
||||||
|
|
@ -113,6 +118,18 @@ public class ChannelManager<K, C extends Channel, A>
|
||||||
return this;
|
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
|
* Returns the {@link Channel} for the given name, creating it using
|
||||||
* the supplier passed to the constructor if it doesn't exist yet.
|
* the supplier passed to the constructor if it doesn't exist yet.
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,8 @@ public class VmMgmt extends FreeMarkerConlet<VmMgmt.VmsModel> {
|
||||||
case "stop":
|
case "stop":
|
||||||
fire(new ModifyVm(vmName, "state", "Stopped", vmChannel));
|
fire(new ModifyVm(vmName, "state", "Stopped", vmChannel));
|
||||||
break;
|
break;
|
||||||
|
case "openConsole":
|
||||||
|
break;
|
||||||
case "cpus":
|
case "cpus":
|
||||||
fire(new ModifyVm(vmName, "currentCpus",
|
fire(new ModifyVm(vmName, "currentCpus",
|
||||||
new BigDecimal(event.param(1).toString()).toBigInteger(),
|
new BigDecimal(event.param(1).toString()).toBigInteger(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue